[glade] GladeImageEditor: Ported to use composite GtkBuilder template.



commit 522b12e6a421cb1b3ff7b56916cd2b6c47f7fde5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Apr 21 21:35:23 2013 +0900

    GladeImageEditor: Ported to use composite GtkBuilder template.

 plugins/gtk+/Makefile.am                       |   1 +
 plugins/gtk+/glade-gtk-resources.gresource.xml |   1 +
 plugins/gtk+/glade-gtk.c                       |  17 +-
 plugins/gtk+/glade-image-editor.c              | 254 +++-------
 plugins/gtk+/glade-image-editor.h              |  28 +-
 plugins/gtk+/glade-image-editor.ui             | 620 +++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in                       |   7 +
 po/POTFILES.in                                 |   1 +
 8 files changed, 707 insertions(+), 222 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 46b5dec..a0b79b2 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -103,6 +103,7 @@ BUILT_SOURCES =             \
 UI_FILES =                             \
        glade-activatable-editor.ui     \
        glade-button-editor.ui          \
+       glade-image-editor.ui           \
        glade-label-editor.ui           \
        glade-widget-editor.ui
 
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 7e58d90..c7d6c79 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-image-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-label-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-widget-editor.ui</file>
   </gresource>
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 7f18f15..2e8c30c 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -3989,9 +3989,11 @@ glade_gtk_image_set_image_mode (GObject * object, const GValue * value)
   glade_widget_property_set_sensitive (gwidget, "resource", FALSE,
                                        NOT_SELECTED_MSG);
   glade_widget_property_set_sensitive (gwidget, "icon-size", FALSE,
-                                       _("This property only applies to stock images"));
+                                       _("This property only applies to stock images or named icons"));
   glade_widget_property_set_sensitive (gwidget, "pixel-size", FALSE,
                                        _("This property only applies to named icons"));
+  glade_widget_property_set_sensitive (gwidget, "use-fallback", FALSE,
+                                       _("This property only applies to named icons"));
 
   switch ((type = g_value_get_int (value)))
     {
@@ -4002,7 +4004,9 @@ glade_gtk_image_set_image_mode (GObject * object, const GValue * value)
 
       case GLADE_IMAGE_MODE_ICON:
         glade_widget_property_set_sensitive (gwidget, "icon-name", TRUE, NULL);
+        glade_widget_property_set_sensitive (gwidget, "icon-size", TRUE, NULL);
         glade_widget_property_set_sensitive (gwidget, "pixel-size", TRUE, NULL);
+        glade_widget_property_set_sensitive (gwidget, "use-fallback", TRUE, NULL);
         break;
 
       case GLADE_IMAGE_MODE_RESOURCE:
@@ -4089,15 +4093,10 @@ GladeEditable *
 glade_gtk_image_create_editable (GladeWidgetAdaptor * adaptor,
                                  GladeEditorPageType type)
 {
-  GladeEditable *editable;
-
-  /* Get base editable */
-  editable = GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
-
   if (type == GLADE_PAGE_GENERAL)
-    return (GladeEditable *) glade_image_editor_new (adaptor, editable);
-
-  return editable;
+    return (GladeEditable *) glade_image_editor_new ();
+  else
+    return GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
 }
 
 /* ----------------------------- GtkMenu ------------------------------ */
diff --git a/plugins/gtk+/glade-image-editor.c b/plugins/gtk+/glade-image-editor.c
index 25b28d6..a88ed82 100644
--- a/plugins/gtk+/glade-image-editor.c
+++ b/plugins/gtk+/glade-image-editor.c
@@ -26,53 +26,75 @@
 
 #include "glade-image-editor.h"
 
+static void glade_image_editor_editable_init (GladeEditableIface * iface);
+static void glade_image_editor_grab_focus (GtkWidget * widget);
 
-static void glade_image_editor_finalize (GObject * object);
+static void stock_toggled    (GtkWidget *widget, GladeImageEditor * image_editor);
+static void icon_toggled     (GtkWidget *widget, GladeImageEditor * image_editor);
+static void resource_toggled (GtkWidget *widget, GladeImageEditor * image_editor);
+static void file_toggled     (GtkWidget *widget, GladeImageEditor * image_editor);
 
-static void glade_image_editor_editable_init (GladeEditableIface * iface);
+struct _GladeImageEditorPrivate
+{
+  GtkWidget *embed;
 
-static void glade_image_editor_grab_focus (GtkWidget * widget);
+  GtkWidget *stock_radio;    /* Create the image from stock-id */
+  GtkWidget *icon_radio;     /* Create the image with the icon theme */
+  GtkWidget *resource_radio; /* Create the image from GResource data */
+  GtkWidget *file_radio;     /* Create the image from filename (libglade only) */
+};
 
 static GladeEditableIface *parent_editable_iface;
 
-G_DEFINE_TYPE_WITH_CODE (GladeImageEditor, glade_image_editor, GTK_TYPE_VBOX,
+G_DEFINE_TYPE_WITH_CODE (GladeImageEditor, glade_image_editor, GLADE_TYPE_EDITOR_SKELETON,
                          G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
                                                 glade_image_editor_editable_init));
 
-
 static void
 glade_image_editor_class_init (GladeImageEditorClass * klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->finalize = glade_image_editor_finalize;
   widget_class->grab_focus = glade_image_editor_grab_focus;
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-image-editor.ui");
+
+  gtk_widget_class_bind_child (widget_class, GladeImageEditorPrivate, embed);
+  gtk_widget_class_bind_child (widget_class, GladeImageEditorPrivate, stock_radio);
+  gtk_widget_class_bind_child (widget_class, GladeImageEditorPrivate, icon_radio);
+  gtk_widget_class_bind_child (widget_class, GladeImageEditorPrivate, resource_radio);
+  gtk_widget_class_bind_child (widget_class, GladeImageEditorPrivate, file_radio);
+
+  gtk_widget_class_bind_callback (widget_class, stock_toggled);
+  gtk_widget_class_bind_callback (widget_class, icon_toggled);
+  gtk_widget_class_bind_callback (widget_class, resource_toggled);
+  gtk_widget_class_bind_callback (widget_class, file_toggled);
+
+  g_type_class_add_private (object_class, sizeof (GladeImageEditorPrivate));  
 }
 
 static void
 glade_image_editor_init (GladeImageEditor * self)
 {
+  self->priv = 
+    G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                GLADE_TYPE_IMAGE_EDITOR,
+                                GladeImageEditorPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
 }
 
 static void
 glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
 {
-  GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (editable);
-  GladeImageEditMode image_mode = 0;
-  GList *l;
+  GladeImageEditor        *image_editor = GLADE_IMAGE_EDITOR (editable);
+  GladeImageEditorPrivate *priv = image_editor->priv;
+  GladeImageEditMode       image_mode = 0;
 
   /* Chain up to default implementation */
   parent_editable_iface->load (editable, widget);
 
-  /* load the embedded editable... */
-  if (image_editor->embed)
-    glade_editable_load (GLADE_EDITABLE (image_editor->embed), widget);
-
-  for (l = image_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, "image-mode", &image_mode);
@@ -81,19 +103,19 @@ glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
         {
           case GLADE_IMAGE_MODE_STOCK:
             gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                          (image_editor->stock_radio), TRUE);
+                                          (priv->stock_radio), TRUE);
             break;
           case GLADE_IMAGE_MODE_ICON:
             gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                          (image_editor->icon_radio), TRUE);
+                                          (priv->icon_radio), TRUE);
             break;
           case GLADE_IMAGE_MODE_RESOURCE:
             gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                          (image_editor->resource_radio), TRUE);
+                                          (priv->resource_radio), TRUE);
             break;
           case GLADE_IMAGE_MODE_FILENAME:
             gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                          (image_editor->file_radio), TRUE);
+                                          (priv->file_radio), TRUE);
             break;
           default:
             break;
@@ -104,51 +126,29 @@ glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
 static void
 glade_image_editor_set_show_name (GladeEditable * editable, gboolean show_name)
 {
-  GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (editable);
+  GladeImageEditor        *image_editor = GLADE_IMAGE_EDITOR (editable);
+  GladeImageEditorPrivate *priv = image_editor->priv;
 
-  glade_editable_set_show_name (GLADE_EDITABLE (image_editor->embed),
+  glade_editable_set_show_name (GLADE_EDITABLE (priv->embed),
                                 show_name);
 }
 
 static void
 glade_image_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_image_editor_load;
   iface->set_show_name = glade_image_editor_set_show_name;
 }
 
 static void
-glade_image_editor_finalize (GObject * object)
-{
-  GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (object);
-
-  if (image_editor->properties)
-    g_list_free (image_editor->properties);
-  image_editor->properties = NULL;
-  image_editor->embed = NULL;
-
-  glade_editable_load (GLADE_EDITABLE (object), NULL);
-
-  G_OBJECT_CLASS (glade_image_editor_parent_class)->finalize (object);
-}
-
-static void
 glade_image_editor_grab_focus (GtkWidget * widget)
 {
-  GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (widget);
+  GladeImageEditor        *image_editor = GLADE_IMAGE_EDITOR (widget);
+  GladeImageEditorPrivate *priv = image_editor->priv;
 
-  gtk_widget_grab_focus (image_editor->embed);
-}
-
-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);
+  gtk_widget_grab_focus (priv->embed);
 }
 
 static void
@@ -225,12 +225,13 @@ set_file_mode (GladeImageEditor * image_editor)
 static void
 stock_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 {
+  GladeImageEditorPrivate *priv = image_editor->priv;
   GladeWidget   *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
 
   if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
     return;
 
-  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (image_editor->stock_radio)))
+  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->stock_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (image_editor));
@@ -249,13 +250,14 @@ stock_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 static void
 icon_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 {
+  GladeImageEditorPrivate *priv = image_editor->priv;
   GladeWidget   *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
 
   if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (image_editor->icon_radio)))
+      (GTK_TOGGLE_BUTTON (priv->icon_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (image_editor));
@@ -274,13 +276,14 @@ icon_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 static void
 resource_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 {
+  GladeImageEditorPrivate *priv = image_editor->priv;
   GladeWidget   *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
 
   if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (image_editor->resource_radio)))
+      (GTK_TOGGLE_BUTTON (priv->resource_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (image_editor));
@@ -299,13 +302,14 @@ resource_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 static void
 file_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
 { 
+  GladeImageEditorPrivate *priv = image_editor->priv;
   GladeWidget   *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
 
   if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
     return;
 
   if (!gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (image_editor->file_radio)))
+      (GTK_TOGGLE_BUTTON (priv->file_radio)))
     return;
 
   glade_editable_block (GLADE_EDITABLE (image_editor));
@@ -321,146 +325,8 @@ file_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
   glade_editable_load (GLADE_EDITABLE (image_editor), gwidget);
 }
 
-
 GtkWidget *
