[gimp] app: Add gimp_tools_get/set_tool_options_gui()
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Add gimp_tools_get/set_tool_options_gui()
- Date: Sun, 31 Oct 2010 13:59:33 +0000 (UTC)
commit 48690d60e185eab584431327d72f24f5b872ed77
Author: Martin Nordholts <martinn src gnome org>
Date: Sun Oct 31 13:05:15 2010 +0100
app: Add gimp_tools_get/set_tool_options_gui()
Add gimp_tools_get_tool_options_gui() and
gimp_tools_set_tool_options_gui() widgets utility functions.
app/tools/gimp-tools.c | 16 ++++++----------
app/widgets/gimptooloptionseditor.c | 6 ++----
app/widgets/gimpwidgets-utils.c | 20 ++++++++++++++++++++
app/widgets/gimpwidgets-utils.h | 5 ++++-
4 files changed, 32 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 446f49b..7a30e91 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -26,6 +26,8 @@
#include "tools-types.h"
+#include "widgets/gimpwidgets-utils.h"
+
#include "core/gimp.h"
#include "core/gimp-contexts.h"
#include "core/gimptoolinfo.h"
@@ -232,13 +234,9 @@ gimp_tools_exit (Gimp *gimp)
GimpToolInfo *tool_info = list->data;
GtkWidget *options_gui;
- options_gui = g_object_get_data (G_OBJECT (tool_info->tool_options),
- "gimp-tool-options-gui");
-
+ options_gui = gimp_tools_get_tool_options_gui (tool_info->tool_options);
gtk_widget_destroy (options_gui);
-
- g_object_set_data (G_OBJECT (tool_info->tool_options),
- "gimp-tool-options-gui", NULL);
+ gimp_tools_set_tool_options_gui (tool_info->tool_options, NULL);
}
tool_manager_exit (gimp);
@@ -358,10 +356,8 @@ gimp_tools_restore (Gimp *gimp)
gtk_widget_show (label);
}
- g_object_set_data_full (G_OBJECT (tool_info->tool_options),
- "gimp-tool-options-gui",
- g_object_ref_sink (options_gui),
- (GDestroyNotify) g_object_unref);
+ gimp_tools_set_tool_options_gui (tool_info->tool_options,
+ g_object_ref_sink (options_gui));
if (tool_info->presets)
gimp_tool_presets_load (tool_info->presets, NULL);
diff --git a/app/widgets/gimptooloptionseditor.c b/app/widgets/gimptooloptionseditor.c
index 8eeac70..f999c88 100644
--- a/app/widgets/gimptooloptionseditor.c
+++ b/app/widgets/gimptooloptionseditor.c
@@ -493,8 +493,7 @@ gimp_tool_options_editor_tool_changed (GimpContext *context,
gimp_tool_options_editor_presets_changed,
editor);
- options_gui = g_object_get_data (G_OBJECT (editor->p->visible_tool_options),
- "gimp-tool-options-gui");
+ options_gui = gimp_tools_get_tool_options_gui (editor->p->visible_tool_options);
if (options_gui)
gtk_widget_hide (options_gui);
@@ -511,8 +510,7 @@ gimp_tool_options_editor_tool_changed (GimpContext *context,
G_CALLBACK (gimp_tool_options_editor_presets_changed),
G_OBJECT (editor), 0);
- options_gui = g_object_get_data (G_OBJECT (tool_info->tool_options),
- "gimp-tool-options-gui");
+ options_gui = gimp_tools_get_tool_options_gui (tool_info->tool_options);
if (! gtk_widget_get_parent (options_gui))
gtk_box_pack_start (GTK_BOX (editor->p->options_vbox), options_gui,
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 03f1087..d5849e6 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -48,6 +48,9 @@
#include "gimp-intl.h"
+#define GIMP_TOOL_OPTIONS_GUI_KEY "gimp-tool-options-gui"
+
+
/**
* gimp_menu_position:
* @menu: a #GtkMenu widget
@@ -1134,3 +1137,20 @@ gimp_dock_with_window_new (GimpDialogFactory *factory,
return dock;
}
+
+GtkWidget *
+gimp_tools_get_tool_options_gui (GimpToolOptions *tool_options)
+{
+ return g_object_get_data (G_OBJECT (tool_options),
+ GIMP_TOOL_OPTIONS_GUI_KEY);
+}
+
+void
+gimp_tools_set_tool_options_gui (GimpToolOptions *tool_options,
+ GtkWidget *widget)
+{
+ g_object_set_data_full (G_OBJECT (tool_options),
+ GIMP_TOOL_OPTIONS_GUI_KEY,
+ widget,
+ widget ? (GDestroyNotify) g_object_unref : NULL);
+}
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index a7caf69..0f60efb 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -85,7 +85,10 @@ void gimp_highlight_widget (GtkWidget *widget
gboolean highlight);
GtkWidget * gimp_dock_with_window_new (GimpDialogFactory *factory,
GdkScreen *screen,
- gboolean toolbox);
+ gboolean toolbox);
+GtkWidget * gimp_tools_get_tool_options_gui (GimpToolOptions *tool_options);
+void gimp_tools_set_tool_options_gui (GimpToolOptions *tool_options,
+ GtkWidget *widget);
#endif /* __GIMP_WIDGETS_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]