Commit b1a1da88 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Start changing the "Dialogs" menu to "Windows", still incomplete.

2008-05-10  Michael Natterer  <mitch@gimp.org>

	Start changing the "Dialogs" menu to "Windows", still incomplete.
	Addresses bug #309707.

	* app/actions/Makefile.am
	* app/actions/windows-actions.[ch]
	* app/actions/windows-commands.[ch]: new files which currently
	hold the "show toolbox" action and callback and new code which
	maintains automatically generated actions for accessing (raising)
	all open images.

	* app/actions/actions.c: register the new "windows" action group.

	* app/actions/dialogs-actions.c
	* app/actions/dialogs-commands.[ch]: remove "show toolbox"
	action and callback and also the action for the "Disalogs" menu.

	* app/menus/Makefile.am
	* app/menus/windows-menu.[ch]: new files which create and destroy
	the menu items for the image window actions.

	* app/menus/menus.c: register the "windows" action group with
	all UI managers that have the "dialogs" action group.

	* app/menus/image-menu.c (image_menu_setup): call
	windows_menu_setup().

	* app/gui/gui.c: s/dialogs_show_toolbox/windows_show_toolbox/g

	* menus/image-menu.xml.in: some minor s/dialogs/windows/
	and add the "Images" submenu.


svn path=/trunk/; revision=25623
parent dc62afec
2008-05-10 Michael Natterer <mitch@gimp.org>
Start changing the "Dialogs" menu to "Windows", still incomplete.
Addresses bug #309707.
* app/actions/Makefile.am
* app/actions/windows-actions.[ch]
* app/actions/windows-commands.[ch]: new files which currently
hold the "show toolbox" action and callback and new code which
maintains automatically generated actions for accessing (raising)
all open images.
* app/actions/actions.c: register the new "windows" action group.
* app/actions/dialogs-actions.c
* app/actions/dialogs-commands.[ch]: remove "show toolbox"
action and callback and also the action for the "Disalogs" menu.
* app/menus/Makefile.am
* app/menus/windows-menu.[ch]: new files which create and destroy
the menu items for the image window actions.
* app/menus/menus.c: register the "windows" action group with
all UI managers that have the "dialogs" action group.
* app/menus/image-menu.c (image_menu_setup): call
windows_menu_setup().
* app/gui/gui.c: s/dialogs_show_toolbox/windows_show_toolbox/g
* menus/image-menu.xml.in: some minor s/dialogs/windows/
and add the "Images" submenu.
2008-05-10 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplay.c (gimp_display_set_image): emit
......
......@@ -152,7 +152,11 @@ libappactions_a_SOURCES = \
window-actions.c \
window-actions.h \
window-commands.c \
window-commands.h
window-commands.h \
windows-actions.c \
windows-actions.h \
windows-commands.c \
windows-commands.h
EXTRA_DIST = \
......
......@@ -83,6 +83,7 @@
#include "tools-actions.h"
#include "vectors-actions.h"
#include "view-actions.h"
#include "windows-actions.h"
#include "gimp-intl.h"
......@@ -203,7 +204,10 @@ static GimpActionFactoryEntry action_groups[] =
vectors_actions_update },
{ "view", N_("View"), GIMP_STOCK_VISIBLE,
view_actions_setup,
view_actions_update }
view_actions_update },
{ "windows", N_("Windows"), NULL,
windows_actions_setup,
windows_actions_update }
};
......
......@@ -35,9 +35,6 @@
static const GimpActionEntry dialogs_actions[] =
{
{ "dialogs-menu", NULL, N_("_Dialogs") },
{ "dialogs-new-dock-menu", NULL, N_("Create New Doc_k") },
{ "dialogs-new-dock-lcp", NULL,
N_("_Layers, Channels & Paths"), NULL,
N_("Open a Layers, Channels & Paths dock"),
......@@ -54,13 +51,7 @@ static const GimpActionEntry dialogs_actions[] =
N_("_Misc. Stuff"), NULL,
N_("Open a dock containing miscellaneous dialogs"),
G_CALLBACK (dialogs_create_stuff_cmd_callback),
GIMP_HELP_DOCK },
{ "dialogs-toolbox", NULL,
N_("Tool_box"), "<control>B",
N_("Raise the toolbox"),
G_CALLBACK (dialogs_show_toolbox_cmd_callback),
GIMP_HELP_TOOLBOX }
GIMP_HELP_DOCK }
};
const GimpStringActionEntry dialogs_dockable_actions[] =
......
......@@ -49,13 +49,6 @@ static void dialogs_create_dock (GdkScreen *screen,
/* public functions */
void
dialogs_show_toolbox_cmd_callback (GtkAction *action,
gpointer data)
{
dialogs_show_toolbox ();
}
void
dialogs_create_toplevel_cmd_callback (GtkAction *action,
const gchar *value,
......@@ -142,24 +135,6 @@ dialogs_create_stuff_cmd_callback (GtkAction *action,
tabs, G_N_ELEMENTS (tabs));
}
void
dialogs_show_toolbox (void)
{
if (! global_toolbox_factory->open_dialogs)
{
GtkWidget *toolbox;
toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory,
gdk_screen_get_default ());
gtk_widget_show (toolbox);
}
else
{
gimp_dialog_factory_show_toolbox (global_toolbox_factory);
}
}
/* private functions */
......
......@@ -20,23 +20,19 @@
#define __DIALOGS_COMMANDS_H__
void dialogs_show_toolbox_cmd_callback (GtkAction *action,
gpointer data);
void dialogs_create_toplevel_cmd_callback (GtkAction *action,
const gchar *value,
gpointer data);
void dialogs_create_dockable_cmd_callback (GtkAction *action,
const gchar *value,
gpointer data);
void dialogs_create_toplevel_cmd_callback (GtkAction *action,
const gchar *value,
gpointer data);
void dialogs_create_dockable_cmd_callback (GtkAction *action,
const gchar *value,
gpointer data);
void dialogs_create_lc_cmd_callback (GtkAction *action,
gpointer data);
void dialogs_create_data_cmd_callback (GtkAction *action,
gpointer data);
void dialogs_create_stuff_cmd_callback (GtkAction *action,
gpointer data);
void dialogs_show_toolbox (void);
void dialogs_create_lc_cmd_callback (GtkAction *action,
gpointer data);
void dialogs_create_data_cmd_callback (GtkAction *action,
gpointer data);
void dialogs_create_stuff_cmd_callback (GtkAction *action,
gpointer data);
#endif /* __DIALOGS_COMMANDS_H__ */
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "file/file-utils.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "display/gimpdisplay.h"
#include "windows-actions.h"
#include "windows-commands.h"
#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 const GimpActionEntry windows_actions[] =
{
{ "windows-menu", NULL, N_("_Windows") },
{ "windows-images-menu", NULL, N_("_Images") },
{ "windows-new-dock-menu", NULL, N_("Create New Doc_k") },
{ "windows-show-toolbox", NULL,
N_("Tool_box"), "<control>B",
N_("Raise the toolbox"),
G_CALLBACK (windows_show_toolbox_cmd_callback),
GIMP_HELP_TOOLBOX }
};
void
windows_actions_setup (GimpActionGroup *group)
{
GList *list;
gimp_action_group_add_actions (group,
windows_actions,
G_N_ELEMENTS (windows_actions));
g_signal_connect_object (group->gimp->displays, "add",
G_CALLBACK (windows_actions_display_add),
group, 0);
g_signal_connect_object (group->gimp->displays, "remove",
G_CALLBACK (windows_actions_display_remove),
group, 0);
for (list = GIMP_LIST (group->gimp->displays)->list;
list;
list = g_list_next (list))
{
GimpDisplay *display = list->data;
windows_actions_display_add (group->gimp->displays, display, group);
}
}
void
windows_actions_update (GimpActionGroup *group,
gpointer data)
{
}
/* private functions */
static void
windows_actions_display_add (GimpContainer *container,
GimpDisplay *display,
GimpActionGroup *group)
{
g_signal_connect_object (display, "notify::image",
G_CALLBACK (windows_actions_image_notify),
group, 0);
if (display->image)
windows_actions_image_notify (display, NULL, group);
}
static void
windows_actions_display_remove (GimpContainer *container,
GimpDisplay *display,
GimpActionGroup *group)
{
GtkAction *action;
gchar *action_name = g_strdup_printf ("windows-display-%04d",
gimp_display_get_ID (display));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (action)
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
g_free (action_name);
}
static void
windows_actions_image_notify (GimpDisplay *display,
const GParamSpec *unused,
GimpActionGroup *group)
{
if (display->image)
{
GtkAction *action;
gchar *action_name = g_strdup_printf ("windows-display-%04d",
gimp_display_get_ID (display));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
if (! action)
{
GimpActionEntry entry;
entry.name = action_name;
entry.stock_id = GIMP_STOCK_IMAGE;
entry.label = "";
entry.accelerator = NULL;
entry.tooltip = NULL;
entry.callback = G_CALLBACK (windows_show_display_cmd_callback);
entry.help_id = NULL;
gimp_action_group_add_actions (group, &entry, 1);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
g_object_set_data (G_OBJECT (action), "display", display);
}
{
const gchar *uri;
gchar *filename;
gchar *basename;
gchar *escaped;
gchar *title;
uri = gimp_object_get_name (GIMP_OBJECT (display->image));
filename = file_utils_uri_display_name (uri);
basename = file_utils_uri_display_basename (uri);
escaped = gimp_escape_uline (basename);
g_free (basename);
title = g_strdup_printf ("%s-%d.%d", escaped,
gimp_image_get_ID (display->image),
display->instance);
g_free (escaped);
g_object_set (action,
"label", title,
"tooltip", filename,
"viewable", display->image,
"context", gimp_get_user_context (group->gimp),
NULL);
g_free (filename);
g_free (title);
}
g_free (action_name);
}
else
{
windows_actions_display_remove (group->gimp->displays, display, group);
}
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __WINDOWS_ACTIONS_H__
#define __WINDOWS_ACTIONS_H__
void windows_actions_setup (GimpActionGroup *group);
void windows_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __WINDOWS_ACTIONS_H__ */
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "widgets/gimpdialogfactory.h"
#include "display/gimpdisplay.h"
#include "dialogs/dialogs.h"
#include "windows-commands.h"
/* public functions */
void
windows_show_toolbox_cmd_callback (GtkAction *action,
gpointer data)
{
windows_show_toolbox ();
}
void
windows_show_display_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display = g_object_get_data (G_OBJECT (action), "display");
gtk_window_present (GTK_WINDOW (display->shell));
}
void
windows_show_toolbox (void)
{
if (! global_toolbox_factory->open_dialogs)
{
GtkWidget *toolbox;
toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory,
gdk_screen_get_default ());
gtk_widget_show (toolbox);
}
else
{
gimp_dialog_factory_show_toolbox (global_toolbox_factory);
}
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __WINDOWS_COMMANDS_H__
#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_toolbox (void);
#endif /* __WINDOWS_COMMANDS_H__ */
......@@ -72,7 +72,7 @@
#include "widgets/gimpwidgets-utils.h"
#include "actions/actions.h"
#include "actions/dialogs-commands.h"
#include "actions/windows-commands.h"
#include "menus/menus.h"
......@@ -530,7 +530,7 @@ gui_restore_after_callback (Gimp *gimp,
if (gui_config->restore_session)
session_restore (gimp);
dialogs_show_toolbox ();
windows_show_toolbox ();
/* move keyboard focus to the display */
gtk_window_present (GTK_WINDOW (display->shell));
......@@ -759,7 +759,7 @@ gui_display_remove (GimpContainer *displays)
/* show the toolbox when the last image window is closed */
if (gimp_container_is_empty (displays))
dialogs_show_toolbox ();
windows_show_toolbox ();
}
static void
......
......@@ -17,7 +17,9 @@ libappmenus_a_SOURCES = \
tool-options-menu.c \
tool-options-menu.h \
window-menu.c \
window-menu.h
window-menu.h \
windows-menu.c \
windows-menu.h
EXTRA_DIST = \
......
......@@ -28,6 +28,7 @@
#include "image-menu.h"
#include "plug-in-menus.h"
#include "window-menu.h"
#include "windows-menu.h"
void
......@@ -40,6 +41,7 @@ image_menu_setup (GimpUIManager *manager,
ui_path = "/dummy-menubar/image-popup";
file_menu_setup (manager, ui_path);
windows_menu_setup (manager, ui_path);
plug_in_menus_setup (manager, ui_path);
path = g_strconcat (ui_path, "/View", NULL);
......
......@@ -107,6 +107,7 @@ menus_init (Gimp *gimp,
"vectors",
"tools",
"dialogs",
"windows",
"plug-in",
"quick-mask",
NULL,
......@@ -130,6 +131,7 @@ menus_init (Gimp *gimp,
"channels",
"vectors",
"tools",
"windows",
"dialogs",
"plug-in",
"quick-mask",
......@@ -147,6 +149,7 @@ menus_init (Gimp *gimp,
"channels",
"vectors",
"tools",
"windows",
"dialogs",
"plug-in",
"quick-mask",
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpthumb/gimpthumb.h"
#include "menus-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimplist.h"
#include "core/gimpviewable.h"
#include "widgets/gimpaction.h"
#include "widgets/gimpuimanager.h"
#include "display/gimpdisplay.h"
#include "windows-menu.h"
static void windows_menu_display_add (GimpContainer *container,
GimpDisplay *display,
GimpUIManager *manager);
static void windows_menu_display_remove (GimpContainer *container,
GimpDisplay *display,
GimpUIManager *manager);
static void windows_menu_image_notify (GimpDisplay *display,
const GParamSpec *unused,
GimpUIManager *manager);
void
windows_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GList *list;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
g_signal_connect_object (manager->gimp->displays, "add",
G_CALLBACK (windows_menu_display_add),
manager, 0);
g_signal_connect_object (manager->gimp->displays, "remove",
G_CALLBACK (windows_menu_display_remove),
manager, 0);
g_object_set_data (G_OBJECT (manager), "image-menu-ui-path",
(gpointer) ui_path);