[gimp] Bug 676374 - Windows->Toolbox shouldn't clear Recently Closed Docks
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 676374 - Windows->Toolbox shouldn't clear Recently Closed Docks
- Date: Tue, 9 Oct 2012 20:56:06 +0000 (UTC)
commit b426acb42d7461f53ead0e1df369762ddfc930b9
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 9 22:54:28 2012 +0200
Bug 676374 - Windows->Toolbox shouldn't clear Recently Closed Docks
When a new toolbox is opened, don't remove all entries containing a
toolbox from the list of recently closed docks. Instead, check if
there is a toolbox already open when such an entry is chosen and tell
the user to close the existing toolbox first.
app/actions/dialogs-actions.c | 5 +----
app/actions/dialogs-actions.h | 10 ++++++----
app/actions/windows-commands.c | 25 ++++++++++++++++++++++++-
app/menus/windows-menu.c | 32 --------------------------------
4 files changed, 31 insertions(+), 41 deletions(-)
---
diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c
index 535b87f..73859ff 100644
--- a/app/actions/dialogs-actions.c
+++ b/app/actions/dialogs-actions.c
@@ -40,9 +40,6 @@
#include "gimp-intl.h"
-static gboolean dialogs_actions_toolbox_exists (Gimp *gimp);
-
-
const GimpStringActionEntry dialogs_dockable_actions[] =
{
{ "dialogs-toolbox", NULL,
@@ -268,7 +265,7 @@ static const GimpStringActionEntry dialogs_toplevel_actions[] =
};
-static gboolean
+gboolean
dialogs_actions_toolbox_exists (Gimp *gimp)
{
GimpDialogFactory *factory = gimp_dialog_factory_get_singleton ();
diff --git a/app/actions/dialogs-actions.h b/app/actions/dialogs-actions.h
index a33c421..dd955bb 100644
--- a/app/actions/dialogs-actions.h
+++ b/app/actions/dialogs-actions.h
@@ -21,16 +21,18 @@
/* this check is needed for the extern declaration below to be correct */
#ifndef __GIMP_ACTION_GROUP_H__
-#error "widgets/gimpactiongroup.h must be included prior to dialog-actions.h"
+#error "widgets/gimpactiongroup.h must be included prior to dialogs-actions.h"
#endif
extern const GimpStringActionEntry dialogs_dockable_actions[];
extern gint n_dialogs_dockable_actions;
-void dialogs_actions_setup (GimpActionGroup *group);
-void dialogs_actions_update (GimpActionGroup *group,
- gpointer data);
+void dialogs_actions_setup (GimpActionGroup *group);
+void dialogs_actions_update (GimpActionGroup *group,
+ gpointer data);
+
+gboolean dialogs_actions_toolbox_exists (Gimp *gimp);
#endif /* __DIALOGS_ACTIONS_H__ */
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 5c93dfe..b82fdfb 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -17,6 +17,8 @@
#include "config.h"
+#include <string.h>
+
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
@@ -29,6 +31,7 @@
#include "core/gimp.h"
#include "core/gimpcontainer.h"
+#include "widgets/gimpactiongroup.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpsessioninfo.h"
#include "widgets/gimpwidgets-utils.h"
@@ -39,8 +42,11 @@
#include "dialogs/dialogs.h"
#include "actions.h"
+#include "dialogs-actions.h"
#include "windows-commands.h"
+#include "gimp-intl.h"
+
void
windows_hide_docks_cmd_callback (GtkAction *action,
@@ -140,7 +146,24 @@ void
windows_open_recent_cmd_callback (GtkAction *action,
gpointer data)
{
- GimpSessionInfo *info = g_object_get_data (G_OBJECT (action), "info");
+ GimpSessionInfo *info;
+ GimpDialogFactoryEntry *entry;
+ Gimp *gimp;
+ return_if_no_gimp (gimp, data);
+
+ info = g_object_get_data (G_OBJECT (action), "info");
+ entry = gimp_session_info_get_factory_entry (info);
+
+ if (entry && strcmp ("gimp-toolbox-window", entry->identifier) == 0 &&
+ dialogs_actions_toolbox_exists (gimp))
+ {
+ gimp_message (gimp,
+ G_OBJECT (action_data_get_widget (data)),
+ GIMP_MESSAGE_WARNING,
+ _("The chosen recent dock contains a toolbox. Please "
+ "close the currently open toolbox and try again."));
+ return;
+ }
g_object_ref (info);
diff --git a/app/menus/windows-menu.c b/app/menus/windows-menu.c
index f111c8d..eb4409a 100644
--- a/app/menus/windows-menu.c
+++ b/app/menus/windows-menu.c
@@ -64,7 +64,6 @@ static void windows_menu_dock_window_removed (GimpDialogFactory *fac
GimpDockWindow *dock_window,
GimpUIManager *manager);
static gboolean windows_menu_is_toolbox_dock_window (GimpDockWindow *dock_window);
-static void windows_menu_remove_toolbox_entries (GimpContainer *docks);
static gchar * windows_menu_dock_window_to_merge_id (GimpDockWindow *dock_window);
static void windows_menu_recent_add (GimpContainer *container,
GimpSessionInfo *info,
@@ -276,12 +275,6 @@ windows_menu_dock_window_added (GimpDialogFactory *factory,
GTK_UI_MANAGER_MENUITEM,
FALSE);
- /* There can only be one toolbox around, so if a new is created,
- * make sure to remove any toolbox entries from Recenly Closed Docks
- */
- if (windows_menu_is_toolbox_dock_window (dock_window))
- windows_menu_remove_toolbox_entries (global_recent_docks);
-
g_free (merge_key);
g_free (action_path);
g_free (action_name);
@@ -317,31 +310,6 @@ windows_menu_is_toolbox_dock_window (GimpDockWindow *dock_window)
return is_for_toolbox;
}
-static void
-windows_menu_remove_toolbox_entries (GimpContainer *docks)
-{
- GList *iter = NULL;
- GList *for_removal = NULL;
-
- for (iter = GIMP_LIST (docks)->list; iter; iter = g_list_next (iter))
- {
- GimpSessionInfo *info = iter->data;
- GimpDialogFactoryEntry *entry = gimp_session_info_get_factory_entry (info);
-
- if (entry && strcmp ("gimp-toolbox-window", entry->identifier) == 0)
- for_removal = g_list_prepend (for_removal, info);
- }
-
- for (iter = for_removal; iter; iter = g_list_next (iter))
- {
- GimpSessionInfo *info = iter->data;
-
- gimp_container_remove (docks, GIMP_OBJECT (info));
- }
-
- g_list_free (for_removal);
-}
-
static gchar *
windows_menu_dock_window_to_merge_id (GimpDockWindow *dock_window)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]