[gimp/gtk3-port: 158/226] libgimpwidgets: move all GimpColorNotebook members to a private struct.



commit f86797c3cb562b361d86577934283a16a9bf8f02
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jan 2 02:20:09 2011 +0100

    libgimpwidgets: move all GimpColorNotebook members to a private struct.

 app/widgets/gimpcolordialog.c       |    5 +-
 app/widgets/gimpcoloreditor.c       |   17 ++-
 libgimpwidgets/gimpcolorbutton.c    |    5 +-
 libgimpwidgets/gimpcolornotebook.c  |  204 +++++++++++++++++++++++-----------
 libgimpwidgets/gimpcolornotebook.h  |   22 ++--
 libgimpwidgets/gimpcolorselection.c |    8 +-
 6 files changed, 174 insertions(+), 87 deletions(-)
---
diff --git a/app/widgets/gimpcolordialog.c b/app/widgets/gimpcolordialog.c
index d630d08..5fabe0f 100644
--- a/app/widgets/gimpcolordialog.c
+++ b/app/widgets/gimpcolordialog.c
@@ -367,11 +367,14 @@ gimp_color_dialog_help_func (const gchar *help_id,
 {
   GimpColorDialog   *dialog = GIMP_COLOR_DIALOG (help_data);
   GimpColorNotebook *notebook;
+  GimpColorSelector *current;
 
   notebook =
     GIMP_COLOR_NOTEBOOK (GIMP_COLOR_SELECTION (dialog->selection)->notebook);
 
-  help_id = GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->help_id;
+  current = gimp_color_notebook_get_current_selector (notebook);
+
+  help_id = GIMP_COLOR_SELECTOR_GET_CLASS (current)->help_id;
 
   gimp_standard_help_func (help_id, NULL);
 }
diff --git a/app/widgets/gimpcoloreditor.c b/app/widgets/gimpcoloreditor.c
index 1f503a3..5673d4c 100644
--- a/app/widgets/gimpcoloreditor.c
+++ b/app/widgets/gimpcoloreditor.c
@@ -184,7 +184,7 @@ gimp_color_editor_init (GimpColorEditor *editor)
                     G_CALLBACK (gimp_color_editor_color_changed),
                     editor);
 
-  notebook = GIMP_COLOR_NOTEBOOK (editor->notebook)->notebook;
+  notebook = gimp_color_notebook_get_notebook (GIMP_COLOR_NOTEBOOK (editor->notebook));
 
   gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
   gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
@@ -194,7 +194,7 @@ gimp_color_editor_init (GimpColorEditor *editor)
 
   group = NULL;
 
