Commit 3b243bdc authored by Martin Nordholts's avatar Martin Nordholts

app: Add gimp_display_get_action_name() utility function

parent 5cea6b06
......@@ -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);
......
......@@ -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 \
......
/* 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));
}
/* 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__ */
......@@ -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));
......
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