Commit 0d58cab3 authored by Tristan Van Berkom's avatar Tristan Van Berkom

When adding a first project, display the first toplevel in the design


	* gladeui/glade-app.c: When adding a first project, display the
	  first toplevel in the design layout.

	* gladeui/glade-widget.c: Handle glade_widget_show() with unrealized
	  design-view, connect-after the design-view's realize and retry.


svn path=/trunk/; revision=1714
parent 834e1fac
......@@ -16,7 +16,13 @@
* gladeui/glade-base-editor.c: Made sure idle handlers werent
updating treeviews after the object is destroyed (also bug 506713).
* gladeui/glade-app.c: When adding a first project, display the
first toplevel in the design layout.
* gladeui/glade-widget.c: Handle glade_widget_show() with unrealized
design-view, connect-after the design-view's realize and retry.
2008-02-16 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* plugins/gtk+/gtk+.xml.in: ignore GtkWindow::accept-focus.
......
......@@ -944,6 +944,21 @@ glade_app_add_project (GladeProject *project)
glade_app_set_project (project);
/* Select the first window in the project */
if (g_list_length (app->priv->projects) == 1)
{
GList *node;
for (node = glade_project_get_objects (project);
node != NULL;
node = g_list_next (node))
{
GObject *obj = G_OBJECT (node->data);
if (GTK_IS_WINDOW (obj))
glade_widget_show (glade_widget_get_from_gobject (obj));
break;
}
}
/* XXX I think the palette & editor should detect this by itself */
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->palette), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->editor), TRUE);
......
......@@ -2168,6 +2168,19 @@ glade_widget_show (GladeWidget *widget)
{
view = glade_design_view_get_from_project (glade_widget_get_project (widget));
layout = GTK_WIDGET (glade_design_view_get_layout (view));
/* This case causes a black window */
if (layout && !GTK_WIDGET_REALIZED (layout))
{
/* give her a little kick */
g_signal_connect_data (G_OBJECT (layout), "realize",
G_CALLBACK (glade_widget_show), widget,
NULL,
G_CONNECT_AFTER|G_CONNECT_SWAPPED);
return;
}
else if (!layout)
return;
if (gtk_bin_get_child (GTK_BIN (layout)) != NULL)
gtk_container_remove (GTK_CONTAINER (layout), gtk_bin_get_child (GTK_BIN (layout)));
......
......@@ -2548,12 +2548,12 @@ add_project (GladeWindow *window, GladeProject *project)
view = glade_design_view_new (project);
gtk_widget_show (view);
glade_app_add_project (project);
gtk_notebook_append_page (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (view), NULL);
gtk_notebook_set_current_page (GTK_NOTEBOOK (window->priv->notebook), -1);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment