Files
evolution/shell/e-shell-config-offline.c
Ettore Perazzoli 4f5782221f 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
2002-11-14 20:32:46 +00:00

217 lines
5.9 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-shell-config-offline.c - Configuration page for offline synchronization.
*
* 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.
*
* Author: Ettore Perazzoli <ettore@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "e-shell-config-offline.h"
#include "evolution-config-control.h"
#include "e-storage-set-view.h"
#include "e-util/e-config-listener.h"
#include "Evolution.h"
#include <bonobo/bonobo-exception.h>
#include <gal/widgets/e-scroll-frame.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtksignal.h>
struct _PageData {
EShell *shell;
GtkWidget *storage_set_view;
EvolutionConfigControl *config_control;
};
typedef struct _PageData PageData;
/* Callbacks. */
static void
config_control_destroy_notify (void *data,
GObject *where_the_config_control_was)
{
PageData *page_data;
page_data = (PageData *) data;
gtk_widget_destroy (page_data->storage_set_view);
g_free (page_data);
}
static void
config_control_apply_callback (EvolutionConfigControl *config_control,
void *data)
{
#if 0
CORBA_Environment ev;
CORBA_sequence_CORBA_string *paths;
CORBA_any any;
PageData *page_data;
GList *checked_paths;
GList *p;
int i;
page_data = (PageData *) data;
checked_paths = e_storage_set_view_get_checkboxes_list (E_STORAGE_SET_VIEW (page_data->storage_set_view));
paths = CORBA_sequence_CORBA_string__alloc ();
paths->_maximum = paths->_length = g_list_length (checked_paths);
paths->_buffer = CORBA_sequence_CORBA_string_allocbuf (paths->_maximum);
CORBA_sequence_set_release (paths, TRUE);
for (p = checked_paths, i = 0; p != NULL; p = p->next, i ++)
paths->_buffer[i] = CORBA_string_dup ((const char *) p->data);
any._type = TC_CORBA_sequence_CORBA_string;
any._value = paths;
CORBA_exception_init (&ev);
Bonobo_ConfigDatabase_setValue (e_shell_get_config_db (page_data->shell),
"/OfflineFolders/paths", &any, &ev);
if (BONOBO_EX (&ev))
g_warning ("Cannot set /OfflineFolders/paths from ConfigDatabase -- %s", BONOBO_EX_ID (&ev));
CORBA_exception_free (&ev);
g_list_free (checked_paths);
#endif
}
static void
storage_set_view_checkboxes_changed_callback (EStorageSetView *storage_set_view,
void *data)
{
PageData *page_data;
page_data = (PageData *) data;
evolution_config_control_changed (page_data->config_control);
}
/* Construction. */
static void
init_storage_set_view_status_from_config (EStorageSetView *storage_set_view,
EShell *shell)
{
#if 0
Bonobo_ConfigDatabase config_db;
CORBA_Environment ev;
CORBA_any *any;
CORBA_sequence_CORBA_string *sequence;
GList *list;
int i;
config_db = e_shell_get_config_db (shell);
g_assert (config_db != CORBA_OBJECT_NIL);
CORBA_exception_init (&ev);
any = Bonobo_ConfigDatabase_getValue (config_db, "/OfflineFolders/paths", "", &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Cannot get /OfflineFolders/paths from ConfigDatabase -- %s", BONOBO_EX_ID (&ev));
CORBA_exception_free (&ev);
return;
}
if (! CORBA_TypeCode_equal (any->_type, TC_CORBA_sequence_CORBA_string, &ev) || BONOBO_EX (&ev)) {
g_warning ("/OfflineFolders/Paths in ConfigDatabase is not the expected type");
CORBA_free (any);
CORBA_exception_free (&ev);
return;
}
sequence = (CORBA_sequence_CORBA_string *) any->_value;
list = NULL;
for (i = 0; i < sequence->_length; i ++)
list = g_list_prepend (list, sequence->_buffer[i]);
e_storage_set_view_set_checkboxes_list (storage_set_view, list);
g_list_free (list);
CORBA_free (any);
CORBA_exception_free (&ev);
#endif
}
static gboolean
storage_set_view_has_checkbox_func (EStorageSet *storage_set,
const char *path,
void *data)
{
EFolder *folder;
folder = e_storage_set_get_folder (storage_set, path);
if (folder == NULL)
return FALSE;
return e_folder_get_can_sync_offline (folder);
}
GtkWidget *
e_shell_config_offline_create_widget (EShell *shell, EvolutionConfigControl *control)
{
PageData *page_data;
GtkWidget *scroll_frame;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
page_data = g_new (PageData, 1);
page_data->shell = shell;
page_data->storage_set_view = e_storage_set_create_new_view (e_shell_get_storage_set (shell), NULL);
e_storage_set_view_set_show_checkboxes (E_STORAGE_SET_VIEW (page_data->storage_set_view), TRUE,
storage_set_view_has_checkbox_func, NULL);
gtk_widget_show (page_data->storage_set_view);
init_storage_set_view_status_from_config (E_STORAGE_SET_VIEW (page_data->storage_set_view), shell);
g_signal_connect (page_data->storage_set_view, "checkboxes_changed",
G_CALLBACK (storage_set_view_checkboxes_changed_callback), page_data);
scroll_frame = e_scroll_frame_new (NULL, NULL);
e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll_frame), GTK_SHADOW_IN);
e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scroll_frame), page_data->storage_set_view);
gtk_widget_show (scroll_frame);
page_data->config_control = control;
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;
}