[gimp] app: add helper function gimp_color_profile_label_new()



commit dc51a8942729ec651a15c3c269de802f5ef97cff
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 23 10:41:34 2015 +0200

    app: add helper function gimp_color_profile_label_new()
    
    which is an expander showing a profile's label, and when expanded has
    detailled information about the profile. Use it in the color profile
    dialog.

 app/dialogs/color-profile-dialog.c     |    4 ++--
 app/widgets/gimpwidgets-constructors.c |   19 +++++++++++++++++++
 app/widgets/gimpwidgets-constructors.h |   10 ++++++----
 3 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/app/dialogs/color-profile-dialog.c b/app/dialogs/color-profile-dialog.c
index 84b9b81..9ea6a3c 100644
--- a/app/dialogs/color-profile-dialog.c
+++ b/app/dialogs/color-profile-dialog.c
@@ -44,6 +44,7 @@
 
 #include "widgets/gimphelp-ids.h"
 #include "widgets/gimpviewabledialog.h"
+#include "widgets/gimpwidgets-constructors.h"
 
 #include "color-profile-dialog.h"
 
@@ -211,8 +212,7 @@ color_profile_dialog_new (GimpImage    *image,
 
   src_profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
 
-  label = gtk_label_new (gimp_color_profile_get_label (src_profile));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  label = gimp_color_profile_label_new (src_profile);
   gtk_container_add (GTK_CONTAINER (frame), label);
   gtk_widget_show (label);
 
diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c
index e799147..b2a83b5 100644
--- a/app/widgets/gimpwidgets-constructors.c
+++ b/app/widgets/gimpwidgets-constructors.c
@@ -21,6 +21,7 @@
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "widgets-types.h"
@@ -225,6 +226,24 @@ gimp_icon_button_new (const gchar *icon_name,
   return button;
 }
 
+GtkWidget *
+gimp_color_profile_label_new (GimpColorProfile *profile)
+{
+  GtkWidget *expander;
+  GtkWidget *view;
+
+  g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
+
+  expander = gtk_expander_new (gimp_color_profile_get_label (profile));
+
+  view = gimp_color_profile_view_new ();
+  gimp_color_profile_view_set_profile (GIMP_COLOR_PROFILE_VIEW (view), profile);
+  gtk_container_add (GTK_CONTAINER (expander), view);
+  gtk_widget_show (view);
+
+  return expander;
+}
+
 
 /*  private functions  */
 
diff --git a/app/widgets/gimpwidgets-constructors.h b/app/widgets/gimpwidgets-constructors.h
index 39810bf..1ff3db6 100644
--- a/app/widgets/gimpwidgets-constructors.h
+++ b/app/widgets/gimpwidgets-constructors.h
@@ -19,11 +19,13 @@
 #define __GIMP_WIDGETS_CONSTRUCTORS_H__
 
 
-GtkWidget * gimp_paint_mode_menu_new (gboolean     with_behind_mode,
-                                      gboolean     with_replace_modes);
+GtkWidget * gimp_paint_mode_menu_new     (gboolean          with_behind_mode,
+                                          gboolean          with_replace_modes);
 
-GtkWidget * gimp_icon_button_new     (const gchar *icon_name,
-                                      const gchar *label);
+GtkWidget * gimp_icon_button_new         (const gchar      *icon_name,
+                                          const gchar      *label);
+
+GtkWidget * gimp_color_profile_label_new (GimpColorProfile *profile);
 
 
 #endif  /*  __GIMP_WIDGETS_CONSTRUCTORS_H__  */


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