[gimp] app: make GimpOperationTool manage an icon name for the GUI



commit 413846475f528f0ff46b50e148e47e8428b17747
Author: Michael Natterer <mitch gimp org>
Date:   Thu May 22 23:29:59 2014 +0200

    app: make GimpOperationTool manage an icon name for the GUI
    
    and add an icon_name parameter to gimp_operation_tool_set_operation().

 app/actions/filters-commands.c |    3 ++-
 app/tools/gimpgegltool.c       |    2 +-
 app/tools/gimpoperationtool.c  |   27 ++++++++++++++++++++++++---
 app/tools/gimpoperationtool.h  |    4 +++-
 4 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/filters-commands.c b/app/actions/filters-commands.c
index 7337e0b..6635154 100644
--- a/app/actions/filters-commands.c
+++ b/app/actions/filters-commands.c
@@ -86,7 +86,8 @@ filters_filter_cmd_callback (GtkAction   *action,
         }
 
       gimp_operation_tool_set_operation (GIMP_OPERATION_TOOL (active_tool),
-                                         operation, label);
+                                         operation, label,
+                                         gtk_action_get_icon_name (action));
       tool_manager_initialize_active (image->gimp, display);
 
       g_free (label);
diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c
index b732ea4..fb131c4 100644
--- a/app/tools/gimpgegltool.c
+++ b/app/tools/gimpgegltool.c
@@ -421,7 +421,7 @@ gimp_gegl_tool_operation_changed (GtkWidget    *widget,
         }
 
       gimp_operation_tool_set_operation (GIMP_OPERATION_TOOL (tool),
-                                         operation, NULL);
+                                         operation, NULL, NULL);
       g_free (operation);
     }
 }
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 15f2005..d531b90 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -163,6 +163,12 @@ gimp_operation_tool_finalize (GObject *object)
       tool->undo_desc = NULL;
     }
 
+  if (tool->icon_name)
+    {
+      g_free (tool->icon_name);
+      tool->icon_name = NULL;
+    }
+
   if (tool->config)
     {
       g_object_unref (tool->config);
@@ -285,6 +291,10 @@ gimp_operation_tool_dialog (GimpImageMapTool *image_map_tool)
   if (tool->undo_desc)
     gimp_tool_gui_set_description (GIMP_IMAGE_MAP_TOOL (tool)->gui,
                                    tool->undo_desc);
+
+  if (tool->icon_name)
+    gimp_tool_gui_set_icon_name (GIMP_IMAGE_MAP_TOOL (tool)->gui,
+                                 tool->icon_name);
 }
 
 static void
@@ -559,7 +569,8 @@ gimp_operation_tool_aux_notify (GimpPickableButton *button,
 void
 gimp_operation_tool_set_operation (GimpOperationTool *tool,
                                    const gchar       *operation,
-                                   const gchar       *undo_desc)
+                                   const gchar       *undo_desc,
+                                   const gchar       *icon_name)
 {
   GimpImageMapTool *im_tool;
 
@@ -574,8 +585,12 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
   if (tool->undo_desc)
     g_free (tool->undo_desc);
 
+  if (tool->icon_name)
+    g_free (tool->icon_name);
+
   tool->operation = g_strdup (operation);
   tool->undo_desc = g_strdup (undo_desc);
+  tool->icon_name = g_strdup (icon_name);
 
   if (tool->config)
     g_object_unref (tool->config);
@@ -674,8 +689,14 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
         }
     }
 
-  if (undo_desc && im_tool->gui)
-    gimp_tool_gui_set_description (im_tool->gui, undo_desc);
+  if (im_tool->gui)
+    {
+      if (undo_desc)
+        gimp_tool_gui_set_description (im_tool->gui, undo_desc);
+
+      if (icon_name)
+        gimp_tool_gui_set_icon_name (im_tool->gui, icon_name);
+    }
 
   if (GIMP_TOOL (tool)->drawable)
     {
diff --git a/app/tools/gimpoperationtool.h b/app/tools/gimpoperationtool.h
index d4eb609..608cd6c 100644
--- a/app/tools/gimpoperationtool.h
+++ b/app/tools/gimpoperationtool.h
@@ -39,6 +39,7 @@ struct _GimpOperationTool
 
   gchar            *operation;
   gchar            *undo_desc;
+  gchar            *icon_name;
   GimpObject       *config;
   GeglNode         *aux_input;
 
@@ -62,7 +63,8 @@ GType   gimp_operation_tool_get_type      (void) G_GNUC_CONST;
 
 void    gimp_operation_tool_set_operation (GimpOperationTool        *tool,
                                            const gchar              *operation,
-                                           const gchar              *undo_desc);
+                                           const gchar              *undo_desc,
+                                           const gchar              *icon_name);
 
 
 #endif  /*  __GIMP_OPERATION_TOOL_H__  */


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