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.)
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
@ -1177,6 +1193,24 @@ gimp_dialog_factory_constructor (GimpDialogFactory *factory,
|
||||
return widget;
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user