[glade] Added GladeToggleButtonEditor.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Added GladeToggleButtonEditor.
- Date: Sun, 14 Apr 2013 15:34:56 +0000 (UTC)
commit ac984203f1eddb4dd44b1468dccfec298fb7a9c4
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Apr 14 22:43:15 2013 +0900
Added GladeToggleButtonEditor.
Mostly just a glade file template and some boiler plate code.
plugins/gtk+/Makefile.am | 5 +-
plugins/gtk+/glade-gtk-resources.gresource.xml | 1 +
plugins/gtk+/glade-gtk.c | 8 ++-
plugins/gtk+/glade-toggle-button-editor.c | 74 ++++++++++++++++++++
plugins/gtk+/glade-toggle-button-editor.h | 56 +++++++++++++++
plugins/gtk+/glade-toggle-button-editor.ui | 96 ++++++++++++++++++++++++++
plugins/gtk+/gtk+.xml.in | 3 +
plugins/gtk-private/glade-gtk-private.xml | 7 ++
po/POTFILES.in | 2 +
9 files changed, 250 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 0389709..33772a6 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -45,6 +45,7 @@ libgladegtk_la_SOURCES = \
glade-model-data.c \
glade-store-editor.c \
glade-string-list.c \
+ glade-toggle-button-editor.c \
glade-tool-button-editor.c \
glade-tool-item-group-editor.c \
glade-treeview-editor.c
@@ -71,6 +72,7 @@ noinst_HEADERS = \
glade-model-data.h \
glade-store-editor.h \
glade-string-list.h \
+ glade-toggle-button-editor.h \
glade-tool-button-editor.h \
glade-tool-item-group-editor.h \
glade-treeview-editor.h
@@ -100,7 +102,8 @@ BUILT_SOURCES = \
UI_FILES = \
glade-activatable-editor.ui \
- glade-button-editor.ui
+ glade-button-editor.ui \
+ glade-toggle-button-editor.ui
EXTRA_DIST = \
$(UI_FILES) \
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index c0b13b3..3c4b1c9 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -3,5 +3,6 @@
<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-toggle-button-editor.ui</file>
</gresource>
</gresources>
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 7a450e8..038fc80 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -42,6 +42,7 @@
#include "glade-entry-editor.h"
#include "glade-activatable-editor.h"
#include "glade-tool-item-group-editor.h"
+#include "glade-toggle-button-editor.h"
#include "glade-string-list.h"
#include "glade-fixed.h"
#include "glade-gtk-action-widgets.h"
@@ -3710,7 +3711,12 @@ glade_gtk_button_create_editable (GladeWidgetAdaptor * adaptor,
GladeEditorPageType type)
{
if (type == GLADE_PAGE_GENERAL)
- return (GladeEditable *) glade_button_editor_new (adaptor, NULL);
+ {
+ 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);
+ }
return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
}
diff --git a/plugins/gtk+/glade-toggle-button-editor.c b/plugins/gtk+/glade-toggle-button-editor.c
new file mode 100644
index 0000000..4b60bf3
--- /dev/null
+++ b/plugins/gtk+/glade-toggle-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-toggle-button-editor.h"
+
+static void glade_toggle_button_editor_grab_focus (GtkWidget * widget);
+
+struct _GladeToggleButtonEditorPrivate
+{
+ GtkWidget *embed;
+};
+
+G_DEFINE_TYPE (GladeToggleButtonEditor, glade_toggle_button_editor, GLADE_TYPE_EDITOR_SKELETON);
+
+static void
+glade_toggle_button_editor_class_init (GladeToggleButtonEditorClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (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);
+
+ g_type_class_add_private (object_class, sizeof (GladeToggleButtonEditorPrivate));
+}
+
+static void
+glade_toggle_button_editor_init (GladeToggleButtonEditor * self)
+{
+ self->priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (self,
+ GLADE_TYPE_TOGGLE_BUTTON_EDITOR,
+ GladeToggleButtonEditorPrivate);
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_toggle_button_editor_grab_focus (GtkWidget * widget)
+{
+ GladeToggleButtonEditor *toggle_button_editor = GLADE_TOGGLE_BUTTON_EDITOR (widget);
+
+ gtk_widget_grab_focus (toggle_button_editor->priv->embed);
+}
+
+GtkWidget *
+glade_toggle_button_editor_new (void)
+{
+ return g_object_new (GLADE_TYPE_TOGGLE_BUTTON_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-toggle-button-editor.h b/plugins/gtk+/glade-toggle-button-editor.h
new file mode 100644
index 0000000..19bdd1c
--- /dev/null
+++ b/plugins/gtk+/glade-toggle-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_TOGGLE_BUTTON_EDITOR_H_
+#define _GLADE_TOGGLE_BUTTON_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_TOGGLE_BUTTON_EDITOR (glade_toggle_button_editor_get_type ())
+#define GLADE_TOGGLE_BUTTON_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GLADE_TYPE_TOGGLE_BUTTON_EDITOR, GladeToggleButtonEditor))
+#define GLADE_TOGGLE_BUTTON_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GLADE_TYPE_TOGGLE_BUTTON_EDITOR, GladeToggleButtonEditorClass))
+#define GLADE_IS_TOGGLE_BUTTON_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GLADE_TYPE_TOGGLE_BUTTON_EDITOR))
+#define GLADE_IS_TOGGLE_BUTTON_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GLADE_TYPE_TOGGLE_BUTTON_EDITOR))
+#define GLADE_TOGGLE_BUTTON_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GLADE_TYPE_TOGGLE_BUTTON_EDITOR, GladeToggleButtonEditorClass))
+
+typedef struct _GladeToggleButtonEditor GladeToggleButtonEditor;
+typedef struct _GladeToggleButtonEditorClass GladeToggleButtonEditorClass;
+typedef struct _GladeToggleButtonEditorPrivate GladeToggleButtonEditorPrivate;
+
+struct _GladeToggleButtonEditor
+{
+ GladeEditorSkeleton parent;
+
+ GladeToggleButtonEditorPrivate *priv;
+};
+
+struct _GladeToggleButtonEditorClass
+{
+ GladeEditorSkeletonClass parent;
+};
+
+GType glade_toggle_button_editor_get_type (void) G_GNUC_CONST;
+GtkWidget *glade_toggle_button_editor_new (void);
+
+G_END_DECLS
+
+#endif /* _GLADE_TOGGLE_BUTTON_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-toggle-button-editor.ui b/plugins/gtk+/glade-toggle-button-editor.ui
new file mode 100644
index 0000000..cb4291c
--- /dev/null
+++ b/plugins/gtk+/glade-toggle-button-editor.ui
@@ -0,0 +1,96 @@
+<?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="GladeToggleButtonEditor" parent="GladeEditorSkeleton">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GladeButtonEditor" id="embed">
+ <property name="visible">True</property>
+ <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="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GladePropertyShell" id="propertyshell1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="property_name">active</property>
+ <property name="editor_type">GladeEpropCheck</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="propertyshell2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="property_name">draw-indicator</property>
+ <property name="editor_type">GladeEpropCheck</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GladePropertyShell" id="propertyshell3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="property_name">inconsistent</property>
+ <property name="editor_type">GladeEpropCheck</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>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</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="propertyshell1"/>
+ <editor id="propertyshell2"/>
+ <editor id="propertyshell3"/>
+ </child-editors>
+ </template>
+</interface>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index a823f59..639c1bc 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1175,6 +1175,9 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkToggleButton" generic-name="togglebutton" _title="Toggle Button">
<properties>
+ <property id="draw-indicator" custom-layout="True"/>
+ <property id="inconsistent" custom-layout="True"/>
+ <property id="active" custom-layout="True"/>
<property id="label" default="togglebutton"/>
</properties>
</glade-widget-class>
diff --git a/plugins/gtk-private/glade-gtk-private.xml b/plugins/gtk-private/glade-gtk-private.xml
index 768553f..2569ded 100644
--- a/plugins/gtk-private/glade-gtk-private.xml
+++ b/plugins/gtk-private/glade-gtk-private.xml
@@ -7,6 +7,12 @@
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>
+ <object name="embed"/>
+ </internal-children>
+ </glade-widget-class>
</glade-widget-classes>
<glade-widget-group name="glade-gtk-plugin" title="GTK+ Plugin Editors">
@@ -15,5 +21,6 @@
<glade-widget-class-ref name="GladeActivatableEditor"/>
<glade-widget-class-ref name="GladeButtonEditor"/>
+ <glade-widget-class-ref name="GladeToggleButtonEditor"/>
</glade-widget-group>
</glade-catalog>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ec2fdae..664d083 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -72,6 +72,7 @@ plugins/gtk+/glade-model-data.c
plugins/gtk+/glade-store-editor.c
plugins/gtk+/glade-string-list.c
plugins/gtk+/glade-text-button.c
+plugins/gtk+/glade-toggle-button-editor.c
plugins/gtk+/glade-tool-button-editor.c
plugins/gtk+/glade-tool-item-group-editor.c
plugins/gtk+/glade-treeview-editor.c
@@ -79,3 +80,4 @@ 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-toggle-button-editor.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]