[glade] Added new GladeRadioButtonEditor
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Added new GladeRadioButtonEditor
- Date: Sun, 14 Apr 2013 15:35:01 +0000 (UTC)
commit 1930a7917692cdc9542798542b1f2bc174fce009
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Apr 15 00:31:38 2013 +0900
Added new GladeRadioButtonEditor
This one just adds the group property to the embedded GladeToggleButtonEditor.
plugins/gtk+/Makefile.am | 3 +
plugins/gtk+/glade-button-editor.ui | 19 ------
plugins/gtk+/glade-gtk-resources.gresource.xml | 1 +
plugins/gtk+/glade-gtk.c | 5 +-
plugins/gtk+/glade-radio-button-editor.c | 74 ++++++++++++++++++++++++
plugins/gtk+/glade-radio-button-editor.h | 56 ++++++++++++++++++
plugins/gtk+/glade-radio-button-editor.ui | 80 ++++++++++++++++++++++++++
plugins/gtk+/glade-toggle-button-editor.c | 2 +-
plugins/gtk+/glade-toggle-button-editor.ui | 1 +
plugins/gtk+/gtk+.xml.in | 1 +
plugins/gtk-private/glade-gtk-private.xml | 1 +
po/POTFILES.in | 2 +
12 files changed, 224 insertions(+), 21 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 33772a6..d7acbf8 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -43,6 +43,7 @@ libgladegtk_la_SOURCES = \
glade-image-item-editor.c \
glade-label-editor.c \
glade-model-data.c \
+ glade-radio-button-editor.c \
glade-store-editor.c \
glade-string-list.c \
glade-toggle-button-editor.c \
@@ -70,6 +71,7 @@ noinst_HEADERS = \
glade-image-item-editor.h \
glade-label-editor.h \
glade-model-data.h \
+ glade-radio-button-editor.h \
glade-store-editor.h \
glade-string-list.h \
glade-toggle-button-editor.h \
@@ -103,6 +105,7 @@ BUILT_SOURCES = \
UI_FILES = \
glade-activatable-editor.ui \
glade-button-editor.ui \
+ glade-radio-button-editor.ui \
glade-toggle-button-editor.ui
EXTRA_DIST = \
diff --git a/plugins/gtk+/glade-button-editor.ui b/plugins/gtk+/glade-button-editor.ui
index 0d4bcdc..4ad7c84 100644
--- a/plugins/gtk+/glade-button-editor.ui
+++ b/plugins/gtk+/glade-button-editor.ui
@@ -185,25 +185,6 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="attributes_port">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">6</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<placeholder/>
</child>
<child>
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 3c4b1c9..9c9a4d4 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -3,6 +3,7 @@
<gresource prefix="/org/gnome/gladegtk">
<file compressed="true" preprocess="xml-stripblanks">glade-activatable-editor.ui</file>
<file compressed="true" preprocess="xml-stripblanks">glade-button-editor.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">glade-radio-button-editor.ui</file>
<file compressed="true" preprocess="xml-stripblanks">glade-toggle-button-editor.ui</file>
</gresource>
</gresources>
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 038fc80..0dd1c3c 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -43,6 +43,7 @@
#include "glade-activatable-editor.h"
#include "glade-tool-item-group-editor.h"
#include "glade-toggle-button-editor.h"
+#include "glade-radio-button-editor.h"
#include "glade-string-list.h"
#include "glade-fixed.h"
#include "glade-gtk-action-widgets.h"
@@ -3712,7 +3713,9 @@ glade_gtk_button_create_editable (GladeWidgetAdaptor * adaptor,
{
if (type == GLADE_PAGE_GENERAL)
{
- if (g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_TOGGLE_BUTTON))
+ if (g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_RADIO_BUTTON))
+ return (GladeEditable *) glade_radio_button_editor_new ();
+ else if (g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_TOGGLE_BUTTON))
return (GladeEditable *) glade_toggle_button_editor_new ();
else
return (GladeEditable *) glade_button_editor_new (adaptor, NULL);
diff --git a/plugins/gtk+/glade-radio-button-editor.c b/plugins/gtk+/glade-radio-button-editor.c
new file mode 100644
index 0000000..f554327
--- /dev/null
+++ b/plugins/gtk+/glade-radio-button-editor.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008 Tristan Van Berkom.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ * Tristan Van Berkom <tvb gnome org>
+ */
+
+#include <config.h>
+#include <gladeui/glade.h>
+#include <glib/gi18n-lib.h>
+
+#include "glade-radio-button-editor.h"
+
+static void glade_radio_button_editor_grab_focus (GtkWidget * widget);
+
+struct _GladeRadioButtonEditorPrivate
+{
+ GtkWidget *embed;
+};
+
+G_DEFINE_TYPE (GladeRadioButtonEditor, glade_radio_button_editor, GLADE_TYPE_EDITOR_SKELETON);
+
+static void
+glade_radio_button_editor_class_init (GladeRadioButtonEditorClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->grab_focus = glade_radio_button_editor_grab_focus;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/gladegtk/glade-radio-button-editor.ui");
+ gtk_widget_class_bind_child (widget_class, GladeRadioButtonEditorPrivate, embed);
+
+ g_type_class_add_private (object_class, sizeof (GladeRadioButtonEditorPrivate));
+}
+
+static void
+glade_radio_button_editor_init (GladeRadioButtonEditor * self)
+{
+ self->priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (self,
+ GLADE_TYPE_RADIO_BUTTON_EDITOR,
+ GladeRadioButtonEditorPrivate);
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_radio_button_editor_grab_focus (GtkWidget * widget)
+{
+ GladeRadioButtonEditor *radio_button_editor = GLADE_RADIO_BUTTON_EDITOR (widget);
+
+ gtk_widget_grab_focus (radio_button_editor->priv->embed);
+}
+
+GtkWidget *
+glade_radio_button_editor_new (void)
+{
+ return g_object_new (GLADE_TYPE_RADIO_BUTTON_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-radio-button-editor.h b/plugins/gtk+/glade-radio-button-editor.h
new file mode 100644
index 0000000..4b1834c
--- /dev/null
+++ b/plugins/gtk+/glade-radio-button-editor.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2008 Tristan Van Berkom.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ * Tristan Van Berkom <tvb gnome org>
+ */
+#ifndef _GLADE_RADIO_BUTTON_EDITOR_H_
+#define _GLADE_RADIO_BUTTON_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_RADIO_BUTTON_EDITOR (glade_radio_button_editor_get_type ())
+#define GLADE_RADIO_BUTTON_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GLADE_TYPE_RADIO_BUTTON_EDITOR, GladeRadioButtonEditor))
+#define GLADE_RADIO_BUTTON_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GLADE_TYPE_RADIO_BUTTON_EDITOR, GladeRadioButtonEditorClass))
+#define GLADE_IS_RADIO_BUTTON_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GLADE_TYPE_RADIO_BUTTON_EDITOR))
+#define GLADE_IS_RADIO_BUTTON_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GLADE_TYPE_RADIO_BUTTON_EDITOR))
+#define GLADE_RADIO_BUTTON_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GLADE_TYPE_RADIO_BUTTON_EDITOR, GladeRadioButtonEditorClass))
+
+typedef struct _GladeRadioButtonEditor GladeRadioButtonEditor;
+typedef struct _GladeRadioButtonEditorClass GladeRadioButtonEditorClass;
+typedef struct _GladeRadioButtonEditorPrivate GladeRadioButtonEditorPrivate;
+
+struct _GladeRadioButtonEditor
+{
+ GladeEditorSkeleton parent;
+
+ GladeRadioButtonEditorPrivate *priv;
+};
+
+struct _GladeRadioButtonEditorClass
+{
+ GladeEditorSkeletonClass parent;
+};
+
+GType glade_radio_button_editor_get_type (void) G_GNUC_CONST;
+GtkWidget *glade_radio_button_editor_new (void);
+
+G_END_DECLS
+
+#endif /* _GLADE_RADIO_BUTTON_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-radio-button-editor.ui b/plugins/gtk+/glade-radio-button-editor.ui
new file mode 100644
index 0000000..6e1fa43
--- /dev/null
+++ b/plugins/gtk+/glade-radio-button-editor.ui
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+ <!-- interface-requires gladeui 0.0 -->
+ <!-- interface-requires gtk+ 3.8 -->
+ <!-- interface-requires glade-gtk-plugin 0.0 -->
+ <template class="GladeRadioButtonEditor" parent="GladeEditorSkeleton">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GladeToggleButtonEditor" id="embed">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child internal-child="embed">
+ <object class="GladeButtonEditor" id="buttoneditor-embed1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="margin_left">12</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GladePropertyLabel" id="propertylabel1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="property_name">group</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GladePropertyShell" id="propertyshell1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="property_name">group</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child-editors>
+ <editor id="embed"/>
+ <editor id="propertylabel1"/>
+ <editor id="propertyshell1"/>
+ </child-editors>
+ </template>
+</interface>
diff --git a/plugins/gtk+/glade-toggle-button-editor.c b/plugins/gtk+/glade-toggle-button-editor.c
index 4b60bf3..b42c53a 100644
--- a/plugins/gtk+/glade-toggle-button-editor.c
+++ b/plugins/gtk+/glade-toggle-button-editor.c
@@ -43,7 +43,7 @@ glade_toggle_button_editor_class_init (GladeToggleButtonEditorClass * klass)
widget_class->grab_focus = glade_toggle_button_editor_grab_focus;
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/gladegtk/glade-toggle-button-editor.ui");
- gtk_widget_class_bind_child (widget_class, GladeToggleButtonEditorPrivate, embed);
+ gtk_widget_class_bind_child_internal (widget_class, GladeToggleButtonEditorPrivate, embed);
g_type_class_add_private (object_class, sizeof (GladeToggleButtonEditorPrivate));
}
diff --git a/plugins/gtk+/glade-toggle-button-editor.ui b/plugins/gtk+/glade-toggle-button-editor.ui
index cb4291c..74edbd8 100644
--- a/plugins/gtk+/glade-toggle-button-editor.ui
+++ b/plugins/gtk+/glade-toggle-button-editor.ui
@@ -19,6 +19,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">12</property>
+ <property name="margin_top">2</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 639c1bc..46afef7 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1215,6 +1215,7 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkRadioButton" generic-name="radiobutton" _title="Radio Button">
<set-property-function>glade_gtk_radio_button_set_property</set-property-function>
<properties>
+ <property id="group" custom-layout="True"/>
<property id="label" default="radiobutton"/>
<property id="xalign" save-always="True"/>
</properties>
diff --git a/plugins/gtk-private/glade-gtk-private.xml b/plugins/gtk-private/glade-gtk-private.xml
index 2569ded..d623f4a 100644
--- a/plugins/gtk-private/glade-gtk-private.xml
+++ b/plugins/gtk-private/glade-gtk-private.xml
@@ -7,6 +7,7 @@
icon-name="widget-gtk-action"/>
<glade-widget-class name="GladeButtonEditor" generic-name="buttoneditor" title="Button Editor"
icon-name="widget-gtk-button"/>
+
<glade-widget-class name="GladeToggleButtonEditor" generic-name="buttoneditor" title="Button Editor"
icon-name="widget-gtk-togglebutton">
<internal-children>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 664d083..f55f5ba 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -69,6 +69,7 @@ plugins/gtk+/glade-image-editor.c
plugins/gtk+/glade-image-item-editor.c
plugins/gtk+/glade-label-editor.c
plugins/gtk+/glade-model-data.c
+plugins/gtk+/glade-radio-button-editor.c
plugins/gtk+/glade-store-editor.c
plugins/gtk+/glade-string-list.c
plugins/gtk+/glade-text-button.c
@@ -80,4 +81,5 @@ plugins/gtk+/gtkunixprint.xml.in
plugins/gtk+/gtk+.xml.in
[type: gettext/glade]plugins/gtk+/glade-activatable-editor.ui
[type: gettext/glade]plugins/gtk+/glade-button-editor.ui
+[type: gettext/glade]plugins/gtk+/glade-radio-button-editor.ui
[type: gettext/glade]plugins/gtk+/glade-toggle-button-editor.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]