[gimp] Add a Single-window mode
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Add a Single-window mode
- Date: Sat, 26 Sep 2009 16:25:28 +0000 (UTC)
commit 9fa51f70f4437ca9feb30fc44beaf6761c9c5938
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Sep 26 18:17:27 2009 +0200
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.
app/actions/windows-actions.c | 90 +++++++++++++++++++++++++++++-----------
app/actions/windows-commands.c | 22 ++++++++++
app/actions/windows-commands.h | 21 +++++----
app/config/gimpguiconfig.c | 12 +++++
app/config/gimpguiconfig.h | 1 +
app/config/gimprc-blurbs.h | 3 +
app/widgets/gimphelp-ids.h | 1 +
menus/image-menu.xml.in | 3 +
8 files changed, 119 insertions(+), 34 deletions(-)
---
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index 0f8aa61..b1f227d 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -25,6 +25,9 @@
#include "actions-types.h"
+#include "config/gimpdisplayconfig.h"
+#include "config/gimpguiconfig.h"
+
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
@@ -47,30 +50,33 @@
#include "gimp-intl.h"
-static void windows_actions_display_add (GimpContainer *container,
- GimpDisplay *display,
- GimpActionGroup *group);
-static void windows_actions_display_remove (GimpContainer *container,
- GimpDisplay *display,
- GimpActionGroup *group);
-static void windows_actions_image_notify (GimpDisplay *display,
- const GParamSpec *unused,
- GimpActionGroup *group);
-static void windows_actions_dock_window_added (GimpDialogFactory *factory,
- GimpDockWindow *dock_window,
- GimpActionGroup *group);
-static void windows_actions_dock_window_removed (GimpDialogFactory *factory,
- GimpDockWindow *dock_window,
- GimpActionGroup *group);
-static void windows_actions_dock_window_notify (GimpDockWindow *dock,
- const GParamSpec *pspec,
- GimpActionGroup *group);
-static void windows_actions_recent_add (GimpContainer *container,
- GimpSessionInfo *info,
- GimpActionGroup *group);
-static void windows_actions_recent_remove (GimpContainer *container,
- GimpSessionInfo *info,
- GimpActionGroup *group);
+static void windows_actions_display_add (GimpContainer *container,
+ GimpDisplay *display,
+ GimpActionGroup *group);
+static void windows_actions_display_remove (GimpContainer *container,
+ GimpDisplay *display,
+ GimpActionGroup *group);
+static void windows_actions_image_notify (GimpDisplay *display,
+ const GParamSpec *unused,
+ GimpActionGroup *group);
+static void windows_actions_dock_window_added (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpActionGroup *group);
+static void windows_actions_dock_window_removed (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpActionGroup *group);
+static void windows_actions_dock_window_notify (GimpDockWindow *dock,
+ const GParamSpec *pspec,
+ GimpActionGroup *group);
+static void windows_actions_recent_add (GimpContainer *container,
+ GimpSessionInfo *info,
+ GimpActionGroup *group);
+static void windows_actions_recent_remove (GimpContainer *container,
+ GimpSessionInfo *info,
+ GimpActionGroup *group);
+static void windows_actions_single_window_mode_notify (GimpDisplayConfig *config,
+ GParamSpec *pspec,
+ GimpActionGroup *group);
static const GimpActionEntry windows_actions[] =
@@ -89,6 +95,16 @@ static const GimpActionEntry windows_actions[] =
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
windows_actions_setup (GimpActionGroup *group)
@@ -99,6 +115,10 @@ windows_actions_setup (GimpActionGroup *group)
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);
g_signal_connect_object (group->gimp->displays, "add",
@@ -149,12 +169,24 @@ windows_actions_setup (GimpActionGroup *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
windows_actions_update (GimpActionGroup *group,
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 *
@@ -411,3 +443,13 @@ windows_actions_recent_remove (GimpContainer *container,
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);
+}
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index dadb921..e176857 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -23,15 +23,21 @@
#include "actions-types.h"
+#include "config/gimpdisplayconfig.h"
+#include "config/gimpguiconfig.h"
+
+#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpsessioninfo.h"
#include "display/gimpdisplay.h"
+#include "display/gimpdisplayshell.h"
#include "dialogs/dialogs.h"
+#include "actions.h"
#include "windows-commands.h"
@@ -45,6 +51,22 @@ windows_show_toolbox_cmd_callback (GtkAction *action,
}
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
windows_show_display_cmd_callback (GtkAction *action,
gpointer data)
{
diff --git a/app/actions/windows-commands.h b/app/actions/windows-commands.h
index d5a1801..f7727c1 100644
--- a/app/actions/windows-commands.h
+++ b/app/actions/windows-commands.h
@@ -19,16 +19,17 @@
#define __WINDOWS_COMMANDS_H__
-void windows_show_toolbox_cmd_callback (GtkAction *action,
- gpointer data);
-void windows_show_display_cmd_callback (GtkAction *action,
- gpointer data);
-void windows_show_dock_cmd_callback (GtkAction *action,
- gpointer data);
-void windows_open_recent_cmd_callback (GtkAction *action,
- gpointer data);
-
-void windows_show_toolbox (void);
+void windows_show_toolbox_cmd_callback (GtkAction *action,
+ gpointer data);
+void windows_use_single_window_mode_cmd_callback (GtkAction *action,
+ gpointer data);
+void windows_show_display_cmd_callback (GtkAction *action,
+ gpointer data);
+void windows_show_dock_cmd_callback (GtkAction *action,
+ gpointer data);
+void windows_open_recent_cmd_callback (GtkAction *action,
+ gpointer data);
+void windows_show_toolbox (void);
#endif /* __WINDOWS_COMMANDS_H__ */
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index fbd40d6..287dfca 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -52,6 +52,7 @@ enum
PROP_RESTORE_SESSION,
PROP_SAVE_TOOL_OPTIONS,
PROP_SHOW_TOOLTIPS,
+ PROP_SINGLE_WINDOW_MODE,
PROP_TEAROFF_MENUS,
PROP_CAN_CHANGE_ACCELS,
PROP_SAVE_ACCELS,
@@ -153,6 +154,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
TRUE,
GIMP_PARAM_STATIC_STRINGS |
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,
"tearoff-menus", TEAROFF_MENUS_BLURB,
TRUE,
@@ -347,6 +353,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_SHOW_TOOLTIPS:
gui_config->show_tooltips = g_value_get_boolean (value);
break;
+ case PROP_SINGLE_WINDOW_MODE:
+ gui_config->single_window_mode = g_value_get_boolean (value);
+ break;
case PROP_TEAROFF_MENUS:
gui_config->tearoff_menus = g_value_get_boolean (value);
break;
@@ -465,6 +474,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_SHOW_TOOLTIPS:
g_value_set_boolean (value, gui_config->show_tooltips);
break;
+ case PROP_SINGLE_WINDOW_MODE:
+ g_value_set_boolean (value, gui_config->single_window_mode);
+ break;
case PROP_TEAROFF_MENUS:
g_value_set_boolean (value, gui_config->tearoff_menus);
break;
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index d020333..6963d74 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -48,6 +48,7 @@ struct _GimpGuiConfig
gboolean restore_session;
gboolean save_tool_options;
gboolean show_tooltips;
+ gboolean single_window_mode;
gboolean tearoff_menus;
gboolean can_change_accels;
gboolean save_accels;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 774fe0b..eec056b 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -343,6 +343,9 @@ N_("When enabled, the sample points are visible by default. This can also be " \
#define SHOW_TOOLTIPS_BLURB \
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 \
N_("What to do when the space bar is pressed in the image window.")
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index fc9153e..0159893 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -483,6 +483,7 @@
#define GIMP_HELP_UNIT_DIALOG "gimp-unit-dialog"
#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_HELP "gimp-help"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 6542177..039fdb5 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -634,6 +634,9 @@
<placeholder name="Docks">
<menuitem action="windows-show-toolbox" />
</placeholder>
+ <separator />
+ <menuitem action="windows-use-single-window-mode" />
+ <separator />
</menu>
<menu action="help-menu" name="Help">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]