aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-ui-utils.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-04-16 20:29:33 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-16 20:29:33 +0800
commit293340151049a04517bb3741172a1f6750ddeabb (patch)
tree01d57d7d9d310f7254ef7166ef5311d74de64650 /libempathy-gtk/empathy-ui-utils.c
parent5d0a01756d410f44588870dabbed42145f2b765e (diff)
downloadgsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.tar
gsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.tar.gz
gsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.tar.bz2
gsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.tar.lz
gsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.tar.xz
gsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.tar.zst
gsoc2013-empathy-293340151049a04517bb3741172a1f6750ddeabb.zip
Refactor the floating ref hack into a new function
From: Xavier Claessens <xclaesse@gmail.com> svn path=/trunk/; revision=2871
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index a1f4a6bfc..aa3492899 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -166,6 +166,23 @@ empathy_builder_connect (GtkBuilder *gui,
va_end (args);
}
+GtkWidget *
+empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
+ GtkWidget *widget)
+{
+ /* On construction gui sinks the initial reference to widget. When gui
+ * is finalized it will drop its ref to widget. We take our own ref to
+ * prevent widget being finalised. The widget is forced to have a
+ * floating reference, like when it was initially unowned so that it can
+ * be used like any other GtkWidget. */
+
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
+
+ return widget;
+}
+
const gchar *
empathy_icon_name_from_account (McAccount *account)
{