summaryrefslogtreecommitdiff
path: root/src/glade-utils.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2006-02-28 01:09:49 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2006-02-28 01:09:49 +0000
commit3cab166c89ea80564df748ff0de0c17f10a7d14e (patch)
tree34bb5454a1fb4fbcc6075df4d54821ec3ab6863f /src/glade-utils.c
parent51dfebec98dea96e8d7bc6e8caf1d59675e41d7d (diff)
downloadglade-3cab166c89ea80564df748ff0de0c17f10a7d14e.tar.gz
Added file filters "All Files" and "Glade Files" to FileChooser Dialog.
* src/glade-utils.c: Added file filters "All Files" and "Glade Files" to FileChooser Dialog. * src/glade-project-window.c: FileChooser save dialog uses 'project->name' or 'project->path' as initial selected filename so that dialog is more intuitive to user.
Diffstat (limited to 'src/glade-utils.c')
-rw-r--r--src/glade-utils.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/glade-utils.c b/src/glade-utils.c
index 560ec0a0..23199ab5 100644
--- a/src/glade-utils.c
+++ b/src/glade-utils.c
@@ -493,7 +493,7 @@ glade_util_hide_window (GtkWindow *window)
* @parent: the parent #GtkWindow for the dialog
* @action: a #GladeUtilFileDialogType to say if the dialog will open or save
*
- * Returns: a file chooser dialog. The caller is responsible
+ * Returns: a "glade file" file chooser dialog. The caller is responsible
* for showing the dialog
*/
GtkWidget *
@@ -501,17 +501,31 @@ glade_util_file_dialog_new (const gchar *title, GtkWindow *parent,
GladeUtilFileDialogType action)
{
GtkWidget *file_dialog;
+ GtkFileFilter *file_filter;
g_return_val_if_fail ((action == GLADE_FILE_DIALOG_ACTION_OPEN ||
action == GLADE_FILE_DIALOG_ACTION_SAVE), NULL);
-
+
file_dialog = gtk_file_chooser_dialog_new (title, parent, action,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- action == GLADE_FILE_DIALOG_ACTION_OPEN ?
- GTK_STOCK_OPEN : GTK_STOCK_SAVE,
- GTK_RESPONSE_OK,
- NULL);
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ action == GLADE_FILE_DIALOG_ACTION_OPEN ?
+ GTK_STOCK_OPEN : GTK_STOCK_SAVE,
+ GTK_RESPONSE_OK,
+ NULL);
+
+ file_filter = gtk_file_filter_new ();
+ gtk_file_filter_add_pattern (file_filter, "*");
+ gtk_file_filter_set_name (file_filter, _("All Files"));
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
+
+ file_filter = gtk_file_filter_new ();
+ gtk_file_filter_add_pattern (file_filter, "*.glade");
+ gtk_file_filter_set_name (file_filter, _("Glade Files"));
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
+
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
+
gtk_window_set_position (GTK_WINDOW (file_dialog), GTK_WIN_POS_CENTER);
return file_dialog;