Commit ea640a6a authored by Johannes Schmid's avatar Johannes Schmid

Merge branch 'master' into signal-tree-model

Conflicts:
	gladeui/Makefile.am
parents b9962332 732c6bba
2010-05-15 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-project.c: Fixed crasher on cross-project copy paste by reordering
the sequence of events in glade_project_add_object().
2010-05-14 Tristan Van Berkom <tvb@gnome.org>
* configure.ac, NEWS: Rolling Glade 3.7.1
* gladeui/glade-widget.c: Added some clarification to the docs of glade_widget_get_children(),
fixed glade_widget_get_children() to not call g_list_append() in a loop.
2010-05-14 Johannes Schmid <jhs@jsschmid.de>
* gladeui/glade-app.c: Allow destruction/recreation of the GladeApp object
* gladeui/glade-signal-editor.[ch]: Some refactoring to make the signal editor
object itself a dockable widget and remove some cruft api (bug 618020)
* gladeui/glade-project.[ch]: Implement GtkTreeModel
* gladeui/glade-base-editor.c, gladeui/glade-editor.c: Adjust for new signal
editor api
* gladeui/glade-inspector.c: Remove duplicate store and use the the GladeProject
as the store directly.
* src/glade-window.c: Removed some code related to old signal editor api cruft.
2010-05-01 Javier Jardón <jjardon@gnome.org>
* gladeui/glade-signal-editor.c: Do not show the event box in signal editor
2010-04-01 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-project.c:
* gladeui/glade-project.c:
- Display GTK+ in caps and always assume GTK+ as a project dependency
(so that empty projects still depend on GTK+ for display purposes).
- Stop showing preferences at project new time (now we have tooltips that tell you this stuff),
......@@ -19,7 +48,7 @@
* src/Makefile.am, src/glade-close-button.[ch]: Using Paolo Borelli's close button code for notebook
tab close buttons.
* src/glade-window.c:
* src/glade-window.c:
- Added option to disable toolbar in View menu and session data (bug 586194).
- Added option to show notebook tabs for open projects also in the View menu and session data.
- Added option to show/hide statusbar in the View menu and session data.
......@@ -27,7 +56,7 @@
* gladeui/glade-palette.c: Made "both" mode use text horizontally again, still get alot of unwanted
ellipsize here.
* gladeui/glade-project.c: Added the targets-changed signal to refresh views with data about
* gladeui/glade-project.c: Added the targets-changed signal to refresh views with data about
target project versions (notebook tabs).
* gladeui/glade-base-editor.c: Fixed to unref in ->dispose() and to unset the loaded widget
......@@ -67,8 +96,8 @@
* gladeui/glade-widget-adaptor.h, gladeui/glade-property-class.h: Added some version checking macros.
* gladeui/glade-signal.[ch]: Add support warning meta data to signals
* gladeui/glade-project.c:
* gladeui/glade-project.c:
- Simplify code with new version checking macros
- Do the verify on signals for widgets as well as project warnings
(update the signals a verify time).
......@@ -122,8 +151,8 @@
to the project.
* gladeui/glade-xml-utils.h: Added "swapped" attribute definition
* gladeui/glade-signal.c: Added "swapped" attribute and read/write from xml, swapped attribute is
* gladeui/glade-signal.c: Added "swapped" attribute and read/write from xml, swapped attribute is
always saved, if its missing on load and user_data (object) is set, we assume a swapped default.
* gladeui/glade-signal-editor.c: Allow toggling "swapped" flag of a signal if user data is set.
......@@ -132,7 +161,7 @@
2010-03-27 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-marshallers.list, gladeui/glade-placeholder.c:
* gladeui/glade-marshallers.list, gladeui/glade-placeholder.c:
Make GladePlaceholder a scrollable widget (hypothetically) to avoid runtime warnings.
* plugins/gtk+/gtk+.xml.in: Disabled "has-separator" of GtkMessageDialog as it ignores the separator
......@@ -140,19 +169,19 @@
* gladeui/glade-project.[ch]: Expose glade_project_get_target_version()
* plugins/gtk+/glade-gtk.c:
* plugins/gtk+/glade-gtk.c:
- check project target gtk+ version to decide initial state
of GtkEntry::buffer.
- Substitute the old manual evaluation with GPC_VERSION_CHECK()
- Avoid critical warnings when setting GtkColorButton properties to NULL
- Avoid critical warnings when setting GtkComboBoxEntry::text-column < 0
- Check for type compatibility before setting cell renderer attributes
- Check for type compatibility before setting cell renderer attributes
- Clear cell renderer attributes before setting liststore column types and resync them after
(Avoids cricital warnings where the underlying data types changed and dont match the properties
of the renderers)
- Fill in the gaps in model data while loading some columns with non serializable types
(fixes severe bug: model data was loaded with missing columns of data).
* gladeui/glade-property-class.h: Created convenience macro GPC_VERSION_CHECK
* gladeui/glade-utils.c: Allow loading of libraries installed in optional non-system prefixes;
......
===========
Glade 3.7.1
===========
- Changed "Close without saving" acelerator key from 'c' to 'w', (Aaron Brown, bug 612538)
- Save Glade files with UTF-8 encoding (Christian Persch, bug 596205)
- Save maximized window state of all windows in session data (Marco Diego Aurélio Mesquita, bug 607670)
- use g_timeout_add_seconds() (Javier Jardón, bug 581255)
- Fixed signal name serialization in GtkBuilder format to use '-' instead of '_' (bug 600031)
- Disable orientation properties completely and disregard them wherever they cause breakage
(Federico Mena Quintero, bug 594231)
- Now print a summery of all missing icons at startup instead of a warning for each missing icon
- Fixed some remaining crashers introduced by recent GSEAL patches
- Integrated GtkToolPalette as the internal implementation of Glade's palette (bug 613956).
- Added tooltip to palette (bug 558983)
- Revamped internal treeview support, less warnings and better refresh of workspace when
editing cell renderer attributes and liststores.
- Glade now loads/saves the "swapped" <signal> attribute.
- Signal editor revamped to now:
o show documentation links
o show warning icons for version mismatches
o edit "swapped" attribute
o edit the user-data object using an object selection dialog.
o now the signal editor is a proper widget-class (Johannes Schmid, bug 618020)
- Disallow adding of non-scrollable widgets to scrolled windows (now an informative
popup comes up instead).
- Fixed hangs in menu/treeview editors (Marco Diego Aurélio Mesquita, bug 609612)
- Changed the old glade-cell-renderer-button for a new activatable pixbuf renderer
glade-cell-renderer-icon.[ch].
- Added support to add GtkActions to GtkActionGroups
- Added support to edit the <accelerator> for an action when in a group.
- Added notebook tabs to the Glade frontend with informative labels (per open project).
- Stop showing preferences dialog at startup time (bug 574095)
- GladeProject now implements GtkTreeModel and GladeInspector view saves lots of code (Johannes Schmid)
- Allow destruction of GladeApp object (Johannes Schmid, bug 618468).
===========
Glade 3.7.0
===========
......
......@@ -4,7 +4,7 @@ AC_PREREQ(2.52)
m4_define(glade_major_version, 3)
m4_define(glade_minor_version, 7)
m4_define(glade_micro_version, 0)
m4_define(glade_micro_version, 1)
m4_define(glade_version, glade_major_version.glade_minor_version.glade_micro_version)
AC_INIT([glade3], [glade_version],
......@@ -52,8 +52,8 @@ AM_PROG_LIBTOOL
# If any interfaces have been added since the last public release, then increment GLADE_AGE.
# If any interfaces have been removed since the last public release, then set GLADE_AGE to 0.
# Reference: http://www.gnu.org/software/libtool/manual.html#Versioning
GLADE_REVISION=3
GLADE_CURRENT=9
GLADE_REVISION=0
GLADE_CURRENT=10
GLADE_AGE=0
GLADE_CURRENT_MINUS_AGE=`expr $GLADE_CURRENT - $GLADE_AGE`
AC_SUBST(GLADE_REVISION)
......@@ -121,7 +121,7 @@ GTK_DOC_CHECK(1.9)
dnl ================================================================
dnl Check for gtk+
dnl ================================================================
PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.19.5 gthread-2.0 libxml-2.0 >= 2.4.0])
PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.20 gthread-2.0 libxml-2.0 >= 2.4.0])
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
......
......@@ -106,6 +106,7 @@ static gchar *pixmaps_dir = NULL;
static gchar *locale_dir = NULL;
static GladeApp *singleton_app = NULL;
static gboolean check_initialised = FALSE;
static void glade_init_check (void);
......@@ -199,8 +200,9 @@ glade_app_finalize (GObject *app)
g_free (modules_dir);
g_free (pixmaps_dir);
g_free (locale_dir);
glade_catalog_destroy_all ();
singleton_app = NULL;
check_initialised = FALSE;
G_OBJECT_CLASS (glade_app_parent_class)->finalize (app);
}
......@@ -396,10 +398,8 @@ build_package_paths (void)
/* initialization function for libgladeui (not GladeApp) */
static void
glade_init_check (void)
{
static gboolean initialised = FALSE;
if (initialised)
{
if (check_initialised)
return;
/* Make sure path accessors work on osx */
......@@ -410,7 +410,7 @@ glade_init_check (void)
bindtextdomain (GETTEXT_PACKAGE, locale_dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
initialised = TRUE;
check_initialised = TRUE;
}
static void
......
......@@ -70,7 +70,7 @@ struct _GladeBaseEditorPrivate
/* Editor UI */
GtkSizeGroup *group;
GtkWidget *paned, *table, *treeview, *main_scroll, *notebook;
GtkWidget *remove_button, *signal_editor_w;
GtkWidget *remove_button;
GladeSignalEditor *signal_editor;
GList *child_types;
......@@ -1782,10 +1782,9 @@ glade_base_editor_init (GladeBaseEditor *editor)
/* Signal Editor */
e->signal_editor = glade_signal_editor_new (NULL);
e->signal_editor_w = glade_signal_editor_get_widget (e->signal_editor);
gtk_widget_show (e->signal_editor_w);
gtk_widget_set_size_request (e->signal_editor_w, -1, 96);
gtk_paned_pack2 (GTK_PANED (paned), e->signal_editor_w, FALSE, FALSE);
gtk_widget_show (GTK_WIDGET(e->signal_editor));
gtk_widget_set_size_request (GTK_WIDGET(e->signal_editor), -1, 96);
gtk_paned_pack2 (GTK_PANED (paned), GTK_WIDGET(e->signal_editor), FALSE, FALSE);
/* Update the treeview on realize event */
g_signal_connect (editor, "realize",
......@@ -2145,9 +2144,9 @@ glade_base_editor_set_show_signal_editor (GladeBaseEditor *editor, gboolean val)
g_return_if_fail (GLADE_IS_BASE_EDITOR (editor));
if (val)
gtk_widget_show (editor->priv->signal_editor_w);
gtk_widget_show (GTK_WIDGET(editor->priv->signal_editor));
else
gtk_widget_hide (editor->priv->signal_editor_w);
gtk_widget_hide (GTK_WIDGET(editor->priv->signal_editor));
}
/* Convenience functions */
......
......@@ -533,6 +533,11 @@ glade_catalog_load_all (void)
gchar **split;
GString *icon_warning = NULL;
gint i;
/* Make sure we don't init the catalogs twice */
if (loaded_catalogs)
return loaded_catalogs;
/* First load catalogs from user specified directories ... */
if ((search_path = g_getenv (GLADE_ENV_CATALOG_PATH)) != NULL)
......@@ -724,7 +729,6 @@ catalog_destroy (GladeCatalog *catalog)
if (catalog->adaptors)
{
/* TODO: free adaptors */
g_list_free (catalog->adaptors);
}
......
......@@ -586,11 +586,11 @@ glade_editor_set_signal_editor (GladeEditor *editor, GladeSignalEditor *signal_e
{
if (editor->signal_editor) {
gtk_container_remove (GTK_CONTAINER (editor->page_signals),
glade_signal_editor_get_widget (editor->signal_editor));
GTK_WIDGET(editor->signal_editor));
}
editor->signal_editor = signal_editor;
gtk_container_add (GTK_CONTAINER (editor->page_signals),
glade_signal_editor_get_widget (editor->signal_editor));
GTK_WIDGET(editor->signal_editor));
}
static void
......@@ -599,7 +599,7 @@ glade_editor_load_signal_page (GladeEditor *editor)
if (editor->signal_editor == NULL) {
editor->signal_editor = glade_signal_editor_new ((gpointer) editor);
gtk_container_add (GTK_CONTAINER (editor->page_signals),
glade_signal_editor_get_widget (editor->signal_editor));
GTK_WIDGET(editor->signal_editor));
}
}
......
This diff is collapsed.
......@@ -604,9 +604,9 @@ glade_palette_new_item_group (GladePalette *palette, GladeWidgetGroup *group)
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
item_group = (GtkWidget *)g_object_new (GTK_TYPE_TOOL_ITEM_GROUP,
"label-widget", label,
NULL);
item_group = gtk_tool_item_group_new ("");
gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (item_group),
label);
/* Tell the item group to ellipsize our custom label for us */
gtk_tool_item_group_set_ellipsize (GTK_TOOL_ITEM_GROUP (item_group),
......
......@@ -94,9 +94,8 @@ struct _GladeProjectPrivate
* requested
*/
GList *objects; /* A list of #GObjects that make up this project.
* The objects are stored in no particular order.
*/
GList *tree; /* List of toplevel Objects in this projects */
GList *objects; /* List of all objects in this project */
GList *selection; /* We need to keep the selection in the project
* because we have multiple projects and when the
......@@ -212,8 +211,15 @@ static guint glade_project_signals[LAST_SIGNAL] = {0};
static GladeIDAllocator *unsaved_number_allocator = NULL;
static void gtk_tree_model_iface_init (GtkTreeModelIface* iface);
static void glade_project_model_get_iter_for_object (GladeProject* project,
GObject* object,
GtkTreeIter* iter);
G_DEFINE_TYPE (GladeProject, glade_project, G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_CODE (GladeProject, glade_project, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
gtk_tree_model_iface_init))
/*******************************************************************
GObjectClass
......@@ -243,7 +249,7 @@ static void
glade_project_dispose (GObject *object)
{
GladeProject *project = GLADE_PROJECT (object);
GList *list;
GList *list;
GladeWidget *gwidget;
GladeProperty *property;
......@@ -285,6 +291,10 @@ glade_project_dispose (GObject *object)
g_object_unref (G_OBJECT (list->data)); /* Remove the GladeProject reference */
g_object_unref (G_OBJECT (gwidget)); /* Remove the overall "Glade" reference */
}
g_list_free (list);
g_list_free (project->priv->objects);
g_list_free (project->priv->tree);
project->priv->tree = NULL;
project->priv->objects = NULL;
G_OBJECT_CLASS (glade_project_parent_class)->dispose (object);
......@@ -589,7 +599,8 @@ glade_project_init (GladeProject *project)
priv->path = NULL;
priv->instance_count = 0;
priv->readonly = FALSE;
priv->objects = NULL;
priv->tree = NULL;
priv->toplevels = NULL;
priv->selection = NULL;
priv->has_selection = FALSE;
priv->undo_stack = NULL;
......@@ -1312,6 +1323,7 @@ glade_project_load_from_file (GladeProject *project, const gchar *path)
gboolean has_gtk_dep = FALSE;
project->priv->selection = NULL;
project->priv->toplevels = NULL;
project->priv->objects = NULL;
project->priv->loading = TRUE;
......@@ -1363,7 +1375,9 @@ glade_project_load_from_file (GladeProject *project, const gchar *path)
continue;
if ((widget = glade_widget_read (project, NULL, node, NULL)) != NULL)
{
glade_project_add_object (project, NULL, widget->object);
}
}
if (!has_gtk_dep)
......@@ -2387,12 +2401,12 @@ glade_project_get_widget_by_name (GladeProject *project, GladeWidget *ancestor,
}
/* Now try searching in only toplevel objects... */
for (list = project->priv->objects; list; list = list->next) {
for (list = project->priv->tree; list; list = list->next) {
GladeWidget *widget;
widget = glade_widget_get_from_gobject (list->data);
g_assert (widget->name);
if (widget->parent == NULL && strcmp (widget->name, name) == 0)
if (strcmp (widget->name, name) == 0)
return widget;
}
......@@ -2644,6 +2658,8 @@ glade_project_add_object (GladeProject *project,
GladeWidget *gwidget;
GList *list, *children;
gchar *name;
GtkTreeIter iter;
GtkTreePath *path;
g_return_if_fail (GLADE_IS_PROJECT (project));
g_return_if_fail (G_IS_OBJECT (object));
......@@ -2658,19 +2674,7 @@ glade_project_add_object (GladeProject *project,
*/
if ((gwidget = glade_widget_get_from_gobject (object)) == NULL)
return;
/* Dont add widgets that are already in the project */
if (glade_project_has_object (project, object))
return;
if (old_project &&
glade_project_has_object (old_project, object))
{
g_critical ("Trying to add object %s to a project but its already in another project",
gwidget->name);
return;
}
/* set the project */
if (gwidget->project != project)
glade_widget_set_project (gwidget, project);
......@@ -2696,8 +2700,33 @@ glade_project_add_object (GladeProject *project,
glade_project_reserve_widget_name (project, gwidget, gwidget->name);
if ((children = glade_widget_adaptor_get_children
(gwidget->adaptor, gwidget->object)) != NULL)
glade_widget_set_project (gwidget, (gpointer)project);
g_object_ref (object);
if (glade_widget_get_parent (gwidget) == NULL)
{
project->priv->tree = g_list_insert_sorted (project->priv->tree, object,
(GCompareFunc)sort_project_dependancies);
}
/* Be sure to update the list before emitting signals */
project->priv->objects = g_list_prepend (project->priv->objects,
object);
if (!project->priv->loading)
{
glade_project_model_get_iter_for_object (project, object, &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (project), &iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (project), path, &iter);
}
/* NOTE: Sensitive ordering here, we need to recurse after updating
* the tree model listeners (and update those listeners after our
* internal lists have been resolved), otherwise children are added
* before the parents (and the views dont like that).
*/
if ((children = glade_widget_get_children (gwidget)) != NULL)
{
for (list = children; list && list->data; list = list->next)
glade_project_add_object
......@@ -2705,20 +2734,12 @@ glade_project_add_object (GladeProject *project,
g_list_free (children);
}
glade_widget_set_project (gwidget, (gpointer)project);
if (!gwidget->parent)
project->priv->objects = g_list_insert_sorted (project->priv->objects, g_object_ref (object),
(GCompareFunc)sort_project_dependancies);
else
project->priv->objects = g_list_append (project->priv->objects, g_object_ref (object));
/* Update user visible compatability info */
glade_project_verify_properties (gwidget);
g_signal_emit (G_OBJECT (project),
glade_project_signals [ADD_WIDGET],
0, gwidget);
/* Update user visible compatability info */
glade_project_verify_properties (gwidget);
}
/**
......@@ -2752,7 +2773,9 @@ void
glade_project_remove_object (GladeProject *project, GObject *object)
{
GladeWidget *gwidget;
GList *link, *list, *children;
GList *list, *children;
GtkTreeIter* iter;
GtkTreePath* path;
g_return_if_fail (GLADE_IS_PROJECT (project));
g_return_if_fail (G_IS_OBJECT (object));
......@@ -2774,17 +2797,33 @@ glade_project_remove_object (GladeProject *project, GObject *object)
glade_project_selection_remove (project, object, TRUE);
if ((link = g_list_find (project->priv->objects, object)) != NULL)
project->priv->objects = g_list_remove (project->priv->objects, object);
iter = glade_util_find_iter_by_widget (GTK_TREE_MODEL (project), gwidget,
GLADE_PROJECT_MODEL_COLUMN_OBJECT);
if (iter)
{
GList *link = g_list_find (project->priv->tree, object);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (project),
iter);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (project),
path);
g_object_unref (object);
glade_project_release_widget_name (project, gwidget,
glade_widget_get_name (gwidget));
project->priv->objects = g_list_delete_link (project->priv->objects, link);
if (link)
{
project->priv->tree = g_list_delete_link (project->priv->tree, link);
}
g_signal_emit (G_OBJECT (project),
glade_project_signals [REMOVE_WIDGET],
0,
gwidget);
gtk_tree_iter_free (iter);
}
}
......@@ -2795,19 +2834,15 @@ adjust_naming_policy (GladeProject *project,
GList *list, *objects;
GladeWidget *widget;
objects = g_list_copy (project->priv->objects);
objects = project->priv->tree;
/* Remove all toplevels (recursive operation) */
for (list = objects; list; list = list->next)
{
widget = glade_widget_get_from_gobject (list->data);
if (!widget->parent)
{
g_object_ref (widget->object);
g_object_ref (widget);
glade_project_remove_object (project, widget->object);
}
g_object_ref (widget->object);
g_object_ref (widget);
glade_project_remove_object (project, widget->object);
}
project->priv->naming_policy = policy;
......@@ -2815,13 +2850,9 @@ adjust_naming_policy (GladeProject *project,
/* Put the toplevels back with the new policy (recursive operation) */
for (list = objects; list; list = list->next)
{
widget = glade_widget_get_from_gobject (list->data);
if (!widget->parent)
{
glade_project_add_object (project, project, widget->object);
g_object_unref (widget->object);
g_object_unref (widget);
}
glade_project_add_object (project, project, widget->object);
g_object_unref (widget->object);
g_object_unref (widget);
}
g_list_free (objects);
......@@ -3493,11 +3524,17 @@ glade_project_get_file_mtime (GladeProject *project)
return project->priv->mtime;
}
/**
* glade_projects_get_objects:
* @project: a GladeProject
*
* Returns: List of all objects in this project
*/
const GList *
glade_project_get_objects (GladeProject *project)
{
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
return project->priv->objects;
}
......@@ -4207,3 +4244,349 @@ glade_project_display_dependencies (GladeProject *project)
return g_string_free (string, FALSE);
}
/* GtkTreeModel implementation */
static void
glade_project_model_get_iter_for_object (GladeProject* project,
GObject* object,
GtkTreeIter* iter)
{
/* Is this unique??? */
iter->stamp = GPOINTER_TO_INT (object);
iter->user_data = object;
}
static GtkTreeModelFlags
glade_project_model_get_flags (GtkTreeModel* model)
{
return 0;
}
static gint
glade_project_model_get_n_columns (GtkTreeModel* model)
{
return GLADE_PROJECT_MODEL_N_COLUMNS;
}
static GType
glade_project_model_get_column_type (GtkTreeModel* model,
gint column)
{
switch (column)
{
case GLADE_PROJECT_MODEL_COLUMN_ICON_NAME:
return G_TYPE_STRING;
case GLADE_PROJECT_MODEL_COLUMN_NAME:
return G_TYPE_STRING;
case GLADE_PROJECT_MODEL_COLUMN_TYPE_NAME:
return G_TYPE_STRING;
case GLADE_PROJECT_MODEL_COLUMN_OBJECT:
return G_TYPE_OBJECT;
default:
g_assert_not_reached();
return G_TYPE_NONE;
}
}
static gboolean
glade_project_model_get_iter (GtkTreeModel* model,
GtkTreeIter* iter,
GtkTreePath* path)
{
GladeProject* project = GLADE_PROJECT (model);
gint* indices = gtk_tree_path_get_indices (path);
gint depth = gtk_tree_path_get_depth (path);
GladeWidget* widget;
GObject* object;
gint i;
GList* parent;
if ((parent = g_list_nth (project->priv->tree, indices[0])) != NULL)
{
object = parent->data;
widget = glade_widget_get_from_gobject (object);
}
else
return FALSE;
for (i = 1; i < depth; i++)
{
GList* children = glade_widget_get_children (widget);
GList* node;
if (!children)
return FALSE;
node = g_list_nth (children, indices[i]);
if (node)
{
object = G_OBJECT (node->data);
}
g_list_free (children);
if (!node)
return FALSE;
widget =
glade_widget_get_from_gobject (object);
}
glade_project_model_get_iter_for_object (project,
object,
iter);
return TRUE;
}
static GtkTreePath*
glade_project_model_get_path (GtkTreeModel* model,
GtkTreeIter* iter)
{
GladeProject* project = GLADE_PROJECT (model);
GtkTreePath* path = gtk_tree_path_new ();
GObject* object = iter->user_data;
GladeWidget* widget = glade_widget_get_from_gobject (object);
GladeWidget* toplevel = glade_widget_get_toplevel (widget);
GladeWidget* parent = widget;
GList* top;
while ((parent = glade_widget_get_parent (widget)) != NULL)
{
GList* children = glade_widget_get_children (parent);
GList* child = g_list_find (children, glade_widget_get_object (widget));
g_assert (child != NULL);
gtk_tree_path_prepend_index (path,
g_list_position (children, child));
g_list_free (children);
widget = parent;
}
/* Get the index for the top-level list */
top = g_list_find (project->priv->tree,
glade_widget_get_object (toplevel));
g_assert (top != NULL);
gtk_tree_path_prepend_index (path, g_list_position (project->priv->tree,
top));
return path;
}
static void
glade_project_model_get_value (GtkTreeModel* model,
GtkTreeIter* iter,
gint column,
GValue* value)
{
GObject* object = iter->user_data;
GladeWidget* widget = glade_widget_get_from_gobject (object);
gchar* icon_name;
value = g_value_init (value,
glade_project_model_get_column_type (model, column));
switch (column)
{
case GLADE_PROJECT_MODEL_COLUMN_ICON_NAME:
g_object_get (widget->adaptor, "icon-name", &icon_name, NULL);
g_value_take_string (value, icon_name);
break;
case GLADE_PROJECT_MODEL_COLUMN_NAME:
g_value_set_string (value,
glade_widget_get_name (widget));