-  for (list = GIMP_COLOR_NOTEBOOK (editor->notebook)->selectors;
+  for (list = gimp_color_notebook_get_selectors (GIMP_COLOR_NOTEBOOK (editor->notebook));
        list;
        list = g_list_next (list))
     {
@@ -342,9 +342,11 @@ gimp_color_editor_set_aux_info (GimpDocked *docked,
                                 GList      *aux_info)
 {
   GimpColorEditor *editor   = GIMP_COLOR_EDITOR (docked);
-  GtkWidget       *notebook = GIMP_COLOR_NOTEBOOK (editor->notebook)->notebook;
+  GtkWidget       *notebook;
   GList           *list;
 
+  notebook = gimp_color_notebook_get_notebook (GIMP_COLOR_NOTEBOOK (editor->notebook));
+
   parent_docked_iface->set_aux_info (docked, aux_info);
 
   for (list = aux_info; list; list = g_list_next (list))
@@ -384,16 +386,19 @@ gimp_color_editor_get_aux_info (GimpDocked *docked)
 {
   GimpColorEditor    *editor   = GIMP_COLOR_EDITOR (docked);
   GimpColorNotebook  *notebook = GIMP_COLOR_NOTEBOOK (editor->notebook);
+  GimpColorSelector  *current;
   GList              *aux_info;
 
   aux_info = parent_docked_iface->get_aux_info (docked);
 
-  if (notebook->cur_page)
+  current = gimp_color_notebook_get_current_selector (notebook);
+
+  if (current)
     {
       GimpSessionInfoAux *aux;
 
       aux = gimp_session_info_aux_new (AUX_INFO_CURRENT_PAGE,
-                                       G_OBJECT_TYPE_NAME (notebook->cur_page));
+                                       G_OBJECT_TYPE_NAME (current));
       aux_info = g_list_append (aux_info, aux);
     }
 
@@ -591,7 +596,7 @@ gimp_color_editor_tab_toggled (GtkWidget       *widget,
           GtkWidget *notebook;
           gint       page_num;
 
-          notebook = GIMP_COLOR_NOTEBOOK (editor->notebook)->notebook;
+          notebook = gimp_color_notebook_get_notebook (GIMP_COLOR_NOTEBOOK (editor->notebook));
 
           page_num = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), selector);
 
diff --git a/libgimpwidgets/gimpcolorbutton.c b/libgimpwidgets/gimpcolorbutton.c
index 5db6318..a8738a4 100644
--- a/libgimpwidgets/gimpcolorbutton.c
+++ b/libgimpwidgets/gimpcolorbutton.c
@@ -1010,12 +1010,15 @@ gimp_color_button_help_func (const gchar *help_id,
 {
   GimpColorSelection *selection;
   GimpColorNotebook  *notebook;
+  GimpColorSelector  *current;
 
   selection = g_object_get_data (G_OBJECT (help_data), COLOR_SELECTION_KEY);
 
   notebook = GIMP_COLOR_NOTEBOOK (selection->notebook);
 
-  help_id = GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->help_id;
+  current = gimp_color_notebook_get_current_selector (notebook);
+
+  help_id = GIMP_COLOR_SELECTOR_GET_CLASS (current)->help_id;
 
   gimp_standard_help_func (help_id, NULL);
 }
diff --git a/libgimpwidgets/gimpcolornotebook.c b/libgimpwidgets/gimpcolornotebook.c
index 0de0e27..f6b33d2 100644
--- a/libgimpwidgets/gimpcolornotebook.c
+++ b/libgimpwidgets/gimpcolornotebook.c
@@ -54,6 +54,17 @@
 #define DEFAULT_TAB_ICON_SIZE  GTK_ICON_SIZE_BUTTON
 
 
+struct _GimpColorNotebookPrivate
+{
+  GtkWidget         *notebook;
+
+  GList             *selectors;
+  GimpColorSelector *cur_page;
+};
+
+#define GET_PRIVATE(obj) (((GimpColorNotebook *) obj)->priv)
+
+
 static void   gimp_color_notebook_style_updated   (GtkWidget         *widget);
 
 static void   gimp_color_notebook_togg_visible    (GimpColorSelector *selector,
@@ -100,6 +111,7 @@ G_DEFINE_TYPE (GimpColorNotebook, gimp_color_notebook,
 static void
 gimp_color_notebook_class_init (GimpColorNotebookClass *klass)
 {
+  GObjectClass           *object_class   = G_OBJECT_CLASS (klass);
   GtkWidgetClass         *widget_class   = GTK_WIDGET_CLASS (klass);
   GimpColorSelectorClass *selector_class = GIMP_COLOR_SELECTOR_CLASS (klass);
 
@@ -128,24 +140,33 @@ gimp_color_notebook_class_init (GimpColorNotebookClass *klass)
                                                               GTK_TYPE_ICON_SIZE,
                                                               DEFAULT_TAB_ICON_SIZE,
                                                               G_PARAM_READABLE));
+
+  g_type_class_add_private (object_class, sizeof (GimpColorNotebookPrivate));
 }
 
 static void
 gimp_color_notebook_init (GimpColorNotebook *notebook)
 {
-  GType *selector_types;
-  guint  n_selector_types;
-  guint  i;
+  GimpColorNotebookPrivate *private = GET_PRIVATE (notebook);
+  GType                    *selector_types;
+  guint                     n_selector_types;
+  guint                     i;
 
-  notebook->notebook = gtk_notebook_new ();
-  gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook->notebook));
-  gtk_box_pack_start (GTK_BOX (notebook), notebook->notebook, TRUE, TRUE, 0);
-  gtk_widget_show (notebook->notebook);
+  notebook->priv = G_TYPE_INSTANCE_GET_PRIVATE (notebook,
+                                                GIMP_TYPE_COLOR_NOTEBOOK,
+                                                GimpColorNotebookPrivate);
 
-  g_signal_connect (notebook->notebook, "switch-page",
+  private = notebook->priv;
+
+  private->notebook = gtk_notebook_new ();
+  gtk_notebook_popup_enable (GTK_NOTEBOOK (private->notebook));
+  gtk_box_pack_start (GTK_BOX (notebook), private->notebook, TRUE, TRUE, 0);
+  gtk_widget_show (private->notebook);
+
+  g_signal_connect (private->notebook, "switch-page",
                     G_CALLBACK (gimp_color_notebook_switch_page),
                     notebook);
-  g_signal_connect (notebook->notebook, "remove",
+  g_signal_connect (private->notebook, "remove",
                     G_CALLBACK (gimp_color_notebook_remove_selector),
                     notebook);
 
@@ -154,8 +175,8 @@ gimp_color_notebook_init (GimpColorNotebook *notebook)
 
   if (n_selector_types == 2)
     {
-      gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook->notebook), FALSE);
-      gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook->notebook), FALSE);
+      gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook), FALSE);
+      gtk_notebook_set_show_border (GTK_NOTEBOOK (private->notebook), FALSE);
     }
 
   for (i = 0; i < n_selector_types; i++)
