Commit a84bfad0 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Merge branch 'master' into offscreen-gtk3

Conflicts:
	ChangeLog
	gladeui/Makefile.am
	gladeui/glade-widget.c
parents 5a713f98 e56a1f69
2010-12-22 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-project.[ch]: Removed dialog and added "load-progress" signal
* gladeui/glade-app.c: Protect against commands executed on loading projects
* src/glade-window.c: Added load progressbar to notebook tabs.
* gladeui/glade-project.c: Added "parse-began" signal
* gladeui/glade-design-view.c: Hide workspace and show load progress
while loading so that one cannot access project widgets during the load
(insensitive workspace was problematic and causing some loaded project
windows to be permanently insensitive).
* src/glade-window.c: Avoid any messups during project load, cannot close
projects while they are loading, etc.
2010-12-21 Tristan Van Berkom <tristanvb@openismus.com>
Added loading objects dialog with progress and cancel.
* src/main.c: Display window before loading command line specified projects.
* gladeui/glade-project.[ch]: Added dialog that pops up when about to load
a large project with glade_project_push_project() to push the progress and
glade_project_load_cancelled() to check and abort while loading the project.
* gladeui/glade-widget.c, gladeui/glade-widget-adaptor.c: Push progress and
abort loading when project indicates the user cancelled the load.
2010-12-20 Tristan Van Berkom <tristanvb@openismus.com>
* plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-column-types.[ch]: Added
glade_column_type_new() to create a GladeColumnType struct properly using
g_slice_new0(). An occurance of allocating the struct with g_new0 was causing
Glade to crash when freeing the block with g_slice_free (bug 637563). Many
big thanks to Benjamin Otte for tracking down the problem.
* gladeui/glade-project.c: Applying Marco Diego Aurélio Mesquita's patch to
make the project preview only preview toplevels.
* gladeui/glade-editor.c: Fixed class header of GladeEditor to update when
widgets unload (patch by Marco Diego Aurélio Mesquita, bug 637541).
* gladeui/glade-editor-property.c, gladeui/glade-property.c, gladeui/glade-widget.c,
plugins/gtk+/glade-gtk.c: Fixing some discrepincies searching for properties as
regular properties or packing properties. Now the conflicting "position" property
on a GtkPaned widget packed into a GtkBox widget works properly (bug 637475).
2010-12-19 Tristan Van Berkom <tristanvb@openismus.com>
* plugins/gtk+/glade-gtk.c: Fix alpha_sort_box_children() to give a consistent
order to placeholders (bug 637534 fix by Marco Diego Aurélio Mesquita).
* plugins/gtk+/glade-gtk.c: Removed alpha_sort_box_children(), project needs to be
sorted with box children by position, loading process depends on this.
* gladeui/glade-widget.[ch]: Hide glade_widget_set_object(), improved reference count
balancing and fixed segfaults upon closing projects that contain filechooser dialogs
referenced by filechooserbuttons.
2010-12-18 Tristan Van Berkom <tristanvb@openismus.com>
* src/Makefile.am, gladeui/Makefile.am, plugins/gtk+/Makefile.am, plugins/gnome/Makefile.am:
Fixed makefiles as per bug 521713 (patch initially by Daniel Macks).
* gladeui/glade-editor-property.c: Hide editor properties when the property is not available
on the widget, bug 585299, fix by Marco Diego Aurélio Mesquita.
* gladeui/glade-editor-property.c: Unload currently loaded property in
glade_editor_property_load_by_widget() when a NULL widget is specified or the property
is not found.
2010-12-17 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-project.c: Restore proper sorting of objects at save time.
* gladeui/glade-property-class.c: Properly order object properties
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Alphabetically sort GtkBox children for save.
* plugins/gtk+/glade-gtk.c, po/*.po: Fixed 'controled' typo with updates to po files, patch
by Matt Woelfel for bug 633957.
* Marking ChangeLog, this is where 3.7.2 was rolled.
2010-12-17 Tristan Van Berkom <tristanvb@openismus.com>
* NEWS, configure.ac: Rolling 3.7.2.
2010-12-17 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-app.[ch]: Added glade_app_queue_selection_changed()
* gladeui/glade-command.c: queue selection changes when widgets are added, this
avoids synchrounously poking the model when the selection changes various times
in a command sequence such as changing a menu item's type.
* gladeui/glade-base-editor.c: Dont call glade_command_create/delete() directly
in change-type, keep delegating this work to build-child/delete-child signals.
* gladeui/glade-widget.[ch]: Added glade_widget_is_ancestor()
* gladeui/glade-utils.c: Change glade_util_find_iter_by_widget() to use
glade_widget_is_ancestor() and speed up searches a little this way.
* plugins/gtk+/glade-gtk.c:
- Defensively avoid crash when setting entry icon tooltips
- Add version check macro to compile with GTK+ 2.20
* plugins/gtk+/glade-gtk.c: Fixed crashes when textview's buffer is deleted, fix
by Martin Schlemmer, bug 609748.
* gladeui/glade-project.c: Fixed crasher when adjusting project naming policy (bug 622528,
thanks goes to Sébastien Granjoux and Martin Schlemmer for looking at this one).
2010-12-16 Tristan Van Berkom <tristanvb@openismus.com>
* plugins/gtk+/glade-gtk.c: Avoid using gtk_combo_box_set_entry_text_column directly (build
for GTK+ 2.20).
* gladeui/glade-project.c: Notify iter changes when the widget name changes, increment project
iter stamp before notifying row-inserted (old iters are invalid, the new iter persists),
fixed leaked GtkTreePath when rows are inserted.
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Fixed GtkComboBox to handle cell-layout
children as well as the possible internal entry (fixes bug 581580).
* doc/Makefile.am: For master branch, change doc build to link against libgladeui-2 library.
* gladeui/glade-base-editor.c: Fixed glade_base_editor_dispose to not access the signal
editor, it's automatically destroyed as being a child of the editor.
* plugins/gtk+/glade-gtk.c: Set added treeviewcolumns to fixed sizing mode if the
treeview is set to use fixed height mode (closing bug 596480).
* gladeui/glade-inspector.c:
- Avoid changing project selection when selection is cleared, selection get's cleared
when the user changes a widget name and a filter is applied (removing the entry from
the filtered model), avoiding syncing project selection avoids making the editor disappear
when the user changes a widget name (fixes bug 604322).
- Also plugged some leaked objects retrieved by gtk_tree_model_get().
* gladeui/glade-editor-table.c: Fire a warning when entry is edited with no widget
loaded, also change the ->loading flag strategy for blocking signal emission instead.
* plugins/gtk+/glade-gtk.c: Fixed floating project menus when context menu is fired (bug 141714).
* gladeui/glade-project.[ch], gladeui/glade-app.[ch], src/glade-window.c: Removed notion
of project "instance_count" which is now unused.
* plugins/gtk+/gtk+.xml.in: Setting dialog type-hint default to Dialog (closes old bug 459917)
* gladeui/glade-project.c: Removing frame shadow (and label) from project preferences (bug 574098).
* plugins/gtk+/gtk+.xml.in: default adjustment page size -> 0 (bug 585085).
2010-12-15 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-project.c: Cleanup glade_project_remove_object(), make sure row_deleted is
fired before modifying internal data structures (and dont use the glade_util_ function
to find a widget iter).
* plugins/gtk+/glade-gtk.c: Fixed errors when undoing the addition of notebook pages.
The problem at length was an issue of orphaned project widgets left in the project model.
* gladeui/glade-widget.[ch], gladeui/glade-project.c, plugins/gtk+/glade-gtk.c: Cleanup
object ref count cycles, now GladeProject just releases all widgets from the project
and keeps a reference to the GladeWidget instead of the GObject, GladeWidget is now
GInitiallyUnowned and GladeProject assumes ownership when objects are added to the
project (glade-gtk.c in this patch avoids needlessly adding a widget to the project
that will be implicitly added, now glade-gtk.c does not directly manually add any
widgets to the project).
* gladeui/glade-widget.c, gladeui/glade-project.c: Fixed some final things with
new GInitiallyUnowned strategy, push superuser mode at dispose time so that
the plugin doesnt screw up, also hold a ref to widgets being rebuilt since
they can go out and into the project.
* plugins/gtk+/glade-gtk.c: Make sure any manually created glade widgets pass
through glade_widget_add_child() and get a proper ref from the parent (fixing
more last minute crahsers).
* gladeui/glade-utils.c: Fixed crasher bug 628233 partially using patch by
ramz <ramanathan.nitt@gmail.com>.
* gladeui/glade-project.c: Fix glade_project_fix_object_props() to copy the
list which risks changing order while iterating.
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Avoid warnings when
loading glade files.
* plugins/gtk+/gtk+.xml.in: Ignore "resize-mode" property incase of crashes
(as reported in bug 622996).
* gladeui/glade-palette.c: Add a label in a box to the palette items to avoid
the evil ellipsization.
* plugins/gtk+/glade-gtk.c: Fixed crash with notebook rebuilding children (bug 365462).
2010-12-14 Tristan Van Berkom <tristanvb@openismus.com>
* Reverted 3.0 commit, now targetting this branch to the final GTK+ 2.x chapter
* Reverted the commit that removes the old fashioned "Custom Widget" handling.
2010-11-12 Johannes Schmid <jhs@gnome.org>
* gladeui/glade-project.c:
......
......@@ -100,7 +100,7 @@ GTKDOC_CFLAGS= \
-I$(top_builddir) \
`pkg-config --cflags gtk+-2.0`
GTKDOC_LIBS=${top_builddir}/gladeui/libgladeui-1.la
GTKDOC_LIBS=${top_builddir}/gladeui/libgladeui-2.la
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
......
## Previewer
bin_PROGRAMS = glade-previewer
lib_LTLIBRARIES = libgladeui-2.la
glade_previewer_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
-DGLADE_GNOMEHELPDIR="\"$(HELP_DIR)\"" \
$(GTK_CFLAGS) \
$(IGE_MAC_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CPPFLAGS)
glade_previewer_CFLAGS = \
$(AM_CFLAGS)
glade_previewer_LDFLAGS = $(AM_LDFLAGS)
glade_previewer_LDADD = libgladeui-2.la $(IGE_MAC_LIBS)
glade_previewer_SOURCES = \
glade-previewer.c
if NATIVE_WIN32
glade_previewer_LDADD += glade-win32-res.o
if !GLADE_UNSTABLE
glade_previewer_LDFLAGS += -mwindows
endif
endif
glade-win32-res.o: glade-previewer.rc
$(WINDRES) $< $@
## Rest of the UI ;)
common_defines = \
......@@ -8,14 +42,12 @@ common_defines = \
-DGLADE_LOCALEDIR="\"$(datadir)/locale\""\
-DGLADE_BINDIR="\"$(bindir)\""
lib_LTLIBRARIES = libgladeui-3.la
BUILT_SOURCES = glade-marshallers.c glade-marshallers.h
EXTRA_DIST = glade-marshallers.list gladeui.rc.in icon-naming-spec.c glade-previewer.rc.in
# The glade-3 core library
libgladeui_3_la_SOURCES = \
# The glade core library
libgladeui_2_la_SOURCES = \
glade-widget-adaptor.c \
glade-debug.c \
glade-project.c \
......@@ -60,24 +92,24 @@ libgladeui_3_la_SOURCES = \
glade-editor-table.c \
glade-cell-renderer-icon.c
libgladeui_3_la_CPPFLAGS = \
libgladeui_2_la_CPPFLAGS = \
$(common_defines) \
-I$(top_srcdir) \
-I$(top_builddir) \
$(AM_CPPFLAGS)
libgladeui_3_la_CFLAGS = \
$(GTK_CFLAGS) \
$(IGE_MAC_BUNDLE_FLAG) \
$(IGE_MAC_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CPPFLAGS)
libgladeui_2_la_CFLAGS = \
$(AM_CFLAGS)
libgladeui_3_la_LDFLAGS = -version-info $(GLADE_CURRENT):$(GLADE_REVISION):$(GLADE_AGE) $(AM_LDFLAGS)
libgladeui_3_la_LIBADD = $(GTK_LIBS) $(IGE_MAC_LIBS)
libgladeui_2_la_LDFLAGS = -version-info $(GLADE_CURRENT):$(GLADE_REVISION):$(GLADE_AGE) $(AM_LDFLAGS)
libgladeui_2_la_LIBADD = $(GTK_LIBS) $(IGE_MAC_LIBS)
libgladeuiincludedir=$(includedir)/libgladeui-3.0/gladeui
libgladeuiincludedir=$(includedir)/libgladeui-2.0/gladeui
libgladeuiinclude_HEADERS = \
glade.h \
glade-debug.h \
......@@ -117,12 +149,12 @@ libgladeuiinclude_HEADERS = \
if PLATFORM_WIN32
libgladeui_3_la_LDFLAGS += -no-undefined
libgladeui_2_la_LDFLAGS += -no-undefined
endif
if NATIVE_WIN32
libgladeui_3_la_LDFLAGS += -Wl,gladeui-win32-res.o -export-symbols gladeui.def
libgladeui_3_la_DEPENDENCIES = gladeui-win32-res.o gladeui.def
libgladeui_2_la_LDFLAGS += -Wl,gladeui-win32-res.o -export-symbols gladeui.def
libgladeui_2_la_DEPENDENCIES = gladeui-win32-res.o gladeui.def
endif
gladeui-win32-res.o: gladeui.rc
......
......@@ -94,6 +94,8 @@ struct _GladeAppPrivate
GList *undo_list, *redo_list; /* Lists of buttons to refresh in update-ui signal */
GladePointerMode pointer_mode; /* Current mode for the pointer in the workspace */
guint selection_changed_id; /* for queue_selection_changed() */
};
static guint glade_app_signals[LAST_SIGNAL] = { 0 };
......@@ -919,50 +921,6 @@ glade_app_hide_properties (void)
}
void
glade_app_update_instance_count (GladeProject *project)
{
GladeApp *app;
GList *l;
gint temp, max = 0, i = 0, uncounted_projects = 0;
gchar *project_name;
g_return_if_fail (GLADE_IS_PROJECT (project));
if (glade_project_get_instance_count (project) > 0)
return;
project_name = glade_project_get_name (project);
app = glade_app_get ();
for (l = app->priv->projects; l; l = l->next)
{
GladeProject *prj = GLADE_PROJECT (l->data);
gchar *name = glade_project_get_name (project);
if (prj != project && !g_utf8_collate (name, project_name))
{
i++;
temp = MAX (glade_project_get_instance_count (prj) + 1, i);
max = MAX (temp, max);
if (glade_project_get_instance_count (prj) < 1)
uncounted_projects++;
}
g_free (name);
}
g_free (project_name);
/* Dont reset the initially opened project */
if (uncounted_projects > 1 || g_list_find (app->priv->projects, project) == NULL)
{
glade_project_set_instance_count (project, MAX (max, i));
}
}
void
glade_app_add_project (GladeProject *project)
{
......@@ -980,7 +938,6 @@ glade_app_add_project (GladeProject *project)
glade_app_set_project (project);
return;
}
glade_app_update_instance_count (project);
/* Take a reference for GladeApp here... */
app->priv->projects = g_list_append (app->priv->projects,
......@@ -1150,10 +1107,9 @@ glade_app_command_copy (void)
gboolean failed = FALSE;
app = glade_app_get();
if (app->priv->active_project == NULL)
{
if (app->priv->active_project == NULL ||
glade_project_is_loading (app->priv->active_project))
return;
}
for (list = glade_app_get_selection ();
list && list->data; list = list->next)
......@@ -1193,7 +1149,8 @@ glade_app_command_cut (void)
gboolean failed = FALSE;
app = glade_app_get();
if (app->priv->active_project == NULL)
if (app->priv->active_project == NULL ||
glade_project_is_loading (app->priv->active_project))
return;
for (list = glade_app_get_selection ();
......@@ -1235,9 +1192,17 @@ glade_app_command_paste (GladePlaceholder *placeholder)
GladeFixed *fixed = NULL;
app = glade_app_get();
if (app->priv->active_project == NULL)
if (app->priv->active_project == NULL ||
glade_project_is_loading (app->priv->active_project))
return;
if (placeholder)
{
if (glade_placeholder_get_project (placeholder) == NULL ||
glade_project_is_loading (glade_placeholder_get_project (placeholder)))
return;
}
list = glade_project_selection_get (app->priv->active_project);
clipboard = glade_app_get_clipboard ();
......@@ -1358,7 +1323,8 @@ glade_app_command_delete (void)
gboolean failed = FALSE;
app = glade_app_get();
if (app->priv->active_project == NULL)
if (app->priv->active_project == NULL ||
glade_project_is_loading (app->priv->active_project))
return;
for (list = glade_app_get_selection ();
......@@ -1643,6 +1609,25 @@ glade_app_selection_changed (void)
}
}
static gboolean
selection_change_idle (GladeApp *app)
{
glade_app_selection_changed ();
app->priv->selection_changed_id = 0;
return FALSE;
}
void
glade_app_queue_selection_changed (void)
{
GladeApp *app = glade_app_get ();
if (app->priv->selection_changed_id == 0)
app->priv->selection_changed_id =
g_idle_add ((GSourceFunc)selection_change_idle, app);
}
GladeApp*
glade_app_new (void)
{
......
......@@ -166,9 +166,6 @@ void glade_app_set_accel_group (GtkAccelGroup *accel_group);
GtkAccelGroup *glade_app_get_accel_group (void);
void glade_app_update_instance_count (GladeProject *project);
GtkWidget *glade_app_undo_button_new (void);
GtkWidget *glade_app_redo_button_new (void);
......@@ -196,6 +193,8 @@ void glade_app_selection_clear (gboolean emit_signal);
void glade_app_selection_changed (void);
void glade_app_queue_selection_changed (void);
/* package paths */
const gchar *glade_app_get_catalogs_dir (void) G_GNUC_CONST;
......
......@@ -322,6 +322,31 @@ glade_base_editor_project_widget_name_changed (GladeProject *project,
GladeWidget *widget,
GladeBaseEditor *editor);
static GladeWidget *
glade_base_editor_delegate_build_child (GladeBaseEditor *editor,
GladeWidget *parent,
GType type)
{
GladeWidget *child = NULL;
g_signal_emit (editor, glade_base_editor_signals[SIGNAL_BUILD_CHILD],
0, parent, type, &child);
return child;
}
static gboolean
glade_base_editor_delegate_delete_child (GladeBaseEditor *editor,
GladeWidget *parent,
GladeWidget *child)
{
gboolean retval;
g_signal_emit (editor, glade_base_editor_signals[SIGNAL_DELETE_CHILD],
0, parent, child, &retval);
return retval;
}
static void
glade_base_editor_name_activate (GtkEntry *entry, GladeWidget *gchild)
{
......@@ -678,9 +703,8 @@ glade_base_editor_add_child (GladeBaseEditor *editor,
glade_widget_get_name (gparent));
/* Build Child */
g_signal_emit (editor, glade_base_editor_signals[SIGNAL_BUILD_CHILD],
0, gparent, type, &gchild_new);
gchild_new = glade_base_editor_delegate_build_child (editor, gparent, type);
if (gchild_new == NULL)
{
glade_command_pop_group ();
......@@ -862,7 +886,6 @@ glade_base_editor_delete_child (GladeBaseEditor *e)
{
GladeWidget *child, *gparent;
GtkTreeIter iter, parent;
gboolean retval;
if (!glade_base_editor_get_child_selected (e, &iter)) return;
......@@ -881,8 +904,7 @@ glade_base_editor_delete_child (GladeBaseEditor *e)
glade_widget_get_name (gparent));
/* Emit delete-child signal */
g_signal_emit (e, glade_base_editor_signals[SIGNAL_DELETE_CHILD],
0, gparent, child, &retval);
glade_base_editor_delegate_delete_child (e, gparent, child);
glade_command_pop_group ();
}
......@@ -1168,7 +1190,6 @@ glade_base_editor_project_disconnect (GladeBaseEditor *editor)
if (e->properties_idle)
g_source_remove (e->properties_idle);
e->properties_idle = 0;
}
static void
......@@ -1246,11 +1267,10 @@ glade_base_editor_dispose (GObject *object)
{
GladeBaseEditor *cobj = GLADE_BASE_EDITOR (object);
glade_signal_editor_load_widget (cobj->priv->signal_editor, NULL);
reset_child_types (cobj);
glade_base_editor_project_disconnect (cobj);
cobj->priv->project = NULL;
if (cobj->priv->group)
cobj->priv->group =
......@@ -1304,10 +1324,8 @@ glade_base_editor_change_type (GladeBaseEditor *editor,
GladeWidget *gchild,
GType type)
{
GladeBaseEditorPrivate *e = editor->priv;
GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (type);
GladeWidget *parent, *gchild_new;
GList list = {0, }, *children, *l;
GList *children, *l;
GObject *child, *child_new;
GtkTreeIter iter;
gchar *name, *class_name;
......@@ -1324,11 +1342,12 @@ glade_base_editor_change_type (GladeBaseEditor *editor,
glade_base_editor_find_child (editor, gchild, &iter);
/* Create new widget */
gchild_new = glade_command_create (adaptor, parent, NULL, e->project);
gchild_new = glade_base_editor_delegate_build_child (editor, parent, type);
child_new = glade_widget_get_object (gchild_new);
/* Cut and Paste childrens */
if ((children = glade_widget_adaptor_get_children (gchild->adaptor, child)))
if ((children = glade_widget_get_children (gchild)) != NULL)
{
GList *gchildren = NULL;
......@@ -1356,10 +1375,13 @@ glade_base_editor_change_type (GladeBaseEditor *editor,
glade_widget_copy_properties (gchild_new, gchild, TRUE, TRUE);
/* Delete old widget */
list.data = gchild;
glade_command_delete (&list);
glade_base_editor_delegate_delete_child (editor, parent, gchild);
/* Apply packing properties to the new object */
/* Apply packing properties to the new object
*
* No need to use GladeCommand here on the newly created widget,
* they just become the initial state for this object.
*/
l = gchild->packing_properties;
while (l)
{
......
......@@ -1401,7 +1401,7 @@ glade_command_add_execute (GladeCommandAddRemove *me)
glade_widget_show (cdata->widget);
}
glade_app_selection_changed ();
glade_app_queue_selection_changed ();
}
return TRUE;
......@@ -1735,12 +1735,11 @@ glade_command_create(GladeWidgetAdaptor *adaptor, GladeWidget *parent, GladePlac
return NULL;
}
widgets = g_list_prepend(widgets, widget);
glade_command_push_group(_("Create %s"), g_list_length (widgets) == 1 ? widget->name : _("multiple"));
glade_command_push_group(_("Create %s"), widget->name);
glade_command_add(widgets, parent, placeholder, FALSE);
glade_command_pop_group();
if (widgets)
g_list_free(widgets);
g_list_free(widgets);
return widget;
}
......
......@@ -57,6 +57,11 @@ struct _GladeDesignViewPrivate
GtkWidget *layout;
GladeProject *project;
GtkWidget *scrolled_window;
GtkWidget *progress;
GtkWidget *progress_window;
};
static GtkVBoxClass *parent_class = NULL;
......@@ -64,15 +69,53 @@ 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_view_set_project (GladeDesignView *view, GladeProject *project)
{
g_return_if_fail (GLADE_IS_PROJECT (project));
view->priv->project = project;
g_object_set_data (G_OBJECT (view->priv->project), GLADE_DESIGN_VIEW_KEY, 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_object_set_data (G_OBJECT (view->priv->project), GLADE_DESIGN_VIEW_KEY, view);
}
static void
......@@ -112,28 +155,42 @@ glade_design_view_get_property (GObject *object,
static void
glade_design_view_init (GladeDesignView *view)
{
GtkWidget *sw;
GtkWidget *viewport;
GtkWidget *viewport, *filler;
view->priv = GLADE_DESIGN_VIEW_GET_PRIVATE (view);
view->priv->project = NULL;
view->priv->layout = glade_design_layout_new ();
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
view->priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view->priv->scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->priv->scrolled_window),
GTK_SHADOW_IN);
viewport = gtk_viewport_new (NULL, NULL);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (viewport), view->priv->layout);
gtk_container_add (GTK_CONTAINER (sw), viewport);
gtk_container_add (GTK_CONTAINER (view->priv->scrolled_window), viewport);
gtk_widget_show (sw);
gtk_widget_show (view->priv->scrolled_window);