[eog] Remove specific file format filters from "Open Image"-dialog
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Remove specific file format filters from "Open Image"-dialog
- Date: Mon, 7 Feb 2011 20:13:27 +0000 (UTC)
commit c19f48f9fccf951fa7557c00635b529b7eb22211
Author: Felix Riemann <friemann gnome org>
Date: Mon Feb 7 21:03:54 2011 +0100
Remove specific file format filters from "Open Image"-dialog
Simplify filter list to either show all files or just the supported
image files in a folder. Also fix list capitalization. Fixes bug 641107.
src/eog-file-chooser.c | 66 +++++++++++++++++++++++++++--------------------
1 files changed, 38 insertions(+), 28 deletions(-)
---
diff --git a/src/eog-file-chooser.c b/src/eog-file-chooser.c
index ec5617a..f7d0044 100644
--- a/src/eog-file-chooser.c
+++ b/src/eog-file-chooser.c
@@ -140,40 +140,17 @@ save_response_cb (GtkDialog *dlg, gint id, gpointer data)
}
}
-static void
-eog_file_chooser_add_filter (EogFileChooser *chooser)
+static GSList*
+_eog_file_chooser_prepare_save_file_filter (GtkFileFilter *all_img_filter)
{
+ GSList *filters = NULL;
+ GSList *formats = NULL;
GSList *it;
- GSList *formats;
- GtkFileFilter *all_file_filter;
- GtkFileFilter *all_img_filter;
GtkFileFilter *filter;
- GSList *filters = NULL;
gchar **mime_types, **pattern, *tmp;
int i;
- GtkFileChooserAction action;
-
- action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (chooser));
-
- if (action != GTK_FILE_CHOOSER_ACTION_SAVE && action != GTK_FILE_CHOOSER_ACTION_OPEN) {
- return;
- }
- /* All Files Filter */
- all_file_filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (all_file_filter, _("All Files"));
- gtk_file_filter_add_pattern (all_file_filter, "*");
-
- /* All Image Filter */
- all_img_filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (all_img_filter, _("All Images"));
-
- if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
- formats = eog_pixbuf_get_savable_formats ();
- }
- else {
- formats = gdk_pixbuf_get_formats ();
- }
+ formats = eog_pixbuf_get_savable_formats ();
/* Image filters */
for (it = formats; it != NULL; it = it->next) {
@@ -220,6 +197,39 @@ eog_file_chooser_add_filter (EogFileChooser *chooser)
}
g_slist_free (formats);
+ return filters;
+}
+static void
+eog_file_chooser_add_filter (EogFileChooser *chooser)
+{
+ GSList *it;
+ GtkFileFilter *all_file_filter;
+ GtkFileFilter *all_img_filter;
+ GSList *filters = NULL;
+ GtkFileChooserAction action;
+
+ action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (chooser));
+
+ if (action != GTK_FILE_CHOOSER_ACTION_SAVE && action != GTK_FILE_CHOOSER_ACTION_OPEN) {
+ return;
+ }
+
+ /* All Files Filter */
+ all_file_filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (all_file_filter, _("All files"));
+ gtk_file_filter_add_pattern (all_file_filter, "*");
+
+ /* All Image Filter */
+ all_img_filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (all_img_filter, _("Supported image files"));
+
+ if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
+ filters = _eog_file_chooser_prepare_save_file_filter(all_img_filter);
+ }
+ else {
+ gtk_file_filter_add_pixbuf_formats(all_img_filter);
+ }
+
/* Add filter to filechooser */
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), all_file_filter);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), all_img_filter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]