[gimp] app: Apply Windows→Hide docks on startup
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Apply Windows→Hide docks on startup
- Date: Tue, 9 Mar 2010 07:03:11 +0000 (UTC)
commit fe6699cc1cd31a445c0590a6b904df218e6222b8
Author: Martin Nordholts <martinn src gnome org>
Date: Tue Mar 9 08:01:34 2010 +0100
app: Apply Windowsâ??Hide docks on startup
Change GimpDialogFactory to apply Windowsâ??Hide docks on startup. (We
already do this for docks in single-window mode.)
app/actions/windows-commands.c | 11 -----------
app/widgets/gimpdialogfactory.c | 38 ++++++++++++++++++++++++++++++++++++--
app/widgets/gimpsessioninfo.c | 14 +++++++++++++-
3 files changed, 49 insertions(+), 14 deletions(-)
---
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 864a04c..2f73b1c 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -47,23 +47,12 @@ windows_hide_docks_cmd_callback (GtkAction *action,
gpointer data)
{
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- GimpDialogsState state = gimp_dialog_factory_get_state (gimp_dialog_factory_get_singleton ());
- GimpDialogsState new_state = state;
Gimp *gimp = NULL;
return_if_no_gimp (gimp, data);
if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
return;
- /* Make sure the state and toggle action are in sync */
- if (active && state == GIMP_DIALOGS_SHOWN)
- new_state = GIMP_DIALOGS_HIDDEN_EXPLICITLY;
- else if (! active)
- new_state = GIMP_DIALOGS_SHOWN;
-
- if (state != new_state)
- gimp_dialog_factory_set_state (gimp_dialog_factory_get_singleton (), new_state);
-
g_object_set (gimp->config,
"hide-docks", active,
NULL);
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index b65578c..209525c 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -30,6 +30,9 @@
#include "widgets-types.h"
+#include "config/gimpguiconfig.h"
+
+#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpmarshal.h"
@@ -75,6 +78,9 @@ static GtkWidget * gimp_dialog_factory_constructor (GimpDialogFactory
GimpContext *context,
GimpUIManager *ui_manager,
gint view_size);
+static void gimp_dialog_factory_config_notify (GimpDialogFactory *factory,
+ GParamSpec *pspec,
+ GimpGuiConfig *config);
static void gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry);
@@ -226,6 +232,7 @@ gimp_dialog_factory_new (const gchar *name,
GimpMenuFactory *menu_factory)
{
GimpDialogFactory *factory;
+ GimpGuiConfig *config;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
@@ -236,9 +243,18 @@ gimp_dialog_factory_new (const gchar *name,
gimp_object_set_name (GIMP_OBJECT (factory), name);
- factory->p->context = context;
- factory->p->menu_factory = menu_factory;
+ config = GIMP_GUI_CONFIG (context->gimp->config);
+
+ factory->p->context = context;
+ factory->p->menu_factory = menu_factory;
+ factory->p->dialog_state = (config->hide_docks ?
+ GIMP_DIALOGS_HIDDEN_EXPLICITLY :
+ GIMP_DIALOGS_SHOWN);
+ g_signal_connect_object (config, "notify::hide-docks",
+ G_CALLBACK (gimp_dialog_factory_config_notify),
+ factory, G_CONNECT_SWAPPED);
+
return factory;
}
@@ -1178,6 +1194,24 @@ gimp_dialog_factory_constructor (GimpDialogFactory *factory,
}
static void
+gimp_dialog_factory_config_notify (GimpDialogFactory *factory,
+ GParamSpec *pspec,
+ GimpGuiConfig *config)
+{
+ GimpDialogsState state = gimp_dialog_factory_get_state (factory);
+ GimpDialogsState new_state = state;
+
+ /* Make sure the state and config are in sync */
+ if (config->hide_docks && state == GIMP_DIALOGS_SHOWN)
+ new_state = GIMP_DIALOGS_HIDDEN_EXPLICITLY;
+ else if (! config->hide_docks)
+ new_state = GIMP_DIALOGS_SHOWN;
+
+ if (state != new_state)
+ gimp_dialog_factory_set_state (factory, new_state);
+}
+
+static void
gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry)
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index 4c179d3..c584a4b 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -28,6 +28,11 @@
#include "widgets-types.h"
+#include "config/gimpguiconfig.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+
#include "gimpdialogfactory.h"
#include "gimpdock.h"
#include "gimpdockwindow.h"
@@ -448,6 +453,8 @@ gimp_session_info_restore (GimpSessionInfo *info,
if (info->p->factory_entry &&
! info->p->factory_entry->dockable)
{
+ GimpCoreConfig *config = gimp_dialog_factory_get_context (factory)->gimp->config;
+
GIMP_LOG (DIALOG_FACTORY, "restoring toplevel \"%s\" (info %p)",
info->p->factory_entry->identifier,
info);
@@ -456,7 +463,12 @@ gimp_session_info_restore (GimpSessionInfo *info,
gimp_dialog_factory_dialog_new (factory, screen,
info->p->factory_entry->identifier,
info->p->factory_entry->view_size,
- TRUE/*present*/);
+ ! GIMP_GUI_CONFIG (config)->hide_docks);
+
+ g_object_set_data (G_OBJECT (dialog), GIMP_DIALOG_VISIBILITY_KEY,
+ GINT_TO_POINTER (GIMP_GUI_CONFIG (config)->hide_docks ?
+ GIMP_DIALOG_VISIBILITY_HIDDEN :
+ GIMP_DIALOG_VISIBILITY_VISIBLE));
if (dialog && info->p->aux_info)
gimp_session_info_aux_set_list (dialog, info->p->aux_info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]