[gimp] app: Add gimp_display_get_action_name() utility function
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Add gimp_display_get_action_name() utility function
- Date: Thu, 7 Apr 2011 05:11:23 +0000 (UTC)
commit 3b243bdcfe7e3bf703cf66ad785d0236e62b0ca4
Author: Martin Nordholts <martinn src gnome org>
Date: Tue Mar 15 08:18:48 2011 +0100
app: Add gimp_display_get_action_name() utility function
app/actions/windows-actions.c | 7 ++---
app/display/Makefile.am | 2 +
app/display/gimpdisplay-utils.c | 48 +++++++++++++++++++++++++++++++++++++++
app/display/gimpdisplay-utils.h | 28 ++++++++++++++++++++++
app/menus/windows-menu.c | 4 +-
5 files changed, 83 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index e581cc1..8e015e0 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -41,6 +41,7 @@
#include "widgets/gimphelp-ids.h"
#include "display/gimpdisplay.h"
+#include "display/gimpdisplay-utils.h"
#include "dialogs/dialogs.h"
@@ -229,8 +230,7 @@ windows_actions_display_remove (GimpContainer *container,
GimpActionGroup *group)
{
GtkAction *action;
- gchar *action_name = g_strdup_printf ("windows-display-%04d",
- gimp_display_get_ID (display));
+ gchar *action_name = gimp_display_get_action_name (display);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
@@ -250,8 +250,7 @@ windows_actions_image_notify (GimpDisplay *display,
if (image)
{
GtkAction *action;
- gchar *action_name = g_strdup_printf ("windows-display-%04d",
- gimp_display_get_ID (display));
+ gchar *action_name = gimp_display_get_action_name (display);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
diff --git a/app/display/Makefile.am b/app/display/Makefile.am
index 5d8e3c7..9679084 100644
--- a/app/display/Makefile.am
+++ b/app/display/Makefile.am
@@ -71,6 +71,8 @@ libappdisplay_a_sources = \
gimpdisplay-foreach.h \
gimpdisplay-handlers.c \
gimpdisplay-handlers.h \
+ gimpdisplay-utils.c \
+ gimpdisplay-utils.h \
gimpdisplayshell.c \
gimpdisplayshell.h \
gimpdisplayshell-appearance.c \
diff --git a/app/display/gimpdisplay-utils.c b/app/display/gimpdisplay-utils.c
new file mode 100644
index 0000000..2dc66fb
--- /dev/null
+++ b/app/display/gimpdisplay-utils.c
@@ -0,0 +1,48 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpdisplay-utils.c
+ * Copyright (C) 2011 Martin Nordholts <martinn src gnome org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Utility functions for the display module (not only the GimpDisplay
+ * class).
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "display-types.h"
+
+#include "gimpdisplay-utils.h"
+#include "gimpdisplay.h"
+
+
+/**
+ * gimp_display_get_action_name:
+ * @display:
+ *
+ * Returns: The action name for the given display. The action name
+ * depends on the display ID. The result must be freed with g_free().
+ **/
+gchar *
+gimp_display_get_action_name (GimpDisplay *display)
+{
+ return g_strdup_printf ("windows-display-%04d",
+ gimp_display_get_ID (display));
+}
diff --git a/app/display/gimpdisplay-utils.h b/app/display/gimpdisplay-utils.h
new file mode 100644
index 0000000..5bd3dd8
--- /dev/null
+++ b/app/display/gimpdisplay-utils.h
@@ -0,0 +1,28 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpdisplay-utils.h
+ * Copyright (C) 2011 Martin Nordholts <martinn src gnome org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_DISPLAY_UTILS_H__
+#define __GIMP_DISPLAY_UTILS_H__
+
+
+gchar * gimp_display_get_action_name (GimpDisplay *display);
+
+
+#endif /* __GIMP_ACTIONS_UTILS_H__ */
diff --git a/app/menus/windows-menu.c b/app/menus/windows-menu.c
index 19afc06..91264af 100644
--- a/app/menus/windows-menu.c
+++ b/app/menus/windows-menu.c
@@ -40,6 +40,7 @@
#include "widgets/gimpuimanager.h"
#include "display/gimpdisplay.h"
+#include "display/gimpdisplay-utils.h"
#include "dialogs/dialogs.h"
@@ -205,8 +206,7 @@ windows_menu_image_notify (GimpDisplay *display,
ui_path = g_object_get_data (G_OBJECT (manager),
"image-menu-ui-path");
- action_name = g_strdup_printf ("windows-display-%04d",
- gimp_display_get_ID (display));
+ action_name = gimp_display_get_action_name (display);
action_path = g_strdup_printf ("%s/Windows/Images", ui_path);
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]