From 19431e8b51f566117596f8ebb21ab25f13b5f4a4 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 20 Jun 2008 11:02:25 +0000 Subject: [PATCH] Seal GtkColorSelectionDialog svn path=/trunk/; revision=20539 --- gtk/gtkcolorseldialog.c | 125 ++++++++++++++++++++++++++++++++++++++++ gtk/gtkcolorseldialog.h | 16 +++-- 2 files changed, 135 insertions(+), 6 deletions(-) diff --git a/gtk/gtkcolorseldialog.c b/gtk/gtkcolorseldialog.c index d1b7c00603..356e450b8c 100644 --- a/gtk/gtkcolorseldialog.c +++ b/gtk/gtkcolorseldialog.c @@ -35,6 +35,14 @@ #include "gtkbuildable.h" #include "gtkalias.h" +enum { + PROP_0, + PROP_COLOR_SELECTION, + PROP_OK_BUTTON, + PROP_CANCEL_BUTTON, + PROP_HELP_BUTTON +}; + /***************************/ /* GtkColorSelectionDialog */ @@ -52,9 +60,70 @@ G_DEFINE_TYPE_WITH_CODE (GtkColorSelectionDialog, gtk_color_selection_dialog, static GtkBuildableIface *parent_buildable_iface; +static void +gtk_color_selection_dialog_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GtkColorSelectionDialog *colorsel; + + colorsel = GTK_COLOR_SELECTION_DIALOG (object); + + switch (prop_id) + { + case PROP_COLOR_SELECTION: + g_value_set_object (value, colorsel->colorsel); + break; + case PROP_OK_BUTTON: + g_value_set_object (value, colorsel->ok_button); + break; + case PROP_CANCEL_BUTTON: + g_value_set_object (value, colorsel->cancel_button); + break; + case PROP_HELP_BUTTON: + g_value_set_object (value, colorsel->help_button); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static void gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + gobject_class->get_property = gtk_color_selection_dialog_get_property; + + g_object_class_install_property (gobject_class, + PROP_COLOR_SELECTION, + g_param_spec_object ("color-selection", + P_("Color Selection"), + P_("The color selection embedded in the dialog."), + GTK_TYPE_WIDGET, + G_PARAM_READABLE)); + g_object_class_install_property (gobject_class, + PROP_OK_BUTTON, + g_param_spec_object ("ok-button", + P_("OK Button"), + P_("The OK button of the dialog."), + GTK_TYPE_WIDGET, + G_PARAM_READABLE)); + g_object_class_install_property (gobject_class, + PROP_CANCEL_BUTTON, + g_param_spec_object ("cancel-button", + P_("Cancel Button"), + P_("The cancel button of the dialog."), + GTK_TYPE_WIDGET, + G_PARAM_READABLE)); + g_object_class_install_property (gobject_class, + PROP_HELP_BUTTON, + g_param_spec_object ("help-button", + P_("Help Button"), + P_("The help button of the dialog."), + GTK_TYPE_WIDGET, + G_PARAM_READABLE)); } static void @@ -118,6 +187,62 @@ gtk_color_selection_dialog_new (const gchar *title) return GTK_WIDGET (colorseldiag); } +/** + * gtk_color_selection_dialog_get_color_selection: + * @colorsel: a #GtkColorSelectionDialog + * + * Retrieves the #GtkColorSelection widget embedded in the dialog. + * + * Since: GSEAL-branch + **/ +GtkWidget* +gtk_color_selection_dialog_get_color_selection (GtkColorSelectionDialog *colorsel) +{ + return colorsel->colorsel; +} + +/** + * gtk_color_selection_dialog_get_ok_button: + * @colorsel: a #GtkColorSelectionDialog + * + * Retrieves the OK button of the dialog. + * + * Since: GSEAL-branch + **/ +GtkWidget* +gtk_color_selection_dialog_get_ok_button (GtkColorSelectionDialog *colorsel) +{ + return colorsel->ok_button; +} + +/** + * gtk_color_selection_dialog_get_cancel_button: + * @colorsel: a #GtkColorSelectionDialog + * + * Retrieves the cancel button of the dialog. + * + * Since: GSEAL-branch + **/ +GtkWidget* +gtk_color_selection_dialog_get_cancel_button (GtkColorSelectionDialog *colorsel) +{ + return colorsel->cancel_button; +} + +/** + * gtk_color_selection_dialog_get_help_button: + * @colorsel: a #GtkColorSelectionDialog + * + * Retrieves the help button of the dialog. + * + * Since: GSEAL-branch + **/ +GtkWidget* +gtk_color_selection_dialog_get_help_button (GtkColorSelectionDialog *colorsel) +{ + return colorsel->help_button; +} + static void gtk_color_selection_dialog_buildable_interface_init (GtkBuildableIface *iface) { diff --git a/gtk/gtkcolorseldialog.h b/gtk/gtkcolorseldialog.h index 38ee923332..c8a04509a2 100644 --- a/gtk/gtkcolorseldialog.h +++ b/gtk/gtkcolorseldialog.h @@ -53,10 +53,10 @@ struct _GtkColorSelectionDialog { GtkDialog parent_instance; - GtkWidget *colorsel; - GtkWidget *ok_button; - GtkWidget *cancel_button; - GtkWidget *help_button; + GtkWidget *GSEAL (colorsel); + GtkWidget *GSEAL (ok_button); + GtkWidget *GSEAL (cancel_button); + GtkWidget *GSEAL (help_button); }; struct _GtkColorSelectionDialogClass @@ -72,8 +72,12 @@ struct _GtkColorSelectionDialogClass /* ColorSelectionDialog */ -GType gtk_color_selection_dialog_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_color_selection_dialog_new (const gchar *title); +GType gtk_color_selection_dialog_get_type (void) G_GNUC_CONST; +GtkWidget* gtk_color_selection_dialog_new (const gchar *title); +GtkWidget* gtk_color_selection_dialog_get_color_selection (GtkColorSelectionDialog *colorsel); +GtkWidget* gtk_color_selection_dialog_get_ok_button (GtkColorSelectionDialog *colorsel); +GtkWidget* gtk_color_selection_dialog_get_cancel_button (GtkColorSelectionDialog *colorsel); +GtkWidget* gtk_color_selection_dialog_get_help_button (GtkColorSelectionDialog *colorsel); G_END_DECLS