-glade_image_editor_new (GladeWidgetAdaptor * adaptor, GladeEditable * embed)
+glade_image_editor_new (void)
 {
-  GladeImageEditor *image_editor;
-  GladeEditorProperty *eprop;
-  GtkWidget *table, *frame, *alignment, *label, *hbox;
-  gchar *str;
-
-  g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
-  g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL);
-
-  image_editor = g_object_new (GLADE_TYPE_IMAGE_EDITOR, NULL);
-  image_editor->embed = GTK_WIDGET (embed);
-
-  /* Pack the parent on top... */
-  gtk_box_pack_start (GTK_BOX (image_editor), GTK_WIDGET (embed), FALSE, FALSE,
-                      0);
-
-  /* Image content frame... */
-  str = g_strdup_printf ("<b>%s</b>", _("Edit Image"));
-  label = gtk_label_new (str);
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  g_free (str);
-  frame = gtk_frame_new (NULL);
-  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-  gtk_box_pack_start (GTK_BOX (image_editor), frame, FALSE, FALSE, 8);
-
-  alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
-  gtk_container_add (GTK_CONTAINER (frame), alignment);
-
-  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 (alignment), table);
-
-  /* Stock image... */
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "stock", FALSE, TRUE);
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  image_editor->stock_radio = gtk_radio_button_new (NULL);
-  gtk_box_pack_start (GTK_BOX (hbox), image_editor->stock_radio, FALSE, FALSE,
-                      2);
-  gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
-  table_attach (table, hbox, 0, 0);
-  table_attach (table, GTK_WIDGET (eprop), 1, 0);
-  image_editor->properties = g_list_prepend (image_editor->properties, eprop);
-
-  /* Icon theme image... */
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-name", FALSE,
-                                                 TRUE);
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  image_editor->icon_radio = gtk_radio_button_new_from_widget
-      (GTK_RADIO_BUTTON (image_editor->stock_radio));
-  gtk_box_pack_start (GTK_BOX (hbox), image_editor->icon_radio, FALSE, FALSE,
-                      2);
-  gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
-  table_attach (table, hbox, 0, 1);
-  table_attach (table, GTK_WIDGET (eprop), 1, 1);
-  image_editor->properties = g_list_prepend (image_editor->properties, eprop);
-
-  /* Resource image... */
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "resource", FALSE,
-                                                 TRUE);
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  image_editor->resource_radio = gtk_radio_button_new_from_widget
-      (GTK_RADIO_BUTTON (image_editor->stock_radio));
-  gtk_box_pack_start (GTK_BOX (hbox), image_editor->resource_radio, FALSE, FALSE,
-                      2);
-  gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
-  table_attach (table, hbox, 0, 2);
-  table_attach (table, GTK_WIDGET (eprop), 1, 2);
-  image_editor->properties = g_list_prepend (image_editor->properties, eprop);
-
-  /* Filename... */
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "pixbuf", FALSE,
-                                                 TRUE);
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  image_editor->file_radio = gtk_radio_button_new_from_widget
-      (GTK_RADIO_BUTTON (image_editor->stock_radio));
-  gtk_box_pack_start (GTK_BOX (hbox), image_editor->file_radio, FALSE, FALSE,
-                      2);
-  gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
-  table_attach (table, hbox, 0, 3);
-  table_attach (table, GTK_WIDGET (eprop), 1, 3);
-  image_editor->properties = g_list_prepend (image_editor->properties, eprop);
-
-  /* Image size frame... */
-  str = g_strdup_printf ("<b>%s</b>", _("Set Image Size"));
-  label = gtk_label_new (str);
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  g_free (str);
-  frame = gtk_frame_new (NULL);
-  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-  gtk_box_pack_start (GTK_BOX (image_editor), frame, FALSE, FALSE, 8);
-
-  alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
-  gtk_container_add (GTK_CONTAINER (frame), alignment);
-
-  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 (alignment), table);
-
-  /* Icon Size... */
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-size", FALSE,
-                                                 TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 0);
-  table_attach (table, GTK_WIDGET (eprop), 1, 0);
-  image_editor->properties = g_list_prepend (image_editor->properties, eprop);
-
-  /* Pixel Size... */
-  eprop =
-      glade_widget_adaptor_create_eprop_by_name (adaptor, "pixel-size", FALSE,
-                                                 TRUE);
-  table_attach (table, glade_editor_property_get_item_label (eprop), 0, 1);
-  table_attach (table, GTK_WIDGET (eprop), 1, 1);
-  image_editor->properties = g_list_prepend (image_editor->properties, eprop);
-
-  /* Connect radio button signals... */
-  g_signal_connect (G_OBJECT (image_editor->stock_radio), "toggled",
-                    G_CALLBACK (stock_toggled), image_editor);
-  g_signal_connect (G_OBJECT (image_editor->icon_radio), "toggled",
-                    G_CALLBACK (icon_toggled), image_editor);
-  g_signal_connect (G_OBJECT (image_editor->resource_radio), "toggled",
-                    G_CALLBACK (resource_toggled), image_editor);
-  g_signal_connect (G_OBJECT (image_editor->file_radio), "toggled",
-                    G_CALLBACK (file_toggled), image_editor);
-
-  gtk_widget_show_all (GTK_WIDGET (image_editor));
-
-  return GTK_WIDGET (image_editor);
+  return g_object_new (GLADE_TYPE_IMAGE_EDITOR, NULL);
 }
