[glade] GladeButtonEditor: Now a composite class defined in builder xml



commit 91208998c21baa89a0ec3864ab49ddb14edfc979
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat Apr 13 23:19:33 2013 +0900

    GladeButtonEditor: Now a composite class defined in builder xml
    
    glade-button-editor.ui can now be edited in Glade, presuming you
    have installed the gladeui catalog first.

 plugins/gtk+/Makefile.am                       |  32 ++-
 plugins/gtk+/glade-button-editor.c             | 265 +++++--------------
 plugins/gtk+/glade-button-editor.h             |  24 +-
 plugins/gtk+/glade-button-editor.ui            | 337 +++++++++++++++++++++++++
 plugins/gtk+/glade-gtk-resources.gresource.xml |   6 +
 plugins/gtk+/gtk+.xml.in                       |   1 +
 po/POTFILES.in                                 |   1 +
 7 files changed, 443 insertions(+), 223 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 92e55cd..3f97fd8 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -21,6 +21,7 @@ libgladegtk_la_CPPFLAGS =   \
 libgladegtk_la_CFLAGS = $(AM_CFLAGS)
 
 libgladegtk_la_SOURCES = \
+       $(BUILT_SOURCES) \
        glade-gtk.c \
        glade-fixed.c \
        glade-accels.c \
@@ -48,8 +49,7 @@ libgladegtk_la_SOURCES = \
        glade-gtk-action-widgets.c \
        glade-gtk-info-bar.c \
        glade-gtk-activatable.c \
-       glade-gtk-switch.c \
-       glade-gtk-marshallers.c
+       glade-gtk-switch.c
 
 libgladegtk_la_LDFLAGS     = -module -avoid-version $(AM_LDFLAGS)
 libgladegtk_la_LIBADD      = $(libgladeui) $(GTK_LIBS)
@@ -78,7 +78,8 @@ noinst_HEADERS = \
        glade-string-list.h \
        glade-gtk-marshallers.h \
        glade-gtk-activatable.h \
-       glade-gtk-action-widgets.h
+       glade-gtk-action-widgets.h \
+       glade-gtk-resources.h
 
 
 if PLATFORM_WIN32
@@ -98,12 +99,23 @@ endif
 
 @INTLTOOL_XML_NOMERGE_RULE@
 
+BUILT_SOURCES = \
+       glade-gtk-marshallers.c \
+       glade-gtk-marshallers.h \
+       glade-gtk-resources.c \
+       glade-gtk-resources.h
 
-CLEANFILES = gtk+.xml gtkunixprint.xml
+EXTRA_DIST = \
+       $(UI_FILES)     \
+       glade-gtk-marshallers.list \
+       gtk+.xml gtk+.xml.in \
+       gtkunixprint.xml gtkunixprint.xml.in \
+       glade-gtk-resources.gresource.xml
 
-BUILT_SOURCES = glade-gtk-marshallers.c glade-gtk-marshallers.h
+UI_FILES = \
+       glade-button-editor.ui
 
-EXTRA_DIST = glade-gtk-marshallers.list gtk+.xml gtk+.xml.in gtkunixprint.xml gtkunixprint.xml.in
+CLEANFILES = gtk+.xml gtkunixprint.xml $(BUILT_SOURCES)
 
 #
 # Marshaller generation
@@ -116,3 +128,11 @@ glade-gtk-marshallers.c: glade-gtk-marshallers.list $(GLIB_GENMARSHAL)
        $(GLIB_GENMARSHAL) --prefix=glade_gtk_marshal $(srcdir)/glade-gtk-marshallers.list --body --header > 
glade-gtk-marshallers-c.tmp     \
        && mv glade-gtk-marshallers-c.tmp glade-gtk-marshallers.c \
        || ( rm -f glade-gtk-marshallers-c.tmp && exit 1 )
+
+# Generate resources
+glade-gtk-resources.h: glade-gtk-resources.gresource.xml $(UI_FILES) $(GRAPHICS_FILES)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/glade-gtk-resources.gresource.xml \
+               --target=$@ --sourcedir=$(srcdir) --c-name _glade_gtk --generate-header
+glade-gtk-resources.c: glade-gtk-resources.gresource.xml $(UI_FILES) $(GRAPHICS_FILES)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/glade-gtk-resources.gresource.xml \
+               --target=$@ --sourcedir=$(srcdir) --c-name _glade_gtk --generate-source
diff --git a/plugins/gtk+/glade-button-editor.c b/plugins/gtk+/glade-button-editor.c
index 0a0dc53..e8f9095 100644
--- a/plugins/gtk+/glade-button-editor.c
+++ b/plugins/gtk+/glade-button-editor.c
@@ -33,14 +33,37 @@ static void glade_button_editor_editable_init (GladeEditableIface * iface);
 
 static void glade_button_editor_grab_focus (GtkWidget * widget);
 
+static void standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor);
+static void custom_toggled (GtkWidget * widget, GladeButtonEditor * button_editor);
+static void stock_toggled (GtkWidget * widget, GladeButtonEditor * button_editor);
+static void label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor);
+
+struct _GladeButtonEditorPrivate
+{
+  GtkWidget *embed;
+
+  GtkWidget *standard_radio; /* Use standard properties to layout a button */
+  GtkWidget *custom_radio;   /* Use a placeholder in the button */
+
+  /* Available in standard mode: */
+  GtkWidget *stock_radio;    /* Create the button using the stock (Available: stock, image-position) */
+  GtkWidget *label_radio;    /* Create the button with a custom label
+                             * (Available: label, use-underline, image, image-position */
+
+  GtkWidget *standard_frame; /* Contains all the button configurations
+                             */
+  GtkWidget *stock_frame;    /* Contains stock and image-position properties
+                             */
+  GtkWidget *label_frame;    /* Contains label, use-underline, image and image-position properties 
+                             */
+};
 
 static GladeEditableIface *parent_editable_iface;
 
-G_DEFINE_TYPE_WITH_CODE (GladeButtonEditor, glade_button_editor, GTK_TYPE_VBOX,
+G_DEFINE_TYPE_WITH_CODE (GladeButtonEditor, glade_button_editor, GLADE_TYPE_EDITOR_SKELETON,
                          G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
                                                 glade_button_editor_editable_init));
 
-
 static void
 glade_button_editor_class_init (GladeButtonEditorClass * klass)
 {
@@ -49,11 +72,35 @@ glade_button_editor_class_init (GladeButtonEditorClass * klass)
 
   object_class->finalize = glade_button_editor_finalize;
   widget_class->grab_focus = glade_button_editor_grab_focus;
+
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-button-editor.ui");
+
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, standard_radio);
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, custom_radio);
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, stock_radio);
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, label_radio);
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, standard_frame);
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, stock_frame);
+  gtk_widget_class_bind_child (widget_class, GladeButtonEditorPrivate, label_frame);
+
+  gtk_widget_class_bind_callback (widget_class, standard_toggled);
+  gtk_widget_class_bind_callback (widget_class, custom_toggled);
+  gtk_widget_class_bind_callback (widget_class, stock_toggled);
+  gtk_widget_class_bind_callback (widget_class, label_toggled);
+
+  g_type_class_add_private (object_class, sizeof (GladeButtonEditorPrivate));  
 }
 
 static void
 glade_button_editor_init (GladeButtonEditor * self)
 {
+  self->priv = 
+    G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                GLADE_TYPE_BUTTON_EDITOR,
+                                GladeButtonEditorPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
 }
 
 static void
@@ -63,19 +110,10 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
   GladeWidget *gchild = NULL;
   GtkWidget *child, *button;
   gboolean use_stock = FALSE, use_appearance = FALSE;
-  GList *l;
 
   /* Chain up to default implementation */
   parent_editable_iface->load (editable, widget);
 
-  /* load the embedded editable... */
-  if (button_editor->embed)
-    glade_editable_load (GLADE_EDITABLE (button_editor->embed), widget);
-
-  for (l = button_editor->properties; l; l = l->next)
-    glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (l->data),
-                                          widget);
-
   if (widget)
     {
       glade_widget_property_get (widget, "use-action-appearance",
@@ -91,71 +129,54 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
           GLADE_IS_PLACEHOLDER (child)) // placeholder there, custom mode
         {
           /* Custom */
-          gtk_widget_set_sensitive (button_editor->standard_frame, FALSE);
+          gtk_widget_set_sensitive (button_editor->priv->standard_frame, FALSE);
           gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                        (button_editor->custom_radio), TRUE);
+                                        (button_editor->priv->custom_radio), TRUE);
         }
       else
         {
           /* Standard */
-          gtk_widget_set_sensitive (button_editor->standard_frame, TRUE);
+          gtk_widget_set_sensitive (button_editor->priv->standard_frame, TRUE);
           gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                        (button_editor->standard_radio), TRUE);
+                                        (button_editor->priv->standard_radio), TRUE);
 
           glade_widget_property_get (widget, "use-stock", &use_stock);
 
           if (use_stock)
             {
-              gtk_widget_set_sensitive (button_editor->stock_frame, TRUE);
-              gtk_widget_set_sensitive (button_editor->label_frame, FALSE);
+              gtk_widget_set_sensitive (button_editor->priv->stock_frame, TRUE);
+              gtk_widget_set_sensitive (button_editor->priv->label_frame, FALSE);
               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                            (button_editor->stock_radio), TRUE);
+                                            (button_editor->priv->stock_radio), TRUE);
             }
           else
             {
-              gtk_widget_set_sensitive (button_editor->stock_frame, FALSE);
-              gtk_widget_set_sensitive (button_editor->label_frame, TRUE);
+              gtk_widget_set_sensitive (button_editor->priv->stock_frame, FALSE);
+              gtk_widget_set_sensitive (button_editor->priv->label_frame, TRUE);
               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                            (button_editor->label_radio), TRUE);
+                                            (button_editor->priv->label_radio), TRUE);
             }
         }
 
       if (use_appearance)
-        gtk_widget_set_sensitive (button_editor->custom_radio, FALSE);
+        gtk_widget_set_sensitive (button_editor->priv->custom_radio, FALSE);
       else
-        gtk_widget_set_sensitive (button_editor->custom_radio, TRUE);
+        gtk_widget_set_sensitive (button_editor->priv->custom_radio, TRUE);
 
     }
 }
 
 static void
-glade_button_editor_set_show_name (GladeEditable * editable, gboolean show_name)
-{
-  GladeButtonEditor *button_editor = GLADE_BUTTON_EDITOR (editable);
-
-  glade_editable_set_show_name (GLADE_EDITABLE (button_editor->embed),
-                                show_name);
-}
-
-static void
 glade_button_editor_editable_init (GladeEditableIface * iface)
 {
-  parent_editable_iface = g_type_default_interface_peek (GLADE_TYPE_EDITABLE);
+  parent_editable_iface = g_type_interface_peek_parent (iface);
 
   iface->load = glade_button_editor_load;
-  iface->set_show_name = glade_button_editor_set_show_name;
 }
 
 static void
 glade_button_editor_finalize (GObject * object)
 {
-  GladeButtonEditor *button_editor = GLADE_BUTTON_EDITOR (object);
-
-  if (button_editor->properties)
-    g_list_free (button_editor->properties);
-  button_editor->properties = NULL;
-  button_editor->embed = NULL;
-
   glade_editable_load (GLADE_EDITABLE (object), NULL);
 
   G_OBJECT_CLASS (glade_button_editor_parent_class)->finalize (object);
@@ -166,7 +187,7 @@ glade_button_editor_grab_focus (GtkWidget * widget)
 {
   GladeButtonEditor *button_editor = GLADE_BUTTON_EDITOR (widget);
 
-  gtk_widget_grab_focus (button_editor->embed);
+  gtk_widget_grab_focus (button_editor->priv->embed);
 }
 
 /* Secion control radio button callbacks: */
@@ -185,7 +206,7 @@ standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (button_editor->standard_radio)))
+      (GTK_TOGGLE_BUTTON (button_editor->priv->standard_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (button_editor));
@@ -247,7 +268,7 @@ custom_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (button_editor->custom_radio)))
+      (GTK_TOGGLE_BUTTON (button_editor->priv->custom_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (button_editor));
@@ -293,7 +314,7 @@ stock_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (button_editor->stock_radio)))
+      (GTK_TOGGLE_BUTTON (button_editor->priv->stock_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (button_editor));
@@ -340,7 +361,7 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (button_editor->label_radio)))
+      (GTK_TOGGLE_BUTTON (button_editor->priv->label_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (button_editor));
@@ -372,158 +393,8 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
   glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
 }
 
-static void
-table_attach (GtkWidget * table, GtkWidget * child, gint pos, gint row)
-{
-  gtk_grid_attach (GTK_GRID (table), child, pos, row, 1, 1);
-
-  if (pos)
-    gtk_widget_set_hexpand (child, TRUE);
-}
-
 GtkWidget *
 glade_button_editor_new (GladeWidgetAdaptor * adaptor, GladeEditable * embed)
 {
-  GladeButtonEditor *button_editor;
-  GladeEditorProperty *eprop;
-  GtkWidget *vbox, *table, *frame;
-
-  g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
-  g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL);
-
-  button_editor = g_object_new (GLADE_TYPE_BUTTON_EDITOR, NULL);
-  button_editor->embed = GTK_WIDGET (embed);
-
-  button_editor->standard_radio =
-      gtk_radio_button_new_with_label (NULL, _("Configure button content"));
-  button_editor->custom_radio =
-      gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON
-                                                   (button_editor->
-                                                    standard_radio),
-                                                   _
-                                                   ("Add custom button content"));
-
-  button_editor->stock_radio =
-      gtk_radio_button_new_with_label (NULL, _("Stock button"));
-  button_editor->label_radio =
-      gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON
-                                                   (button_editor->stock_radio),
-                                                   _
-                                                   ("Label with optional image"));
-
-  g_signal_connect (G_OBJECT (button_editor->standard_radio), "toggled",
-                    G_CALLBACK (standard_toggled), button_editor);
-  g_signal_connect (G_OBJECT (button_editor->custom_radio), "toggled",
-                    G_CALLBACK (custom_toggled), button_editor);
-  g_signal_connect (G_OBJECT (button_editor->stock_radio), "toggled",
-                    G_CALLBACK (stock_toggled), button_editor);
-  g_signal_connect (G_OBJECT (button_editor->label_radio), "toggled",
-                    G_CALLBACK (label_toggled), button_editor);
-
-  /* Pack the parent on top... */
-  gtk_box_pack_start (GTK_BOX (button_editor), GTK_WIDGET (embed), FALSE, FALSE,
-                      0);
-
-  /* Standard frame... */
-  frame = gtk_frame_new (NULL);
-  gtk_frame_set_label_widget (GTK_FRAME (frame), button_editor->standard_radio);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-  gtk_box_pack_start (GTK_BOX (button_editor), frame, FALSE, FALSE, 8);
-
-  button_editor->standard_frame = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (button_editor->standard_frame), 6,
-                             0, 12, 0);
-  gtk_container_add (GTK_CONTAINER (frame), button_editor->standard_frame);
-
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-  gtk_container_add (GTK_CONTAINER (button_editor->standard_frame), vbox);
-
-  /* Populate stock frame here... */
-  frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-  gtk_frame_set_label_widget (GTK_FRAME (frame), button_editor->stock_radio);
-  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 4);
-
-  button_editor->stock_frame = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (button_editor->stock_frame), 6, 0,
-                             12, 0);
-  gtk_container_add (GTK_CONTAINER (frame), button_editor->stock_frame);
-
-  table = gtk_grid_new ();
-  gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
-                                  GTK_ORIENTATION_VERTICAL);
-  gtk_grid_set_row_spacing (GTK_GRID (table), 4);
-  gtk_container_add (GTK_CONTAINER (button_editor->stock_frame), table);
-
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "stock", FALSE, TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 0);
-  table_attach (table, GTK_WIDGET (eprop), 1, 0);
-  button_editor->properties = g_list_prepend (button_editor->properties, eprop);
-
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "image-position",
-                                                 FALSE, TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 1);
-  table_attach (table, GTK_WIDGET (eprop), 1, 1);
-  button_editor->properties = g_list_prepend (button_editor->properties, eprop);
-
-  /* Populate label frame here... */
-  frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-  gtk_frame_set_label_widget (GTK_FRAME (frame), button_editor->label_radio);
-  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 4);
-
-  button_editor->label_frame = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (button_editor->label_frame), 6, 0,
-                             12, 0);
-  gtk_container_add (GTK_CONTAINER (frame), button_editor->label_frame);
-
-  table = gtk_grid_new ();
-  gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
-                                  GTK_ORIENTATION_VERTICAL);
-  gtk_grid_set_row_spacing (GTK_GRID (table), 4);
-  gtk_container_add (GTK_CONTAINER (button_editor->label_frame), table);
-
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 0);
-  table_attach (table, GTK_WIDGET (eprop), 1, 0);
-  button_editor->properties = g_list_prepend (button_editor->properties, eprop);
-
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "use-underline",
-                                                 FALSE, TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 1);
-  table_attach (table, GTK_WIDGET (eprop), 1, 1);
-  button_editor->properties = g_list_prepend (button_editor->properties, eprop);
-
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "image", FALSE, TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 2);
-  table_attach (table, GTK_WIDGET (eprop), 1, 2);
-  button_editor->properties = g_list_prepend (button_editor->properties, eprop);
-
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "image-position",
-                                                 FALSE, TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 3);
-  table_attach (table, GTK_WIDGET (eprop), 1, 3);
-  button_editor->properties = g_list_prepend (button_editor->properties, eprop);
-
-  /* Custom radio button on the bottom */
-  gtk_box_pack_start (GTK_BOX (button_editor), button_editor->custom_radio,
-                      FALSE, FALSE, 0);
-
-  /* Don't show the button customization for menu buttons */
-  if (g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_MENU_BUTTON))
-    {
-      gtk_widget_set_no_show_all (button_editor->standard_radio, TRUE);
-      gtk_widget_set_no_show_all (button_editor->custom_radio, TRUE);
-      gtk_widget_set_no_show_all (button_editor->standard_frame, TRUE);
-    }
-
-  gtk_widget_show_all (GTK_WIDGET (button_editor));
-
-  return GTK_WIDGET (button_editor);
+  return g_object_new (GLADE_TYPE_BUTTON_EDITOR, NULL);
 }
diff --git a/plugins/gtk+/glade-button-editor.h b/plugins/gtk+/glade-button-editor.h
index 7091726..72a6048 100644
--- a/plugins/gtk+/glade-button-editor.h
+++ b/plugins/gtk+/glade-button-editor.h
@@ -34,34 +34,18 @@ G_BEGIN_DECLS
 
 typedef struct _GladeButtonEditor        GladeButtonEditor;
 typedef struct _GladeButtonEditorClass   GladeButtonEditorClass;
+typedef struct _GladeButtonEditorPrivate GladeButtonEditorPrivate;
 
 struct _GladeButtonEditor
 {
-       GtkVBox  parent;
+  GladeEditorSkeleton  parent;
 
-       GtkWidget *embed;
-
-       GtkWidget *standard_radio; /* Use standard properties to layout a button */
-       GtkWidget *custom_radio;   /* Use a placeholder in the button */
-
-       /* Available in standard mode: */
-       GtkWidget *stock_radio;    /* Create the button using the stock (Available: stock, image-position) */
-       GtkWidget *label_radio;    /* Create the button with a custom label
-                                   * (Available: label, use-underline, image, image-position */
-
-       GtkWidget *standard_frame; /* Contains all the button configurations
-                                   */
-       GtkWidget *stock_frame;    /* Contains stock and image-position properties
-                                   */
-       GtkWidget *label_frame;    /* Contains label, use-underline, image and image-position properties 
-                                   */
-
-       GList *properties;         /* A list of eprops to update at load() time */
+  GladeButtonEditorPrivate *priv;
 };
 
 struct _GladeButtonEditorClass
 {
-       GtkVBoxClass parent;
+  GladeEditorSkeletonClass parent;
 };
 
 GType            glade_button_editor_get_type (void) G_GNUC_CONST;
