[glade] Optimized project loading time by not updating progrebars on each object loaded. Added bg logo on em



commit ab1a3aef1d27311d94da90deb447193222428441
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Apr 13 20:32:18 2011 -0300

    Optimized project loading time by not updating progrebars on each object loaded.
    Added bg logo on empty GladeDesignView.
    Migrated code using deprecated GtkStyle to GtkStyleContext

 ChangeLog                     |   22 +++
 gladeui/glade-design-layout.c |   89 ++++++---
 gladeui/glade-design-view.c   |  152 +++++++---------
 gladeui/glade-path.h          |  408 +++++++++++++++++++++++++++++++++++++++++
 gladeui/glade-project.c       |   38 +++--
 src/glade-window.c            |   22 ++-
 src/main.c                    |   17 ++
 7 files changed, 606 insertions(+), 142 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9ec1180..bff122d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2011-04-13  Juan Pablo Ugarte <juanpablougarte gmail com>
+
+	* gladeui/glade-design-view.c:
+	  o removed progress bar
+	  o draw wilber when there is no project loaded
+	  o set widget bg on GtkWidget::style-updated signal
+
+	* gladeui/glade-design-layout.c:
+	  o set widget bg and update frame colors on GtkWidget::style-updated signal
+	  o removed deprecated GtkStyle use and replaced with GtkStyleContext
+
+	* src/main.c: added loading time output if --verbose is set
+        
+	* src/glade-window.c:
+	  o added % to progress bar string
+	  o only update progressbar if percentage changed
+
+	* gladeui/glade-project.c: slightly optimized glade_project_add_object()
+	
+	* gladeui/glade-path.h: new file containing a cairo_path_t of GLADE's old
+          logo remake by Franco Dodorico.
+
 2011-04-05  Tristan Van Berkom <tristanvb openismus com>
 
 	* configure.ac, NEWS: Rolling 3.10.0
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index 1108f42..4326e5f 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -61,7 +61,11 @@ struct _GladeDesignLayoutPrivate
   gint current_width, current_height;
   PangoLayout *widget_name;
   gint layout_width;
-  
+
+  /* Colors */
+  GdkRGBA frame_color[2];
+  GdkRGBA frame_color_active[2];
+
   /* state machine */
   Activity activity;            /* the current activity */
   gint dx;                      /* child.width - event.pointer.x   */
@@ -537,7 +541,8 @@ glade_design_layout_damage (GtkWidget *widget, GdkEventExpose *event)
 }
 
 static inline void