@@ -177,10 +198,10 @@ gimp_color_notebook_init (GimpColorNotebook *notebook)
 static void
 gimp_color_notebook_style_updated (GtkWidget *widget)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (widget);
-  GList             *list;
-  gint               tab_border;
-  GtkIconSize        icon_size;
+  GimpColorNotebookPrivate *private = GET_PRIVATE (widget);
+  GList                    *list;
+  gint                      tab_border;
+  GtkIconSize               icon_size;
 
   GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
@@ -189,11 +210,11 @@ gimp_color_notebook_style_updated (GtkWidget *widget)
                         "tab-icon_size", &icon_size,
                         NULL);
 
-  g_object_set (notebook->notebook,
+  g_object_set (private->notebook,
                 "tab-border", tab_border,
                 NULL);
 
-  for (list = notebook->selectors; list; list = g_list_next (list))
+  for (list = private->selectors; list; list = g_list_next (list))
     {
       GimpColorSelectorClass *selector_class;
       GtkWidget              *image;
@@ -203,7 +224,7 @@ gimp_color_notebook_style_updated (GtkWidget *widget)
       image = gtk_image_new_from_icon_name (selector_class->icon_name,
                                             icon_size);
 
-      gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook->notebook),
+      gtk_notebook_set_tab_label (GTK_NOTEBOOK (private->notebook),
                                   GTK_WIDGET (list->data),
                                   image);
     }
@@ -213,10 +234,10 @@ static void
 gimp_color_notebook_togg_visible (GimpColorSelector *selector,
                                   gboolean           visible)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
-  GList             *list;
+  GimpColorNotebookPrivate *private = GET_PRIVATE (selector);
+  GList                    *list;
 
