aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-ft-manager.c
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2008-11-22 00:15:39 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-11-22 00:15:39 +0800
commita75883cc0f8cc67287bd50cbde713f9e23872232 (patch)
tree22c3549442db0f6e431abc6c5859cc7046406479 /libempathy-gtk/empathy-ft-manager.c
parentd2e05177b87b3b38345a3535c2afb54528d0d8a2 (diff)
downloadgsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.tar
gsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.tar.gz
gsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.tar.bz2
gsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.tar.lz
gsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.tar.xz
gsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.tar.zst
gsoc2013-empathy-a75883cc0f8cc67287bd50cbde713f9e23872232.zip
Added ability for the ft manager to stay around when closed. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=1766
Diffstat (limited to 'libempathy-gtk/empathy-ft-manager.c')
-rw-r--r--libempathy-gtk/empathy-ft-manager.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/libempathy-gtk/empathy-ft-manager.c b/libempathy-gtk/empathy-ft-manager.c
index 4eeba68f7..20d41ba75 100644
--- a/libempathy-gtk/empathy-ft-manager.c
+++ b/libempathy-gtk/empathy-ft-manager.c
@@ -116,6 +116,8 @@ static void ft_manager_display_accept_dialog (EmpathyFTManager *ft_manager,
G_DEFINE_TYPE (EmpathyFTManager, empathy_ft_manager, G_TYPE_OBJECT);
+static EmpathyFTManager *manager_p = NULL;
+
static void
empathy_ft_manager_class_init (EmpathyFTManagerClass *klass)
{
@@ -154,31 +156,26 @@ empathy_ft_manager_finalize (GObject *object)
g_source_remove (priv->save_geometry_id);
}
- G_OBJECT_CLASS (empathy_ft_manager_parent_class)->finalize (object);
-}
-
-EmpathyFTManager *
-empathy_ft_manager_get_default (void)
-{
- static EmpathyFTManager *manager;
-
- if (!manager)
- manager = empathy_ft_manager_new ();
+ manager_p = NULL;
- return manager;
+ G_OBJECT_CLASS (empathy_ft_manager_parent_class)->finalize (object);
}
/**
- * empathy_ft_manager_new:
+ * empathy_ft_manager_get_default:
*
- * Creates a new #EmpathyFTManager.
+ * Returns a new #EmpathyFTManager if there is not already one, or the existing
+ * one if it exists.
*
- * Returns: a new #EmpathyFTManager
+ * Returns: a #EmpathyFTManager
*/
EmpathyFTManager *
-empathy_ft_manager_new (void)
+empathy_ft_manager_get_default (void)
{
- return g_object_new (EMPATHY_TYPE_FT_MANAGER, NULL);
+ if (!manager_p)
+ manager_p = g_object_new (EMPATHY_TYPE_FT_MANAGER, NULL);
+
+ return manager_p;
}
/**
@@ -674,15 +671,18 @@ ft_manager_delete_event_cb (GtkWidget *widget,
priv = GET_PRIV (ft_manager);
+ ft_manager_clear (ft_manager);
if (g_hash_table_size (priv->file_to_row_ref) == 0) {
DEBUG ("Destroying window");
+ empathy_ft_manager_finalize (G_OBJECT (ft_manager));
+ manager_p = NULL;
return FALSE;
} else {
DEBUG ("Hiding window");
gtk_widget_hide (widget);
- ft_manager_clear (ft_manager);
return TRUE;
}
+
}
static gboolean
@@ -912,12 +912,6 @@ ft_manager_remove_file_from_list (EmpathyFTManager *ft_manager,
}
gtk_tree_row_reference_free (row_ref);
}
-
- if (g_hash_table_size (priv->file_to_row_ref) == 0 &&
- !GTK_WIDGET_VISIBLE (priv->window)) {
- DEBUG ("Destroying window");
- gtk_widget_destroy (priv->window);
- }
}
static void