-draw_frame (cairo_t * cr, GladeDesignLayoutPrivate *priv, GtkStyle *style, GtkStateType state, int x, int y, int w, int h)
+draw_frame (cairo_t *cr, GladeDesignLayoutPrivate *priv, gboolean selected,
+            int x, int y, int w, int h)
 {
   cairo_save (cr);
 
@@ -546,7 +551,8 @@ draw_frame (cairo_t * cr, GladeDesignLayoutPrivate *priv, GtkStyle *style, GtkSt
   cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
   cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
 
-  gdk_cairo_set_source_color (cr, &style->bg[state]);
+  gdk_cairo_set_source_rgba (cr, (selected) ? &priv->frame_color_active[0] :
+                             &priv->frame_color[0]);
 
   /* rectangle */
   cairo_rectangle (cr, x, y, w, h);
@@ -554,10 +560,10 @@ draw_frame (cairo_t * cr, GladeDesignLayoutPrivate *priv, GtkStyle *style, GtkSt
 
   if (priv->widget_name)
     {
+      GdkRGBA *color = (selected) ? &priv->frame_color_active[1] : &priv->frame_color[1];
       GdkRectangle *rect = &priv->south_east;
-      GdkColor *color = &style->text[state];
       cairo_pattern_t *pattern;
-      gdouble xx, yy, r, g, b;
+      gdouble xx, yy;
       
       xx = rect->x + rect->width;
       yy = rect->y + rect->height;
@@ -572,13 +578,11 @@ draw_frame (cairo_t * cr, GladeDesignLayoutPrivate *priv, GtkStyle *style, GtkSt
       cairo_close_path (cr);
       cairo_fill (cr);
 
-      r = color->red/65535.;
-      g = color->green/65535.;
-      b = color->blue/65535.;
-
       /* Draw widget name */
       if (rect->width < priv->layout_width)
         {
+          gdouble r = color->red, g = color->green, b = color->blue;
+          
           pattern = cairo_pattern_create_linear (xx-16-OUTLINE_WIDTH, 0,
                                                  xx-OUTLINE_WIDTH, 0);
           cairo_pattern_add_color_stop_rgba (pattern, 0, r, g, b, 1);
@@ -588,7 +592,7 @@ draw_frame (cairo_t * cr, GladeDesignLayoutPrivate *priv, GtkStyle *style, GtkSt
       else
         {
           pattern = NULL;
-          cairo_set_source_rgb (cr, r, g, b);
+          gdk_cairo_set_source_rgba (cr, color);
         }
 
       cairo_move_to (cr, rect->x + OUTLINE_WIDTH, rect->y + OUTLINE_WIDTH);
@@ -601,18 +605,18 @@ draw_frame (cairo_t * cr, GladeDesignLayoutPrivate *priv, GtkStyle *style, GtkSt
 }
 
 static inline void
-draw_selection (cairo_t *cr, GtkWidget *parent, GtkWidget *widget,
-                gfloat r, gfloat g, gfloat b)
+draw_selection (cairo_t *cr, GtkWidget *parent, GtkWidget *widget, GdkRGBA *color)
 {
   cairo_pattern_t *gradient;
+  gdouble r, g, b, cx, cy;
   GtkAllocation alloc;
-  gdouble cx, cy;
   gint x, y;
 
   gtk_widget_get_allocation (widget, &alloc);
 
   if (alloc.x < 0 || alloc.y < 0) return;
   
+  r = color->red; g = color->green; b = color->blue;
   gtk_widget_translate_coordinates (widget, parent, 0, 0, &x, &y);
 
   cx = x + alloc.width/2;
@@ -637,31 +641,23 @@ static gboolean
 glade_design_layout_draw (GtkWidget * widget, cairo_t * cr)
 {
   GladeDesignLayoutPrivate *priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
+  GdkWindow *window = gtk_widget_get_window (widget);
 
-  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
+  if (gtk_cairo_should_draw_window (cr, window))
     {
       GladeProject *project;
       GladeWidget *gchild;
-      GtkStyle *style;
       GtkWidget *child;
-      
-      style = gtk_widget_get_style (widget);
-
-      /* draw a white widget background */
-      gdk_cairo_set_source_color (cr, &style->base[gtk_widget_get_state (widget)]);
-      cairo_paint (cr);
 
       if ((child = gtk_bin_get_child (GTK_BIN (widget))) &&
           gtk_widget_get_visible (child) &&
           (gchild = glade_widget_get_from_gobject (G_OBJECT (child))) &&
           (project = glade_widget_get_project (gchild)))
         {
-          const GdkColor *color = &gtk_widget_get_style (widget)->bg[GTK_STATE_SELECTED];
           gint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
           gboolean selected = FALSE;
-          gfloat r, g, b;
           GList *l;
-          
+
           /* draw offscreen widgets */
           gdk_cairo_set_source_window (cr, priv->offscreen_window,
                                        priv->child_offset, priv->child_offset);
@@ -670,9 +666,6 @@ glade_design_layout_draw (GtkWidget * widget, cairo_t * cr)
           cairo_fill (cr);
 
           /* Draw selection */
-          r = color->red/65535.;
-          g = color->green/65535.;
-          b = color->blue/65535.;
           cairo_set_line_width (cr, OUTLINE_WIDTH/2);
           cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
           cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
@@ -686,7 +679,7 @@ glade_design_layout_draw (GtkWidget * widget, cairo_t * cr)
                   if (GTK_IS_WIDGET (selection) && 
 		      gtk_widget_is_ancestor (selection, child))
                   {
-                    draw_selection (cr, widget, selection, r, g, b);
+                    draw_selection (cr, widget, selection, &priv->frame_color_active[0]);
                     selected = TRUE;
                   }
                 }
@@ -695,8 +688,7 @@ glade_design_layout_draw (GtkWidget * widget, cairo_t * cr)
             }
 
           /* draw frame */
-          draw_frame (cr, priv, style,
-                      (selected) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL,
+          draw_frame (cr, priv, selected,
                       border_width + PADDING,
                       border_width + PADDING,
                       priv->current_width + 2 * OUTLINE_WIDTH,
@@ -918,7 +910,41 @@ glade_design_layout_unrealize (GtkWidget * widget)
 }
 
 static void
-glade_design_layout_init (GladeDesignLayout * layout)
+glade_design_layout_style_updated (GtkWidget *widget)
+{
+  GladeDesignLayoutPrivate *priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
+  GtkStyleContext *context = gtk_widget_get_style_context (widget);
+  GdkRGBA bg_color;
+
+  gtk_style_context_save (context);
+  
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+
+  gtk_style_context_get_background_color (context,
+                                          GTK_STATE_FLAG_NORMAL,
+                                          &bg_color);
+
+  gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED,
+                                          &priv->frame_color[0]);
+  gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED,
+                               &priv->frame_color[1]);
+  
+  gtk_style_context_get_background_color (context,
+                                          GTK_STATE_FLAG_SELECTED |
+                                          GTK_STATE_FLAG_FOCUSED,
+                                          &priv->frame_color_active[0]);
+  gtk_style_context_get_color (context,
+                               GTK_STATE_FLAG_SELECTED |
+                               GTK_STATE_FLAG_FOCUSED,
+                               &priv->frame_color_active[1]);
+
+  gtk_style_context_restore (context);
+  
+  gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &bg_color);
+}
+
+static void
+glade_design_layout_init (GladeDesignLayout *layout)
 {
   GladeDesignLayoutPrivate *priv;
 
@@ -1007,6 +1033,7 @@ glade_design_layout_class_init (GladeDesignLayoutClass * klass)
   widget_class->get_preferred_width_for_height = glade_design_layout_get_preferred_width_for_height;
   widget_class->get_preferred_height_for_width = glade_design_layout_get_preferred_height_for_width;
   widget_class->size_allocate = glade_design_layout_size_allocate;
+  widget_class->style_updated = glade_design_layout_style_updated;
 
   g_object_class_install_property (object_class, PROP_DESIGN_VIEW,
                                    g_param_spec_object ("design-view", _("Design View"),
diff --git a/gladeui/glade-design-view.c b/gladeui/glade-design-view.c
index af68862..dcbbb5e 100644
--- a/gladeui/glade-design-view.c
+++ b/gladeui/glade-design-view.c
@@ -39,6 +39,7 @@
 #include "glade-design-view.h"
 #include "glade-design-layout.h"
 #include "glade-design-private.h"
+#include "glade-path.h"
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -55,57 +56,16 @@ enum
 
 struct _GladeDesignViewPrivate
 {
-  GtkWidget *layout_box;
-
   GladeProject *project;
-
-  GtkWidget *scrolled_window;
-
-  GtkWidget *progress;
-  GtkWidget *progress_window;
+  GtkWidget *scrolled_window;  /* Main scrolled window */
+  GtkWidget *layout_box;       /* Box to pack a GladeDesignLayout for each toplevel in project */
 };
 
 static GtkVBoxClass *parent_class = NULL;
 
-
 G_DEFINE_TYPE (GladeDesignView, glade_design_view, GTK_TYPE_VBOX)
 
 static void
-glade_design_view_parse_began (GladeProject *project,
-			       GladeDesignView *view)
-{
-  gtk_widget_hide (view->priv->scrolled_window);
-  gtk_widget_show (view->priv->progress_window);
-}
-
-static void
-glade_design_view_parse_finished (GladeProject *project,
-                                  GladeDesignView *view)
-{
-  gtk_widget_hide (view->priv->progress_window);
-  gtk_widget_show (view->priv->scrolled_window);
-}
-
-static void
-glade_design_view_load_progress (GladeProject *project,
-                                 gint total, gint step, GladeDesignView *view)
-{
-  gchar *path;
-  gchar *str;
-
-  path = glade_utils_replace_home_dir_with_tilde (glade_project_get_path (project));
-  str = g_strdup_printf (_("Loading %s: loaded %d of %d objects"),
-                         path, step, total);
-
-  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (view->priv->progress), str);
-  g_free (str);
-  g_free (path);
-
-  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (view->priv->progress),
-                                 step * 1.0 / total);
-}
-
-static void
 glade_design_layout_scroll (GladeDesignView *view, gint x, gint y, gint w, gint h)
 {
   gdouble vadj_val, hadj_val, vpage_end, hpage_end;
@@ -247,12 +207,12 @@ glade_design_view_set_project (GladeDesignView *view, GladeProject *project)
                     G_CALLBACK (on_project_add_widget), view);
   g_signal_connect (project, "remove-widget",
                     G_CALLBACK (on_project_remove_widget), view);
-  g_signal_connect (project, "parse-began",
-                    G_CALLBACK (glade_design_view_parse_began), view);
-  g_signal_connect (project, "parse-finished",
-                    G_CALLBACK (glade_design_view_parse_finished), view);
-  g_signal_connect (project, "load-progress",
-                    G_CALLBACK (glade_design_view_load_progress), view);
+  g_signal_connect_swapped (project, "parse-began",
+                            G_CALLBACK (gtk_widget_hide),
+                            view->priv->scrolled_window);
+  g_signal_connect_swapped (project, "parse-finished",
+                            G_CALLBACK (gtk_widget_show),
+                            view->priv->scrolled_window);
   g_signal_connect (project, "selection-changed",
                     G_CALLBACK (glade_design_view_selection_changed), view);
   g_signal_connect (project, "widget-visibility-changed",
@@ -294,21 +254,64 @@ glade_design_view_get_property (GObject *object,
     }
 }
 
+static void
+logo_draw (GtkWidget *widget, cairo_t *cr)
+{
+  GtkAllocation alloc;
+  gdouble scale;
+
+  gtk_widget_get_allocation (widget, &alloc);
+
+  cairo_save (cr);
+  
+  cairo_set_source_rgba (cr, 0, 0, 0, .08);
+
+  scale = MIN ((alloc.width/1.5)/(glade_path_WIDTH), (alloc.height/1.5)/(glade_path_HEIGHT));
+
+  cairo_scale (cr, scale, scale);
+  
+  cairo_translate (cr, (alloc.width / scale) - glade_path_WIDTH,
+                   (alloc.height / scale) - glade_path_HEIGHT);
+  cairo_append_path (cr, &glade_path);
+  cairo_fill (cr);
+
+  cairo_restore (cr);
+}
+
 static gboolean
-on_viewport_draw (GtkWidget *widget, cairo_t *cr)
+glade_design_view_draw (GtkWidget *widget, cairo_t *cr)
 {
-  GtkStyle *style = gtk_widget_get_style (widget);
+  GladeDesignViewPrivate *priv = GLADE_DESIGN_VIEW_GET_PRIVATE (widget);
+  
+  GTK_WIDGET_CLASS (glade_design_view_parent_class)->draw (widget, cr);
+
+  if (gtk_widget_get_visible (priv->scrolled_window) == FALSE)
+    logo_draw (widget, cr);
+  
+  return FALSE;
+}
 
-  gdk_cairo_set_source_color (cr, &style->base[gtk_widget_get_state (widget)]);
-  cairo_paint (cr);
+static void
+glade_design_view_style_updated (GtkWidget *widget)
+{
+  GladeDesignViewPrivate *priv = GLADE_DESIGN_VIEW_GET_PRIVATE (widget);
+  GtkWidget *viewport = gtk_bin_get_child (GTK_BIN (priv->scrolled_window));
+  GtkStyleContext *context = gtk_widget_get_style_context (viewport);
+  GdkRGBA bg_color;
 
-  return TRUE;
+  gtk_style_context_save (context);
+  
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+  gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color);
+  gtk_widget_override_background_color (viewport, GTK_STATE_FLAG_NORMAL, &bg_color);
+  
+  gtk_style_context_restore (context);
 }
 
 static void
 glade_design_view_init (GladeDesignView *view)
 {
-  GtkWidget *viewport, *filler, *align;
+  GtkWidget *viewport;
 
   view->priv = GLADE_DESIGN_VIEW_GET_PRIVATE (view);
 
@@ -329,8 +332,6 @@ glade_design_view_init (GladeDesignView *view)
                                        GTK_SHADOW_IN);
 
   viewport = gtk_viewport_new (NULL, NULL);
-  gtk_widget_set_app_paintable (viewport, TRUE);
-  g_signal_connect (viewport, "draw", G_CALLBACK (on_viewport_draw), NULL);
   gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
   gtk_container_add (GTK_CONTAINER (viewport), view->priv->layout_box);
   gtk_container_add (GTK_CONTAINER (view->priv->scrolled_window), viewport);
@@ -338,37 +339,9 @@ glade_design_view_init (GladeDesignView *view)
   gtk_widget_show (view->priv->scrolled_window);
   gtk_widget_show (viewport);
   gtk_widget_show_all (view->priv->layout_box);
-
-  gtk_box_pack_start (GTK_BOX (view), view->priv->scrolled_window, TRUE, TRUE,
-                      0);
-
-  /* The progress window */
-  view->priv->progress_window = gtk_vbox_new (FALSE, 0);
-  filler = gtk_label_new (NULL);
-  gtk_widget_show (filler);
-  gtk_box_pack_start (GTK_BOX (view->priv->progress_window), filler, TRUE, TRUE,
-                      0);
-
-  align = gtk_alignment_new (0.5, 0.5, 0.75, 1.0);
-  gtk_widget_show (align);
-  gtk_box_pack_start (GTK_BOX (view->priv->progress_window), align, FALSE, TRUE,
-                      0);
-
-  view->priv->progress = gtk_progress_bar_new ();
-  gtk_progress_bar_set_show_text (GTK_PROGRESS_BAR (view->priv->progress),
-                                  TRUE);
-  gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (view->priv->progress),
-                                  PANGO_ELLIPSIZE_END);
-  gtk_widget_show (view->priv->progress);
-  gtk_container_add (GTK_CONTAINER (align), view->priv->progress);
-
-  filler = gtk_label_new (NULL);
-  gtk_widget_show (filler);
-  gtk_box_pack_start (GTK_BOX (view->priv->progress_window), filler, TRUE, TRUE,
-                      0);
-  gtk_box_pack_start (GTK_BOX (view), view->priv->progress_window, TRUE, TRUE,
-                      0);
-
+  
+  gtk_box_pack_start (GTK_BOX (view), view->priv->scrolled_window, TRUE, TRUE, 0);
+  
   gtk_container_set_border_width (GTK_CONTAINER (view), 0);
 }
 
@@ -385,6 +358,9 @@ glade_design_view_class_init (GladeDesignViewClass *klass)
   object_class->get_property = glade_design_view_get_property;
   object_class->set_property = glade_design_view_set_property;
 
+  widget_class->draw = glade_design_view_draw;
+  widget_class->style_updated = glade_design_view_style_updated;
+  
   g_object_class_install_property (object_class,
                                    PROP_PROJECT,
                                    g_param_spec_object ("project",
diff --git a/gladeui/glade-path.h b/gladeui/glade-path.h
new file mode 100644
index 0000000..b4270a5
--- /dev/null
+++ b/gladeui/glade-path.h
@@ -0,0 +1,408 @@
+#ifndef __glade_path_H__
+#define __glade_path_H__
+
+#define glade_path_WIDTH 408.781250
+#define glade_path_HEIGHT 398.937500
+
+cairo_path_data_t glade_path_data[] = {
+	{.header.type = 0, .header.length = 2},
+	{.point.x = 90.343750, .point.y = 0.000000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 89.687500, .point.y = 2.250000},
+	{.point.x = 89.421875, .point.y = 10.992188},
+	{.point.x = 89.812500, .point.y = 19.406250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 90.441406, .point.y = 32.828125},
+	{.point.x = 91.304688, .point.y = 35.968750},
+	{.point.x = 96.500000, .point.y = 45.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 100.148438, .point.y = 51.394531},
+	{.point.x = 105.625000, .point.y = 57.781250},
+	{.point.x = 110.750000, .point.y = 61.656250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 120.437500, .point.y = 68.976562},
+	{.point.x = 144.214844, .point.y = 79.347656},
+	{.point.x = 171.375000, .point.y = 88.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 196.046875, .point.y = 95.921875},
+	{.point.x = 204.484375, .point.y = 99.640625},
+	{.point.x = 211.781250, .point.y = 106.000000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 215.050781, .point.y = 108.847656},
+	{.point.x = 217.988281, .point.y = 110.636719},
+	{.point.x = 218.312500, .point.y = 109.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 218.640625, .point.y = 109.242188},
+	{.point.x = 218.062500, .point.y = 102.550781},
+	{.point.x = 217.000000, .point.y = 95.093750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 214.566406, .point.y = 78.011719},
+	{.point.x = 207.527344, .point.y = 64.671875},
+	{.point.x = 194.875000, .point.y = 53.187500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 182.554688, .point.y = 42.000000},
+	{.point.x = 172.675781, .point.y = 36.773438},
+	{.point.x = 149.531250, .point.y = 29.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 113.113281, .point.y = 16.847656},
+	{.point.x = 106.210938, .point.y = 13.308594},
+	{.point.x = 96.906250, .point.y = 2.281250},
+	{.header.type = 3, .header.length = 1},
+	{.header.type = 0, .header.length = 2},
+	{.point.x = 238.031250, .point.y = 58.656250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 237.492188, .point.y = 58.968750},
+	{.point.x = 239.261719, .point.y = 61.609375},
+	{.point.x = 242.156250, .point.y = 64.750000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 245.250000, .point.y = 68.101562},
+	{.point.x = 250.398438, .point.y = 75.605469},
+	{.point.x = 253.593750, .point.y = 81.468750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 258.394531, .point.y = 90.273438},
+	{.point.x = 259.523438, .point.y = 94.562500},
+	{.point.x = 260.156250, .point.y = 105.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 261.109375, .point.y = 123.046875},
+	{.point.x = 258.335938, .point.y = 134.652344},
+	{.point.x = 249.781250, .point.y = 149.468750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 244.441406, .point.y = 158.726562},
+	{.point.x = 242.363281, .point.y = 160.906250},
+	{.point.x = 238.968750, .point.y = 160.906250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 235.425781, .point.y = 160.906250},
+	{.point.x = 234.160156, .point.y = 159.308594},
+	{.point.x = 230.718750, .point.y = 150.531250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 221.054688, .point.y = 125.871094},
+	{.point.x = 203.195312, .point.y = 113.500000},
+	{.point.x = 167.750000, .point.y = 107.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 145.222656, .point.y = 102.921875},
+	{.point.x = 134.351562, .point.y = 99.855469},
+	{.point.x = 123.000000, .point.y = 94.375000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 113.082031, .point.y = 89.589844},
+	{.point.x = 98.183594, .point.y = 76.960938},
+	{.point.x = 94.687500, .point.y = 70.375000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 91.265625, .point.y = 63.921875},
+	{.point.x = 89.593750, .point.y = 68.769531},
+	{.point.x = 89.562500, .point.y = 85.343750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 89.519531, .point.y = 110.410156},
+	{.point.x = 99.582031, .point.y = 135.527344},
+	{.point.x = 116.437500, .point.y = 152.437500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 123.062500, .point.y = 159.062500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 114.343750, .point.y = 158.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 109.535156, .point.y = 157.464844},
+	{.point.x = 102.035156, .point.y = 155.664062},
+	{.point.x = 97.656250, .point.y = 154.000000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 87.226562, .point.y = 150.039062},
+	{.point.x = 72.132812, .point.y = 137.804688},
+	{.point.x = 66.750000, .point.y = 128.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 64.394531, .point.y = 125.054688},
+	{.point.x = 61.109375, .point.y = 113.023438},
+	{.point.x = 61.062500, .point.y = 114.500000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 60.906250, .point.y = 119.500000},
+	{.point.x = 67.855469, .point.y = 159.640625},
+	{.point.x = 71.281250, .point.y = 172.000000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 73.156250, .point.y = 178.757812},
+	{.point.x = 74.492188, .point.y = 184.515625},
+	{.point.x = 74.218750, .point.y = 184.750000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 73.949219, .point.y = 184.984375},
+	{.point.x = 68.496094, .point.y = 183.968750},
+	{.point.x = 62.093750, .point.y = 182.500000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 47.703125, .point.y = 179.199219},
+	{.point.x = 20.855469, .point.y = 178.828125},
+	{.point.x = 8.875000, .point.y = 181.812500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 0.000000, .point.y = 184.031250},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 6.218750, .point.y = 186.750000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 15.660156, .point.y = 190.910156},
+	{.point.x = 29.242188, .point.y = 204.425781},
+	{.point.x = 34.906250, .point.y = 215.218750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 42.023438, .point.y = 228.773438},
+	{.point.x = 47.375000, .point.y = 247.988281},
+	{.point.x = 50.562500, .point.y = 271.718750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 54.019531, .point.y = 297.421875},
+	{.point.x = 54.898438, .point.y = 301.527344},
+	{.point.x = 58.312500, .point.y = 309.187500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 62.550781, .point.y = 318.691406},
+	{.point.x = 74.937500, .point.y = 334.589844},
+	{.point.x = 86.937500, .point.y = 345.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 96.863281, .point.y = 355.152344},
+	{.point.x = 97.121094, .point.y = 355.523438},
+	{.point.x = 90.031250, .point.y = 350.781250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 85.796875, .point.y = 347.949219},
+	{.point.x = 81.859375, .point.y = 345.039062},
+	{.point.x = 81.312500, .point.y = 344.281250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 80.769531, .point.y = 343.527344},
+	{.point.x = 77.796875, .point.y = 341.339844},
+	{.point.x = 74.687500, .point.y = 339.437500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 69.062500, .point.y = 336.000000},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 70.343750, .point.y = 343.656250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 71.976562, .point.y = 353.304688},
+	{.point.x = 81.210938, .point.y = 377.386719},
+	{.point.x = 85.375000, .point.y = 382.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 89.117188, .point.y = 387.804688},
+	{.point.x = 92.617188, .point.y = 393.371094},
+	{.point.x = 96.406250, .point.y = 398.937500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 140.062500, .point.y = 398.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 125.261719, .point.y = 391.414062},
+	{.point.x = 111.375000, .point.y = 383.683594},
+	{.point.x = 111.375000, .point.y = 382.625000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 111.375000, .point.y = 382.187500},
+	{.point.x = 116.660156, .point.y = 384.617188},
+	{.point.x = 123.156250, .point.y = 388.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 130.234375, .point.y = 391.750000},
+	{.point.x = 137.937500, .point.y = 395.398438},
+	{.point.x = 146.062500, .point.y = 398.937500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 247.531250, .point.y = 398.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 212.316406, .point.y = 389.019531},
+	{.point.x = 176.621094, .point.y = 375.136719},
+	{.point.x = 146.812500, .point.y = 359.125000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 124.667969, .point.y = 347.230469},
+	{.point.x = 121.132812, .point.y = 343.796875},
+	{.point.x = 141.375000, .point.y = 353.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 181.539062, .point.y = 373.777344},
+	{.point.x = 230.722656, .point.y = 390.035156},
+	{.point.x = 277.125000, .point.y = 398.937500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 387.281250, .point.y = 398.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 389.449219, .point.y = 398.289062},
+	{.point.x = 391.582031, .point.y = 397.632812},
+	{.point.x = 393.406250, .point.y = 397.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 402.406250, .point.y = 394.074219},
+	{.point.x = 403.734375, .point.y = 393.250000},
+	{.point.x = 408.781250, .point.y = 384.656250},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 408.781250, .point.y = 369.218750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 354.609375, .point.y = 380.550781},
+	{.point.x = 261.796875, .point.y = 362.976562},
+	{.point.x = 186.843750, .point.y = 326.812500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 170.699219, .point.y = 319.023438},
+	{.point.x = 149.531250, .point.y = 307.312500},
+	{.point.x = 149.531250, .point.y = 306.156250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 149.531250, .point.y = 305.832031},
+	{.point.x = 156.691406, .point.y = 309.121094},
+	{.point.x = 165.437500, .point.y = 313.468750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 208.855469, .point.y = 335.046875},
+	{.point.x = 265.519531, .point.y = 352.527344},
+	{.point.x = 313.187500, .point.y = 359.093750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 333.339844, .point.y = 361.871094},
+	{.point.x = 369.632812, .point.y = 362.246094},
+	{.point.x = 385.093750, .point.y = 359.812500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 391.878906, .point.y = 358.746094},
+	{.point.x = 401.050781, .point.y = 356.160156},
+	{.point.x = 408.781250, .point.y = 353.437500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 408.781250, .point.y = 327.812500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 357.781250, .point.y = 339.546875},
+	{.point.x = 260.570312, .point.y = 318.058594},
+	{.point.x = 187.781250, .point.y = 278.000000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 172.882812, .point.y = 269.800781},
+	{.point.x = 170.656250, .point.y = 267.132812},
+	{.point.x = 184.531250, .point.y = 274.093750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 225.066406, .point.y = 294.429688},
+	{.point.x = 273.574219, .point.y = 309.937500},
+	{.point.x = 316.531250, .point.y = 316.281250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 339.093750, .point.y = 319.613281},
+	{.point.x = 375.757812, .point.y = 320.351562},
+	{.point.x = 389.531250, .point.y = 317.718750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 395.226562, .point.y = 316.632812},
+	{.point.x = 402.355469, .point.y = 314.566406},
+	{.point.x = 408.781250, .point.y = 312.343750},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 408.781250, .point.y = 286.781250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 392.652344, .point.y = 290.996094},
+	{.point.x = 359.242188, .point.y = 291.675781},
+	{.point.x = 331.593750, .point.y = 286.687500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 293.644531, .point.y = 279.839844},
+	{.point.x = 248.632812, .point.y = 264.089844},
+	{.point.x = 217.218750, .point.y = 246.687500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 202.500000, .point.y = 238.531250},
+	{.point.x = 200.261719, .point.y = 235.210938},
+	{.point.x = 214.593750, .point.y = 242.781250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 228.839844, .point.y = 250.308594},
+	{.point.x = 256.128906, .point.y = 260.804688},
+	{.point.x = 277.156250, .point.y = 266.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 323.738281, .point.y = 280.226562},
+	{.point.x = 366.109375, .point.y = 283.082031},
+	{.point.x = 394.843750, .point.y = 274.781250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 399.859375, .point.y = 273.332031},
+	{.point.x = 404.953125, .point.y = 271.539062},
+	{.point.x = 408.781250, .point.y = 269.937500},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 408.781250, .point.y = 246.375000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 405.968750, .point.y = 241.371094},
+	{.point.x = 403.597656, .point.y = 237.246094},
+	{.point.x = 403.343750, .point.y = 237.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 403.019531, .point.y = 236.753906},
+	{.point.x = 398.386719, .point.y = 238.460938},
+	{.point.x = 393.031250, .point.y = 240.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 383.820312, .point.y = 244.945312},
+	{.point.x = 382.070312, .point.y = 245.160156},
+	{.point.x = 359.625000, .point.y = 245.093750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 340.851562, .point.y = 245.039062},
+	{.point.x = 332.679688, .point.y = 244.292969},
+	{.point.x = 320.437500, .point.y = 241.468750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 293.203125, .point.y = 235.187500},
+	{.point.x = 255.355469, .point.y = 220.000000},
+	{.point.x = 242.218750, .point.y = 210.062500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 238.386719, .point.y = 207.164062},
+	{.point.x = 238.996094, .point.y = 207.246094},
+	{.point.x = 246.812500, .point.y = 210.812500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 279.453125, .point.y = 225.703125},
+	{.point.x = 308.761719, .point.y = 233.277344},
+	{.point.x = 338.656250, .point.y = 234.531250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 357.054688, .point.y = 235.304688},
+	{.point.x = 360.980469, .point.y = 234.976562},
+	{.point.x = 371.375000, .point.y = 231.968750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 389.828125, .point.y = 226.628906},
+	{.point.x = 390.781250, .point.y = 225.835938},
+	{.point.x = 391.156250, .point.y = 215.093750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 391.449219, .point.y = 206.785156},
+	{.point.x = 390.515625, .point.y = 204.261719},
+	{.point.x = 382.312500, .point.y = 190.468750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 377.289062, .point.y = 182.019531},
+	{.point.x = 373.121094, .point.y = 173.703125},
+	{.point.x = 373.031250, .point.y = 171.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 372.945312, .point.y = 170.171875},
+	{.point.x = 371.769531, .point.y = 171.984375},
+	{.point.x = 370.468750, .point.y = 176.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 363.761719, .point.y = 196.949219},
+	{.point.x = 349.835938, .point.y = 203.890625},
+	{.point.x = 323.812500, .point.y = 199.250000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 309.765625, .point.y = 196.746094},
+	{.point.x = 278.191406, .point.y = 183.371094},
+	{.point.x = 280.875000, .point.y = 181.062500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 281.234375, .point.y = 180.757812},
+	{.point.x = 286.589844, .point.y = 182.289062},
+	{.point.x = 292.781250, .point.y = 184.437500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 313.656250, .point.y = 191.675781},
+	{.point.x = 335.207031, .point.y = 191.050781},
+	{.point.x = 345.625000, .point.y = 182.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 353.035156, .point.y = 177.167969},
+	{.point.x = 355.558594, .point.y = 171.070312},
+	{.point.x = 355.437500, .point.y = 159.343750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 355.097656, .point.y = 126.226562},
+	{.point.x = 321.609375, .point.y = 89.011719},
+	{.point.x = 275.187500, .point.y = 70.156250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 265.082031, .point.y = 66.050781},
+	{.point.x = 241.316406, .point.y = 58.656250},
+	{.point.x = 238.187500, .point.y = 58.656250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 238.132812, .point.y = 58.656250},
+	{.point.x = 238.070312, .point.y = 58.636719},
+	{.point.x = 238.031250, .point.y = 58.656250},
+	{.header.type = 3, .header.length = 1},
+	{.header.type = 0, .header.length = 2},
+	{.point.x = 388.437500, .point.y = 132.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 387.890625, .point.y = 132.968750},
+	{.point.x = 386.785156, .point.y = 133.718750},
+	{.point.x = 385.156250, .point.y = 135.031250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 374.984375, .point.y = 143.238281},
+	{.point.x = 375.207031, .point.y = 153.203125},
+	{.point.x = 385.968750, .point.y = 167.937500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 388.792969, .point.y = 171.800781},
+	{.point.x = 392.011719, .point.y = 177.000000},
+	{.point.x = 393.125000, .point.y = 179.531250},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 395.156250, .point.y = 184.156250},
+	{.header.type = 1, .header.length = 2},
+	{.point.x = 398.718750, .point.y = 179.531250},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 403.707031, .point.y = 173.039062},
+	{.point.x = 403.257812, .point.y = 162.636719},
+	{.point.x = 397.656250, .point.y = 153.875000},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 389.765625, .point.y = 141.527344},
+	{.point.x = 387.507812, .point.y = 136.390625},
+	{.point.x = 388.656250, .point.y = 133.812500},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 388.929688, .point.y = 133.203125},
+	{.point.x = 388.921875, .point.y = 132.882812},
+	{.point.x = 388.656250, .point.y = 132.843750},
+	{.header.type = 2, .header.length = 4},
+	{.point.x = 388.601562, .point.y = 132.835938},
+	{.point.x = 388.519531, .point.y = 132.828125},
+	{.point.x = 388.437500, .point.y = 132.843750},
+	{.header.type = 3, .header.length = 1},
+	{.header.type = 0, .header.length = 2},
+	{.point.x = 388.437500, .point.y = 132.843750}
+};
+
+cairo_path_t glade_path = {0, glade_path_data, 397};
+#endif /* __glade_path_H__ */
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 24d133b..19b56fa 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -2678,6 +2678,12 @@ glade_project_check_reordered (GladeProject *project,
   g_list_free (new_order);
 }
 
+static inline gboolean
+glade_project_has_gwidget (GladeProject *project, GladeWidget *gwidget)
+{
+  return (glade_widget_get_project (gwidget) == project && 
+           glade_widget_in_project (gwidget));
+}
 
 /**
  * glade_project_add_object:
@@ -2689,9 +2695,10 @@ glade_project_check_reordered (GladeProject *project,
 void
 glade_project_add_object (GladeProject *project, GObject *object)
 {
+  GladeProjectPrivate *priv;
   GladeWidget *gwidget;
   GList *list, *children;
-  gchar *name;
+  const gchar *name;
 
   g_return_if_fail (GLADE_IS_PROJECT (project));
   g_return_if_fail (G_IS_OBJECT (object));
@@ -2707,7 +2714,7 @@ glade_project_add_object (GladeProject *project, GObject *object)
   if ((gwidget = glade_widget_get_from_gobject (object)) == NULL)
     return;
 
-  if (glade_project_has_object (project, object))
+  if (glade_project_has_gwidget (project, gwidget))
     {
       /* FIXME: It's possible we need to notify the model iface if this 
        * happens to make sure the hierarchy is the same, I dont know, this 
@@ -2716,22 +2723,26 @@ glade_project_add_object (GladeProject *project, GObject *object)
       return;
     }
 
+  priv = project->priv;
+  
+  name = glade_widget_get_name (gwidget);
   /* Make sure we have an exclusive name first... */
