From 993d2df33800ec8160aa655301b88fa1dde612b4 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Sat, 20 Feb 2010 10:32:50 +0100 Subject: [PATCH] app: Make hideability a per entry rather than per dialog factory thing --- app/dialogs/dialogs.c | 16 ++++++++++++---- app/widgets/gimpdialogfactory.c | 16 ++++++++-------- app/widgets/gimpdialogfactory.h | 7 +++++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c index 867086e7c4..7da5f536fb 100644 --- a/app/dialogs/dialogs.c +++ b/app/dialogs/dialogs.c @@ -60,6 +60,7 @@ GimpContainer *global_recent_docks = NULL; TRUE /* session_managed */, \ remember_size /* remember_size */, \ FALSE /* remember_if_open */, \ + TRUE /* hideable */, \ FALSE /* dockable */} #define TOPLEVEL(id, new_func, singleton, session_managed, remember_size) \ @@ -74,6 +75,7 @@ GimpContainer *global_recent_docks = NULL; session_managed /* session_managed */, \ remember_size /* remember_size */, \ FALSE /* remember_if_open */, \ + TRUE /* hideable */, \ FALSE /* dockable */} #define DOCKABLE(id, name, blurb, stock_id, help_id, new_func, view_size, singleton) \ @@ -88,6 +90,7 @@ GimpContainer *global_recent_docks = NULL; FALSE /* session_managed */, \ FALSE /* remember_size */, \ TRUE /* remember_if_open */, \ + TRUE /* hideable */, \ TRUE /* dockable */} #define DOCK(id, new_func) \ @@ -102,6 +105,7 @@ GimpContainer *global_recent_docks = NULL; FALSE /* session_managed */, \ FALSE /* remember_size */, \ FALSE /* remember_if_open */, \ + TRUE /* hideable */, \ FALSE /* dockable */} #define DOCK_WINDOW(id, new_func) \ @@ -116,6 +120,7 @@ GimpContainer *global_recent_docks = NULL; TRUE /* session_managed */, \ TRUE /* remember_size */, \ TRUE /* remember_if_open */, \ + TRUE /* hideable */, \ FALSE /* dockable */} #define LISTGRID(id, name, blurb, stock_id, help_id, view_size) \ @@ -130,6 +135,7 @@ GimpContainer *global_recent_docks = NULL; FALSE /* session_managed */, \ FALSE /* remember_size */, \ TRUE /* remember_if_open */, \ + TRUE /* hideable */, \ TRUE /* dockable */}, \ { "gimp-"#id"-grid" /* identifier */, \ name /* name */, \ @@ -142,6 +148,7 @@ GimpContainer *global_recent_docks = NULL; FALSE /* session_managed */, \ FALSE /* remember_size */, \ TRUE /* remember_if_open */, \ + TRUE /* hideable */, \ TRUE /* dockable */} #define LIST(id, name, blurb, stock_id, help_id, view_size) \ @@ -156,6 +163,7 @@ GimpContainer *global_recent_docks = NULL; FALSE /* session_managed */, \ FALSE /* remember_size */, \ TRUE /* remember_if_open */, \ + TRUE /* hideable */, \ TRUE /* dockable */} @@ -357,14 +365,12 @@ dialogs_init (Gimp *gimp, /* Toplevel */ global_dialog_factory = gimp_dialog_factory_new ("toplevel", gimp_get_user_context (gimp), - menu_factory, - TRUE); + menu_factory); /* Display */ global_display_factory = gimp_dialog_factory_new ("display", gimp_get_user_context (gimp), - menu_factory, - FALSE); + menu_factory); for (i = 0; i < G_N_ELEMENTS (entries); i++) @@ -380,6 +386,7 @@ dialogs_init (Gimp *gimp, entries[i].session_managed, entries[i].remember_size, entries[i].remember_if_open, + entries[i].hideable, entries[i].dockable); gimp_dialog_factory_register_entry (global_display_factory, @@ -392,6 +399,7 @@ dialogs_init (Gimp *gimp, TRUE, TRUE, FALSE, + FALSE, FALSE); global_recent_docks = gimp_list_new (GIMP_TYPE_SESSION_INFO, FALSE); diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c index 78b9bca5c1..162fd75b73 100644 --- a/app/widgets/gimpdialogfactory.c +++ b/app/widgets/gimpdialogfactory.c @@ -69,8 +69,6 @@ struct _GimpDialogFactoryPrivate GList *session_infos; GList *registered_dialogs; - - gboolean toggle_visibility; }; @@ -249,8 +247,7 @@ gimp_dialog_factory_finalize (GObject *object) GimpDialogFactory * gimp_dialog_factory_new (const gchar *name, GimpContext *context, - GimpMenuFactory *menu_factory, - gboolean toggle_visibility) + GimpMenuFactory *menu_factory) { GimpDialogFactory *factory; gpointer key; @@ -278,7 +275,6 @@ gimp_dialog_factory_new (const gchar *name, factory->p->context = context; factory->p->menu_factory = menu_factory; - factory->p->toggle_visibility = toggle_visibility; return factory; } @@ -314,6 +310,7 @@ gimp_dialog_factory_register_entry (GimpDialogFactory *factory, gboolean session_managed, gboolean remember_size, gboolean remember_if_open, + gboolean hideable, gboolean dockable) { GimpDialogFactoryEntry *entry; @@ -334,6 +331,7 @@ gimp_dialog_factory_register_entry (GimpDialogFactory *factory, entry->session_managed = session_managed ? TRUE : FALSE; entry->remember_size = remember_size ? TRUE : FALSE; entry->remember_if_open = remember_if_open ? TRUE : FALSE; + entry->hideable = hideable ? TRUE : FALSE; entry->dockable = dockable ? TRUE : FALSE; factory->p->registered_dialogs = g_list_prepend (factory->p->registered_dialogs, @@ -1517,17 +1515,19 @@ gimp_dialog_factories_hide_foreach (gconstpointer key, { GList *list; - if (! factory->p->toggle_visibility) - return; - for (list = factory->p->open_dialogs; list; list = g_list_next (list)) { GtkWidget *widget = list->data; if (GTK_IS_WIDGET (widget) && gtk_widget_is_toplevel (widget)) { + GimpDialogFactoryEntry *entry = NULL; GimpDialogVisibilityState visibility = GIMP_DIALOG_VISIBILITY_UNKNOWN; + gimp_dialog_factory_from_widget (widget, &entry); + if (! entry->hideable) + continue; + if (gtk_widget_get_visible (widget)) { visibility = GIMP_DIALOG_VISIBILITY_VISIBLE; diff --git a/app/widgets/gimpdialogfactory.h b/app/widgets/gimpdialogfactory.h index d2cb764647..634c859662 100644 --- a/app/widgets/gimpdialogfactory.h +++ b/app/widgets/gimpdialogfactory.h @@ -61,6 +61,9 @@ struct _GimpDialogFactoryEntry gboolean remember_size; gboolean remember_if_open; + /* If TRUE the visibility of the dialog is toggleable */ + gboolean hideable; + /* If TRUE the entry is for a dockable, FALSE otherwise */ gboolean dockable; }; @@ -107,8 +110,7 @@ struct _GimpDialogFactoryClass GType gimp_dialog_factory_get_type (void) G_GNUC_CONST; GimpDialogFactory * gimp_dialog_factory_new (const gchar *name, GimpContext *context, - GimpMenuFactory *menu_factory, - gboolean toggle_visibility); + GimpMenuFactory *menu_factory); GimpDialogFactory * gimp_dialog_factory_from_name (const gchar *name); void gimp_dialog_factory_register_entry (GimpDialogFactory *factory, const gchar *identifier, @@ -122,6 +124,7 @@ void gimp_dialog_factory_register_entry (GimpDialogFactory gboolean session_managed, gboolean remember_size, gboolean remember_if_open, + gboolean hideable, gboolean dockable); GimpDialogFactoryEntry * gimp_dialog_factory_find_entry (GimpDialogFactory *factory,