-  for (list = notebook->selectors; list; list = g_list_next (list))
+  for (list = private->selectors; list; list = g_list_next (list))
     {
       GimpColorSelector *child = list->data;
 
@@ -228,10 +249,10 @@ static void
 gimp_color_notebook_togg_sensitive (GimpColorSelector *selector,
                                     gboolean           sensitive)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
-  GList             *list;
+  GimpColorNotebookPrivate *private = GET_PRIVATE (selector);
+  GList                    *list;
 
-  for (list = notebook->selectors; list; list = g_list_next (list))
+  for (list = private->selectors; list; list = g_list_next (list))
     {
       GimpColorSelector *child = list->data;
 
@@ -243,10 +264,10 @@ static void
 gimp_color_notebook_set_show_alpha (GimpColorSelector *selector,
                                     gboolean           show_alpha)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
-  GList             *list;
+  GimpColorNotebookPrivate *private = GET_PRIVATE (selector);
+  GList                    *list;
 
-  for (list = notebook->selectors; list; list = g_list_next (list))
+  for (list = private->selectors; list; list = g_list_next (list))
     {
       GimpColorSelector *child = list->data;
 
@@ -259,44 +280,44 @@ gimp_color_notebook_set_color (GimpColorSelector *selector,
                                const GimpRGB     *rgb,
                                const GimpHSV     *hsv)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
+  GimpColorNotebookPrivate *private = GET_PRIVATE (selector);
 
-  g_signal_handlers_block_by_func (notebook->cur_page,
+  g_signal_handlers_block_by_func (private->cur_page,
                                    gimp_color_notebook_color_changed,
-                                   notebook);
+                                   selector);
 
-  gimp_color_selector_set_color (notebook->cur_page, rgb, hsv);
+  gimp_color_selector_set_color (private->cur_page, rgb, hsv);
 
-  g_signal_handlers_unblock_by_func (notebook->cur_page,
+  g_signal_handlers_unblock_by_func (private->cur_page,
                                      gimp_color_notebook_color_changed,
-                                     notebook);
+                                     selector);
 }
 
 static void
 gimp_color_notebook_set_channel (GimpColorSelector        *selector,
                                  GimpColorSelectorChannel  channel)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
+  GimpColorNotebookPrivate *private = GET_PRIVATE (selector);
 
-  g_signal_handlers_block_by_func (notebook->cur_page,
+  g_signal_handlers_block_by_func (private->cur_page,
                                    gimp_color_notebook_channel_changed,
-                                   notebook);
+                                   selector);
 
-  gimp_color_selector_set_channel (notebook->cur_page, channel);
+  gimp_color_selector_set_channel (private->cur_page, channel);
 
-  g_signal_handlers_unblock_by_func (notebook->cur_page,
+  g_signal_handlers_unblock_by_func (private->cur_page,
                                      gimp_color_notebook_channel_changed,
-                                     notebook);
+                                     selector);
 }
 
 static void
 gimp_color_notebook_set_config (GimpColorSelector *selector,
                                 GimpColorConfig   *config)
 {
-  GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
-  GList             *list;
+  GimpColorNotebookPrivate *private = GET_PRIVATE (selector);
+  GList                    *list;
 
-  for (list = notebook->selectors; list; list = g_list_next (list))
+  for (list = private->selectors; list; list = g_list_next (list))
     {
       GimpColorSelector *child = list->data;
 
@@ -310,30 +331,31 @@ gimp_color_notebook_switch_page (GtkNotebook       *gtk_notebook,
                                  guint              page_num,
                                  GimpColorNotebook *notebook)
 {
-  GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
-  GtkWidget         *page_widget;
+  GimpColorNotebookPrivate *private  = GET_PRIVATE (notebook);
+  GimpColorSelector        *selector = GIMP_COLOR_SELECTOR (notebook);
+  GtkWidget                *page_widget;
 
   page_widget = gtk_notebook_get_nth_page (gtk_notebook, page_num);
 
-  notebook->cur_page = GIMP_COLOR_SELECTOR (page_widget);
+  private->cur_page = GIMP_COLOR_SELECTOR (page_widget);
 
-  g_signal_handlers_block_by_func (notebook->cur_page,
+  g_signal_handlers_block_by_func (private->cur_page,
                                    gimp_color_notebook_color_changed,
                                    notebook);
-  g_signal_handlers_block_by_func (notebook->cur_page,
+  g_signal_handlers_block_by_func (private->cur_page,
                                    gimp_color_notebook_channel_changed,
                                    notebook);
 
-  gimp_color_selector_set_color (notebook->cur_page,
+  gimp_color_selector_set_color (private->cur_page,
                                  &selector->rgb,
                                  &selector->hsv);
-  gimp_color_selector_set_channel (notebook->cur_page,
+  gimp_color_selector_set_channel (private->cur_page,
                                    selector->channel);
 
-  g_signal_handlers_unblock_by_func (notebook->cur_page,
+  g_signal_handlers_unblock_by_func (private->cur_page,
                                      gimp_color_notebook_color_changed,
                                      notebook);
-  g_signal_handlers_unblock_by_func (notebook->cur_page,
+  g_signal_handlers_unblock_by_func (private->cur_page,
                                      gimp_color_notebook_channel_changed,
                                      notebook);
 }
@@ -368,12 +390,13 @@ static GtkWidget *
 gimp_color_notebook_add_page (GimpColorNotebook *notebook,
                               GType              page_type)
 {
-  GimpColorSelector      *selector = GIMP_COLOR_SELECTOR (notebook);
-  GimpColorSelectorClass *selector_class;
-  GtkWidget              *page;
-  GtkWidget              *menu_widget;
-  GtkWidget              *image;
-  GtkWidget              *label;
+  GimpColorNotebookPrivate *private  = GET_PRIVATE (notebook);
+  GimpColorSelector        *selector = GIMP_COLOR_SELECTOR (notebook);
+  GimpColorSelectorClass   *selector_class;
+  GtkWidget                *page;
+  GtkWidget                *menu_widget;
+  GtkWidget                *image;
+  GtkWidget                *label;
 
   page = gimp_color_selector_new (page_type,
                                   &selector->rgb,
@@ -402,13 +425,13 @@ gimp_color_notebook_add_page (GimpColorNotebook *notebook,
   image = gtk_image_new_from_icon_name (selector_class->icon_name,
                                         DEFAULT_TAB_ICON_SIZE);
 
-  gtk_notebook_append_page_menu (GTK_NOTEBOOK (notebook->notebook),
+  gtk_notebook_append_page_menu (GTK_NOTEBOOK (private->notebook),
                                  page, image, menu_widget);
 
-  if (! notebook->cur_page)
-    notebook->cur_page = GIMP_COLOR_SELECTOR (page);
+  if (! private->cur_page)
+    private->cur_page = GIMP_COLOR_SELECTOR (page);
 
-  notebook->selectors = g_list_append (notebook->selectors, page);
+  private->selectors = g_list_append (private->selectors, page);
 
   gtk_widget_show (page);
 
@@ -427,10 +450,11 @@ gimp_color_notebook_remove_selector (GtkContainer      *container,
                                      GtkWidget         *widget,
                                      GimpColorNotebook *notebook)
 {
-  notebook->selectors = g_list_remove (notebook->selectors, widget);
+  notebook->priv->selectors = g_list_remove (notebook->priv->selectors,
+                                             widget);
 
-  if (! notebook->selectors)
-    notebook->cur_page = NULL;
+  if (! notebook->priv->selectors)
+    notebook->priv->cur_page = NULL;
 }
 
 
@@ -459,7 +483,7 @@ gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
   g_return_val_if_fail (! g_type_is_a (page_type, GIMP_TYPE_COLOR_NOTEBOOK),
                         NULL);
 
-  for (list = notebook->selectors; list; list = g_list_next (list))
+  for (list = notebook->priv->selectors; list; list = g_list_next (list))
     {
       GimpColorSelector *page = list->data;
 
@@ -468,7 +492,7 @@ gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
           if (has_page)
             return GTK_WIDGET (page);
 
-          gtk_container_remove (GTK_CONTAINER (notebook->notebook),
+          gtk_container_remove (GTK_CONTAINER (notebook->priv->notebook),
                                 GTK_WIDGET (page));
 
           return NULL;
@@ -480,3 +504,51 @@ gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
 
   return gimp_color_notebook_add_page (notebook, page_type);
 }
+
+/**
+ * gimp_color_notebook_get_notebook:
+ * @notebook:  A #GimpColorNotebook widget.
+ *
+ * Return value: The #GtkNotebook inside.
+ *
+ * Since: GIMP 3.0
+ **/
+GtkWidget *
+gimp_color_notebook_get_notebook (GimpColorNotebook *notebook)
+{
+  g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
+
+  return notebook->priv->notebook;
+}
+
+/**
+ * gimp_color_notebook_get_selectors:
+ * @notebook:  A #GimpColorNotebook widget.
+ *
+ * Return value: The notebook's list of #GimpColorSelector's.
+ *
+ * Since: GIMP 3.0
+ **/
+GList *
+gimp_color_notebook_get_selectors (GimpColorNotebook *notebook)
+{
+  g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
+
+  return notebook->priv->selectors;
+}
+
+/**
+ * gimp_color_notebook_get_current_selector:
+ * @notebook:  A #GimpColorNotebook widget.
+ *
+ * Return value: The active page's #GimpColorSelector.
+ *
+ * Since: GIMP 3.0
+ **/
+GimpColorSelector *
+gimp_color_notebook_get_current_selector (GimpColorNotebook *notebook)
+{
+  g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
+
+  return notebook->priv->cur_page;
+}
diff --git a/libgimpwidgets/gimpcolornotebook.h b/libgimpwidgets/gimpcolornotebook.h
index 97c247b..663f603 100644
--- a/libgimpwidgets/gimpcolornotebook.h
+++ b/libgimpwidgets/gimpcolornotebook.h
@@ -42,16 +42,14 @@ G_BEGIN_DECLS
 #define GIMP_COLOR_NOTEBOOK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_NOTEBOOK, 
GimpColorNotebookClass))
 
 
-typedef struct _GimpColorNotebookClass GimpColorNotebookClass;
+typedef struct _GimpColorNotebookPrivate GimpColorNotebookPrivate;
+typedef struct _GimpColorNotebookClass   GimpColorNotebookClass;
 
 struct _GimpColorNotebook
 {
-  GimpColorSelector  parent_instance;
+  GimpColorSelector         parent_instance;
 
-  GtkWidget         *notebook;
-
-  GList             *selectors;
-  GimpColorSelector *cur_page;
+  GimpColorNotebookPrivate *priv;
 };
 
 struct _GimpColorNotebookClass
@@ -66,11 +64,15 @@ struct _GimpColorNotebookClass
 };
 
 
-GType       gimp_color_notebook_get_type     (void) G_GNUC_CONST;
+GType               gimp_color_notebook_get_type             (void) G_GNUC_CONST;
+
+GtkWidget         * gimp_color_notebook_set_has_page         (GimpColorNotebook *notebook,
+                                                              GType              page_type,
+                                                              gboolean           has_page);
 
-GtkWidget * gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
-                                              GType              page_type,
-                                              gboolean           has_page);
+GtkWidget         * gimp_color_notebook_get_notebook         (GimpColorNotebook *notebook);
+GList             * gimp_color_notebook_get_selectors        (GimpColorNotebook *notebook);
+GimpColorSelector * gimp_color_notebook_get_current_selector (GimpColorNotebook *notebook);
 
 
 G_END_DECLS
diff --git a/libgimpwidgets/gimpcolorselection.c b/libgimpwidgets/gimpcolorselection.c
index cd483b5..8f007d2 100644
--- a/libgimpwidgets/gimpcolorselection.c
+++ b/libgimpwidgets/gimpcolorselection.c
@@ -203,7 +203,7 @@ gimp_color_selection_init (GimpColorSelection *selection)
   g_signal_connect (selection->notebook, "color-changed",
                     G_CALLBACK (gimp_color_selection_notebook_changed),
                     selection);
-  g_signal_connect (GIMP_COLOR_NOTEBOOK (selection->notebook)->notebook,
+  g_signal_connect (gimp_color_notebook_get_notebook (GIMP_COLOR_NOTEBOOK (selection->notebook)),
                     "switch-page",
                     G_CALLBACK (gimp_color_selection_switch_page),
                     selection);
@@ -548,10 +548,12 @@ gimp_color_selection_switch_page (GtkWidget          *widget,
                                   GimpColorSelection *selection)
 {
   GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selection->notebook);
+  GimpColorSelector *current;
   gboolean           sensitive;
 
-  sensitive =
-    (GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->set_channel != NULL);
+  current = gimp_color_notebook_get_current_selector (notebook);
+
+  sensitive = (GIMP_COLOR_SELECTOR_GET_CLASS (current)->set_channel != NULL);
 
   gimp_color_selector_set_toggles_sensitive
     (GIMP_COLOR_SELECTOR (selection->scales), sensitive);


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