[gimp] libgimpwidgets: gimp_pixmap_button_new, gimp_unit_menu_update -> gimpoldwidgets



commit 268930f48996d4dea01cd7a94c88bc85c6d29020
Author: Michael Natterer <mitch gimp org>
Date:   Thu Apr 28 14:53:49 2011 +0200

    libgimpwidgets: gimp_pixmap_button_new, gimp_unit_menu_update -> gimpoldwidgets
    
    where they belog. gimp_unit_menu_update() is newly deprecated.

 .../libgimpwidgets/libgimpwidgets-sections.txt     |    4 +-
 libgimpwidgets/gimpoldwidgets.c                    |   96 +++++++++++++++++++
 libgimpwidgets/gimpoldwidgets.h                    |   22 ++++-
 libgimpwidgets/gimppropwidgets.c                   |    3 +
 libgimpwidgets/gimpunitmenu.c                      |    3 +
 libgimpwidgets/gimpwidgets.c                       |   99 --------------------
 libgimpwidgets/gimpwidgets.h                       |   11 --
 7 files changed, 121 insertions(+), 117 deletions(-)
---
diff --git a/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt b/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
index e59fb4b..860ffdb 100644
--- a/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
+++ b/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
@@ -974,7 +974,6 @@ GIMP_RANDOM_SEED_TOGGLE
 gimp_random_seed_new
 GIMP_COORDINATES_CHAINBUTTON
 gimp_coordinates_new
-gimp_pixmap_button_new
 gimp_toggle_button_sensitive_update
 gimp_toggle_button_update
 gimp_radio_button_update
@@ -982,7 +981,6 @@ gimp_int_adjustment_update
 gimp_uint_adjustment_update
 gimp_float_adjustment_update
 gimp_double_adjustment_update
-gimp_unit_menu_update
 gimp_table_attach_aligned
 gimp_label_set_attributes
 GIMP_WIDGETS_ERROR
@@ -1267,6 +1265,8 @@ gimp_option_menu_set_history
 GimpOptionMenuSensitivityCallback
 gimp_option_menu_set_sensitive
 gimp_menu_item_update
+gimp_pixmap_button_new
+gimp_unit_menu_update
 </SECTION>
 
 <SECTION>
diff --git a/libgimpwidgets/gimpoldwidgets.c b/libgimpwidgets/gimpoldwidgets.c
index 94d45b3..e30d477 100644
--- a/libgimpwidgets/gimpoldwidgets.c
+++ b/libgimpwidgets/gimpoldwidgets.c
@@ -27,10 +27,14 @@
 #undef GTK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
 
+#include "libgimpbase/gimpbase.h"
+
 #include "gimpwidgetstypes.h"
 
 #undef GIMP_DISABLE_DEPRECATED
 #include "gimpoldwidgets.h"
