Commit 9fa51f70 authored by Martin Nordholts's avatar Martin Nordholts

Add a Single-window mode

Add a single-window mode that can be toggled from 'Windows ->
Single-window mode'. No code is yet hooked to the mode though.
parent 1f098e57
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "actions-types.h" #include "actions-types.h"
#include "config/gimpdisplayconfig.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimplist.h" #include "core/gimplist.h"
...@@ -47,30 +50,33 @@ ...@@ -47,30 +50,33 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static void windows_actions_display_add (GimpContainer *container, static void windows_actions_display_add (GimpContainer *container,
GimpDisplay *display, GimpDisplay *display,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_display_remove (GimpContainer *container, static void windows_actions_display_remove (GimpContainer *container,
GimpDisplay *display, GimpDisplay *display,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_image_notify (GimpDisplay *display, static void windows_actions_image_notify (GimpDisplay *display,
const GParamSpec *unused, const GParamSpec *unused,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_dock_window_added (GimpDialogFactory *factory, static void windows_actions_dock_window_added (GimpDialogFactory *factory,
GimpDockWindow *dock_window, GimpDockWindow *dock_window,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_dock_window_removed (GimpDialogFactory *factory, static void windows_actions_dock_window_removed (GimpDialogFactory *factory,
GimpDockWindow *dock_window, GimpDockWindow *dock_window,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_dock_window_notify (GimpDockWindow *dock, static void windows_actions_dock_window_notify (GimpDockWindow *dock,
const GParamSpec *pspec, const GParamSpec *pspec,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_recent_add (GimpContainer *container, static void windows_actions_recent_add (GimpContainer *container,
GimpSessionInfo *info, GimpSessionInfo *info,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_recent_remove (GimpContainer *container, static void windows_actions_recent_remove (GimpContainer *container,
GimpSessionInfo *info, GimpSessionInfo *info,
GimpActionGroup *group); GimpActionGroup *group);
static void windows_actions_single_window_mode_notify (GimpDisplayConfig *config,
GParamSpec *pspec,
GimpActionGroup *group);
static const GimpActionEntry windows_actions[] = static const GimpActionEntry windows_actions[] =
...@@ -89,6 +95,16 @@ static const GimpActionEntry windows_actions[] = ...@@ -89,6 +95,16 @@ static const GimpActionEntry windows_actions[] =
GIMP_HELP_TOOLBOX } GIMP_HELP_TOOLBOX }
}; };
static const GimpToggleActionEntry windows_toggle_actions[] =
{
{ "windows-use-single-window-mode", NULL,
NC_("windows-action", "Single-window mode"), NULL,
NC_("windows-action", "When enabled GIMP is in a single-window mode. Far from completely implemented!"),
G_CALLBACK (windows_use_single_window_mode_cmd_callback),
FALSE,
GIMP_HELP_WINDOWS_USE_SINGLE_WINDOW_MODE }
};
void void
windows_actions_setup (GimpActionGroup *group) windows_actions_setup (GimpActionGroup *group)
...@@ -99,6 +115,10 @@ windows_actions_setup (GimpActionGroup *group) ...@@ -99,6 +115,10 @@ windows_actions_setup (GimpActionGroup *group)
windows_actions, windows_actions,
G_N_ELEMENTS (windows_actions)); G_N_ELEMENTS (windows_actions));
gimp_action_group_add_toggle_actions (group, "windows-action",
windows_toggle_actions,
G_N_ELEMENTS (windows_toggle_actions));
gimp_action_group_set_action_hide_empty (group, "windows-docks-menu", FALSE); gimp_action_group_set_action_hide_empty (group, "windows-docks-menu", FALSE);
g_signal_connect_object (group->gimp->displays, "add", g_signal_connect_object (group->gimp->displays, "add",
...@@ -149,12 +169,24 @@ windows_actions_setup (GimpActionGroup *group) ...@@ -149,12 +169,24 @@ windows_actions_setup (GimpActionGroup *group)
windows_actions_recent_add (global_recent_docks, info, group); windows_actions_recent_add (global_recent_docks, info, group);
} }
g_signal_connect_object (group->gimp->config, "notify::single-window-mode",
G_CALLBACK (windows_actions_single_window_mode_notify),
group, 0);
} }
void void
windows_actions_update (GimpActionGroup *group, windows_actions_update (GimpActionGroup *group,
gpointer data) gpointer data)
{ {
GimpGuiConfig *config = GIMP_GUI_CONFIG (group->gimp->config);
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
SET_ACTIVE ("windows-use-single-window-mode", config->single_window_mode);
#undef SET_ACTIVE
} }
gchar * gchar *
...@@ -411,3 +443,13 @@ windows_actions_recent_remove (GimpContainer *container, ...@@ -411,3 +443,13 @@ windows_actions_recent_remove (GimpContainer *container,
g_free (action_name); g_free (action_name);
} }
static void
windows_actions_single_window_mode_notify (GimpDisplayConfig *config,
GParamSpec *pspec,
GimpActionGroup *group)
{
gimp_action_group_set_action_active (group,
"windows-use-single-window-mode",
GIMP_GUI_CONFIG (config)->single_window_mode);
}
...@@ -23,15 +23,21 @@ ...@@ -23,15 +23,21 @@
#include "actions-types.h" #include "actions-types.h"
#include "config/gimpdisplayconfig.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "widgets/gimpdialogfactory.h" #include "widgets/gimpdialogfactory.h"
#include "widgets/gimpsessioninfo.h" #include "widgets/gimpsessioninfo.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "dialogs/dialogs.h" #include "dialogs/dialogs.h"
#include "actions.h"
#include "windows-commands.h" #include "windows-commands.h"
...@@ -44,6 +50,22 @@ windows_show_toolbox_cmd_callback (GtkAction *action, ...@@ -44,6 +50,22 @@ windows_show_toolbox_cmd_callback (GtkAction *action,
windows_show_toolbox (); windows_show_toolbox ();
} }
void
windows_use_single_window_mode_cmd_callback (GtkAction *action,
gpointer data)
{
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
Gimp *gimp = NULL;
return_if_no_gimp (gimp, data);
if (GIMP_GUI_CONFIG (gimp->config)->single_window_mode == active)
return;
g_object_set (gimp->config,
"single-window-mode", active,
NULL);
}
void void
windows_show_display_cmd_callback (GtkAction *action, windows_show_display_cmd_callback (GtkAction *action,
gpointer data) gpointer data)
......
...@@ -19,16 +19,17 @@ ...@@ -19,16 +19,17 @@
#define __WINDOWS_COMMANDS_H__ #define __WINDOWS_COMMANDS_H__
void windows_show_toolbox_cmd_callback (GtkAction *action, void windows_show_toolbox_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void windows_show_display_cmd_callback (GtkAction *action, void windows_use_single_window_mode_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void windows_show_dock_cmd_callback (GtkAction *action, void windows_show_display_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void windows_open_recent_cmd_callback (GtkAction *action, void windows_show_dock_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void windows_open_recent_cmd_callback (GtkAction *action,
void windows_show_toolbox (void); gpointer data);
void windows_show_toolbox (void);
#endif /* __WINDOWS_COMMANDS_H__ */ #endif /* __WINDOWS_COMMANDS_H__ */
...@@ -52,6 +52,7 @@ enum ...@@ -52,6 +52,7 @@ enum
PROP_RESTORE_SESSION, PROP_RESTORE_SESSION,
PROP_SAVE_TOOL_OPTIONS, PROP_SAVE_TOOL_OPTIONS,
PROP_SHOW_TOOLTIPS, PROP_SHOW_TOOLTIPS,
PROP_SINGLE_WINDOW_MODE,
PROP_TEAROFF_MENUS, PROP_TEAROFF_MENUS,
PROP_CAN_CHANGE_ACCELS, PROP_CAN_CHANGE_ACCELS,
PROP_SAVE_ACCELS, PROP_SAVE_ACCELS,
...@@ -153,6 +154,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) ...@@ -153,6 +154,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
TRUE, TRUE,
GIMP_PARAM_STATIC_STRINGS | GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART); GIMP_CONFIG_PARAM_RESTART);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SINGLE_WINDOW_MODE,
"single-window-mode", SINGLE_WINDOW_MODE_BLURB,
FALSE,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEAROFF_MENUS, GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEAROFF_MENUS,
"tearoff-menus", TEAROFF_MENUS_BLURB, "tearoff-menus", TEAROFF_MENUS_BLURB,
TRUE, TRUE,
...@@ -347,6 +353,9 @@ gimp_gui_config_set_property (GObject *object, ...@@ -347,6 +353,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_SHOW_TOOLTIPS: case PROP_SHOW_TOOLTIPS:
gui_config->show_tooltips = g_value_get_boolean (value); gui_config->show_tooltips = g_value_get_boolean (value);
break; break;
case PROP_SINGLE_WINDOW_MODE:
gui_config->single_window_mode = g_value_get_boolean (value);
break;
case PROP_TEAROFF_MENUS: case PROP_TEAROFF_MENUS:
gui_config->tearoff_menus = g_value_get_boolean (value); gui_config->tearoff_menus = g_value_get_boolean (value);
break; break;
...@@ -465,6 +474,9 @@ gimp_gui_config_get_property (GObject *object, ...@@ -465,6 +474,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_SHOW_TOOLTIPS: case PROP_SHOW_TOOLTIPS:
g_value_set_boolean (value, gui_config->show_tooltips); g_value_set_boolean (value, gui_config->show_tooltips);
break; break;
case PROP_SINGLE_WINDOW_MODE:
g_value_set_boolean (value, gui_config->single_window_mode);
break;
case PROP_TEAROFF_MENUS: case PROP_TEAROFF_MENUS:
g_value_set_boolean (value, gui_config->tearoff_menus); g_value_set_boolean (value, gui_config->tearoff_menus);
break; break;
......
...@@ -48,6 +48,7 @@ struct _GimpGuiConfig ...@@ -48,6 +48,7 @@ struct _GimpGuiConfig
gboolean restore_session; gboolean restore_session;
gboolean save_tool_options; gboolean save_tool_options;
gboolean show_tooltips; gboolean show_tooltips;
gboolean single_window_mode;
gboolean tearoff_menus; gboolean tearoff_menus;
gboolean can_change_accels; gboolean can_change_accels;
gboolean save_accels; gboolean save_accels;
......
...@@ -343,6 +343,9 @@ N_("When enabled, the sample points are visible by default. This can also be " \ ...@@ -343,6 +343,9 @@ N_("When enabled, the sample points are visible by default. This can also be " \
#define SHOW_TOOLTIPS_BLURB \ #define SHOW_TOOLTIPS_BLURB \
N_("Show a tooltip when the pointer hovers over an item.") N_("Show a tooltip when the pointer hovers over an item.")
#define SINGLE_WINDOW_MODE_BLURB \
N_("Use GIMP in a single-window mode.")
#define SPACE_BAR_ACTION_BLURB \ #define SPACE_BAR_ACTION_BLURB \
N_("What to do when the space bar is pressed in the image window.") N_("What to do when the space bar is pressed in the image window.")
......
...@@ -483,6 +483,7 @@ ...@@ -483,6 +483,7 @@
#define GIMP_HELP_UNIT_DIALOG "gimp-unit-dialog" #define GIMP_HELP_UNIT_DIALOG "gimp-unit-dialog"
#define GIMP_HELP_WINDOWS_SHOW_DOCK "gimp-windows-show-dock" #define GIMP_HELP_WINDOWS_SHOW_DOCK "gimp-windows-show-dock"
#define GIMP_HELP_WINDOWS_USE_SINGLE_WINDOW_MODE "gimp-windows-use-single-window-mode"
#define GIMP_HELP_WINDOWS_OPEN_RECENT_DOCK "gimp-windows-open-recent-dock" #define GIMP_HELP_WINDOWS_OPEN_RECENT_DOCK "gimp-windows-open-recent-dock"
#define GIMP_HELP_HELP "gimp-help" #define GIMP_HELP_HELP "gimp-help"
......
...@@ -634,6 +634,9 @@ ...@@ -634,6 +634,9 @@
<placeholder name="Docks"> <placeholder name="Docks">
<menuitem action="windows-show-toolbox" /> <menuitem action="windows-show-toolbox" />
</placeholder> </placeholder>
<separator />
<menuitem action="windows-use-single-window-mode" />
<separator />
</menu> </menu>
<menu action="help-menu" name="Help"> <menu action="help-menu" name="Help">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment