* 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
127 lines
3.4 KiB
C
127 lines
3.4 KiB
C
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||
/* e-shell-config-autocompletion.c - Configuration page for addressbook autocompletion.
|
||
*
|
||
* Copyright (C) 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
|
||
* License as published by the Free Software Foundation.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
* General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU General Public
|
||
* License along with this program; if not, write to the
|
||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||
* Boston, MA 02111-1307, USA.
|
||
*
|
||
* Authors: Chris Lahey <clahey@ximian.com>
|
||
* Chris Toshok <toshok@ximian.com>
|
||
*/
|
||
|
||
#ifdef HAVE_CONFIG_H
|
||
#include <config.h>
|
||
#endif
|
||
|
||
|
||
#include "e-shell-config-autocompletion.h"
|
||
|
||
#include "e-folder-list.h"
|
||
|
||
#include "Evolution.h"
|
||
|
||
#include <bonobo/bonobo-exception.h>
|
||
|
||
#include <libgnome/gnome-i18n.h>
|
||
#include <gtk/gtkwidget.h>
|
||
#include <gtk/gtksignal.h>
|
||
|
||
|
||
typedef struct {
|
||
EvolutionConfigControl *config_control;
|
||
|
||
GtkWidget *control_widget;
|
||
|
||
EConfigListener *config_listener;
|
||
EvolutionShellClient *shell_client;
|
||
} EvolutionAutocompletionConfig;
|
||
|
||
static void
|
||
folder_list_changed_callback (EFolderList *efl,
|
||
EvolutionAutocompletionConfig *ac)
|
||
{
|
||
evolution_config_control_changed (ac->config_control);
|
||
}
|
||
|
||
static void
|
||
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);
|
||
|
||
g_free (ac);
|
||
}
|
||
|
||
|
||
static void
|
||
config_control_apply_callback (EvolutionConfigControl *config_control,
|
||
EvolutionAutocompletionConfig *ac)
|
||
{
|
||
char *xml;
|
||
|
||
xml = e_folder_list_get_xml (E_FOLDER_LIST (ac->control_widget));
|
||
e_config_listener_set_string (ac->config_listener, "/Addressbook/Completion/uris", xml);
|
||
g_free (xml);
|
||
}
|
||
|
||
GtkWidget *
|
||
e_shell_config_autocompletion_create_widget (EShell *shell, EvolutionConfigControl *config_control)
|
||
{
|
||
GNOME_Evolution_Shell shell_dup;
|
||
EvolutionAutocompletionConfig *ac;
|
||
char *xml;
|
||
CORBA_Environment ev;
|
||
static const char *possible_types[] = { "contacts/*", NULL };
|
||
|
||
ac = g_new0 (EvolutionAutocompletionConfig, 1);
|
||
ac->config_listener = e_config_listener_new ();
|
||
|
||
CORBA_exception_init (&ev);
|
||
|
||
shell_dup = CORBA_Object_duplicate (BONOBO_OBJREF (shell), &ev);
|
||
ac->shell_client = evolution_shell_client_new (shell_dup);
|
||
|
||
xml = e_config_listener_get_string_with_default (ac->config_listener,
|
||
"/Addressbook/Completion/uris",
|
||
NULL, NULL);
|
||
|
||
ac->control_widget = e_folder_list_new (ac->shell_client, xml);
|
||
g_free (xml);
|
||
|
||
gtk_object_set (GTK_OBJECT (ac->control_widget),
|
||
"title", _("Extra Completion folders"),
|
||
"possible_types", possible_types,
|
||
NULL);
|
||
|
||
gtk_widget_show (ac->control_widget);
|
||
|
||
ac->config_control = config_control;
|
||
|
||
g_signal_connect (ac->control_widget, "changed",
|
||
G_CALLBACK (folder_list_changed_callback), ac);
|
||
g_signal_connect (ac->config_control, "apply",
|
||
G_CALLBACK (config_control_apply_callback), ac);
|
||
|
||
g_object_weak_ref (G_OBJECT (ac->config_control), config_control_destroy_notify, ac);
|
||
|
||
CORBA_exception_free (&ev);
|
||
|
||
return ac->control_widget;
|
||
}
|
||
|