Commit 29f75fee authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

GladeGtk*: always use connect_object() for parse-finished signal

This ensures the signal will get disconnected if object is finalized.
parent 7acdd3c6
......@@ -44,27 +44,26 @@ glade_gtk_action_bar_create_editable (GladeWidgetAdaptor * adaptor,
}
static void
glade_gtk_action_bar_parse_finished (GladeProject * project,
GObject * object)
glade_gtk_action_bar_parse_finished (GladeProject *project, GObject *object)
{
GladeWidget *gbox;
gbox = glade_widget_get_from_gobject (object);
glade_widget_property_set (gbox, "use-center-child", gtk_action_bar_get_center_widget (GTK_ACTION_BAR (object)) != NULL);
GladeWidget *gbox = glade_widget_get_from_gobject (object);
glade_widget_property_set (gbox, "use-center-child",
gtk_action_bar_get_center_widget (GTK_ACTION_BAR (object)) != NULL);
}
void
glade_gtk_action_bar_post_create (GladeWidgetAdaptor * adaptor,
GObject * container,
GladeCreateReason reason)
glade_gtk_action_bar_post_create (GladeWidgetAdaptor *adaptor,
GObject *container,
GladeCreateReason reason)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (container);
GladeProject *project = glade_widget_get_project (gwidget);
if (reason == GLADE_CREATE_LOAD)
g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_gtk_action_bar_parse_finished),
container);
if (glade_project_is_loading (project))
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_action_bar_parse_finished),
container,
0);
}
static gint
......
......@@ -201,11 +201,12 @@ glade_gtk_assistant_post_create (GladeWidgetAdaptor *adaptor,
/* Chain Up first */
GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_WINDOW)->post_create (adaptor, object, reason);
if (reason == GLADE_CREATE_LOAD)
if (glade_project_is_loading (project))
{
g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_gtk_assistant_parse_finished),
object);
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_assistant_parse_finished),
object,
0);
}
else if (reason == GLADE_CREATE_USER)
{
......
......@@ -269,9 +269,9 @@ glade_gtk_cell_renderer_write_widget (GladeWidgetAdaptor *adaptor,
}
static void
glade_gtk_cell_renderer_parse_finished (GladeProject *project,
GladeWidget *widget)
glade_gtk_cell_renderer_parse_finished (GladeProject *project, GObject *object)
{
GladeWidget *widget = glade_widget_get_from_gobject (object);
GladeProperty *property;
GList *l;
static gint attr_len = 0, use_attr_len = 0;
......@@ -321,9 +321,10 @@ glade_gtk_cell_renderer_read_widget (GladeWidgetAdaptor *adaptor,
/* First chain up and read in all the properties... */
GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (G_TYPE_OBJECT)->read_widget (adaptor, widget, node);
g_signal_connect (glade_widget_get_project (widget), "parse-finished",
G_CALLBACK (glade_gtk_cell_renderer_parse_finished),
widget);
g_signal_connect_object (glade_widget_get_project (widget), "parse-finished",
G_CALLBACK (glade_gtk_cell_renderer_parse_finished),
glade_widget_get_object (widget),
0);
}
static gboolean
......
......@@ -199,6 +199,7 @@ glade_gtk_grid_post_create (GladeWidgetAdaptor *adaptor,
GladeCreateReason reason)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (container);
GladeProject *project = glade_widget_get_project (gwidget);
g_signal_connect (G_OBJECT (gwidget), "configure-child",
G_CALLBACK (glade_gtk_grid_configure_child), container);
......@@ -209,10 +210,11 @@ glade_gtk_grid_post_create (GladeWidgetAdaptor *adaptor,
g_signal_connect (G_OBJECT (gwidget), "configure-end",
G_CALLBACK (glade_gtk_grid_configure_end), container);
if (reason == GLADE_CREATE_LOAD)
g_signal_connect (glade_widget_get_project (gwidget), "parse-finished",
G_CALLBACK (glade_gtk_grid_parse_finished),
container);
if (glade_project_is_loading (project))
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_grid_parse_finished),
container,
0);
}
void
......
......@@ -70,9 +70,7 @@ static void
glade_gtk_header_bar_parse_finished (GladeProject *project,
GObject *object)
{
GladeWidget *gbox;
gbox = glade_widget_get_from_gobject (object);
GladeWidget *gbox = glade_widget_get_from_gobject (object);
glade_widget_property_set (gbox, "size", glade_gtk_header_bar_get_num_children (object));
glade_widget_property_set (gbox, "use-custom-title", gtk_header_bar_get_custom_title (GTK_HEADER_BAR (object)) != NULL);
}
......@@ -85,11 +83,12 @@ glade_gtk_header_bar_post_create (GladeWidgetAdaptor *adaptor,
GladeWidget *parent = glade_widget_get_from_gobject (container);
GladeProject *project = glade_widget_get_project (parent);
if (reason == GLADE_CREATE_LOAD)
if (glade_project_is_loading (project))
{
g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_gtk_header_bar_parse_finished),
container);
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_header_bar_parse_finished),
container,
0);
}
else if (reason == GLADE_CREATE_USER)
{
......
......@@ -139,9 +139,9 @@ glade_gtk_image_menu_item_set_property (GladeWidgetAdaptor *adaptor,
}
static void
glade_gtk_image_menu_item_parse_finished (GladeProject *project,
GladeWidget *widget)
glade_gtk_image_menu_item_parse_finished (GladeProject *project, GObject *object)
{
GladeWidget *widget = glade_widget_get_from_gobject (object);
GladeWidget *gimage;
GtkWidget *image = NULL;
glade_widget_property_get (widget, "image", &image);
......@@ -181,11 +181,11 @@ glade_gtk_image_menu_item_read_widget (GladeWidgetAdaptor *adaptor,
property = glade_widget_get_property (widget, "use-stock");
glade_property_sync (property);
/* Run this after the load so that image is resolved. */
g_signal_connect (G_OBJECT (glade_widget_get_project (widget)), "parse-finished",
G_CALLBACK (glade_gtk_image_menu_item_parse_finished),
widget);
g_signal_connect_object (glade_widget_get_project (widget), "parse-finished",
G_CALLBACK (glade_gtk_image_menu_item_parse_finished),
glade_widget_get_object (widget),
0);
}
......
......@@ -171,25 +171,27 @@ glade_listbox_get_placeholder (GtkListBox *list_box) {
}
static void
glade_gtk_listbox_parse_finished (GladeProject *project, GladeWidget *gbox)
glade_gtk_listbox_parse_finished (GladeProject *project, GObject *box)
{
GObject *box = glade_widget_get_object (gbox);
glade_widget_property_set (gbox, "use-placeholder", glade_listbox_get_placeholder (GTK_LIST_BOX (box)) != NULL);
GladeWidget *gbox = glade_widget_get_from_gobject (box);
glade_widget_property_set (gbox, "use-placeholder",
glade_listbox_get_placeholder (GTK_LIST_BOX (box)) != NULL);
}
void
glade_gtk_listbox_post_create (GladeWidgetAdaptor *adaptor,
GObject *container,
GladeCreateReason reason)
GObject *container,
GladeCreateReason reason)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (container);
GladeProject *project = glade_widget_get_project (gwidget);
if (reason == GLADE_CREATE_LOAD)
if (glade_project_is_loading (project))
{
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_listbox_parse_finished),
gwidget, 0);
container,
0);
}
}
......
......@@ -414,10 +414,11 @@ glade_gtk_notebook_post_create (GladeWidgetAdaptor *adaptor,
g_signal_connect (G_OBJECT (notebook), "switch-page",
G_CALLBACK (glade_gtk_notebook_switch_page), NULL);
if (reason == GLADE_CREATE_LOAD)
g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_gtk_notebook_parse_finished),
notebook);
if (glade_project_is_loading (project))
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_notebook_parse_finished),
notebook,
0);
}
static gint
......
......@@ -167,10 +167,11 @@ glade_gtk_popover_menu_post_create (GladeWidgetAdaptor *adaptor,
GladeWidget *parent = glade_widget_get_from_gobject (container);
GladeProject *project = glade_widget_get_project (parent);
if (reason == GLADE_CREATE_LOAD)
g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_gtk_popover_menu_parse_finished),
container);
if (glade_project_is_loading (project))
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_popover_menu_parse_finished),
container,
0);
g_signal_connect (G_OBJECT (parent), "notify::project",
G_CALLBACK (glade_gtk_popover_menu_project_changed), NULL);
......
......@@ -157,9 +157,9 @@ glade_gtk_tool_button_set_property (GladeWidgetAdaptor *adaptor,
}
static void
glade_gtk_tool_button_parse_finished (GladeProject *project,
GladeWidget *widget)
glade_gtk_tool_button_parse_finished (GladeProject *project, GObject *object)
{
GladeWidget *widget = glade_widget_get_from_gobject (object);
gchar *stock_str = NULL, *icon_name = NULL;
gint stock_id = 0;
GtkWidget *label_widget = NULL, *image_widget = NULL;
......@@ -207,7 +207,8 @@ glade_gtk_tool_button_read_widget (GladeWidgetAdaptor *adaptor,
GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_TOOL_ITEM)->read_widget (adaptor, widget, node);
/* Run this after the load so that icon-widget is resolved. */
g_signal_connect (glade_widget_get_project (widget),
"parse-finished",
G_CALLBACK (glade_gtk_tool_button_parse_finished), widget);
g_signal_connect_object (glade_widget_get_project (widget), "parse-finished",
G_CALLBACK (glade_gtk_tool_button_parse_finished),
glade_widget_get_object (widget),
0);
}
......@@ -71,9 +71,9 @@ glade_gtk_tool_item_group_remove_child (GladeWidgetAdaptor *adaptor,
}
static void
glade_gtk_tool_item_group_parse_finished (GladeProject *project,
GladeWidget *widget)
glade_gtk_tool_item_group_parse_finished (GladeProject *project, GObject *object)
{
GladeWidget *widget = glade_widget_get_from_gobject (object);
GtkWidget *label_widget = NULL;
glade_widget_property_get (widget, "label-widget", &label_widget);
......@@ -97,9 +97,11 @@ glade_gtk_tool_item_group_read_widget (GladeWidgetAdaptor *adaptor,
GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_TOOL_ITEM)->read_widget (adaptor, widget, node);
/* Run this after the load so that icon-widget is resolved. */
g_signal_connect (glade_widget_get_project (widget),
"parse-finished",
G_CALLBACK (glade_gtk_tool_item_group_parse_finished), widget);
g_signal_connect_object (glade_widget_get_project (widget),
"parse-finished",
G_CALLBACK (glade_gtk_tool_item_group_parse_finished),
glade_widget_get_object (widget),
0);
}
static void
......
......@@ -84,9 +84,10 @@ glade_gtk_window_post_create (GladeWidgetAdaptor *adaptor,
if (reason == GLADE_CREATE_LOAD)
{
g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_gtk_window_parse_finished),
object);
g_signal_connect_object (project, "parse-finished",
G_CALLBACK (glade_gtk_window_parse_finished),
object,
0);
}
else if (reason == GLADE_CREATE_USER &&
gtk_bin_get_child (GTK_BIN (object)) == NULL)
......
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