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)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
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;
|
Gimp *gimp = NULL;
|
||||||
return_if_no_gimp (gimp, data);
|
return_if_no_gimp (gimp, data);
|
||||||
|
|
||||||
if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
|
if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
|
||||||
return;
|
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,
|
g_object_set (gimp->config,
|
||||||
"hide-docks", active,
|
"hide-docks", active,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
|
|
||||||
#include "widgets-types.h"
|
#include "widgets-types.h"
|
||||||
|
|
||||||
|
#include "config/gimpguiconfig.h"
|
||||||
|
|
||||||
|
#include "core/gimp.h"
|
||||||
#include "core/gimpcontext.h"
|
#include "core/gimpcontext.h"
|
||||||
#include "core/gimpmarshal.h"
|
#include "core/gimpmarshal.h"
|
||||||
|
|
||||||
@ -75,6 +78,9 @@ static GtkWidget * gimp_dialog_factory_constructor (GimpDialogFactory
|
|||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
GimpUIManager *ui_manager,
|
GimpUIManager *ui_manager,
|
||||||
gint view_size);
|
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,
|
static void gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
|
||||||
GimpDialogFactory *factory,
|
GimpDialogFactory *factory,
|
||||||
GimpDialogFactoryEntry *entry);
|
GimpDialogFactoryEntry *entry);
|
||||||
@ -226,6 +232,7 @@ gimp_dialog_factory_new (const gchar *name,
|
|||||||
GimpMenuFactory *menu_factory)
|
GimpMenuFactory *menu_factory)
|
||||||
{
|
{
|
||||||
GimpDialogFactory *factory;
|
GimpDialogFactory *factory;
|
||||||
|
GimpGuiConfig *config;
|
||||||
|
|
||||||
g_return_val_if_fail (name != NULL, NULL);
|
g_return_val_if_fail (name != NULL, NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||||
@ -236,8 +243,17 @@ gimp_dialog_factory_new (const gchar *name,
|
|||||||
|
|
||||||
gimp_object_set_name (GIMP_OBJECT (factory), name);
|
gimp_object_set_name (GIMP_OBJECT (factory), name);
|
||||||
|
|
||||||
|
config = GIMP_GUI_CONFIG (context->gimp->config);
|
||||||
|
|
||||||
factory->p->context = context;
|
factory->p->context = context;
|
||||||
factory->p->menu_factory = menu_factory;
|
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;
|
return factory;
|
||||||
}
|
}
|
||||||
@ -1177,6 +1193,24 @@ gimp_dialog_factory_constructor (GimpDialogFactory *factory,
|
|||||||
return widget;
|
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
|
static void
|
||||||
gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
|
gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
|
||||||
GimpDialogFactory *factory,
|
GimpDialogFactory *factory,
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
|
|
||||||
#include "widgets-types.h"
|
#include "widgets-types.h"
|
||||||
|
|
||||||
|
#include "config/gimpguiconfig.h"
|
||||||
|
|
||||||
|
#include "core/gimp.h"
|
||||||
|
#include "core/gimpcontext.h"
|
||||||
|
|
||||||
#include "gimpdialogfactory.h"
|
#include "gimpdialogfactory.h"
|
||||||
#include "gimpdock.h"
|
#include "gimpdock.h"
|
||||||
#include "gimpdockwindow.h"
|
#include "gimpdockwindow.h"
|
||||||
@ -448,6 +453,8 @@ gimp_session_info_restore (GimpSessionInfo *info,
|
|||||||
if (info->p->factory_entry &&
|
if (info->p->factory_entry &&
|
||||||
! info->p->factory_entry->dockable)
|
! info->p->factory_entry->dockable)
|
||||||
{
|
{
|
||||||
|
GimpCoreConfig *config = gimp_dialog_factory_get_context (factory)->gimp->config;
|
||||||
|
|
||||||
GIMP_LOG (DIALOG_FACTORY, "restoring toplevel \"%s\" (info %p)",
|
GIMP_LOG (DIALOG_FACTORY, "restoring toplevel \"%s\" (info %p)",
|
||||||
info->p->factory_entry->identifier,
|
info->p->factory_entry->identifier,
|
||||||
info);
|
info);
|
||||||
@ -456,7 +463,12 @@ gimp_session_info_restore (GimpSessionInfo *info,
|
|||||||
gimp_dialog_factory_dialog_new (factory, screen,
|
gimp_dialog_factory_dialog_new (factory, screen,
|
||||||
info->p->factory_entry->identifier,
|
info->p->factory_entry->identifier,
|
||||||
info->p->factory_entry->view_size,
|
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)
|
if (dialog && info->p->aux_info)
|
||||||
gimp_session_info_aux_set_list (dialog, info->p->aux_info);
|
gimp_session_info_aux_set_list (dialog, info->p->aux_info);
|
||||||
|
Reference in New Issue
Block a user