app: show relevant files only by default.
Just like it was until now, the default filtering should not be all
files, but only relevant files (i.e. XCF when saving, exportable images
when exporting and loadable images/XCF when opening).
Now all files will only be available through the "Show All Files"
checkbox.
This is simpler than previous implementations where the list was
proposing "All Files", "All Images" and "All XCF/export images". That is
just too much.
With this default, I get the "All Files" checkbox out of the expander so
that it is visible immediately even when the format list is unexpanded
(you don't want people to get pissed when not finding how to display all
their files).
(cherry picked from commit 6b4b3bad13)
This commit is contained in:
@ -743,23 +743,23 @@ gimp_file_dialog_add_proc_selection (GimpFileDialog *dialog)
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *checkbox;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
|
||||
gimp_file_dialog_add_extra_widget (dialog, box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box);
|
||||
|
||||
dialog->proc_expander = gtk_expander_new_with_mnemonic (NULL);
|
||||
gimp_file_dialog_add_extra_widget (dialog,
|
||||
dialog->proc_expander,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (dialog->proc_expander);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
|
||||
gtk_container_add (GTK_CONTAINER (dialog->proc_expander), box);
|
||||
gtk_widget_show (box);
|
||||
|
||||
/* The list of file formats. */
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (box), scrolled_window, TRUE, TRUE, 1);
|
||||
gtk_container_add (GTK_CONTAINER (dialog->proc_expander), scrolled_window);
|
||||
gtk_widget_show (scrolled_window);
|
||||
|
||||
gtk_widget_set_size_request (scrolled_window, -1, 200);
|
||||
@ -781,7 +781,7 @@ gimp_file_dialog_add_proc_selection (GimpFileDialog *dialog)
|
||||
checkbox = gimp_prop_check_button_new (G_OBJECT (dialog),
|
||||
"show-all-files",
|
||||
_("Show All Files"));
|
||||
gtk_box_pack_start (GTK_BOX (box), checkbox, FALSE, FALSE, 1);
|
||||
gtk_box_pack_end (GTK_BOX (box), checkbox, FALSE, FALSE, 1);
|
||||
gtk_widget_show (checkbox);
|
||||
}
|
||||
|
||||
@ -813,12 +813,7 @@ gimp_file_dialog_proc_changed (GimpFileProcView *view,
|
||||
|
||||
if (name)
|
||||
{
|
||||
gchar *label;
|
||||
|
||||
if (dialog->show_all_files)
|
||||
label = g_strdup_printf (_("Select File _Type (%s) - Show All Files"), name);
|
||||
else
|
||||
label = g_strdup_printf (_("Select File _Type (%s)"), name);
|
||||
gchar *label = g_strdup_printf (_("Select File _Type (%s)"), name);
|
||||
|
||||
gtk_expander_set_label (GTK_EXPANDER (dialog->proc_expander), label);
|
||||
|
||||
|
||||
@ -61,7 +61,8 @@ static void gimp_file_proc_view_finalize (GObject
|
||||
static void gimp_file_proc_view_selection_changed (GtkTreeSelection *selection,
|
||||
GimpFileProcView *view);
|
||||
|
||||
static GtkFileFilter * gimp_file_proc_view_process_procedure (GimpPlugInProcedure *file_proc);
|
||||
static GtkFileFilter * gimp_file_proc_view_process_procedure (GimpPlugInProcedure *file_proc,
|
||||
GtkFileFilter *all);
|
||||
static gchar * gimp_file_proc_view_pattern_from_extension (const gchar *extension);
|
||||
|
||||
|
||||
@ -116,6 +117,7 @@ gimp_file_proc_view_new (Gimp *gimp,
|
||||
const gchar *automatic,
|
||||
const gchar *automatic_help_id)
|
||||
{
|
||||
GtkFileFilter *all_filter;
|
||||
GtkTreeView *view;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkCellRenderer *cell;
|
||||
@ -139,6 +141,8 @@ gimp_file_proc_view_new (Gimp *gimp,
|
||||
|
||||
g_object_unref (store);
|
||||
|
||||
all_filter = gtk_file_filter_new ();
|
||||
|
||||
for (list = procedures; list; list = g_slist_next (list))
|
||||
{
|
||||
GimpPlugInProcedure *proc = list->data;
|
||||
@ -153,7 +157,7 @@ gimp_file_proc_view_new (Gimp *gimp,
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
|
||||
filter = gimp_file_proc_view_process_procedure (proc);
|
||||
filter = gimp_file_proc_view_process_procedure (proc, all_filter);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COLUMN_PROC, proc,
|
||||
@ -182,18 +186,12 @@ gimp_file_proc_view_new (Gimp *gimp,
|
||||
|
||||
if (automatic)
|
||||
{
|
||||
GtkFileFilter *filter = gtk_file_filter_new ();
|
||||
|
||||
gtk_list_store_prepend (store, &iter);
|
||||
|
||||
gtk_file_filter_set_name (filter, _("All files"));
|
||||
gtk_file_filter_add_pattern (filter, "*");
|
||||
|
||||
gtk_list_store_set (store, &iter,
|
||||
COLUMN_PROC, NULL,
|
||||
COLUMN_LABEL, automatic,
|
||||
COLUMN_HELP_ID, automatic_help_id,
|
||||
COLUMN_FILTER, filter,
|
||||
COLUMN_FILTER, all_filter,
|
||||
-1);
|
||||
}
|
||||
|
||||
@ -353,13 +351,16 @@ gimp_file_proc_view_selection_changed (GtkTreeSelection *selection,
|
||||
/**
|
||||
* gimp_file_proc_view_process_procedure:
|
||||
* @file_proc:
|
||||
* @all:
|
||||
*
|
||||
* Creates a #GtkFileFilter of @file_proc.
|
||||
* Creates a #GtkFileFilter of @file_proc and adds the extensions to
|
||||
* the @all filter.
|
||||
* The returned #GtkFileFilter has a normal ref and must be unreffed
|
||||
* when used.
|
||||
**/
|
||||
static GtkFileFilter *
|
||||
gimp_file_proc_view_process_procedure (GimpPlugInProcedure *file_proc)
|
||||
gimp_file_proc_view_process_procedure (GimpPlugInProcedure *file_proc,
|
||||
GtkFileFilter *all)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
GString *str;
|
||||
@ -382,6 +383,7 @@ gimp_file_proc_view_process_procedure (GimpPlugInProcedure *file_proc)
|
||||
const gchar *mime_type = list->data;
|
||||
|
||||
gtk_file_filter_add_mime_type (filter, mime_type);
|
||||
gtk_file_filter_add_mime_type (all, mime_type);
|
||||
}
|
||||
|
||||
for (list = file_proc->extensions_list, i = 0;
|
||||
@ -393,6 +395,7 @@ gimp_file_proc_view_process_procedure (GimpPlugInProcedure *file_proc)
|
||||
|
||||
pattern = gimp_file_proc_view_pattern_from_extension (extension);
|
||||
gtk_file_filter_add_pattern (filter, pattern);
|
||||
gtk_file_filter_add_pattern (all, pattern);
|
||||
g_free (pattern);
|
||||
|
||||
if (i == 0)
|
||||
|
||||
Reference in New Issue
Block a user