diff --git a/plugins/gtk+/glade-button-editor.ui b/plugins/gtk+/glade-button-editor.ui
new file mode 100644
index 0000000..997f279
--- /dev/null
+++ b/plugins/gtk+/glade-button-editor.ui
@@ -0,0 +1,337 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires gladeui 0.0 -->
+  <!-- interface-requires gtk+ 3.8 -->
+  <template class="GladeButtonEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GladeEditorTable" id="embed">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkFrame" id="standard">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkBox" id="standard_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="margin_top">6</property>
+            <property name="hexpand">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkFrame" id="stock">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkGrid" id="stock_frame">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">12</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="row_spacing">4</property>
+                    <child>
+                      <object class="GladePropertyLabel" id="propertylabel1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">False</property>
+                        <property name="visible_window">False</property>
+                        <property name="property_name">stock</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="GladePropertyLabel" id="propertylabel2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">False</property>
+                        <property name="visible_window">False</property>
+                        <property name="property_name">image-position</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="propertyshell2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="property_name">image-position</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</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="hexpand">True</property>
+                        <property name="property_name">stock</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>
+                </child>
+                <child type="label">
+                  <object class="GtkRadioButton" id="stock_radio">
+                    <property name="label" translatable="yes">Stock Button</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="stock_toggled" swapped="no"/>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkGrid" id="label_frame">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">12</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="row_spacing">4</property>
+                    <child>
+                      <object class="GladePropertyLabel" id="propertylabel3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">False</property>
+                        <property name="visible_window">False</property>
+                        <property name="property_name">label</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="propertyshell3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="property_name">label</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>
+                      <object class="GladePropertyLabel" id="propertylabel4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">False</property>
+                        <property name="visible_window">False</property>
+                        <property name="property_name">use-underline</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="propertyshell4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="property_name">use-underline</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GladePropertyLabel" id="propertylabel5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">False</property>
+                        <property name="visible_window">False</property>
+                        <property name="property_name">image</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GladePropertyShell" id="propertyshell5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="property_name">image</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GladePropertyLabel" id="propertylabel6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">False</property>
+                        <property name="visible_window">False</property>
+                        <property name="property_name">image-position</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GladePropertyShell" id="propertyshell6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="property_name">image-position</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkRadioButton" id="label_radio">
+                    <property name="label" translatable="yes">Label with optional image</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">stock_radio</property>
+                    <signal name="toggled" handler="label_toggled" swapped="no"/>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkRadioButton" id="standard_radio">
+            <property name="label" translatable="yes">Configure Button Content</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="xalign">0</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+            <signal name="toggled" handler="standard_toggled" swapped="no"/>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkRadioButton" id="custom_radio">
+        <property name="label" translatable="yes">Add custom button content</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="xalign">0</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+        <property name="group">standard_radio</property>
+        <signal name="toggled" handler="custom_toggled" swapped="no"/>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child-editors>
+      <editor id="embed"/>
+      <editor id="propertylabel1"/>
+      <editor id="propertyshell1"/>
+      <editor id="propertylabel2"/>
+      <editor id="propertyshell2"/>
+      <editor id="propertylabel3"/>
+      <editor id="propertyshell3"/>
+      <editor id="propertylabel4"/>
+      <editor id="propertyshell4"/>
+      <editor id="propertylabel5"/>
+      <editor id="propertyshell5"/>
+      <editor id="propertylabel6"/>
+      <editor id="propertyshell6"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
new file mode 100644
index 0000000..e840f4f
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/gladegtk">
+    <file compressed="true" preprocess="xml-stripblanks">glade-button-editor.ui</file>
+  </gresource>
+</gresources>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 4ce27bd..9fa8b32 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1548,6 +1548,7 @@ embedded in another object</_tooltip>
     </glade-widget-class>
 
     <glade-widget-class name="GtkGrid" generic-name="grid" _title="Grid">
+      <destroy-object-function>glade_gtk_grid_destroy_object</destroy-object-function>
       <create-widget-function>glade_gtk_create_fixed_widget</create-widget-function>
       <post-create-function>glade_gtk_grid_post_create</post-create-function>
       <child-set-property-function>glade_gtk_grid_set_child_property</child-set-property-function>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 20783dd..5762376 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -56,6 +56,7 @@ plugins/gtk+/glade-accels.c
 plugins/gtk+/glade-activatable-editor.c
 plugins/gtk+/glade-attributes.c
 plugins/gtk+/glade-button-editor.c
+[type: gettext/glade]plugins/gtk+/glade-button-editor.ui
 plugins/gtk+/glade-cell-renderer-editor.c
 plugins/gtk+/glade-column-types.c
 plugins/gtk+/glade-entry-editor.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]