[libgd] header-button: add GdHeaderRadioButton
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd] header-button: add GdHeaderRadioButton
- Date: Thu, 7 Mar 2013 21:19:51 +0000 (UTC)
commit cfd511301407b5afe9f524ade70e9ed57b5aca8a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Mar 7 16:16:52 2013 -0500
header-button: add GdHeaderRadioButton
This is a radio button with mode = FALSE, useful to implement radio button
groups on a header bar, like GdStackSwitcher does.
A future commit will port GdStackSwitcher to use this.
libgd/gd-header-button.c | 40 ++++++++++++++++++++++++++++++++++++++++
libgd/gd-header-button.h | 5 +++++
2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/libgd/gd-header-button.c b/libgd/gd-header-button.c
index 203fa6b..5a3c2c6 100644
--- a/libgd/gd-header-button.c
+++ b/libgd/gd-header-button.c
@@ -414,6 +414,35 @@ gd_header_menu_button_init (GdHeaderMenuButton *self)
{
}
+typedef GtkRadioButtonClass GdHeaderRadioButtonClass;
+G_DEFINE_TYPE_WITH_CODE (GdHeaderRadioButton, gd_header_radio_button, GTK_TYPE_RADIO_BUTTON,
+ G_IMPLEMENT_INTERFACE (GD_TYPE_HEADER_BUTTON, gd_header_button_generic_iface_init))
+
+static void
+gd_header_radio_button_constructed (GObject *object)
+{
+ GdHeaderRadioButton *self = (GdHeaderRadioButton *) (object);
+
+ G_OBJECT_CLASS (GET_PARENT_CLASS (object))->constructed (object);
+
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (self), FALSE);
+}
+
+static void
+gd_header_radio_button_class_init (GdHeaderRadioButtonClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ oclass->constructed = gd_header_radio_button_constructed;
+
+ gd_header_button_generic_class_init (klass);
+}
+
+static void
+gd_header_radio_button_init (GdHeaderRadioButton *self)
+{
+}
+
/**
* gd_header_simple_button_new:
*
@@ -437,6 +466,17 @@ gd_header_toggle_button_new (void)
}
/**
+ * gd_header_radio_button_new:
+ *
+ * Returns: (transfer none):
+ */
+GtkWidget *
+gd_header_radio_button_new (void)
+{
+ return g_object_new (GD_TYPE_HEADER_RADIO_BUTTON, NULL);
+}
+
+/**
* gd_header_menu_button_new:
*
* Returns: (transfer none):
diff --git a/libgd/gd-header-button.h b/libgd/gd-header-button.h
index 43b0715..f5cec51 100644
--- a/libgd/gd-header-button.h
+++ b/libgd/gd-header-button.h
@@ -49,6 +49,11 @@ typedef GtkToggleButton GdHeaderToggleButton;
GType gd_header_toggle_button_get_type (void) G_GNUC_CONST;
GtkWidget * gd_header_toggle_button_new (void);
+#define GD_TYPE_HEADER_RADIO_BUTTON (gd_header_radio_button_get_type ())
+typedef GtkRadioButton GdHeaderRadioButton;
+GType gd_header_radio_button_get_type (void) G_GNUC_CONST;
+GtkWidget * gd_header_radio_button_new (void);
+
#define GD_TYPE_HEADER_MENU_BUTTON (gd_header_menu_button_get_type ())
typedef GtkMenuButton GdHeaderMenuButton;
GType gd_header_menu_button_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]