diff options
Diffstat (limited to 'libempathy-gtk/empathy-ft-manager.c')
-rw-r--r-- | libempathy-gtk/empathy-ft-manager.c | 40 |
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 |