[gimp] app: add gimp_tool_gui_set_icon_name()



commit 453882c81e755dc4f20b83efffbd2dacbd547a6c
Author: Michael Natterer <mitch gimp org>
Date:   Thu May 22 23:29:24 2014 +0200

    app: add gimp_tool_gui_set_icon_name()

 app/display/gimptoolgui.c |   36 ++++++++++++++++++++++++++++++++++++
 app/display/gimptoolgui.h |    2 ++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/app/display/gimptoolgui.c b/app/display/gimptoolgui.c
index 203c145..ebf902a 100644
--- a/app/display/gimptoolgui.c
+++ b/app/display/gimptoolgui.c
@@ -63,6 +63,7 @@ struct _GimpToolGuiPrivate
 {
   GimpToolInfo     *tool_info;
   gchar            *description;
+  gchar            *icon_name;
   GList            *response_entries;
   gint              default_response;
   gboolean          focus_on_map;
@@ -186,6 +187,12 @@ gimp_tool_gui_finalize (GObject *object)
       private->description = NULL;
     }
 
+  if (private->icon_name)
+    {
+      g_free (private->icon_name);
+      private->icon_name = NULL;
+    }
+
   if (private->response_entries)
     {
       g_list_free_full (private->response_entries,
@@ -283,6 +290,35 @@ gimp_tool_gui_set_description (GimpToolGui *gui,
 }
 
 void
+gimp_tool_gui_set_icon_name (GimpToolGui *gui,
+                             const gchar *icon_name)
+{
+  GimpToolGuiPrivate *private;
+
+  g_return_if_fail (GIMP_IS_TOOL_GUI (gui));
+
+  private = GET_PRIVATE (gui);
+
+  if (icon_name == private->icon_name)
+    return;
+
+  g_free (private->icon_name);
+  private->icon_name = g_strdup (icon_name);
+
+  if (! icon_name)
+    icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (private->tool_info));
+
+  if (private->overlay)
+    {
+      /* TODO */
+    }
+  else
+    {
+      g_object_set (private->dialog, "icon-name", icon_name, NULL);
+    }
+}
+
+void
 gimp_tool_gui_set_shell (GimpToolGui      *gui,
                          GimpDisplayShell *shell)
 {
diff --git a/app/display/gimptoolgui.h b/app/display/gimptoolgui.h
index 7b57dcf..a091f9c 100644
--- a/app/display/gimptoolgui.h
+++ b/app/display/gimptoolgui.h
@@ -61,6 +61,8 @@ GimpToolGui * gimp_tool_gui_new                    (GimpToolInfo     *tool_info,
 
 void          gimp_tool_gui_set_description        (GimpToolGui      *gui,
                                                     const gchar      *description);
+void          gimp_tool_gui_set_icon_name          (GimpToolGui      *gui,
+                                                    const gchar      *icon_name);
 
 void          gimp_tool_gui_set_shell              (GimpToolGui      *gui,
                                                     GimpDisplayShell *shell);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]