[glade] GladeButtonEditor: Added an extension port for derived editors to add properties
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeButtonEditor: Added an extension port for derived editors to add properties
- Date: Sun, 12 May 2013 12:09:36 +0000 (UTC)
commit c733d592a83cfcc0c2c898c0fc6abafd1398d44b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun May 12 19:29:59 2013 +0900
GladeButtonEditor: Added an extension port for derived editors to add properties
plugins/gtk+/glade-button-editor.c | 21 ++++++++++-
plugins/gtk+/glade-button-editor.h | 3 +-
plugins/gtk+/glade-button-editor.ui | 55 ++++++++++++++++++----------
plugins/gtk-private/glade-gtk-private.xml | 12 +++++-
4 files changed, 65 insertions(+), 26 deletions(-)
---
diff --git a/plugins/gtk+/glade-button-editor.c b/plugins/gtk+/glade-button-editor.c
index 175e277..fde2f6f 100644
--- a/plugins/gtk+/glade-button-editor.c
+++ b/plugins/gtk+/glade-button-editor.c
@@ -37,6 +37,7 @@ static void label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor
struct _GladeButtonEditorPrivate
{
GtkWidget *embed;
+ GtkWidget *extension_port;
/* Radio Button */
GtkWidget *group_label;
@@ -87,6 +88,7 @@ glade_button_editor_class_init (GladeButtonEditorClass * klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-button-editor.ui");
+ gtk_widget_class_bind_child_internal (widget_class, GladeButtonEditorPrivate, extension_port);
gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, embed);
gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, relief_label);
gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, relief_shell);
@@ -144,7 +146,9 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
gboolean is_radio = GTK_IS_RADIO_BUTTON (button);
gboolean modify_content = TRUE;
- if (GTK_IS_MENU_BUTTON (button) || GTK_IS_LINK_BUTTON (button))
+ if (GTK_IS_MENU_BUTTON (button) ||
+ GTK_IS_LINK_BUTTON (button) ||
+ GTK_IS_SCALE_BUTTON (button))
modify_content = FALSE;
gtk_widget_set_visible (priv->active_shell, is_toggle);
@@ -385,7 +389,20 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
}
GtkWidget *
-glade_button_editor_new (GladeWidgetAdaptor * adaptor, GladeEditable * embed)
+glade_button_editor_new (void)
{
return g_object_new (GLADE_TYPE_BUTTON_EDITOR, NULL);
}
+
+/*************************************
+ * Private Plugin Extensions *
+ *************************************/
+void
+glade_button_editor_post_create (GladeWidgetAdaptor *adaptor,
+ GObject *editor,
+ GladeCreateReason reason)
+{
+ GladeButtonEditorPrivate *priv = GLADE_BUTTON_EDITOR (editor)->priv;
+
+ gtk_widget_show (priv->extension_port);
+}
diff --git a/plugins/gtk+/glade-button-editor.h b/plugins/gtk+/glade-button-editor.h
index 72a6048..a5bf1f1 100644
--- a/plugins/gtk+/glade-button-editor.h
+++ b/plugins/gtk+/glade-button-editor.h
@@ -49,8 +49,7 @@ struct _GladeButtonEditorClass
};
GType glade_button_editor_get_type (void) G_GNUC_CONST;
-GtkWidget *glade_button_editor_new (GladeWidgetAdaptor *adaptor,
- GladeEditable *editable);
+GtkWidget *glade_button_editor_new (void);
G_END_DECLS
diff --git a/plugins/gtk+/glade-button-editor.ui b/plugins/gtk+/glade-button-editor.ui
index bc60b64..dcc4134 100644
--- a/plugins/gtk+/glade-button-editor.ui
+++ b/plugins/gtk+/glade-button-editor.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="glade">
+ <!-- interface-requires gtk+ 3.10 -->
<!-- interface-requires gladeui 0.0 -->
- <!-- interface-requires gtk+ 3.8 -->
<!-- interface-requires glade-gtk-plugin 0.0 -->
<template class="GladeButtonEditor" parent="GladeEditorSkeleton">
<property name="visible">True</property>
@@ -24,7 +24,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -37,7 +37,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -52,7 +52,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -65,7 +65,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -82,7 +82,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -99,7 +99,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -116,7 +116,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -129,7 +129,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -142,7 +142,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -160,7 +160,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">8</property>
+ <property name="top_attach">9</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -176,7 +176,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">8</property>
+ <property name="top_attach">9</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -194,7 +194,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -210,7 +210,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -225,7 +225,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -238,7 +238,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -257,7 +257,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
@@ -292,7 +292,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">10</property>
+ <property name="top_attach">11</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
@@ -311,7 +311,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">11</property>
+ <property name="top_attach">12</property>
<property name="width">4</property>
<property name="height">1</property>
</packing>
@@ -575,7 +575,22 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">12</property>
+ <property name="top_attach">13</property>
+ <property name="width">4</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="extension_port">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
<property name="width">4</property>
<property name="height">1</property>
</packing>
diff --git a/plugins/gtk-private/glade-gtk-private.xml b/plugins/gtk-private/glade-gtk-private.xml
index b173797..4f7abfd 100644
--- a/plugins/gtk-private/glade-gtk-private.xml
+++ b/plugins/gtk-private/glade-gtk-private.xml
@@ -5,8 +5,6 @@
<!-- Editors to use in our GTK+ plugin -->
<glade-widget-class name="GladeActivatableEditor" generic-name="activatableeditor" title="Activatable
Editor"
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="GladeFileChooserEditor" generic-name="filechoosereditor" title="File Chooser
Editor"
icon-name="widget-gtk-filechooserwidget"/>
<glade-widget-class name="GladeFontChooserEditor" generic-name="fontchoosereditor" title="Font Chooser
Editor"
@@ -45,6 +43,16 @@
</internal-children>
</glade-widget-class>
+ <glade-widget-class name="GladeButtonEditor" generic-name="buttoneditor" title="Button Editor"
+ icon-name="widget-gtk-button">
+ <post-create-function>glade_button_editor_post_create</post-create-function>
+ <properties>
+ <property id="size" disabled="True"/>
+ </properties>
+ <internal-children>
+ <object name="extension_port" anarchist="True"/>
+ </internal-children>
+ </glade-widget-class>
</glade-widget-classes>
<glade-widget-group name="glade-gtk-plugin" title="GTK+ Plugin Editors">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]