[gimp] app: Inline gimp_dialog_factory_show_toolbox()
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Inline gimp_dialog_factory_show_toolbox()
- Date: Sat, 19 Dec 2009 08:23:24 +0000 (UTC)
commit 2b7f8f7a7e4fd8a1945292ae26dc535c778b47a4
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Dec 19 09:22:59 2009 +0100
app: Inline gimp_dialog_factory_show_toolbox()
Merge gimp_dialog_factory_show_toolbox() into the only caller
windows_show_toolbox() to get rid of one non-generic GimpDialogFactory
function.
app/actions/windows-commands.c | 30 ++++++++++++++++++++++++++----
app/widgets/gimpdialogfactory.c | 31 -------------------------------
app/widgets/gimpdialogfactory.h | 1 -
3 files changed, 26 insertions(+), 36 deletions(-)
---
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index eee568b..af68ae7 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -41,7 +41,26 @@
#include "windows-commands.h"
-/* public functions */
+static GtkWidget * gimp_dialog_factory_get_toolbox (GimpDialogFactory *toolbox_factory);
+
+
+static GtkWidget *
+gimp_dialog_factory_get_toolbox (GimpDialogFactory *toolbox_factory)
+{
+ GList *list = NULL;
+
+ for (list = toolbox_factory->open_dialogs; list; list = list->next)
+ {
+ /* The only toplevel widget in the toolbox factory is the
+ * toolbox
+ */
+ if (GTK_IS_WIDGET (list->data) && gtk_widget_is_toplevel (list->data))
+ return list->data;
+ }
+
+ return NULL;
+}
+
void
windows_show_toolbox_cmd_callback (GtkAction *action,
@@ -103,10 +122,10 @@ windows_open_recent_cmd_callback (GtkAction *action,
void
windows_show_toolbox (void)
{
+ GtkWidget *toolbox;
+
if (! global_toolbox_factory->open_dialogs)
{
- GtkWidget *toolbox;
-
toolbox = gimp_dialog_factory_dock_with_window_new (global_toolbox_factory,
gdk_screen_get_default ());
@@ -114,6 +133,9 @@ windows_show_toolbox (void)
}
else
{
- gimp_dialog_factory_show_toolbox (global_toolbox_factory);
+ toolbox = gimp_dialog_factory_get_toolbox (global_toolbox_factory);
+
+ if (toolbox)
+ gtk_window_present (GTK_WINDOW (toolbox));
}
}
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index d8065f7..b856d98 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -100,9 +100,6 @@ static void gimp_dialog_factories_unset_busy_foreach(gconstpointer key,
GimpDialogFactory *factory,
gpointer data);
-static GtkWidget *
- gimp_dialog_factory_get_toolbox (GimpDialogFactory *toolbox_factory);
-
G_DEFINE_TYPE (GimpDialogFactory, gimp_dialog_factory, GIMP_TYPE_OBJECT)
@@ -1141,19 +1138,6 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
}
void
-gimp_dialog_factory_show_toolbox (GimpDialogFactory *toolbox_factory)
-{
- GtkWidget *toolbox;
-
- g_return_if_fail (GIMP_IS_DIALOG_FACTORY (toolbox_factory));
-
- toolbox = gimp_dialog_factory_get_toolbox (toolbox_factory);
-
- if (toolbox)
- gtk_window_present (GTK_WINDOW (toolbox));
-}
-
-void
gimp_dialog_factory_hide_dialog (GtkWidget *dialog)
{
g_return_if_fail (GTK_IS_WIDGET (dialog));
@@ -1681,18 +1665,3 @@ gimp_dialog_factories_unset_busy_foreach (gconstpointer key,
}
}
}
-
-/* The only toplevel widget in the toolbox factory is the toolbox */
-static GtkWidget *
-gimp_dialog_factory_get_toolbox (GimpDialogFactory *toolbox_factory)
-{
- GList *list;
-
- for (list = toolbox_factory->open_dialogs; list; list = list->next)
- {
- if (GTK_IS_WIDGET (list->data) && gtk_widget_is_toplevel (list->data))
- return list->data;
- }
-
- return NULL;
-}
diff --git a/app/widgets/gimpdialogfactory.h b/app/widgets/gimpdialogfactory.h
index db90652..22bc27d 100644
--- a/app/widgets/gimpdialogfactory.h
+++ b/app/widgets/gimpdialogfactory.h
@@ -173,7 +173,6 @@ void gimp_dialog_factory_add_foreign (GimpDialogFactory
GtkWidget *dialog);
void gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
GtkWidget *dialog);
-void gimp_dialog_factory_show_toolbox (GimpDialogFactory *toolbox_factory);
void gimp_dialog_factory_hide_dialog (GtkWidget *dialog);
void gimp_dialog_factories_session_save (GimpConfigWriter *writer);
void gimp_dialog_factories_session_restore (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]