[glade] GladeEditor rework: Make atk.png loaded as a GResource.



commit f6a253038501e46629b5ea50cd017044bfa507da
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Fri Apr 12 19:28:04 2013 +0900

    GladeEditor rework: Make atk.png loaded as a GResource.

 data/icons/Makefile.am                  |    2 +-
 gladeui/Makefile.am                     |   21 +++++++++++++--------
 {data/icons => gladeui}/atk.png         |  Bin 914 -> 914 bytes
 gladeui/glade-editor.c                  |    8 ++++----
 gladeui/glade-editor.h                  |    4 ++--
 gladeui/gladeui-resources.gresource.xml |    1 +
 6 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index e9ac3d1..02f7d9a 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -18,7 +18,7 @@ update-icon-cache:
 
 pixmapsdir = $(pkgdatadir)/pixmaps
 pixmaps_DATA = devhelp.png \
-       plus.png atk.png \
+       plus.png \
        fixed-bg.png placeholder.png \
        deprecated-16x16.png \
        deprecated-22x22.png
diff --git a/gladeui/Makefile.am b/gladeui/Makefile.am
index 14b925c..188da9d 100644
--- a/gladeui/Makefile.am
+++ b/gladeui/Makefile.am
@@ -54,12 +54,17 @@ UI_FILES = \
        glade-project-properties.ui \
        glade-property-label.ui
 
-EXTRA_DIST = \
-       $(UI_FILES)     \
-       glade-marshallers.list \
-       gladeui.rc.in \
-       icon-naming-spec.c \
-       glade-previewer.rc.in \
+GRAPHICS_FILES = \
+       atk.png
+
+
+EXTRA_DIST =                   \
+       $(UI_FILES)             \
+       $(GRAPHICS_FILES)       \
+       glade-marshallers.list  \
+       gladeui.rc.in           \
+       icon-naming-spec.c      \
+       glade-previewer.rc.in   \
        gladeui-resources.gresource.xml
 
 # The glade core library
@@ -236,9 +241,9 @@ CLEANFILES += $(gir_DATA) $(typelib_DATA)
 endif
 
 # Generate resources
-gladeui-resources.h: gladeui-resources.gresource.xml $(UI_FILES)
+gladeui-resources.h: gladeui-resources.gresource.xml $(UI_FILES) $(GRAPHICS_FILES)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/gladeui-resources.gresource.xml \
                --target=$@ --sourcedir=$(srcdir) --c-name _gladeui --generate-header
-gladeui-resources.c: gladeui-resources.gresource.xml $(UI_FILES)
+gladeui-resources.c: gladeui-resources.gresource.xml $(UI_FILES) $(GRAPHICS_FILES)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/gladeui-resources.gresource.xml \
                --target=$@ --sourcedir=$(srcdir) --c-name _gladeui --generate-source
diff --git a/data/icons/atk.png b/gladeui/atk.png
similarity index 100%
rename from data/icons/atk.png
rename to gladeui/atk.png
diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c
index bdf776d..8c0ec57 100644
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@ -138,7 +138,7 @@ struct _GladeEditorPrivate
   gboolean show_class_field; /* Whether or not to show the class field at the top */
 };
 
-G_DEFINE_TYPE (GladeEditor, glade_editor, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (GladeEditor, glade_editor, GTK_TYPE_BOX);
 
 static GParamSpec *properties[N_PROPERTIES];
 
@@ -273,8 +273,7 @@ glade_editor_notebook_page (GladeEditor *editor,
   /* construct tab label widget */
   if (type == GLADE_PAGE_ATK)
     {
-      gchar *path = g_build_filename (glade_app_get_pixmaps_dir (), "atk.png", NULL);
-      GtkWidget *image = gtk_image_new_from_file (path);
+      GtkWidget *image = gtk_image_new_from_resource ("/org/gnome/gladeui/atk.png");
 
       label_widget = gtk_event_box_new ();
       gtk_container_add (GTK_CONTAINER (label_widget), image);
@@ -282,7 +281,6 @@ glade_editor_notebook_page (GladeEditor *editor,
       gtk_widget_show (image);
 
       gtk_widget_set_tooltip_text (label_widget, name);
-      g_free (path);
     }
   else
     {
@@ -451,6 +449,8 @@ glade_editor_init (GladeEditor *editor)
   GladeEditorPrivate *priv;
   GtkWidget    *hbox;
 
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL);
+
   editor->priv = priv = GLADE_EDITOR_GET_PRIVATE (editor);
 
   priv->notebook = gtk_notebook_new ();
diff --git a/gladeui/glade-editor.h b/gladeui/glade-editor.h
index 3f24382..1a39b3d 100644
--- a/gladeui/glade-editor.h
+++ b/gladeui/glade-editor.h
@@ -24,14 +24,14 @@ typedef struct _GladeEditorPrivate   GladeEditorPrivate;
  */
 struct _GladeEditor
 {
-  GtkVBox vbox;  /* The editor is a vbox */
+  GtkBox vbox;  /* The editor is a vbox */
        
   GladeEditorPrivate *priv;
 };
 
 struct _GladeEditorClass
 {
-  GtkVBoxClass parent_class;
+  GtkBoxClass parent_class;
 
   void   (* glade_reserved1)   (void);
   void   (* glade_reserved2)   (void);
diff --git a/gladeui/gladeui-resources.gresource.xml b/gladeui/gladeui-resources.gresource.xml
index 96a4b3d..03aea4f 100644
--- a/gladeui/gladeui-resources.gresource.xml
+++ b/gladeui/gladeui-resources.gresource.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/gladeui">
+    <file>atk.png</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-project-properties.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-property-label.ui</file>
   </gresource>


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