diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-11-15 04:32:46 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-11-15 04:32:46 +0800 |
commit | 4f5782221ff72c0f9bf2066fe88aadadfb9c0c5b (patch) | |
tree | 403ba09391610f38fcacb7af6d85fbc8355e5717 /shell | |
parent | c2effba7cf78ed636248da4c45ceefc2df52261b (diff) | |
download | gsoc2013-evolution-4f5782221ff72c0f9bf2066fe88aadadfb9c0c5b.tar.gz gsoc2013-evolution-4f5782221ff72c0f9bf2066fe88aadadfb9c0c5b.tar.zst gsoc2013-evolution-4f5782221ff72c0f9bf2066fe88aadadfb9c0c5b.zip |
Removed. (no_views_left_cb): Use g_object_add_weak_pointer() instad of
* main.c (quit_box_destroyed_callback): Removed.
(no_views_left_cb): Use g_object_add_weak_pointer() instad of
connecting to the "destroy" signal.
(destroy_cb): Removed.
(shell_weak_notify): New.
(idle_cb): Use g_object_weak_ref() on the shell object instead of
connecting to the "destroy" signal.
* evolution-test-component.c (dialog_destroy_callback): Removed.
(dialog_weak_notify): New.
(create_new_folder_selector): Use g_object_weak_ref() on the
dialog instead of connecting the "destroy" signal.
* e-shortcuts.c (view_destroyed_cb): Removed.
(view_weak_notify): New.
(e_shortcuts_new_view): g_object_weak_ref() the new view instead
of connecting the "destroy" signal.
(impl_dispose): Free the ->views and g_object_weak_unref() all the
items.
* e-shell.c (view_destroy_cb): Removed.
(view_weak_notify): New.
(create_view): Use g_object_weak_ref() on the newly created view
instead of connecting to the "destroy" signal.
(impl_dispose): g_object_weak_unref() the views.
(e_shell_show_settings): Use g_object_add_weak_pointer() on the
settings_dialog instead of connecting to the "destroy" signal.
(settings_dialog_destroy_cb): Removed.
* e-shell-shared-folder-picker-dialog.c
(progress_bar_weak_notify): New.
(progress_bar_destroy_callback): Removed.
(create_progress_dialog): Use g_object_weak_ref() on the progress
bar object instead of connecting to its "destroy" signal.
(shell_destroy_callback): Removed.
(shell_view_destroy_callback): Removed.
(storage_destroy_callback): Removed.
(shell_weak_notify): New.
(shell_view_weak_notify): New.
(storage_weak_notify): New.
(discover_folder): Use g_object_weak_ref() on the shell, parent,
storage objects instead of connecting to their "destroy" signals.
* e-shell-importer.c: Removed member destroyed from
ImporterComponentData.
(import_cb): Instead of checking if ->destroyed is TRUE, check if
->dialog is NULL to decide whether the dialog has been destroyed
or not.
(dialog_destroy_cb): Removed.
(start_import): Use g_object_weak_ref() on the dialog object
instead of connecting to its "destroy" signal.
(dialog_close): Removed.
(dialog_weak_notify): New.
(show_import_wizard): Use g_object_weak_ref() on the dialog object
instead of connecting to its "destroy" signal.
(import_druid_destroy): New.
(import_druid_weak_notify): New.
(show_import_wizard): Use g_object_weak_ref() on the druid object
instead of connecting to its "destroy" signal.
* e-shell-folder-selection-dialog.c
(e_shell_folder_selection_dialog_construct): g_object_weak_ref()
the shell object instead of connecting to its "destroy" signal.
* e-shell-folder-creation-dialog.c (dialog_destroy_cb): Removed.
(dialog_destroy_notify): New.
(e_shell_show_folder_creation_dialog): g_object_weak_ref() the
dialog instead of connecting to its "destroy" signal.
(shell_destroy_cb): Removed.
(shell_destroy_notify): New.
(e_shell_show_folder_creation_dialog): g_object_weak_ref() the
shell object instead of connecting to its "destroy" signal.
* e-shell-config-offline.c (config_control_destroy_callback):
Removed.
(config_control_destroy_notify): New.
(e_shell_config_offline_create_widget): g_object_weak_ref() the
config_control instead of connecting to its "destroy" signal.
* e-shell-config-default-folders.c
(config_control_destroy_callback): Removed.
(config_control_destroy_notify): New.
(e_shell_config_default_folders_create_widget):
g_object_weak_ref() instead of connecting to the "destroy" signal.
* e-shell-config-autocompletion.c (config_control_destroy_notify):
New.
(config_control_destroy_callback): Removed.
(e_shell_config_autocompletion_create_widget):
g_object_weak_ref() instead of connecting to the "destroy" signal.
* e-activity-handler.c (task_bar_destroy_cb): Removed.
(task_bar_destroy_notify): New.
(e_activity_handler_attach_task_bar): Weak_ref the task_bar using
task_bar_destroy_notify.
(impl_dispose): Weak_unref the task bars in priv->task_bars.
svn path=/trunk/; revision=18756
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 99 | ||||
-rw-r--r-- | shell/e-activity-handler.c | 18 | ||||
-rw-r--r-- | shell/e-shell-config-autocompletion.c | 10 | ||||
-rw-r--r-- | shell/e-shell-config-default-folders.c | 10 | ||||
-rw-r--r-- | shell/e-shell-config-offline.c | 8 | ||||
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 25 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.c | 6 | ||||
-rw-r--r-- | shell/e-shell-importer.c | 39 | ||||
-rw-r--r-- | shell/e-shell-shared-folder-picker-dialog.c | 35 | ||||
-rw-r--r-- | shell/e-shell-startup-wizard.c | 2 | ||||
-rw-r--r-- | shell/e-shell.c | 34 | ||||
-rw-r--r-- | shell/e-shortcuts.c | 14 | ||||
-rw-r--r-- | shell/evolution-test-component.c | 7 | ||||
-rw-r--r-- | shell/main.c | 21 |
14 files changed, 197 insertions, 131 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index e13943aaf2..89f67988a5 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,102 @@ +2002-11-14 Ettore Perazzoli <ettore@ximian.com> + + * main.c (quit_box_destroyed_callback): Removed. + (no_views_left_cb): Use g_object_add_weak_pointer() instad of + connecting to the "destroy" signal. + (destroy_cb): Removed. + (shell_weak_notify): New. + (idle_cb): Use g_object_weak_ref() on the shell object instead of + connecting to the "destroy" signal. + + * evolution-test-component.c (dialog_destroy_callback): Removed. + (dialog_weak_notify): New. + (create_new_folder_selector): Use g_object_weak_ref() on the + dialog instead of connecting the "destroy" signal. + + * e-shortcuts.c (view_destroyed_cb): Removed. + (view_weak_notify): New. + (e_shortcuts_new_view): g_object_weak_ref() the new view instead + of connecting the "destroy" signal. + (impl_dispose): Free the ->views and g_object_weak_unref() all the + items. + + * e-shell.c (view_destroy_cb): Removed. + (view_weak_notify): New. + (create_view): Use g_object_weak_ref() on the newly created view + instead of connecting to the "destroy" signal. + (impl_dispose): g_object_weak_unref() the views. + (e_shell_show_settings): Use g_object_add_weak_pointer() on the + settings_dialog instead of connecting to the "destroy" signal. + (settings_dialog_destroy_cb): Removed. + + * e-shell-shared-folder-picker-dialog.c + (progress_bar_weak_notify): New. + (progress_bar_destroy_callback): Removed. + (create_progress_dialog): Use g_object_weak_ref() on the progress + bar object instead of connecting to its "destroy" signal. + (shell_destroy_callback): Removed. + (shell_view_destroy_callback): Removed. + (storage_destroy_callback): Removed. + (shell_weak_notify): New. + (shell_view_weak_notify): New. + (storage_weak_notify): New. + (discover_folder): Use g_object_weak_ref() on the shell, parent, + storage objects instead of connecting to their "destroy" signals. + + * e-shell-importer.c: Removed member destroyed from + ImporterComponentData. + (import_cb): Instead of checking if ->destroyed is TRUE, check if + ->dialog is NULL to decide whether the dialog has been destroyed + or not. + (dialog_destroy_cb): Removed. + (start_import): Use g_object_weak_ref() on the dialog object + instead of connecting to its "destroy" signal. + (dialog_close): Removed. + (dialog_weak_notify): New. + (show_import_wizard): Use g_object_weak_ref() on the dialog object + instead of connecting to its "destroy" signal. + (import_druid_destroy): New. + (import_druid_weak_notify): New. + (show_import_wizard): Use g_object_weak_ref() on the druid object + instead of connecting to its "destroy" signal. + + * e-shell-folder-selection-dialog.c + (e_shell_folder_selection_dialog_construct): g_object_weak_ref() + the shell object instead of connecting to its "destroy" signal. + + * e-shell-folder-creation-dialog.c (dialog_destroy_cb): Removed. + (dialog_destroy_notify): New. + (e_shell_show_folder_creation_dialog): g_object_weak_ref() the + dialog instead of connecting to its "destroy" signal. + (shell_destroy_cb): Removed. + (shell_destroy_notify): New. + (e_shell_show_folder_creation_dialog): g_object_weak_ref() the + shell object instead of connecting to its "destroy" signal. + + * e-shell-config-offline.c (config_control_destroy_callback): + Removed. + (config_control_destroy_notify): New. + (e_shell_config_offline_create_widget): g_object_weak_ref() the + config_control instead of connecting to its "destroy" signal. + + * e-shell-config-default-folders.c + (config_control_destroy_callback): Removed. + (config_control_destroy_notify): New. + (e_shell_config_default_folders_create_widget): + g_object_weak_ref() instead of connecting to the "destroy" signal. + + * e-shell-config-autocompletion.c (config_control_destroy_notify): + New. + (config_control_destroy_callback): Removed. + (e_shell_config_autocompletion_create_widget): + g_object_weak_ref() instead of connecting to the "destroy" signal. + + * e-activity-handler.c (task_bar_destroy_cb): Removed. + (task_bar_destroy_notify): New. + (e_activity_handler_attach_task_bar): Weak_ref the task_bar using + task_bar_destroy_notify. + (impl_dispose): Weak_unref the task bars in priv->task_bars. + 2002-11-13 Ettore Perazzoli <ettore@ximian.com> * e-shell-startup-wizard.c: Change type of member etd in diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c index aab5216e69..b85f9cb06b 100644 --- a/shell/e-activity-handler.c +++ b/shell/e-activity-handler.c @@ -308,19 +308,16 @@ setup_task_bar (EActivityHandler *activity_handler, } static void -task_bar_destroy_callback (GtkObject *task_bar_object, - void *data) +task_bar_destroy_notify (void *data, + GObject *task_bar_instance) { - ETaskBar *task_bar; EActivityHandler *activity_handler; EActivityHandlerPrivate *priv; - task_bar = E_TASK_BAR (task_bar_object); - activity_handler = E_ACTIVITY_HANDLER (data); priv = activity_handler->priv; - priv->task_bars = g_slist_remove (priv->task_bars, task_bar); + priv->task_bars = g_slist_remove (priv->task_bars, task_bar_instance); } @@ -332,6 +329,7 @@ impl_dispose (GObject *object) EActivityHandler *handler; EActivityHandlerPrivate *priv; GList *p; + GSList *sp; handler = E_ACTIVITY_HANDLER (object); priv = handler->priv; @@ -346,6 +344,10 @@ impl_dispose (GObject *object) g_list_free (priv->activity_infos); priv->activity_infos = NULL; + for (sp = priv->task_bars; sp != NULL; sp = sp->next) + g_object_weak_unref (G_OBJECT (sp->data), task_bar_destroy_notify, sp->data); + priv->task_bars = NULL; + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } @@ -588,9 +590,7 @@ e_activity_handler_attach_task_bar (EActivityHandler *activity_handler, priv = activity_handler->priv; - g_signal_connect_object (task_bar, "destroy", - G_CALLBACK (task_bar_destroy_callback), - G_OBJECT (activity_handler), 0); + g_object_weak_ref (G_OBJECT (task_bar), task_bar_destroy_notify, activity_handler); priv->task_bars = g_slist_prepend (priv->task_bars, task_bar); diff --git a/shell/e-shell-config-autocompletion.c b/shell/e-shell-config-autocompletion.c index 37ea318681..b3b72bb954 100644 --- a/shell/e-shell-config-autocompletion.c +++ b/shell/e-shell-config-autocompletion.c @@ -56,9 +56,11 @@ folder_list_changed_callback (EFolderList *efl, } static void -config_control_destroy_callback (EvolutionConfigControl *config_control, - EvolutionAutocompletionConfig *ac) +config_control_destroy_notify (void *data, + GObject *where_the_config_control_was) { + EvolutionAutocompletionConfig *ac = (EvolutionAutocompletionConfig *) data; + g_object_unref (ac->shell_client); g_object_unref (ac->config_listener); @@ -114,8 +116,8 @@ e_shell_config_autocompletion_create_widget (EShell *shell, EvolutionConfigContr G_CALLBACK (folder_list_changed_callback), ac); g_signal_connect (ac->config_control, "apply", G_CALLBACK (config_control_apply_callback), ac); - g_signal_connect (ac->config_control, "destroy", - G_CALLBACK (config_control_destroy_callback), ac); + + g_object_weak_ref (G_OBJECT (ac->config_control), config_control_destroy_notify, ac); CORBA_exception_free (&ev); diff --git a/shell/e-shell-config-default-folders.c b/shell/e-shell-config-default-folders.c index 776bb015de..45bfe87a4d 100644 --- a/shell/e-shell-config-default-folders.c +++ b/shell/e-shell-config-default-folders.c @@ -95,9 +95,11 @@ config_control_apply_cb (EvolutionConfigControl *control, } static void -config_control_destroy_cb (EvolutionConfigControl *config_control, - EvolutionDefaultFolderConfig *dfc) +config_control_destroy_notify (void *data, + GObject *where_the_config_control_was) { + EvolutionDefaultFolderConfig *dfc = (EvolutionDefaultFolderConfig *) data; + g_object_unref (dfc->config_listener); g_free (dfc->mail_uri); @@ -188,8 +190,8 @@ e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigCont g_signal_connect (dfc->config_control, "apply", G_CALLBACK (config_control_apply_cb), dfc); - g_signal_connect (dfc->config_control, "destroy", - G_CALLBACK (config_control_destroy_cb), dfc); + + g_object_weak_ref (G_OBJECT (dfc->config_control), config_control_destroy_notify, dfc); return widget; } diff --git a/shell/e-shell-config-offline.c b/shell/e-shell-config-offline.c index 405426b36d..d331fbbc01 100644 --- a/shell/e-shell-config-offline.c +++ b/shell/e-shell-config-offline.c @@ -53,8 +53,8 @@ typedef struct _PageData PageData; /* Callbacks. */ static void -config_control_destroy_callback (GtkObject *object, - void *data) +config_control_destroy_notify (void *data, + GObject *where_the_config_control_was) { PageData *page_data; @@ -207,10 +207,10 @@ e_shell_config_offline_create_widget (EShell *shell, EvolutionConfigControl *con page_data->config_control = control; - g_signal_connect (page_data->config_control, "destroy", - G_CALLBACK (config_control_destroy_callback), page_data); g_signal_connect (page_data->config_control, "apply", G_CALLBACK (config_control_apply_callback), page_data); + g_object_weak_ref (G_OBJECT (page_data->config_control), config_control_destroy_notify, page_data); + return scroll_frame; } diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index c7664d866b..09bd3d725d 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -211,8 +211,8 @@ dialog_response_cb (GnomeDialog *dialog, } static void -dialog_destroy_cb (GtkObject *object, - void *data) +dialog_destroy_notify (void *data, + GObject *where_the_dialog_was) { DialogData *dialog_data; @@ -266,17 +266,15 @@ storage_set_view_folder_selected_cb (EStorageSetView *storage_set_view, /* Shell signal callbacks. */ -#if 0 static void -shell_destroy_cb (GtkObject *object, - void *data) +shell_destroy_notify (void *data, + GObject *where_the_shell_was) { - GnomeDialog *dialog; + DialogData *dialog_data = (DialogData *) data; - dialog = GNOME_DIALOG (data); - gtk_widget_destroy (GTK_WIDGET (dialog)); + dialog_data->shell = NULL; + gtk_widget_destroy (GTK_WIDGET (dialog_data->dialog)); } -#endif /* Dialog setup. */ @@ -528,8 +526,7 @@ e_shell_show_folder_creation_dialog (EShell *shell, g_signal_connect (dialog, "response", G_CALLBACK (dialog_response_cb), dialog_data); - g_signal_connect (dialog, "destroy", - G_CALLBACK (dialog_destroy_cb), dialog_data); + g_object_weak_ref (G_OBJECT (dialog), dialog_destroy_notify, dialog_data); g_signal_connect (dialog_data->folder_name_entry, "changed", G_CALLBACK (folder_name_entry_changed_cb), dialog_data); @@ -537,11 +534,7 @@ e_shell_show_folder_creation_dialog (EShell *shell, g_signal_connect (dialog_data->storage_set_view, "folder_selected", G_CALLBACK (storage_set_view_folder_selected_cb), dialog_data); -#if 0 /* FIXME */ - g_signal_connect_object (GTK_OBJECT (shell), "destroy", - G_CALLBACK (shell_destroy_cb), dialog_data, - GTK_OBJECT (dialog)); -#endif + g_object_weak_ref (G_OBJECT (shell), shell_destroy_notify, dialog_data); g_object_unref (gui); } diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index 76e943a24c..0d04899e78 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -419,11 +419,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s /* Make sure we get destroyed if the shell gets destroyed. */ priv->shell = shell; -#if 0 - gtk_signal_connect_object_while_alive (GTK_OBJECT (shell), "destroy", - G_CALLBACK (gtk_widget_destroy), - GTK_OBJECT (folder_selection_dialog)); -#endif + g_object_weak_ref (G_OBJECT (shell), (GWeakNotify) gtk_widget_destroy, folder_selection_dialog); /* Set up the label. */ diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 9cfedb9dc0..b2bb3b00c1 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -216,7 +216,6 @@ typedef struct _ImporterComponentData { int item; gboolean stop; - gboolean destroyed; } ImporterComponentData; static gboolean importer_timeout_fn (gpointer data); @@ -259,8 +258,8 @@ import_cb (EvolutionImporterListener *listener, } g_free (icd->filename); - if (!icd->destroyed) - gtk_object_destroy (GTK_OBJECT (icd->dialog)); + if (icd->dialog != NULL) + gtk_widget_destroy (icd->dialog); bonobo_object_unref (BONOBO_OBJECT (icd->listener)); g_object_unref (icd->client); g_free (icd); @@ -299,11 +298,13 @@ dialog_clicked_cb (GnomeDialog *dialog, } static void -dialog_destroy_cb (GtkObject *object, - ImporterComponentData *icd) +dialog_destroy_notify (void *data, + GObject *where_the_dialog_was) { + ImporterComponentData *icd = (ImporterComponentData *) data; + + icd->dialog = NULL; icd->stop = TRUE; - icd->destroyed = TRUE; } struct _IIDInfo { @@ -505,15 +506,14 @@ start_import (const char *folderpath, icd = g_new (ImporterComponentData, 1); icd->stop = FALSE; - icd->destroyed = FALSE; icd->dialog = GNOME_DIALOG (gnome_dialog_new (_("Importing"), GNOME_STOCK_BUTTON_CANCEL, NULL)); g_signal_connect (icd->dialog, "clicked", G_CALLBACK (dialog_clicked_cb), icd); - g_signal_connect (icd->dialog, "destroy", - G_CALLBACK (dialog_destroy_cb), icd); - + + g_object_weak_ref (icd->dialog, dialog_destroy_notify, icd); + label = g_strdup_printf (_("Importing %s.\nStarting %s"), filename, real_iid); icd->contents = gtk_label_new (label); @@ -937,9 +937,11 @@ import_druid_cancel (GnomeDruid *druid, } static void -import_druid_destroy (GtkObject *object, - ImportData *data) +import_druid_weak_notify (void *data, + GObject *where_the_object_was) { + ImportData *data = (ImportData *) data; + g_object_unref (data->wizard); g_free (data->choosen_iid); g_free (data); @@ -1186,9 +1188,11 @@ druid_finish_button_change (GnomeDruid *druid) } static void -close_dialog (GtkWidget *dialog, - gboolean *dialog_open) +close_dialog (void *data, + GObject *where_the_dialog_was) { + gboolean *dialog_open = (gboolean *) data; + *dialog_open = FALSE; } @@ -1214,8 +1218,7 @@ show_import_wizard (BonoboUIComponent *component, gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "importdruid", "Evolution:shell"); gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (user_data)); - g_signal_connect (data->dialog, "destroy", - G_CALLBACK (close_dialog), &dialog_open); + g_object_weak_ref (data->dialog, dialog_weak_notify, &dialog_open); gnome_dialog_close_hides (GNOME_DIALOG (data->dialog), TRUE); data->druid = glade_xml_get_widget (data->wizard, "druid1"); @@ -1274,8 +1277,8 @@ show_import_wizard (BonoboUIComponent *component, /* Finish page */ g_signal_connect (data->finish, "finish", G_CALLBACK (import_druid_finish), data); - g_signal_connect (data->dialog, "destroy", - G_CALLBACK (import_druid_destroy), data); + + g_object_weak_ref (data->dialog, import_druid_weak_notify, data); gtk_widget_show_all (data->dialog); } diff --git a/shell/e-shell-shared-folder-picker-dialog.c b/shell/e-shell-shared-folder-picker-dialog.c index 16fee71c10..3c8065709c 100644 --- a/shell/e-shell-shared-folder-picker-dialog.c +++ b/shell/e-shell-shared-folder-picker-dialog.c @@ -296,8 +296,8 @@ progress_bar_timeout_callback (void *data) } static void -progress_bar_destroy_callback (GtkObject *object, - void *data) +progress_bar_weak_notify (void *data, + GObject *where_the_object_was) { int timeout_id; @@ -375,21 +375,17 @@ create_progress_dialog (EShell *shell, gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), progress_bar, FALSE, TRUE, 0); timeout_id = g_timeout_add (50, progress_bar_timeout_callback, progress_bar); - g_signal_connect (progress_bar, "destroy", - G_CALLBACK (progress_bar_destroy_callback), - GINT_TO_POINTER (timeout_id)); + g_object_weak_ref (G_OBJECT (progress_bar), progress_bar_weak_notify, GINT_TO_POINTER (timeout_id)); timeout_id = g_timeout_add (PROGRESS_DIALOG_DELAY, progress_dialog_show_timeout_callback, dialog); - g_signal_connect (progress_bar, "destroy", - G_CALLBACK (progress_bar_destroy_callback), - GINT_TO_POINTER (timeout_id)); + g_object_weak_ref (G_OBJECT (progress_bar), progress_bar_weak_notify, GINT_TO_POINTER (timeout_id)); return dialog; } static void -shell_destroy_callback (GtkObject *object, - void *data) +shell_weak_notify (void *data, + GObject *where_the_object_was) { DiscoveryData *discovery_data; @@ -398,8 +394,8 @@ shell_destroy_callback (GtkObject *object, } static void -shell_view_destroy_callback (GtkObject *object, - void *data) +shell_view_weak_notify (void *data, + GObject *where_the_object_was) { DiscoveryData *discovery_data; @@ -408,8 +404,8 @@ shell_view_destroy_callback (GtkObject *object, } static void -storage_destroy_callback (GtkObject *object, - void *data) +storage_weak_notify (void *data, + GObject *where_the_object_was) { DiscoveryData *discovery_data; @@ -487,14 +483,9 @@ discover_folder (EShell *shell, discovery_data->storage = storage; g_object_ref (storage); - g_signal_connect (shell, "destroy", - G_CALLBACK (shell_destroy_callback), discovery_data); - - g_signal_connect (parent, "destroy", - G_CALLBACK (shell_view_destroy_callback), discovery_data); - - g_signal_connect (storage, "destroy", - G_CALLBACK (storage_destroy_callback), discovery_data); + g_object_weak_ref (G_OBJECT (shell), shell_weak_notify, discovery_data); + g_object_weak_ref (G_OBJECT (parent), shell_view_weak_notify, discovery_data); + g_object_weak_ref (G_OBJECT (storage), storage_weak_notify, discovery_data); g_signal_connect (dialog, "clicked", G_CALLBACK (progress_dialog_clicked_callback), discovery_data); diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c index fa955184ed..9a04b651c1 100644 --- a/shell/e-shell-startup-wizard.c +++ b/shell/e-shell-startup-wizard.c @@ -846,6 +846,8 @@ e_shell_startup_wizard_create (void) SWData *data; int num_accounts; + return TRUE; + data = g_new0 (SWData, 1); data->config_listener = e_config_listener_new(); diff --git a/shell/e-shell.c b/shell/e-shell.c index 42beaa9280..6ac6061970 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-shell.c * - * Copyright (C) 2000, 2001 Ximian, Inc. + * Copyright (C) 2000, 2001, 2002 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -957,14 +957,12 @@ view_delete_event_cb (GtkWidget *widget, } static void -view_destroy_cb (GtkObject *object, - void *data) +view_weak_notify (void *data, + GObject *where_the_object_was) { EShell *shell; int num_views; - g_assert (E_IS_SHELL_VIEW (object)); - shell = E_SHELL (data); num_views = g_list_length (shell->priv->views); @@ -975,7 +973,7 @@ view_destroy_cb (GtkObject *object, if (num_views - 1 == 0) e_shell_save_settings (shell); - shell->priv->views = g_list_remove (shell->priv->views, object); + shell->priv->views = g_list_remove (shell->priv->views, where_the_object_was); if (shell->priv->views == NULL) { set_interactive (shell, FALSE); @@ -1001,8 +999,8 @@ create_view (EShell *shell, g_signal_connect (view, "delete_event", G_CALLBACK (view_delete_event_cb), shell); - g_signal_connect (view, "destroy", - G_CALLBACK (view_destroy_cb), shell); + + g_object_weak_ref (G_OBJECT (view), view_weak_notify, shell); if (uri != NULL) e_shell_view_display_uri (E_SHELL_VIEW (view), uri, TRUE); @@ -1085,9 +1083,8 @@ impl_dispose (GObject *object) gtk_signal_disconnect_by_func (GTK_OBJECT (view), G_CALLBACK (view_delete_event_cb), shell); - gtk_signal_disconnect_by_func (GTK_OBJECT (view), - G_CALLBACK (view_destroy_cb), - shell); + + g_object_weak_unref (G_OBJECT (view), view_weak_notify, shell); gtk_object_destroy (GTK_OBJECT (view)); } @@ -2079,18 +2076,6 @@ e_shell_send_receive (EShell *shell) e_free_string_list (id_list); } -static void -settings_dialog_destroy_cb (GtkWidget *widget, void *data) -{ - EShell *shell; - EShellPrivate *priv; - - shell = E_SHELL (data); - priv = shell->priv; - - priv->settings_dialog = NULL; -} - void e_shell_show_settings (EShell *shell, const char *type, EShellView *shell_view) { @@ -2112,8 +2097,7 @@ e_shell_show_settings (EShell *shell, const char *type, EShellView *shell_view) if (type != NULL) e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (priv->settings_dialog), type); - g_signal_connect (priv->settings_dialog, "destroy", - G_CALLBACK (settings_dialog_destroy_cb), shell); + g_object_add_weak_pointer (G_OBJECT (priv->settings_dialog), (void **) & priv->settings_dialog); gtk_widget_show (priv->settings_dialog); } diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c index 2561ce91bb..a1cd88a272 100644 --- a/shell/e-shortcuts.c +++ b/shell/e-shortcuts.c @@ -579,8 +579,8 @@ get_item (EShortcuts *shortcuts, /* Signal handlers for the views. */ static void -view_destroyed_cb (GtkObject *object, - gpointer data) +view_weak_notify (void *data, + GObject *where_the_object_was) { EShortcuts *shortcuts; EShortcutsPrivate *priv; @@ -588,7 +588,7 @@ view_destroyed_cb (GtkObject *object, shortcuts = E_SHORTCUTS (data); priv = shortcuts->priv; - priv->views = g_slist_remove (priv->views, object); + priv->views = g_slist_remove (priv->views, where_the_object_was); } @@ -626,6 +626,7 @@ impl_dispose (GObject *object) { EShortcuts *shortcuts; EShortcutsPrivate *priv; + GSList *p; shortcuts = E_SHORTCUTS (object); priv = shortcuts->priv; @@ -643,6 +644,11 @@ impl_dispose (GObject *object) priv->dirty = FALSE; } + for (p = priv->views; p != NULL; p = p->next) + g_object_weak_unref (G_OBJECT (p->data), view_weak_notify, shortcuts); + g_slist_free (priv->views); + priv->views = NULL; + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } @@ -885,7 +891,7 @@ e_shortcuts_new_view (EShortcuts *shortcuts) new = e_shortcuts_view_new (shortcuts); priv->views = g_slist_prepend (priv->views, new); - gtk_signal_connect (GTK_OBJECT (new), "destroy", GTK_SIGNAL_FUNC (view_destroyed_cb), shortcuts); + g_object_weak_ref (G_OBJECT (new), view_weak_notify, shortcuts); return new; } diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c index 0e96bad012..39cfb11ceb 100644 --- a/shell/evolution-test-component.c +++ b/shell/evolution-test-component.c @@ -206,8 +206,8 @@ dialog_clicked_callback (GtkDialog *dialog, } static void -dialog_destroy_callback (GtkObject *object, - void *data) +dialog_weak_notify (void *data, + GObject *where_the_object_was) { GNOME_Evolution_StorageSetView storage_set_view_iface; CORBA_Environment ev; @@ -266,8 +266,7 @@ create_new_folder_selector (EvolutionShellComponent *shell_component) /* This is necessary to unref the StorageSetView iface once we are done with it. */ - g_signal_connect (dialog, "destroy", - G_CALLBACK (dialog_destroy_callback), storage_set_view_iface); + g_object_weak_ref (G_OBJECT (dialog), dialog_weak_notify, storage_set_view_iface); gtk_widget_show (control_widget); gtk_widget_show (dialog); diff --git a/shell/main.c b/shell/main.c index 2261aa84d1..36a5648763 100644 --- a/shell/main.c +++ b/shell/main.c @@ -129,22 +129,12 @@ quit_box_new (void) } static void -quit_box_destroyed_callback (GtkObject *object, - void *data) -{ - GtkWidget **p; - - p = (GtkWidget **) data; - *p = NULL; -} - -static void no_views_left_cb (EShell *shell, gpointer data) { GtkWidget *quit_box; quit_box = quit_box_new (); - g_signal_connect (quit_box, "destroy", G_CALLBACK (quit_box_destroyed_callback), &quit_box); + g_object_add_weak_pointer (G_OBJECT (quit_box), (void **) &quit_box); /* FIXME: This is wrong. We should exit only when the shell is destroyed. But refcounting is broken at present, so this is a @@ -184,7 +174,8 @@ no_views_left_cb (EShell *shell, gpointer data) } static void -destroy_cb (GtkObject *object, gpointer data) +shell_weak_notify (void *data, + GObject *where_the_object_was) { gtk_main_quit (); } @@ -368,10 +359,8 @@ idle_cb (void *data) case E_SHELL_CONSTRUCT_RESULT_OK: e_shell_config_factory_register (shell); - g_signal_connect (shell, "no_views_left", - G_CALLBACK (no_views_left_cb), NULL); - g_signal_connect (shell, "destroy", - G_CALLBACK (destroy_cb), NULL); + g_signal_connect (shell, "no_views_left", G_CALLBACK (no_views_left_cb), NULL); + g_object_weak_ref (G_OBJECT (shell), shell_weak_notify, NULL); if (!getenv ("EVOLVE_ME_HARDER")) g_signal_connect (shell, "new_view_created", |