-  if (!glade_project_available_widget_name (project, gwidget, glade_widget_get_name (gwidget)))
+  if (!glade_project_available_widget_name (project, gwidget, name))
     {
-      name = glade_project_new_widget_name (project, gwidget, glade_widget_get_name (gwidget));
+      gchar *new_name = glade_project_new_widget_name (project, gwidget, name);
 
       /* XXX Collect these errors and make a report at startup time */
-      if (project->priv->loading)
+      if (priv->loading)
         g_warning ("Loading object '%s' with name conflict, renaming to '%s'",
-                   glade_widget_get_name (gwidget), name);
-
-      glade_widget_set_name (gwidget, name);
+                   name, new_name);
 
-      g_free (name);
+      glade_widget_set_name (gwidget, new_name);
+      name = glade_widget_get_name (gwidget);
+      
+      g_free (new_name);
     }
 
-  glade_project_reserve_widget_name (project, gwidget, glade_widget_get_name (gwidget));
+  glade_project_reserve_widget_name (project, gwidget, name);
 
   glade_widget_set_project (gwidget, (gpointer) project);
   glade_widget_set_in_project (gwidget, TRUE);
@@ -2739,9 +2750,9 @@ glade_project_add_object (GladeProject *project, GObject *object)
 
   /* Be sure to update the lists before emitting signals */
   if (glade_widget_get_parent (gwidget) == NULL)