+#include "gimppixmap.h"
+#include "gimpunitmenu.h"
 
 
 /**
@@ -549,3 +553,95 @@ gimp_menu_item_update (GtkWidget *widget,
   *item_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
                                                   "gimp-item-data"));
 }
+
+
+/**
+ * gimp_pixmap_button_new:
+ * @xpm_data: The XPM data which will be passed to gimp_pixmap_new().
+ * @text:     An optional text which will appear right of the pixmap.
+ *
+ * Convenience function that creates a #GtkButton with a #GimpPixmap
+ * and an optional #GtkLabel.
+ *
+ * Returns: The new #GtkButton.
+ **/
+GtkWidget *
+gimp_pixmap_button_new (gchar       **xpm_data,
+                        const gchar  *text)
+{
+  GtkWidget *button;
+  GtkWidget *pixmap;
+
+  button = gtk_button_new ();
+  pixmap = gimp_pixmap_new (xpm_data);
+
+  if (text)
+    {
+      GtkWidget *abox;
+      GtkWidget *hbox;
+      GtkWidget *label;
+
+      abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+      gtk_container_add (GTK_CONTAINER (button), abox);
+      gtk_widget_show (abox);
+
+      hbox = gtk_hbox_new (FALSE, 0);
+      gtk_container_add (GTK_CONTAINER (abox), hbox);
+      gtk_widget_show (hbox);
+
+      gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
+      gtk_widget_show (pixmap);
+
+      label = gtk_label_new_with_mnemonic (text);
+      gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
+      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
+      gtk_widget_show (label);
+    }
+  else
+    {
+      gtk_container_add (GTK_CONTAINER (button), pixmap);
+      gtk_widget_show (pixmap);
+    }
+
+
+  return button;
+}
+
+
+/**
+ * gimp_unit_menu_update:
+ * @widget: A #GimpUnitMenu.
+ * @data:   A pointer to a #GimpUnit variable which will store the unit menu's
+ *          value.
+ *
+ * This callback can set the number of decimal digits of an arbitrary number
+ * of #GtkSpinButton's. To use this functionality, attach the spinbuttons
+ * as list of data pointers attached with g_object_set_data() with the
+ * "set_digits" key.
+ *
+ * See gimp_toggle_button_sensitive_update() for a description of how
+ * to set up the list.
+ **/
+void
+gimp_unit_menu_update (GtkWidget *widget,
+                       gpointer   data)
+{
+  GimpUnit  *val = (GimpUnit *) data;
+  GtkWidget *spinbutton;
+  gint       digits;
+
+  *val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
+
+  digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
+            ((*val == GIMP_UNIT_PERCENT) ? 2 :
+             (MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
+
+  digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
+
+  spinbutton = g_object_get_data (G_OBJECT (widget), "set_digits");
+  while (spinbutton)
+    {
+      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
+      spinbutton = g_object_get_data (G_OBJECT (spinbutton), "set_digits");
+    }
+}
diff --git a/libgimpwidgets/gimpoldwidgets.h b/libgimpwidgets/gimpoldwidgets.h
index 83c2ea5..24baa27 100644
--- a/libgimpwidgets/gimpoldwidgets.h
+++ b/libgimpwidgets/gimpoldwidgets.h
@@ -55,8 +55,9 @@ GtkWidget * gimp_int_option_menu_new         (gboolean        menu_only,
 void        gimp_int_option_menu_set_history (GtkOptionMenu  *option_menu,
                                               gint            item_data);
 
-typedef gboolean (*GimpIntOptionMenuSensitivityCallback) (gint     item_data,
-                                                          gpointer callback_data);
+typedef gboolean (* GimpIntOptionMenuSensitivityCallback) (gint     item_data,
+                                                           gpointer callback_data);
+
 void  gimp_int_option_menu_set_sensitive (GtkOptionMenu    *option_menu,
                                           GimpIntOptionMenuSensitivityCallback callback,
                                           gpointer          callback_data);
@@ -89,15 +90,26 @@ void  gimp_option_menu_set_history   (GtkOptionMenu    *option_menu,
                                       gpointer          item_data);
 
 
-typedef gboolean (*GimpOptionMenuSensitivityCallback) (gpointer item_data,
-                                                       gpointer callback_data);
+typedef gboolean (* GimpOptionMenuSensitivityCallback) (gpointer item_data,
+                                                        gpointer callback_data);
 
 void  gimp_option_menu_set_sensitive (GtkOptionMenu    *option_menu,
                                       GimpOptionMenuSensitivityCallback callback,
                                       gpointer          callback_data);
 
 
-void gimp_menu_item_update           (GtkWidget        *widget,
+void   gimp_menu_item_update         (GtkWidget        *widget,
+                                      gpointer          data);
+
+GtkWidget * gimp_pixmap_button_new   (gchar           **xpm_data,
+                                      const gchar      *text);
+
+
+/*
+ *  Standard Callbacks
+ */
+
+void   gimp_unit_menu_update         (GtkWidget        *widget,
                                       gpointer          data);
 
 
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 303b15e..a8d2e23 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -19,6 +19,8 @@
 
 #include <string.h>
 
+/* FIXME: #undef GTK_DISABLE_DEPRECATED */
+#undef GTK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
@@ -29,6 +31,7 @@
 #include "gimpwidgetstypes.h"
 
 #undef GIMP_DISABLE_DEPRECATED
+#include "gimpoldwidgets.h"
 #include "gimppropwidgets.h"
 #include "gimpunitmenu.h"
 
diff --git a/libgimpwidgets/gimpunitmenu.c b/libgimpwidgets/gimpunitmenu.c
index 5b6a1c3..f46cee4 100644
--- a/libgimpwidgets/gimpunitmenu.c
+++ b/libgimpwidgets/gimpunitmenu.c
@@ -23,6 +23,8 @@
 
 #undef GSEAL_ENABLE
 
+/* FIXME: #undef GTK_DISABLE_DEPRECATED */
+#undef GTK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
@@ -34,6 +36,7 @@
 #include "gimpwidgets.h"
 
 #undef GIMP_DISABLE_DEPRECATED
+#include "gimpoldwidgets.h"
 #include "gimpunitmenu.h"
 
 #include "libgimp/libgimp-intl.h"
diff --git a/libgimpwidgets/gimpwidgets.c b/libgimpwidgets/gimpwidgets.c
index a1b0ef6..9217a06 100644
--- a/libgimpwidgets/gimpwidgets.c
+++ b/libgimpwidgets/gimpwidgets.c
@@ -27,15 +27,6 @@
 #include "libgimpmath/gimpmath.h"
 #include "libgimpbase/gimpbase.h"
 
-#include "gimpwidgetstypes.h"
-
-#include "gimpchainbutton.h"
-
-#include "gimpsizeentry.h"
-#include "gimpunitmenu.h"
-
-#undef GIMP_DISABLE_DEPRECATED
-#include "gimppixmap.h"
 #include "gimpwidgets.h"
 
 #include "libgimp/libgimp-intl.h"
@@ -825,58 +816,6 @@ gimp_coordinates_new (GimpUnit         unit,
 }
 
 
-/**
- * gimp_pixmap_button_new:
- * @xpm_data: The XPM data which will be passed to gimp_pixmap_new().
- * @text:     An optional text which will appear right of the pixmap.
- *
- * Convenience function that creates a #GtkButton with a #GimpPixmap
- * and an optional #GtkLabel.
- *
- * Returns: The new #GtkButton.
- **/
-GtkWidget *
-gimp_pixmap_button_new (gchar       **xpm_data,
-                        const gchar  *text)
-{
-  GtkWidget *button;
-  GtkWidget *pixmap;
-
-  button = gtk_button_new ();
-  pixmap = gimp_pixmap_new (xpm_data);
-
-  if (text)
-    {
-      GtkWidget *abox;
-      GtkWidget *hbox;
-      GtkWidget *label;
-
-      abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-      gtk_container_add (GTK_CONTAINER (button), abox);
-      gtk_widget_show (abox);
-
-      hbox = gtk_hbox_new (FALSE, 0);
-      gtk_container_add (GTK_CONTAINER (abox), hbox);
-      gtk_widget_show (hbox);
-
-      gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
-      gtk_widget_show (pixmap);
-
-      label = gtk_label_new_with_mnemonic (text);
-      gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
-      gtk_widget_show (label);
-    }
-  else
-    {
-      gtk_container_add (GTK_CONTAINER (button), pixmap);
-      gtk_widget_show (pixmap);
-    }
-
-
-  return button;
-}
-
 /*
  *  Standard Callbacks
  */
@@ -1037,44 +976,6 @@ gimp_double_adjustment_update (GtkAdjustment *adjustment,
   *val = gtk_adjustment_get_value (adjustment);
 }
 
-/**
- * gimp_unit_menu_update:
- * @widget: A #GimpUnitMenu.
- * @data:   A pointer to a #GimpUnit variable which will store the unit menu's
- *          value.
- *
- * This callback can set the number of decimal digits of an arbitrary number
- * of #GtkSpinButton's. To use this functionality, attach the spinbuttons
- * as list of data pointers attached with g_object_set_data() with the
- * "set_digits" key.
- *
- * See gimp_toggle_button_sensitive_update() for a description of how
- * to set up the list.
- **/
-void
-gimp_unit_menu_update (GtkWidget *widget,
-                       gpointer   data)
-{
-  GimpUnit  *val = (GimpUnit *) data;
-  GtkWidget *spinbutton;
-  gint       digits;
-
-  *val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
-
-  digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
-            ((*val == GIMP_UNIT_PERCENT) ? 2 :
-             (MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
-
-  digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
-
-  spinbutton = g_object_get_data (G_OBJECT (widget), "set_digits");
-  while (spinbutton)
-    {
-      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
-      spinbutton = g_object_get_data (G_OBJECT (spinbutton), "set_digits");
-    }
-}
-
 
 /*
  *  Helper Functions
diff --git a/libgimpwidgets/gimpwidgets.h b/libgimpwidgets/gimpwidgets.h
index f1059b3..bc2f892 100644
--- a/libgimpwidgets/gimpwidgets.h
+++ b/libgimpwidgets/gimpwidgets.h
@@ -221,14 +221,6 @@ GtkWidget * gimp_coordinates_new   (GimpUnit            unit,
                                     gdouble             ysize_100  /* % */);
 
 
-#ifndef GIMP_DISABLE_DEPRECATED
-
-GtkWidget * gimp_pixmap_button_new  (gchar             **xpm_data,
-                                     const gchar        *text);
-
-#endif
-
-
 /*
  *  Standard Callbacks
  */
@@ -253,9 +245,6 @@ void gimp_float_adjustment_update        (GtkAdjustment   *adjustment,
 void gimp_double_adjustment_update       (GtkAdjustment   *adjustment,
                                           gpointer         data);
 
-void gimp_unit_menu_update               (GtkWidget       *widget,
-                                          gpointer         data);
-
 
 /*
  *  Helper Functions



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