diff --git a/plugins/gtk+/glade-image-editor.h b/plugins/gtk+/glade-image-editor.h
index e6c8de8..f3afd79 100644
--- a/plugins/gtk+/glade-image-editor.h
+++ b/plugins/gtk+/glade-image-editor.h
@@ -34,39 +34,29 @@ G_BEGIN_DECLS
 
 typedef struct _GladeImageEditor        GladeImageEditor;
 typedef struct _GladeImageEditorClass   GladeImageEditorClass;
+typedef struct _GladeImageEditorPrivate GladeImageEditorPrivate;
 
 typedef enum {
-       GLADE_IMAGE_MODE_STOCK = 0, /* default */
-       GLADE_IMAGE_MODE_ICON,
-       GLADE_IMAGE_MODE_RESOURCE,
-       GLADE_IMAGE_MODE_FILENAME
+  GLADE_IMAGE_MODE_STOCK = 0, /* default */
+  GLADE_IMAGE_MODE_ICON,
+  GLADE_IMAGE_MODE_RESOURCE,
+  GLADE_IMAGE_MODE_FILENAME
 } GladeImageEditMode;
 
 struct _GladeImageEditor
 {
-       GtkVBox  parent;
+  GladeEditorSkeleton  parent;
 
-       GtkWidget *embed;
-
-       GtkWidget *stock_radio;    /* Create the image from stock-id */
-       GtkWidget *icon_radio;     /* Create the image with the icon theme */
-       GtkWidget *resource_radio; /* Create the image from GResource data */
-       GtkWidget *file_radio;     /* Create the image from filename (libglade only) */
-
-       GtkWidget *size_radio;     /* Set size with GtkIconSize */
-       GtkWidget *pixels_radio;   /* Set size in Pixel value */
-
-       GList *properties;         /* A list of eprops to update at load() time */
+  GladeImageEditorPrivate *priv;
 };
 
 struct _GladeImageEditorClass
 {
-       GtkVBoxClass parent;
+  GladeEditorSkeletonClass parent;
 };
 
 GType            glade_image_editor_get_type (void) G_GNUC_CONST;
-GtkWidget       *glade_image_editor_new      (GladeWidgetAdaptor *adaptor,
-                                             GladeEditable      *editable);
+GtkWidget       *glade_image_editor_new      (void);
 
 G_END_DECLS
 
diff --git a/plugins/gtk+/glade-image-editor.ui b/plugins/gtk+/glade-image-editor.ui
new file mode 100644
index 0000000..52b382f
--- /dev/null
+++ b/plugins/gtk+/glade-image-editor.ui
@@ -0,0 +1,620 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gladeui 0.0 -->
+  <!-- interface-requires gtk+ 3.8 -->
+  <template class="GladeImageEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="has_focus">False</property>
+    <property name="is_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkGrid" id="grid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="has_focus">False</property>
+        <property name="is_focus">False</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="image_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="label" translatable="yes">Image</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">6</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="stock_radio">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="receives_default">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">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"/>
+            <child>
+              <object class="GladePropertyLabel" id="stock_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_focus">False</property>
+                <property name="is_focus">False</property>
+                <property name="property_name">stock</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="stock_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">stock</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">2</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="icon_radio">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="receives_default">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">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="icon_toggled" swapped="no"/>
+            <child>
+              <object class="GladePropertyLabel" id="icon_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_focus">False</property>
+                <property name="is_focus">False</property>
+                <property name="property_name">icon-name</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="icon_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">icon-name</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="use_fallback_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">use-fallback</property>
+            <property name="editor_type">GladeEpropCheck</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">4</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="resource_radio">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="receives_default">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">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="resource_toggled" swapped="no"/>
+            <child>
+              <object class="GladePropertyLabel" id="resource_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_focus">False</property>
+                <property name="is_focus">False</property>
+                <property name="property_name">resource</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">5</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="file_radio">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="receives_default">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">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="file_toggled" swapped="no"/>
+            <child>
+              <object class="GladePropertyLabel" id="file_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_focus">False</property>
+                <property name="is_focus">False</property>
+                <property name="property_name">pixbuf</property>
+              </object>
+            </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>
+          <object class="GtkLabel" id="size_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="label" translatable="yes">Size and Alignment</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">7</property>
+            <property name="width">6</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="icon_size_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">icon-size</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">8</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="pixel_size_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">pixel-size</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">9</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="resource_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">resource</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">5</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="file_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">pixbuf</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">6</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="icon_size_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">icon-size</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">8</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="pixel_size_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">pixel-size</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">9</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="align_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="margin_left">12</property>
+            <property name="margin_top">4</property>
+            <property name="hexpand">False</property>
+            <property name="label" translatable="yes">Alignment</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">10</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="padding_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="margin_top">4</property>
+            <property name="hexpand">False</property>
+            <property name="label" translatable="yes">Padding</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">10</property>
+            <property name="width">2</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="halign_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">24</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">xalign</property>
+            <property name="custom_text" translatable="yes">Horizontal</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">11</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="valign_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">24</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">yalign</property>
+            <property name="custom_text" translatable="yes">Vertical</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">12</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="hpad_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">xpad</property>
+            <property name="custom_text" translatable="yes">Horizontal</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">11</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="vpad_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">ypad</property>
+            <property name="custom_text" translatable="yes">Vertical</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">12</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="halign_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">xalign</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">11</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="valign_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">yalign</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">12</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="hpad_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">xpad</property>
+          </object>
+          <packing>
+            <property name="left_attach">3</property>
+            <property name="top_attach">11</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="vpad_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">ypad</property>
+          </object>
+          <packing>
+            <property name="left_attach">3</property>
+            <property name="top_attach">12</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladeEditorTable" id="embed">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">6</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child-editors>
+      <editor id="stock_label"/>
+      <editor id="stock_editor"/>
+      <editor id="icon_label"/>
+      <editor id="icon_editor"/>
+      <editor id="use_fallback_editor"/>
+      <editor id="resource_label"/>
+      <editor id="file_label"/>
+      <editor id="icon_size_label"/>
+      <editor id="pixel_size_label"/>
+      <editor id="resource_editor"/>
+      <editor id="file_editor"/>
+      <editor id="icon_size_editor"/>
+      <editor id="pixel_size_editor"/>
+      <editor id="halign_label"/>
+      <editor id="valign_label"/>
+      <editor id="hpad_label"/>
+      <editor id="vpad_label"/>
+      <editor id="halign_editor"/>
+      <editor id="valign_editor"/>
+      <editor id="hpad_editor"/>
+      <editor id="vpad_editor"/>
+      <editor id="embed"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index cd6e5f6..34d14b2 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -405,6 +405,7 @@ embedded in another object</_tooltip>
            <type>GladeParamObjects</type>
            <value-type>GtkAccelGroup</value-type>
          </parameter-spec>
+         <_tooltip>A list of accel groups to be added to this window</_tooltip>
        </property>
        <property id="attached-to" since="3.4" ignore="True"/>
        <property id="opacity" since="2.12" ignore="True"/>
@@ -476,6 +477,7 @@ embedded in another object</_tooltip>
        <property id="application" since="3.0" disabled="True"/>
        <property id="has-resize-grip" since="3.0"/>
        <property id="resize-grip-visible" since="3.0" disabled="True"/>
+       <property id="mnemonics-visible" disabled="True"/>
       </properties>
     </glade-widget-class>
 
@@ -1507,9 +1509,14 @@ embedded in another object</_tooltip>
        </property>
        <property id="stock" stock-icon="True" custom-layout="True" default="gtk-missing-image"/>
        <property id="icon-name" _name="Icon Name" themed-icon="True" custom-layout="True" />
+       <property id="use-fallback" custom-layout="True"/>
        <property id="pixbuf" _name="File Name" custom-layout="True"/>
        <property id="resource" _name="Resource Name" custom-layout="True" ignore="True" since="3.8"/>
        <property id="pixel-size" custom-layout="True"/>
+       <property id="xalign" custom-layout="True"/>
+       <property id="yalign" custom-layout="True"/>
+       <property id="xpad" custom-layout="True"/>
+       <property id="ypad" custom-layout="True"/>
        <!-- We have to save/load icon-size as int, and fake the enum -->
        <property id="icon-size" _name="Icon Size" custom-layout="True" 
                  default="GTK_ICON_SIZE_BUTTON" save="False">
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fe7f676..938fe5e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -80,5 +80,6 @@ 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-image-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-label-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-widget-editor.ui


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