-    project->priv->tree = g_list_append (project->priv->tree, object);
+    priv->tree = g_list_append (priv->tree, object);
 
-  project->priv->objects = g_list_prepend (project->priv->objects, object);
+  priv->objects = g_list_prepend (priv->objects, object);
 
   glade_project_notify_row_inserted (project, gwidget);
 
@@ -2783,8 +2794,7 @@ glade_project_has_object (GladeProject *project, GObject *object)
 
   g_return_val_if_fail (GLADE_IS_WIDGET (gwidget), FALSE);
 
-  return (glade_widget_get_project (gwidget) == project && 
-           glade_widget_in_project (gwidget));
+  return glade_project_has_gwidget (project, gwidget);
 }
 
 void
diff --git a/src/glade-window.c b/src/glade-window.c
index 8b77667..0d465ac 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -2570,22 +2570,26 @@ tab_close_button_clicked_cb (GtkWidget * close_button, GladeProject * project)
 }
 
 static void
-project_load_progress_cb (GladeProject * project,
-                          gint total, gint step, GtkProgressBar * progress)
+project_load_progress_cb (GladeProject *project,
+                          gint total, gint step,
+                          GtkProgressBar *progress)
 {
-  gchar *name;
+  gint fraction = (step * 1.0 / total) * 100;
+  gchar *str, *name;
 
+  if (fraction/100.0 == gtk_progress_bar_get_fraction (progress))
+    return;
+  
   name = glade_project_get_name (project);
+  str = g_strdup_printf ("%s (%d%%)", name, fraction);
 
-  /* translators: "project name (objects loaded in total objects)" */
-  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress), name);
+  gtk_progress_bar_set_text (progress, str);
   g_free (name);
