[gimp] Add gimp_preview_tab_style_to_icon() utility function



commit 501f97b54be11575629b7783f5c874ba22caa249
Author: Martin Nordholts <martinn src gnome org>
Date:   Fri Jun 11 22:38:34 2010 +0200

    Add gimp_preview_tab_style_to_icon() utility function
    
    Also fix wrong conversion from PREVIEW_NAME to ICON_BLURB

 app/widgets/gimpdockable.c      |   20 +-------------------
 app/widgets/gimpwidgets-utils.c |   24 ++++++++++++++++++++++++
 app/widgets/gimpwidgets-utils.h |    1 +
 3 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index 60ad609..1f276c0 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -1318,25 +1318,7 @@ gimp_dockable_convert_tab_style (GimpDockable   *dockable,
   GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
 
   if (child && ! GIMP_DOCKED_GET_INTERFACE (child)->get_preview)
-    {
-      switch (tab_style)
-        {
-        case GIMP_TAB_STYLE_PREVIEW:
-          tab_style = GIMP_TAB_STYLE_ICON;
-          break;
-
-        case GIMP_TAB_STYLE_PREVIEW_NAME:
-          tab_style = GIMP_TAB_STYLE_ICON_BLURB;
-          break;
-
-        case GIMP_TAB_STYLE_PREVIEW_BLURB:
-          tab_style = GIMP_TAB_STYLE_ICON_BLURB;
-          break;
-
-        default:
-          break;
-        }
-    }
+    tab_style = gimp_preview_tab_style_to_icon (tab_style);
 
   return tab_style;
 }
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 09a6ca1..03f1087 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -429,6 +429,30 @@ gimp_get_icon_size (GtkWidget   *widget,
   return icon_size;
 }
 
+GimpTabStyle
+gimp_preview_tab_style_to_icon (GimpTabStyle tab_style)
+{
+  switch (tab_style)
+    {
+    case GIMP_TAB_STYLE_PREVIEW:
+      tab_style = GIMP_TAB_STYLE_ICON;
+      break;
+
+    case GIMP_TAB_STYLE_PREVIEW_NAME:
+      tab_style = GIMP_TAB_STYLE_ICON_NAME;
+      break;
+
+    case GIMP_TAB_STYLE_PREVIEW_BLURB:
+      tab_style = GIMP_TAB_STYLE_ICON_BLURB;
+      break;
+
+    default:
+      break;
+    }
+
+  return tab_style;
+}
+
 const gchar *
 gimp_get_mod_name_shift (void)
 {
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index c6184d1..a7caf69 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -49,6 +49,7 @@ GtkIconSize       gimp_get_icon_size               (GtkWidget            *widget
                                                     GtkIconSize           max_size,
                                                     gint                  width,
                                                     gint                  height);
+GimpTabStyle      gimp_preview_tab_style_to_icon   (GimpTabStyle          tab_style);
 const gchar     * gimp_get_mod_name_shift          (void);
 const gchar     * gimp_get_mod_name_control        (void);
 const gchar     * gimp_get_mod_name_alt            (void);



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