[gimp] libgimpwidgets: move all GimpColorNotebook members to a private struct.
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: move all GimpColorNotebook members to a private struct.
- Date: Sun, 20 May 2018 19:21:54 +0000 (UTC)
commit 0e35af272336cc57c3073e57665a62259ef22f5a
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 | 10 +-
libgimpwidgets/gimpcolornotebook.c | 226 +++++++++++++++++++++++------------
libgimpwidgets/gimpcolornotebook.h | 22 ++--
libgimpwidgets/gimpcolorselection.c | 8 +-
6 files changed, 187 insertions(+), 101 deletions(-)
---
diff --git a/app/widgets/gimpcolordialog.c b/app/widgets/gimpcolordialog.c
index 5e1a8b3..a88ae49 100644
--- a/app/widgets/gimpcolordialog.c
+++ b/app/widgets/gimpcolordialog.c
@@ -333,11 +333,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 c5a6abd..49a009a 100644
--- a/app/widgets/gimpcoloreditor.c
+++ b/app/widgets/gimpcoloreditor.c
@@ -191,7 +191,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);
@@ -201,7 +201,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))
{
@@ -367,9 +367,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))
@@ -409,16 +411,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);
}
@@ -616,7 +621,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 f5f6e7e..e693513 100644
--- a/libgimpwidgets/gimpcolorbutton.c
+++ b/libgimpwidgets/gimpcolorbutton.c
@@ -1070,16 +1070,18 @@ static void
gimp_color_button_help_func (const gchar *help_id,
gpointer help_data)
{
- GimpColorButton *button;
- GimpColorButtonPrivate *priv = GET_PRIVATE (help_data);
- GimpColorNotebook *notebook;
+ GimpColorSelection *selection;
+ GimpColorNotebook *notebook;
+ GimpColorSelector *current;
button = g_object_get_data (G_OBJECT (help_data), COLOR_BUTTON_KEY);
priv = GET_PRIVATE (button);
notebook = GIMP_COLOR_NOTEBOOK (GIMP_COLOR_SELECTION (priv->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 42848e6..0bdee9b 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,
@@ -109,6 +120,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);
@@ -139,24 +151,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);
@@ -165,8 +186,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++)
@@ -188,10 +209,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);
@@ -200,11 +221,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;
@@ -214,7 +235,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);
}
@@ -224,10 +245,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;
@@ -239,10 +260,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;
@@ -254,10 +275,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;
@@ -270,34 +291,34 @@ 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
@@ -305,27 +326,27 @@ gimp_color_notebook_set_model_visible (GimpColorSelector *selector,
GimpColorSelectorModel model,
gboolean visible)
{
- 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_model_visible_changed,
- notebook);
+ selector);
- gimp_color_selector_set_model_visible (notebook->cur_page, model, visible);
+ gimp_color_selector_set_model_visible (private->cur_page, model, visible);
- g_signal_handlers_unblock_by_func (notebook->cur_page,
+ g_signal_handlers_unblock_by_func (private->cur_page,
gimp_color_notebook_model_visible_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;
@@ -339,28 +360,29 @@ gimp_color_notebook_switch_page (GtkNotebook *gtk_notebook,
guint page_num,
GimpColorNotebook *notebook)
{
- GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
- GtkWidget *page_widget;
- GimpColorSelectorModel model;
+ GimpColorNotebookPrivate *private = GET_PRIVATE (notebook);
+ GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
+ GtkWidget *page_widget;
+ GimpColorSelectorModel model;
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);
- g_signal_handlers_block_by_func (notebook->cur_page,
+ g_signal_handlers_block_by_func (private->cur_page,
gimp_color_notebook_model_visible_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,
gimp_color_selector_get_channel (selector));
for (model = GIMP_COLOR_SELECTOR_MODEL_RGB;
@@ -369,17 +391,17 @@ gimp_color_notebook_switch_page (GtkNotebook *gtk_notebook,
{
gboolean visible = gimp_color_selector_get_model_visible (selector, model);
- gimp_color_selector_set_model_visible (notebook->cur_page, model,
+ gimp_color_selector_set_model_visible (private->cur_page, model,
visible);
}
- 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);
- g_signal_handlers_unblock_by_func (notebook->cur_page,
+ g_signal_handlers_unblock_by_func (private->cur_page,
gimp_color_notebook_model_visible_changed,
notebook);
}
@@ -423,13 +445,14 @@ 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;
- gboolean show_alpha;
+ GimpColorNotebookPrivate *private = GET_PRIVATE (notebook);
+ GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
+ GimpColorSelectorClass *selector_class;
+ GtkWidget *page;
+ GtkWidget *menu_widget;
+ GtkWidget *image;
+ GtkWidget *label;
+ gboolean show_alpha;
page = gimp_color_selector_new (page_type,
&selector->rgb,
@@ -458,13 +481,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);
@@ -486,10 +509,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;
}
@@ -518,7 +542,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;
@@ -527,7 +551,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;
@@ -539,3 +563,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 0678dda..3625adb 100644
--- a/libgimpwidgets/gimpcolorselection.c
+++ b/libgimpwidgets/gimpcolorselection.c
@@ -204,7 +204,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);
@@ -553,10 +553,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]