+  g_free (str);
 
-  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
-                                 step * 1.0 / total);
+  gtk_progress_bar_set_fraction (progress, fraction/100.0);
 
-  while (gtk_events_pending ())
-    gtk_main_iteration ();
+  while (gtk_events_pending ()) gtk_main_iteration ();
 }
 
 static void
diff --git a/src/main.c b/src/main.c
index 048ebc6..87d3cd7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -74,6 +74,7 @@ main (int argc, char *argv[])
   GOptionGroup *option_group;
   GError *error = NULL;
   gboolean opened_project = FALSE;
+  GTimer *timer = NULL;
 
   if (!g_thread_supported ())
     g_thread_init (NULL);
@@ -162,6 +163,11 @@ main (int argc, char *argv[])
 
   gtk_widget_show (GTK_WIDGET (window));
 
+  /* Update UI before loading files */
+  while (gtk_events_pending ()) gtk_main_iteration ();
+
+  if (verbose) timer = g_timer_new ();
+  
   /* load files specified on commandline */
   if (files != NULL)
     {
@@ -169,6 +175,8 @@ main (int argc, char *argv[])
 
       for (i = 0; files[i]; ++i)
         {
+          if (verbose) g_timer_start (timer);
+          
           if (g_file_test (files[i], G_FILE_TEST_EXISTS) != FALSE)
 	    {
 	      if (glade_window_open_project (window, files[i]))
@@ -177,10 +185,19 @@ main (int argc, char *argv[])
           else
             g_warning (_("Unable to open '%s', the file does not exist.\n"),
                        files[i]);
+
+          if (verbose)
+            {
+              g_timer_stop (timer);
+              g_message ("Loading '%s' took %lf seconds", files[i],
+                         g_timer_elapsed (timer, NULL));
+            }
         }
       g_strfreev (files);
     }
 
+  if (verbose) g_timer_destroy (timer);
+  
   if (!opened_project)
     glade_window_new_project (window);
 



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