From 4ba6a25075f9cee4d9aafefe1d77a14e2734300d Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 10 Jun 2004 16:30:15 +0000 Subject: Remove no-longer-used stuff * check-empty.xpm, check-filled.xpm, check-missing.xpm: * e-shell-config-autocompletion.[ch]: * e-shell-config-default-folders.[ch]: * e-shell-config-folder-settings.[ch]: * e-shell-config-offline.[ch]: * e-shell-config.[ch]: * e-shell-folder-creation-dialog.[ch]: * e-shell-shared-folder-picker-dialog.[ch]: * e-storage-set-store.[ch]: * e-storage-set-view-checkboxes.etstate: * e-storage-set-view-no-checkboxes.etstate: * e-storage-set-view.etspec: * e-uri-schema-registry.[ch]: * evolution-activity-client.c: * evolution-storage-set-view-factory.[ch]: * evolution-storage-set-view.[ch]: * glade/e-folder-list.glade: * glade/e-shell-config-default-folders.glade: * glade/e-shell-folder-creation-dialog.glade: * glade/e-shell-shared-folder-picker-dialog.glade: Remove no-longer-used stuff * README: Remove this, since it's more confusing than true now. * Evolution-Offline.idl, Evolution-common.idl: Remove GNOME_Evolution_Folder, and references to it. * e-active-connection-dialog.glade: * evolution-startup-wizard.glade: Move the last two remaining files from ./glade/ up to here. * glade/*: Gone. * Makefile.am, .cvsignore: update for the above svn path=/trunk/; revision=26286 --- shell/.cvsignore | 7 +- shell/ChangeLog | 37 + shell/Evolution-Offline.idl | 20 +- shell/Evolution-common.idl | 13 - shell/Makefile.am | 43 +- shell/README | 14 - shell/check-empty.xpm | 21 - shell/check-filled.xpm | 21 - shell/check-missing.xpm | 20 - shell/e-active-connection-dialog.glade | 193 +++ shell/e-shell-config-autocompletion.c | 129 -- shell/e-shell-config-autocompletion.h | 34 - shell/e-shell-config-default-folders.c | 203 --- shell/e-shell-config-default-folders.h | 34 - shell/e-shell-config-folder-settings.c | 82 -- shell/e-shell-config-folder-settings.h | 32 - shell/e-shell-config-offline.c | 168 --- shell/e-shell-config-offline.h | 33 - shell/e-shell-config.c | 69 - shell/e-shell-config.h | 30 - shell/e-shell-folder-creation-dialog.c | 580 --------- shell/e-shell-folder-creation-dialog.h | 49 - shell/e-shell-shared-folder-picker-dialog.c | 557 -------- shell/e-shell-shared-folder-picker-dialog.h | 33 - shell/e-storage-set-store.c | 1361 -------------------- shell/e-storage-set-store.h | 91 -- shell/e-storage-set-view-checkboxes.etstate | 5 - shell/e-storage-set-view-no-checkboxes.etstate | 4 - shell/e-storage-set-view.etspec | 8 - shell/e-uri-schema-registry.c | 181 --- shell/e-uri-schema-registry.h | 70 - shell/evolution-activity-client.c | 461 ------- shell/evolution-startup-wizard.glade | 90 ++ shell/evolution-storage-set-view-factory.c | 74 -- shell/evolution-storage-set-view-factory.h | 30 - shell/evolution-storage-set-view.c | 481 ------- shell/evolution-storage-set-view.h | 70 - shell/glade/.cvsignore | 4 - shell/glade/Makefile.am | 9 - shell/glade/e-active-connection-dialog.glade | 193 --- shell/glade/e-folder-list.glade | 110 -- shell/glade/e-shell-config-default-folders.glade | 194 --- shell/glade/e-shell-folder-creation-dialog.glade | 180 --- .../e-shell-shared-folder-picker-dialog.glade | 252 ---- shell/glade/evolution-startup-wizard.glade | 90 -- 45 files changed, 335 insertions(+), 6045 deletions(-) delete mode 100644 shell/README delete mode 100644 shell/check-empty.xpm delete mode 100644 shell/check-filled.xpm delete mode 100644 shell/check-missing.xpm create mode 100644 shell/e-active-connection-dialog.glade delete mode 100644 shell/e-shell-config-autocompletion.c delete mode 100644 shell/e-shell-config-autocompletion.h delete mode 100644 shell/e-shell-config-default-folders.c delete mode 100644 shell/e-shell-config-default-folders.h delete mode 100644 shell/e-shell-config-folder-settings.c delete mode 100644 shell/e-shell-config-folder-settings.h delete mode 100644 shell/e-shell-config-offline.c delete mode 100644 shell/e-shell-config-offline.h delete mode 100644 shell/e-shell-config.c delete mode 100644 shell/e-shell-config.h delete mode 100644 shell/e-shell-folder-creation-dialog.c delete mode 100644 shell/e-shell-folder-creation-dialog.h delete mode 100644 shell/e-shell-shared-folder-picker-dialog.c delete mode 100644 shell/e-shell-shared-folder-picker-dialog.h delete mode 100644 shell/e-storage-set-store.c delete mode 100644 shell/e-storage-set-store.h delete mode 100644 shell/e-storage-set-view-checkboxes.etstate delete mode 100644 shell/e-storage-set-view-no-checkboxes.etstate delete mode 100644 shell/e-storage-set-view.etspec delete mode 100644 shell/e-uri-schema-registry.c delete mode 100644 shell/e-uri-schema-registry.h delete mode 100644 shell/evolution-activity-client.c create mode 100644 shell/evolution-startup-wizard.glade delete mode 100644 shell/evolution-storage-set-view-factory.c delete mode 100644 shell/evolution-storage-set-view-factory.h delete mode 100644 shell/evolution-storage-set-view.c delete mode 100644 shell/evolution-storage-set-view.h delete mode 100644 shell/glade/.cvsignore delete mode 100644 shell/glade/Makefile.am delete mode 100644 shell/glade/e-active-connection-dialog.glade delete mode 100644 shell/glade/e-folder-list.glade delete mode 100644 shell/glade/e-shell-config-default-folders.glade delete mode 100644 shell/glade/e-shell-folder-creation-dialog.glade delete mode 100644 shell/glade/e-shell-shared-folder-picker-dialog.glade delete mode 100644 shell/glade/evolution-startup-wizard.glade diff --git a/shell/.cvsignore b/shell/.cvsignore index 49d8b218e2..528cd09dd1 100644 --- a/shell/.cvsignore +++ b/shell/.cvsignore @@ -2,10 +2,6 @@ .deps .libs .pure -Evolution-Addressbook-SelectNames-common.c -Evolution-Addressbook-SelectNames-skels.c -Evolution-Addressbook-SelectNames-stubs.c -Evolution-Addressbook-SelectNames.h Evolution-common.c Evolution-skels.c Evolution-stubs.c @@ -17,8 +13,7 @@ Evolution-DataServer.h ID Makefile Makefile.in -apps_evolution_shell-1.5.schemas -apps_evolution_shell-1.5.schemas.in +apps_evolution_shell-*.schemas evolution evolution-nognome evolution-test-component diff --git a/shell/ChangeLog b/shell/ChangeLog index fa031c500b..62345c4b81 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,40 @@ +2004-06-09 Dan Winship + + * check-empty.xpm, check-filled.xpm, check-missing.xpm: + * e-shell-config-autocompletion.[ch]: + * e-shell-config-default-folders.[ch]: + * e-shell-config-folder-settings.[ch]: + * e-shell-config-offline.[ch]: + * e-shell-config.[ch]: + * e-shell-folder-creation-dialog.[ch]: + * e-shell-shared-folder-picker-dialog.[ch]: + * e-storage-set-store.[ch]: + * e-storage-set-view-checkboxes.etstate: + * e-storage-set-view-no-checkboxes.etstate: + * e-storage-set-view.etspec: + * e-uri-schema-registry.[ch]: + * evolution-activity-client.c: + * evolution-storage-set-view-factory.[ch]: + * evolution-storage-set-view.[ch]: + * glade/e-folder-list.glade: + * glade/e-shell-config-default-folders.glade: + * glade/e-shell-folder-creation-dialog.glade: + * glade/e-shell-shared-folder-picker-dialog.glade: Remove + no-longer-used stuff + + * README: Remove this, since it's more confusing than true now. + + * Evolution-Offline.idl, Evolution-common.idl: Remove + GNOME_Evolution_Folder, and references to it. + + * e-active-connection-dialog.glade: + * evolution-startup-wizard.glade: Move the last two remaining + files from ./glade/ up to here. + + * glade/*: Gone. + + * Makefile.am, .cvsignore: update for the above + 2004-06-06 Jeffrey Stedfast * e-shell-window-commands.c: Added Martyn Russel to the credits. diff --git a/shell/Evolution-Offline.idl b/shell/Evolution-Offline.idl index 4648fd9a7f..e896710503 100644 --- a/shell/Evolution-Offline.idl +++ b/shell/Evolution-Offline.idl @@ -32,22 +32,14 @@ interface Offline : Bonobo::Unknown { /* Whether the component is currently off-line. */ attribute boolean isOffline; - /* Ask the component to prepare to go into off-line mode. The - component must return a list of the current active connections. - After this call, the shell is expected to: (in order) - - 1. Invoke ::syncFolder for each of the component's folders that - need to be synchronized to disk for offline usage. - - 2. Either invoke ::goOffline (actually complete the operation - and go off-line) or ::goOnline (operation cancelled). - */ + /* Ask the component to prepare to go into off-line mode. The + * component must return a list of the current active + * connections. After this call, the shell is expected to + * either invoke ::goOffline (actually complete the operation + * and go off-line) or ::goOnline (operation cancelled). + */ void prepareForOffline (out ConnectionList active_connection_list); - /* Request the component to stop syncing the specified folder. This - has to happen after ::syncFolder. */ - oneway void cancelSyncFolder (in Folder folder); - /* Ask the component to go into off-line mode. This always comes after a ::prepareForOffline. */ void goOffline (in OfflineProgressListener listener) diff --git a/shell/Evolution-common.idl b/shell/Evolution-common.idl index 5cc1cf1b5f..62f113f79c 100644 --- a/shell/Evolution-common.idl +++ b/shell/Evolution-common.idl @@ -10,19 +10,6 @@ module GNOME { module Evolution { - struct Folder { - string type; - string description; - string displayName; - string physicalUri; - string evolutionUri; - string customIconName; - long unreadCount; - boolean canSyncOffline; - short sortingPriority; - }; - typedef sequence FolderList; - struct Icon { short width, height; boolean hasAlpha; diff --git a/shell/Makefile.am b/shell/Makefile.am index fa3c86f9ff..527b2d92f1 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = glade importer +SUBDIRS = importer INCLUDES = \ -I$(top_srcdir)/widgets \ @@ -8,7 +8,6 @@ INCLUDES = \ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ -DEVOLUTION_HELPDIR=\""$(evolutionhelpdir)"\" \ -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \ -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \ @@ -50,27 +49,6 @@ $(IDL_GENERATED_H): $(IDLS) $(IDL_GENERATED_C): $(IDL_GENERATED_H) -# SelectNames CORBA stuff - -SELECT_NAMES_IDL = \ - $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl - -SELECT_NAMES_IDL_GENERATED_H = \ - Evolution-Addressbook-SelectNames.h - -SELECT_NAMES_IDL_GENERATED_C = \ - Evolution-Addressbook-SelectNames-common.c \ - Evolution-Addressbook-SelectNames-skels.c \ - Evolution-Addressbook-SelectNames-stubs.c - -SELECT_NAMES_IDL_GENERATED = $(SELECT_NAMES_IDL_GENERATED_C) $(SELECT_NAMES_IDL_GENERATED_H) - -$(SELECT_NAMES_IDL_GENERATED_H): $(SELECT_NAMES_IDL) - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(SELECT_NAMES_IDL) - -$(SELECT_NAMES_IDL_GENERATED_C): $(SELECT_NAMES_IDL_GENERATED_H) - - # Data Server CORBA stuff DATASERVER_IDL_GENERATED_H = \ Evolution-DataServer.h @@ -126,7 +104,6 @@ libeshell_la_LIBADD = \ # Evolution executable evolution_SOURCES = \ - $(SELECT_NAMES_IDL_GENERATED) \ $(DATASERVER_IDL_GENERATED) \ e-component-registry.c \ e-component-registry.h \ @@ -139,10 +116,10 @@ evolution_SOURCES = \ e-shell-constants.h \ e-shell-folder-title-bar.c \ e-shell-folder-title-bar.h \ - e-shell-offline-handler.c \ - e-shell-offline-handler.h \ e-shell-importer.c \ e-shell-importer.h \ + e-shell-offline-handler.c \ + e-shell-offline-handler.h \ e-shell-settings-dialog.c \ e-shell-settings-dialog.h \ e-shell-startup-wizard.c \ @@ -202,12 +179,9 @@ errordir = $(privdatadir)/errors %.xml.h: %.xml $(top_builddir)/e-util/e-error-tool $^ -etspec_DATA = e-storage-set-view.etspec - -icons = \ - check-empty.xpm \ - check-filled.xpm \ - check-missing.xpm +glade_DATA = \ + e-active-connection-dialog.glade \ + evolution-startup-wizard.glade # GConf schemas @@ -258,9 +232,8 @@ EXTRA_DIST = \ GNOME_Evolution_Test.server.in.in \ $(error_DATA) \ $(error_i18n) \ - $(etspec_DATA) \ + $(glade_DATA) \ $(schema_DATA) \ - $(icons) \ ChangeLog.pre-1-4 \ e-shell-marshal.list \ evolution-nognome.in @@ -279,7 +252,7 @@ evolution.pure: evolution endif -BUILT_SOURCES = $(IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) $(testserver_DATA) $(DATASERVER_IDL_GENERATED) $(error_i18n) +BUILT_SOURCES = $(IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) $(testserver_DATA) $(DATASERVER_IDL_GENERATED) $(error_i18n) CLEANFILES = $(BUILT_SOURCES) dist-hook: diff --git a/shell/README b/shell/README deleted file mode 100644 index fc0871eb5d..0000000000 --- a/shell/README +++ /dev/null @@ -1,14 +0,0 @@ -Two things are built in this directory: the shell's executable, named -`evolution', and the shell utility library, `libeshell'. - -The `e-*' files belong to the shell, and their API is not exported at -all. - -The `evolution-*' files, instead, are Bonobo-style wrappers for the -shell's Evolution:: CORBA interfaces. They are all compiled into -`libeshell'; the shell itself links against `libeshell'. - -The `evolution-*-client' files are utility GTK+-style wrappers for the -CORBA methods; the modules whose name does not end with `-client', -instead, are Bonobo-like GTK+ objects wrapping the implementation of -the CORBA server. diff --git a/shell/check-empty.xpm b/shell/check-empty.xpm deleted file mode 100644 index 746b20234e..0000000000 --- a/shell/check-empty.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * check_empty_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ............ ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" ............ ", -" ", -" "}; diff --git a/shell/check-filled.xpm b/shell/check-filled.xpm deleted file mode 100644 index c0468fc25b..0000000000 --- a/shell/check-filled.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * check_filled_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ............ ", -" . . ", -" . . . ", -" . .. . ", -" . ... . ", -" . . ... . ", -" . .. ... . ", -" . ..... . ", -" . ... . ", -" . . . ", -" . . ", -" ............ ", -" ", -" "}; diff --git a/shell/check-missing.xpm b/shell/check-missing.xpm deleted file mode 100644 index 72bdb7a782..0000000000 --- a/shell/check-missing.xpm +++ /dev/null @@ -1,20 +0,0 @@ -/* XPM */ -static const char * check_missing_xpm[] = { -"16 16 1 1", -" c None", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/shell/e-active-connection-dialog.glade b/shell/e-active-connection-dialog.glade new file mode 100644 index 0000000000..aab9ad6577 --- /dev/null +++ b/shell/e-active-connection-dialog.glade @@ -0,0 +1,193 @@ + + + + + + + True + Active Connections + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 256 + 192 + True + False + False + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + True + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 12 + True + False + 12 + + + + True + <b>Active Connections</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + False + 12 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + False + 12 + + + + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + Click OK to close these connections and go offline + False + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + + diff --git a/shell/e-shell-config-autocompletion.c b/shell/e-shell-config-autocompletion.c deleted file mode 100644 index df232e8067..0000000000 --- a/shell/e-shell-config-autocompletion.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- 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 - * Chris Toshok - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include "e-shell-config-autocompletion.h" - -#include "e-folder-list.h" - -#include "Evolution.h" - -#include - -#include -#include -#include - -#include - - -typedef struct { - EvolutionConfigControl *config_control; - - GtkWidget *control_widget; - - 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_free (ac); -} - - -static void -config_control_apply_callback (EvolutionConfigControl *config_control, - EvolutionAutocompletionConfig *ac) -{ - GConfClient *client; - char *xml; - - client = gconf_client_get_default (); - - xml = e_folder_list_get_xml (E_FOLDER_LIST (ac->control_widget)); - gconf_client_set_string (client, "/apps/evolution/addressbook/completion/uris", xml, NULL); - g_free (xml); - - g_object_unref (client); -} - -GtkWidget * -e_shell_config_autocompletion_create_widget (EShell *shell, EvolutionConfigControl *config_control) -{ - EvolutionAutocompletionConfig *ac; - CORBA_Environment ev; - GConfClient *client; - static const char *possible_types[] = { "contacts/*", NULL }; - char *xml; - - ac = g_new0 (EvolutionAutocompletionConfig, 1); - - CORBA_exception_init (&ev); - - ac->shell_client = evolution_shell_client_new (BONOBO_OBJREF (shell)); - - client = gconf_client_get_default (); - xml = gconf_client_get_string (client, "/apps/evolution/addressbook/completion/uris", NULL); - g_object_unref (client); - - ac->control_widget = e_folder_list_new (ac->shell_client, xml); - g_free (xml); - - g_object_set((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; -} - diff --git a/shell/e-shell-config-autocompletion.h b/shell/e-shell-config-autocompletion.h deleted file mode 100644 index 46a65627a3..0000000000 --- a/shell/e-shell-config-autocompletion.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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 - * Chris Toshok - */ - -#ifndef E_SHELL_CONFIG_AUTOCOMPLETION_H -#define E_SHELL_CONFIG_AUTOCOMPLETION_H - -#include "e-shell.h" - -#include -#include "evolution-config-control.h" - -GtkWidget *e_shell_config_autocompletion_create_widget (EShell *shell, EvolutionConfigControl *config_control); - -#endif /* E_SHELL_CONFIG_AUTOCOMPLETION_H */ diff --git a/shell/e-shell-config-default-folders.c b/shell/e-shell-config-default-folders.c deleted file mode 100644 index 8c60682068..0000000000 --- a/shell/e-shell-config-default-folders.c +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-default-folders.c - Configuration page for specifying default - * folders. - * - * 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: Dan Winship - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-shell-config-default-folders.h" - -#include "evolution-folder-selector-button.h" - -#include -#include -#include - -#include - -#include - - -typedef struct { - GladeXML *glade; - EvolutionConfigControl *config_control; - - char *mail_uri, *mail_path; - char *contacts_uri, *contacts_path; - char *calendar_uri, *calendar_path; - char *tasks_uri, *tasks_path; - - EvolutionShellClient *shell_client; -} EvolutionDefaultFolderConfig; - -static void -folder_selected (EvolutionFolderSelectorButton *button, - GNOME_Evolution_Folder *folder, - EvolutionDefaultFolderConfig *dfc) -{ - char **uri_ptr, **path_ptr; - - uri_ptr = g_object_get_data (G_OBJECT (button), "uri_ptr"); - path_ptr = g_object_get_data (G_OBJECT (button), "path_ptr"); - - g_free (*uri_ptr); - g_free (*path_ptr); - *uri_ptr = g_strdup (folder->physicalUri); - *path_ptr = g_strdup (folder->evolutionUri); - - evolution_config_control_changed (dfc->config_control); -} - -GtkWidget *e_shell_config_default_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2); - -GtkWidget * -e_shell_config_default_folder_selector_button_new (char *widget_name, - char *string1, - char *string2, - int int1, int int2) -{ - return (GtkWidget *) g_object_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, NULL); -} - -static void -config_control_apply_cb (EvolutionConfigControl *control, - EvolutionDefaultFolderConfig *dfc) -{ - GConfClient *client; - - client = gconf_client_get_default (); - - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_path", dfc->mail_path, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_uri", dfc->mail_uri, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_path", dfc->contacts_path, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_uri", dfc->contacts_uri, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_path", dfc->calendar_path, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_uri", dfc->calendar_uri, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_path", dfc->tasks_path, NULL); - gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_uri", dfc->tasks_uri, NULL); - - - g_object_unref (client); -} - -static void -config_control_destroy_notify (void *data, - GObject *where_the_config_control_was) -{ - EvolutionDefaultFolderConfig *dfc = (EvolutionDefaultFolderConfig *) data; - - g_free (dfc->mail_uri); - g_free (dfc->mail_path); - g_free (dfc->contacts_uri); - g_free (dfc->contacts_path); - g_free (dfc->calendar_uri); - g_free (dfc->calendar_path); - g_free (dfc->tasks_uri); - g_free (dfc->tasks_path); - - g_object_unref (dfc->glade); - g_object_unref (dfc->shell_client); - - g_free (dfc); -} - -static const char *mail_types[] = { "mail", NULL }; -static const char *contacts_types[] = { "contacts", "contacts/ldap", NULL }; -static const char *calendar_types[] = { "calendar", NULL }; -static const char *tasks_types[] = { "tasks", NULL }; - -static void -setup_folder_selector (EvolutionDefaultFolderConfig *dfc, - const char *widget_name, - char **path_ptr, char *path_dbpath, - char **uri_ptr, char *uri_dbpath, - const char **types) -{ - GConfClient *client; - GtkWidget *button; - - client = gconf_client_get_default (); - - *path_ptr = gconf_client_get_string (client, path_dbpath, NULL); - *uri_ptr = gconf_client_get_string (client, uri_dbpath, NULL); - - g_object_unref (client); - - button = glade_xml_get_widget (dfc->glade, widget_name); - evolution_folder_selector_button_construct ( - EVOLUTION_FOLDER_SELECTOR_BUTTON (button), - dfc->shell_client, _("Select Default Folder"), - *uri_ptr, types); - g_object_set_data (G_OBJECT (button), "uri_ptr", uri_ptr); - g_object_set_data (G_OBJECT (button), "path_ptr", path_ptr); - g_signal_connect (button, "selected", - G_CALLBACK (folder_selected), - dfc); - - /* XXX libglade2 seems to not show custom widgets even when - they're flagged Visible.*/ - gtk_widget_show (button); -} - -GtkWidget* -e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigControl *config_control) -{ - EvolutionDefaultFolderConfig *dfc; - GtkWidget *widget; - - dfc = g_new0 (EvolutionDefaultFolderConfig, 1); - - dfc->shell_client = evolution_shell_client_new (BONOBO_OBJREF (shell)); - - dfc->glade = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-config-default-folders.glade", NULL, NULL); - - setup_folder_selector (dfc, "default_mail_button", - &dfc->mail_path, "/apps/evolution/shell/default_folders/mail_path", - &dfc->mail_uri, "/apps/evolution/shell/default_folders/mail_uri", - mail_types); - setup_folder_selector (dfc, "default_contacts_button", - &dfc->contacts_path, "/apps/evolution/shell/default_folders/contacts_path", - &dfc->contacts_uri, "/apps/evolution/shell/default_folders/contacts_uri", - contacts_types); - setup_folder_selector (dfc, "default_calendar_button", - &dfc->calendar_path, "/apps/evolution/shell/default_folders/calendar_path", - &dfc->calendar_uri, "/apps/evolution/shell/default_folders/calendar_uri", - calendar_types); - setup_folder_selector (dfc, "default_tasks_button", - &dfc->tasks_path, "/apps/evolution/shell/default_folders/tasks_path", - &dfc->tasks_uri, "/apps/evolution/shell/default_folders/tasks_uri", - tasks_types); - - widget = glade_xml_get_widget (dfc->glade, "default_folders_table"); - gtk_widget_ref (widget); - gtk_container_remove (GTK_CONTAINER (widget->parent), widget); - gtk_widget_show (widget); - dfc->config_control = config_control; - - g_signal_connect (dfc->config_control, "apply", - G_CALLBACK (config_control_apply_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-default-folders.h b/shell/e-shell-config-default-folders.h deleted file mode 100644 index c5f4412a7a..0000000000 --- a/shell/e-shell-config-default-folders.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-default-folders.h - Configuration page for specifying default - * folders. - * - * 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: Dan Winship - */ - -#ifndef E_SHELL_CONFIG_DEFAULT_FOLDERS_H -#define E_SHELL_CONFIG_DEFAULT_FOLDERS_H - -#include "e-shell.h" - -#include -#include "evolution-config-control.h" - -GtkWidget *e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigControl *config_control); - -#endif /* E_SHELL_CONFIG_DEFAULT_FOLDERS_H */ diff --git a/shell/e-shell-config-folder-settings.c b/shell/e-shell-config-folder-settings.c deleted file mode 100644 index 0805c00448..0000000000 --- a/shell/e-shell-config-folder-settings.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-folder-settings.c - Configuration page for folder settings. - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include "e-shell-config-folder-settings.h" -#include "e-shell-config-offline.h" -#include "e-shell-config-autocompletion.h" -#include "e-shell-config-default-folders.h" - -#include "evolution-config-control.h" -#include "e-storage-set-view.h" - -#include "Evolution.h" - -#include - -#include -#include -#include - - -static void -append_to_notebook (GtkWidget *notebook, char *label_str, - GtkWidget *child) -{ - GtkWidget *label; - - label = gtk_label_new (label_str); - - gtk_notebook_append_page (GTK_NOTEBOOK(notebook), child, label); - gtk_widget_show (label); - gtk_widget_show (child); -} - -BonoboObject * -e_shell_config_folder_settings_create_control (EShell *shell) -{ - GtkWidget *notebook; - EvolutionConfigControl *control; - - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - notebook = gtk_notebook_new (); - - control = evolution_config_control_new (notebook); - - append_to_notebook (notebook, _("Default Folders"), - e_shell_config_default_folders_create_widget (shell, control)); - - append_to_notebook (notebook, _("Offline Folders"), - e_shell_config_offline_create_widget (shell, control)); - - append_to_notebook (notebook, _("Autocompletion Folders"), - e_shell_config_autocompletion_create_widget (shell, control)); - - gtk_widget_show (notebook); - - return BONOBO_OBJECT (control); -} diff --git a/shell/e-shell-config-folder-settings.h b/shell/e-shell-config-folder-settings.h deleted file mode 100644 index 9da0bc79be..0000000000 --- a/shell/e-shell-config-folder-settings.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-folder-settings.h - Configuration page for folder settings. - * - * 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 - */ - -#ifndef E_SHELL_CONFIG_FOLDER_SETTINGS_H -#define E_SHELL_CONFIG_FOLDER_SETTINGS_H - -#include "e-shell.h" - -#include - -BonoboObject *e_shell_config_folder_settings_create_control (EShell *shell); - -#endif /* E_SHELL_CONFIG_FOLDER_SETTINGS_H */ diff --git a/shell/e-shell-config-offline.c b/shell/e-shell-config-offline.c deleted file mode 100644 index 1342abbbb2..0000000000 --- a/shell/e-shell-config-offline.c +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include "e-shell-config-offline.h" - -#include "evolution-config-control.h" -#include "e-storage-set-view.h" - -#include "Evolution.h" - -#include - -#include -#include -#include - - -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) -{ - GConfClient *gconf_client; - PageData *page_data; - GSList *checked_paths; - - page_data = (PageData *) data; - - checked_paths = e_storage_set_view_get_checkboxes_list (E_STORAGE_SET_VIEW (page_data->storage_set_view)); - - gconf_client = gconf_client_get_default (); - - gconf_client_set_list (gconf_client, "/apps/evolution/shell/offline/folder_paths", - GCONF_VALUE_STRING, checked_paths, NULL); - - g_slist_foreach (checked_paths, (GFunc) g_free, NULL); - g_slist_free (checked_paths); - - g_object_unref (gconf_client); -} - -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) -{ - GConfClient *gconf_client; - GSList *list; - - gconf_client = gconf_client_get_default (); - - list = gconf_client_get_list (gconf_client, "/apps/evolution/shell/offline/folder_paths", - GCONF_VALUE_STRING, NULL); - - e_storage_set_view_set_checkboxes_list (storage_set_view, list); - - g_slist_foreach (list, (GFunc) g_free, NULL); - g_slist_free (list); - - g_object_unref (gconf_client); -} - -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 *scrolled_window; - - 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); - - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (scrolled_window), page_data->storage_set_view); - gtk_widget_show (scrolled_window); - - 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 scrolled_window; -} diff --git a/shell/e-shell-config-offline.h b/shell/e-shell-config-offline.h deleted file mode 100644 index fb1d9fb0fb..0000000000 --- a/shell/e-shell-config-offline.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-offline.h - 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 - */ - -#ifndef E_SHELL_CONFIG_OFFLINE_H -#define E_SHELL_CONFIG_OFFLINE_H - -#include "e-shell.h" - -#include -#include "evolution-config-control.h" - -GtkWidget *e_shell_config_offline_create_widget (EShell *shell, EvolutionConfigControl *config_control); - -#endif /* E_SHELL_CONFIG_OFFLINE_H */ diff --git a/shell/e-shell-config.c b/shell/e-shell-config.c deleted file mode 100644 index 27a2fbd937..0000000000 --- a/shell/e-shell-config.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config.c - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-shell-config.h" - -#include "e-shell-config-folder-settings.h" -#include "evolution-config-control.h" -#include "evolution-folder-selector-button.h" - -#include -#include - - -#define E_SHELL_CONFIG_FACTORY_OAFIID "OAFIID:GNOME_Evolution_Shell_Config_Factory:" BASE_VERSION - -#define E_SHELL_CONFIG_FOLDER_SETTINGS_OAFIID "OAFIID:GNOME_Evolution_Shell_Config_FolderSettings_Control:" BASE_VERSION - - -static BonoboObject * -config_control_factory_cb (BonoboGenericFactory *factory, - const char *component_id, - gpointer shell) -{ - if (!strcmp (component_id, E_SHELL_CONFIG_FOLDER_SETTINGS_OAFIID)) - return e_shell_config_folder_settings_create_control (shell); - else { - g_assert_not_reached(); - return NULL; - } -} - -gboolean -e_shell_config_factory_register (EShell *shell) -{ - BonoboGenericFactory *factory; - - g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - - factory = bonobo_generic_factory_new (E_SHELL_CONFIG_FACTORY_OAFIID, - config_control_factory_cb, - shell); - - if (factory == NULL) { - g_warning ("Cannot register factory %s", E_SHELL_CONFIG_FACTORY_OAFIID); - return FALSE; - } - return TRUE; -} diff --git a/shell/e-shell-config.h b/shell/e-shell-config.h deleted file mode 100644 index 9ba17b78d7..0000000000 --- a/shell/e-shell-config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config.h - * - * 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. - */ - -#ifndef E_SHELL_CONFIG_H -#define E_SHELL_CONFIG_H - -#include "e-shell.h" - -#include - -gboolean e_shell_config_factory_register (EShell *shell); - -#endif diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c deleted file mode 100644 index 1a4afb1403..0000000000 --- a/shell/e-shell-folder-creation-dialog.c +++ /dev/null @@ -1,580 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000, 2001 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - -#include "e-storage-set.h" -#include "e-storage-set-view.h" -#include "e-shell-utils.h" - -#include "e-util/e-dialog-utils.h" - -#include "e-shell-folder-creation-dialog.h" - - -#define GLADE_FILE_NAME EVOLUTION_GLADEDIR "/e-shell-folder-creation-dialog.glade" - - -/* Forward declarations for the weak references. */ -static void dialog_destroy_notify (void *data, GObject *where_the_dialog_was); -static void shell_destroy_notify (void *data, GObject *where_the_shell_was); - -/* Data for the callbacks. */ -struct _DialogData { - GtkWidget *dialog; - EShell *shell; - - GtkWidget *folder_name_entry; - GtkWidget *storage_set_view; - GtkWidget *folder_type_option_menu; - - GList *folder_types; - - char *folder_path; - - EShellFolderCreationDialogCallback result_callback; - void *result_callback_data; - - gboolean creation_in_progress; -}; -typedef struct _DialogData DialogData; - -static void -dialog_data_destroy (DialogData *dialog_data) -{ - e_free_string_list (dialog_data->folder_types); - g_free (dialog_data->folder_path); - - if (dialog_data->dialog != NULL) - g_object_weak_unref (G_OBJECT (dialog_data->dialog), dialog_destroy_notify, dialog_data); - - if (dialog_data->shell != NULL) - g_object_weak_unref (G_OBJECT (dialog_data->shell), shell_destroy_notify, dialog_data); - - g_free (dialog_data); -} - - -/* Callback for the asynchronous folder creation function. */ - -static void -async_create_cb (EStorageSet *storage_set, - EStorageResult result, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - - dialog_data->creation_in_progress = FALSE; - - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog_data->dialog), GTK_RESPONSE_OK, TRUE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog_data->dialog), GTK_RESPONSE_CANCEL, TRUE); - - if (result == E_STORAGE_OK) { - /* Success! Tell the callback of this, then return */ - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS, - dialog_data->folder_path, - dialog_data->result_callback_data); - if (dialog_data->dialog != NULL) { - gtk_widget_destroy (dialog_data->dialog); - } else { - /* If dialog_data->dialog is NULL, it means that the - dialog has been destroyed before we were done, so we - have to free the dialog_data ourselves. */ - dialog_data_destroy (dialog_data); - } - return; - } - - /* Tell the callback something failed, then popup a dialog - explaining how it failed */ - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_FAIL, - dialog_data->folder_path, - dialog_data->result_callback_data); - - e_notice (dialog_data->dialog, GTK_MESSAGE_ERROR, - _("Cannot create the specified folder:\n%s"), - e_storage_result_to_string (result)); - - /* If dialog_data->dialog is NULL, it means that the dialog has been - destroyed before we were done, so we have to free the dialog_data - ourselves. */ - if (dialog_data->dialog == NULL) - dialog_data_destroy (dialog_data); -} - - -/* Dialog signal callbacks. */ - -static void -dialog_response_cb (GtkDialog *dialog, - int response_id, - void *data) -{ - DialogData *dialog_data; - EStorageSet *storage_set; - GtkWidget *folder_type_menu_item; - const char *folder_type; - const char *parent_path; - const char *reason; - const char *folder_name; - char *path; - - dialog_data = (DialogData *) data; - - if (response_id != GTK_RESPONSE_OK) { - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL, - NULL, - dialog_data->result_callback_data); - gtk_widget_destroy (GTK_WIDGET (dialog)); - return; - } - - folder_name = gtk_entry_get_text(GTK_ENTRY (dialog_data->folder_name_entry)); - - if (! e_shell_folder_name_is_valid (folder_name, &reason)) { - e_notice (dialog, GTK_MESSAGE_ERROR, - _("The specified folder name is not valid: %s"), reason); - return; - } - - parent_path = e_storage_set_view_get_current_folder - (E_STORAGE_SET_VIEW (dialog_data->storage_set_view)); - if (parent_path == NULL) { - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL, - NULL, - dialog_data->result_callback_data); - gtk_widget_destroy (GTK_WIDGET (dialog)); - return; - } - - path = g_build_filename (parent_path, folder_name, NULL); - - storage_set = e_shell_get_storage_set (dialog_data->shell); - - folder_type_menu_item = GTK_OPTION_MENU (dialog_data->folder_type_option_menu)->menu_item; - folder_type = g_object_get_data (G_OBJECT (folder_type_menu_item), "folder_type"); - - if (folder_type == NULL) { - g_warning ("Cannot get folder type for selected GtkOptionMenu item."); - return; - } - - g_free (dialog_data->folder_path); - dialog_data->folder_path = path; - - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL, FALSE); - - dialog_data->creation_in_progress = TRUE; - - e_storage_set_async_create_folder (storage_set, - path, - folder_type, - "", /* description */ - async_create_cb, dialog_data); -} - -static void -dialog_destroy_notify (void *data, - GObject *where_the_dialog_was) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - dialog_data->dialog = NULL; - - if (dialog_data->creation_in_progress) { - /* If the dialog has been closed before we are done creating - the folder, the dialog_data will be freed after the creation - is completed. */ - dialog_data->folder_name_entry = NULL; - dialog_data->storage_set_view = NULL; - dialog_data->folder_type_option_menu = NULL; - return; - } - - dialog_data_destroy (dialog_data); -} - -static void -folder_name_entry_activate_cb (GtkEntry *entry, - void *data) -{ - DialogData *dialog_data; - const char *parent_path; - - dialog_data = (DialogData *) data; - - parent_path = e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (dialog_data->storage_set_view)); - - if (parent_path != NULL - && GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0) - gtk_dialog_response (GTK_DIALOG (dialog_data->dialog), GTK_RESPONSE_OK); -} - -static void -folder_name_entry_changed_cb (GtkEditable *editable, - void *data) -{ - DialogData *dialog_data; - const char *parent_path; - - dialog_data = (DialogData *) data; - - parent_path = e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (dialog_data->storage_set_view)); - - if (parent_path != NULL - && GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0) - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog_data->dialog), GTK_RESPONSE_OK, TRUE); - else - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog_data->dialog), GTK_RESPONSE_OK, FALSE); -} - -static void -storage_set_view_folder_selected_cb (EStorageSetView *storage_set_view, - const char *path, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - - if (GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0) - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog_data->dialog), GTK_RESPONSE_OK, TRUE); -} - - -/* Shell signal callbacks. */ - -static void -shell_destroy_notify (void *data, - GObject *where_the_shell_was) -{ - DialogData *dialog_data = (DialogData *) data; - - dialog_data->shell = NULL; - gtk_widget_destroy (GTK_WIDGET (dialog_data->dialog)); -} - - -/* Dialog setup. */ - -static void -setup_dialog (GtkWidget *dialog, - GladeXML *gui, - EShell *shell, - GtkWindow *parent_window) -{ - if (parent_window != NULL) - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); - - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - gtk_window_set_title (GTK_WINDOW (dialog), _("Create New Folder")); - - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - - gtk_widget_show (dialog); -} - -static void -setup_folder_name_entry (GtkWidget *dialog, - GladeXML *gui, - EShell *shell) -{ - GtkWidget *folder_name_entry; - - folder_name_entry = glade_xml_get_widget (gui, "folder_name_entry"); -} - -static GtkWidget * -add_storage_set_view (GtkWidget *dialog, - GladeXML *gui, - EShell *shell, - const char *default_parent_folder) -{ - EStorageSet *storage_set; - GtkWidget *storage_set_view; - GtkWidget *scrolled_window; - GtkWidget *vbox; - - storage_set = e_shell_get_storage_set (shell); - storage_set_view = e_storage_set_create_new_view (storage_set, NULL); - - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE); - - GTK_WIDGET_SET_FLAGS (storage_set_view, GTK_CAN_FOCUS); - - if (default_parent_folder != NULL) - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (storage_set_view), - default_parent_folder); - - vbox = glade_xml_get_widget (gui, "main_vbox"); - - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 6); - - gtk_container_add (GTK_CONTAINER (scrolled_window), storage_set_view); - - gtk_widget_show (scrolled_window); - gtk_widget_show (storage_set_view); - - return storage_set_view; -} - -struct _TypeWithDisplayName { - const char *type; - const char *display_name; -}; -typedef struct _TypeWithDisplayName TypeWithDisplayName; - -static int -type_with_display_name_compare_func (const void *a, const void *b) -{ - const TypeWithDisplayName *val_a, *val_b; - char *a_display_name_casefolded; - char *b_display_name_casefolded; - int retval; - - val_a = (const TypeWithDisplayName *) a; - val_b = (const TypeWithDisplayName *) b; - - a_display_name_casefolded = g_utf8_casefold (val_a->display_name, -1); - b_display_name_casefolded = g_utf8_casefold (val_b->display_name, -1); - - retval = g_utf8_collate (a_display_name_casefolded, b_display_name_casefolded); - - g_free (a_display_name_casefolded); - g_free (b_display_name_casefolded); - - return retval; -} - -static GList * -add_folder_types (GtkWidget *dialog, - GladeXML *gui, - EShell *shell, - const char *default_type) -{ - EFolderTypeRegistry *folder_type_registry; - GtkWidget *folder_type_option_menu; - GtkWidget *menu; - GList *folder_types; - GList *types_with_display_names; - GList *p; - int default_item; - int i, len; - - folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu"); - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (folder_type_option_menu)); - - folder_type_registry = e_shell_get_folder_type_registry (shell); - g_assert (folder_type_registry != NULL); - - folder_types = e_folder_type_registry_get_type_names (folder_type_registry); - if (folder_types == NULL) - return NULL; /* Uh? */ - - types_with_display_names = NULL; - for (p = folder_types; p != NULL; p = p->next) { - TypeWithDisplayName *new; - - new = g_new (TypeWithDisplayName, 1); - new->type = p->data; - new->display_name = e_folder_type_registry_get_display_name_for_type (folder_type_registry, new->type); - - types_with_display_names = g_list_prepend (types_with_display_names, new); - } - - types_with_display_names = g_list_sort (types_with_display_names, type_with_display_name_compare_func); - - /* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again). */ - - default_item = -1; - i = 0; - for (p = types_with_display_names; p != NULL; p = p->next) { - const TypeWithDisplayName *type; - GtkWidget *menu_item; - - type = (const TypeWithDisplayName *) p->data; - - if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type->type)) - continue; - - menu_item = gtk_menu_item_new_with_label (type->display_name); - gtk_widget_show (menu_item); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - - g_object_set_data_full (G_OBJECT (menu_item), "folder_type", g_strdup (type->type), g_free); - - if (strcmp (type->type, default_type) == 0) - default_item = i; - else if (default_item == -1) { - len = strlen (type->type); - if (strncmp (type->type, default_type, len) == 0 && - default_type[len] == '/') - default_item = i; - } - - i ++; - } - if (default_item == -1) - default_item = 0; - - for (p = types_with_display_names; p != NULL; p = p->next) - g_free (p->data); - g_list_free (types_with_display_names); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (folder_type_option_menu), menu); - gtk_widget_show (menu); - - gtk_option_menu_set_history (GTK_OPTION_MENU (folder_type_option_menu), default_item); - gtk_widget_queue_resize (folder_type_option_menu); - - return folder_types; -} - -static const char * -get_type_from_parent_path (EShell *shell, - const char *path) -{ - EFolder *folder; - const char *folder_type; - EStorageSet *set; - - set = e_shell_get_storage_set (shell); - folder = e_storage_set_get_folder (set, path); - if (folder == NULL) { - return "mail"; - } - - folder_type = e_folder_get_type_string (folder); - if (folder_type == NULL || strcmp (folder_type, "noselect") == 0) { - return "mail"; - } else { - return folder_type; - } -} - - -/* FIXME: Currently this is modal. I think it's OK, but if people think it is - not, we should change it to non-modal and make sure only one of these is - open at once. Currently it relies on modality for this. */ -void -e_shell_show_folder_creation_dialog (EShell *shell, - GtkWindow *parent_window, - const char *default_parent_folder, - const char *default_type, - EShellFolderCreationDialogCallback result_callback, - void *result_callback_data) -{ - GladeXML *gui; - GtkWidget *dialog; - GtkWidget *storage_set_view; - GList *folder_types; - DialogData *dialog_data; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - gui = glade_xml_new (GLADE_FILE_NAME, NULL, NULL); - if (gui == NULL) { - g_warning ("Cannot load Glade description file for the folder creation dialog -- %s", - GLADE_FILE_NAME); - return; - } - - dialog = glade_xml_get_widget (gui, "create_folder_dialog"); - - setup_dialog (dialog, gui, shell, parent_window); - setup_folder_name_entry (dialog, gui, shell); - - storage_set_view = add_storage_set_view (dialog, gui, shell, default_parent_folder); - if (default_type == NULL) { - const char *dt; - - dt = get_type_from_parent_path (shell, default_parent_folder); - folder_types = add_folder_types (dialog, gui, shell, dt); - } else { - folder_types = add_folder_types (dialog, gui, shell, default_type); - } - - dialog_data = g_new (DialogData, 1); - dialog_data->dialog = dialog; - dialog_data->shell = shell; - dialog_data->folder_name_entry = glade_xml_get_widget (gui, "folder_name_entry"); - dialog_data->storage_set_view = storage_set_view; - dialog_data->folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu"); - dialog_data->folder_types = folder_types; - dialog_data->folder_path = NULL; - dialog_data->result_callback = result_callback; - dialog_data->result_callback_data = result_callback_data; - dialog_data->creation_in_progress = FALSE; - - g_signal_connect (dialog, "response", - G_CALLBACK (dialog_response_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); - - g_signal_connect (dialog_data->folder_name_entry, "activate", - G_CALLBACK (folder_name_entry_activate_cb), dialog_data); - - g_signal_connect (dialog_data->storage_set_view, "folder_selected", - G_CALLBACK (storage_set_view_folder_selected_cb), dialog_data); - - g_object_weak_ref (G_OBJECT (shell), shell_destroy_notify, dialog_data); - - g_object_unref (gui); -} diff --git a/shell/e-shell-folder-creation-dialog.h b/shell/e-shell-folder-creation-dialog.h deleted file mode 100644 index 8e3e990835..0000000000 --- a/shell/e-shell-folder-creation-dialog.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000 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 - */ - -#ifndef E_SHELL_FOLDER_CREATION_DIALOG_H -#define E_SHELL_FOLDER_CREATION_DIALOG_H - -#include - -#include "e-shell.h" - -enum _EShellFolderCreationDialogResult { - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_FAIL, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL -}; -typedef enum _EShellFolderCreationDialogResult EShellFolderCreationDialogResult; - -typedef void (* EShellFolderCreationDialogCallback) (EShell *shell, - EShellFolderCreationDialogResult result, - const char *path, - void *data); - -void e_shell_show_folder_creation_dialog (EShell *shell, - GtkWindow *parent, - const char *default_parent_folder, - const char *default_type, - EShellFolderCreationDialogCallback result_callback, - void *result_callback_data); - -#endif /* E_SHELL_FOLDER_CREATION_DIALOG_H */ diff --git a/shell/e-shell-shared-folder-picker-dialog.c b/shell/e-shell-shared-folder-picker-dialog.c deleted file mode 100644 index 1bf651f25f..0000000000 --- a/shell/e-shell-shared-folder-picker-dialog.c +++ /dev/null @@ -1,557 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-shared-folder-picker-dialog.c - Implementation for the shared folder - * picker dialog. - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-shell-shared-folder-picker-dialog.h" - -#include "e-corba-storage.h" -#include "e-shell-constants.h" -#include "evolution-storage-listener.h" - -#include "Evolution-Addressbook-SelectNames.h" - -#include "e-util/e-dialog-utils.h" - -#include -#include - -#include -#include -#include - -#include - -#include -#include - - -/* Timeout for showing the progress dialog (msecs). */ - -#define PROGRESS_DIALOG_DELAY 500 - - -/* Dialog creation and handling. */ - -static void -setup_folder_name_combo (GladeXML *glade_xml) -{ - GtkWidget *combo; - GList *string_list; - char *strings[] = { - "Calendar", - "Inbox", - "Contacts", - NULL - /* FIXME: Should these be translated? */ - }; - int i; - - combo = glade_xml_get_widget (glade_xml, "folder-name-combo"); - g_assert (GTK_IS_COMBO (combo)); - - string_list = NULL; - for (i = 0; strings[i] != NULL; i ++) - string_list = g_list_append (string_list, strings[i]); - gtk_combo_set_popdown_strings (GTK_COMBO (combo), string_list); - g_list_free (string_list); - - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), "Calendar"); -} - -static void -user_clicked (GtkWidget *button, GNOME_Evolution_Addressbook_SelectNames corba_iface) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - GNOME_Evolution_Addressbook_SelectNames_activateDialog (corba_iface, "User", &ev); - - if (BONOBO_EX (&ev)) - g_warning ("Cannot activate SelectNames dialog -- %s", BONOBO_EX_REPOID (&ev)); - - CORBA_exception_free (&ev); -} - -static GtkWidget * -setup_name_selector (GladeXML *glade_xml, - GNOME_Evolution_Addressbook_SelectNames *iface_ret) -{ - GNOME_Evolution_Addressbook_SelectNames corba_iface; - Bonobo_Control control; - CORBA_Environment ev; - GtkWidget *placeholder; - GtkWidget *control_widget; - GtkWidget *button; - - placeholder = glade_xml_get_widget (glade_xml, "user-picker-placeholder"); - g_assert (GTK_IS_CONTAINER (placeholder)); - - CORBA_exception_init (&ev); - - corba_iface = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION, - 0, NULL, &ev); - if (corba_iface == CORBA_OBJECT_NIL || BONOBO_EX (&ev)) { - g_warning ("Cannot activate SelectNames -- %s", BONOBO_EX_REPOID (&ev)); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - GNOME_Evolution_Addressbook_SelectNames_addSectionWithLimit (corba_iface, "User", "User", 1, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Cannot add SelectNames section -- %s", BONOBO_EX_REPOID (&ev)); - goto err; - } - - control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (corba_iface, "User", &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Cannot get SelectNames section -- %s", BONOBO_EX_REPOID (&ev)); - goto err; - } - - control_widget = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL); - gtk_container_add (GTK_CONTAINER (placeholder), control_widget); - gtk_widget_show (control_widget); - - button = glade_xml_get_widget (glade_xml, "button-user"); - g_signal_connect (button, "clicked", G_CALLBACK (user_clicked), corba_iface); - - CORBA_exception_free (&ev); - *iface_ret = corba_iface; - return control_widget; - - err: - bonobo_object_release_unref (corba_iface, NULL); - CORBA_exception_free (&ev); - return NULL; -} - -static void -server_option_menu_item_activate_callback (GtkMenuItem *menu_item, - void *data) -{ - char **storage_name_return; - - storage_name_return = (char **) data; - if (*storage_name_return != NULL) - g_free (*storage_name_return); - - *storage_name_return = g_strdup ((const char *) g_object_get_data (G_OBJECT (menu_item), "storage_name")); -} - -static void -folder_name_entry_changed_callback (GtkEditable *editable, - void *data) -{ - GtkDialog *dialog = GTK_DIALOG (data); - const char *folder_name_text = gtk_entry_get_text (GTK_ENTRY (editable)); - - if (*folder_name_text == '\0') - gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, FALSE); - else - gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, TRUE); -} - -static void -setup_server_option_menu (EShell *shell, - GladeXML *glade_xml, - char **storage_name_return) -{ - GList *storages; - GList *p; - GtkWidget *widget; - GtkWidget *menu; - - widget = glade_xml_get_widget (glade_xml, "server-option-menu"); - g_assert (GTK_IS_OPTION_MENU (widget)); - - menu = gtk_menu_new (); - gtk_widget_show (menu); - - *storage_name_return = NULL; - storages = e_storage_set_get_storage_list (e_shell_get_storage_set (shell)); - for (p = storages; p != NULL; p = p->next) { - GtkWidget *menu_item; - const char *storage_name; - - if (!e_storage_supports_shared_folders (p->data)) - continue; - - storage_name = e_storage_get_name (E_STORAGE (p->data)); - - menu_item = gtk_menu_item_new_with_label (storage_name); - g_signal_connect (menu_item, "activate", - G_CALLBACK (server_option_menu_item_activate_callback), - storage_name_return); - g_object_set_data_full (G_OBJECT (menu_item), "storage_name", g_strdup (storage_name), g_free); - - gtk_widget_show (menu_item); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - - if (*storage_name_return == NULL) - *storage_name_return = g_strdup (storage_name); - } - - gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); - - /* FIXME: Default to the current storage in the shell view. */ -} - -static gboolean -show_dialog (EShell *shell, - EShellView *parent, - char **user_email_address_return, - char **storage_name_return, - char **folder_name_return) -{ - GNOME_Evolution_Addressbook_SelectNames corba_iface; - GladeXML *glade_xml; - GtkWidget *dialog; - GtkWidget *name_selector_widget; - GtkWidget *folder_name_entry; - char *user_email_address; - int response; - - glade_xml = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-shared-folder-picker-dialog.glade", - NULL, NULL); - g_assert (glade_xml != NULL); - - name_selector_widget = setup_name_selector (glade_xml, &corba_iface); - if (name_selector_widget == NULL) - return FALSE; - - setup_server_option_menu (shell, glade_xml, storage_name_return); - setup_folder_name_combo (glade_xml); - - dialog = glade_xml_get_widget (glade_xml, "dialog"); - g_assert (dialog != NULL); - - folder_name_entry = glade_xml_get_widget (glade_xml, "folder-name-entry"); - - /* Connect the callback to set the OK button insensitive when there is - no text in the folder_name_entry. Notice that we put a value there - by default so the OK button is sensitive by default. */ - g_signal_connect (folder_name_entry, "changed", - G_CALLBACK (folder_name_entry_changed_callback), dialog); - - while (TRUE) { - response = gtk_dialog_run (GTK_DIALOG (dialog)); - if (response == GTK_RESPONSE_CANCEL) { - g_free (*storage_name_return); - *storage_name_return = NULL; - gtk_widget_destroy (dialog); - bonobo_object_release_unref (corba_iface, NULL); - return FALSE; - } - - bonobo_widget_get_property (BONOBO_WIDGET (name_selector_widget), - "addresses", TC_CORBA_string, &user_email_address, - NULL); - - if (user_email_address != NULL && *user_email_address != '\0') - break; - - g_free (user_email_address); - - /* It would be nice to insensitivize the OK button appropriately - instead of doing this, but unfortunately we can't do this for the - Bonobo control. */ - e_notice (dialog, GTK_MESSAGE_ERROR, _("Please select a user.")); - } - - *user_email_address_return = user_email_address; - *folder_name_return = g_strdup (gtk_entry_get_text (GTK_ENTRY (folder_name_entry))); - - gtk_widget_destroy (dialog); - bonobo_object_release_unref (corba_iface, NULL); - return TRUE; -} - - -/* Discovery process. */ - -static void shell_weak_notify (void *data, GObject *where_the_object_was); -static void shell_view_weak_notify (void *data, GObject *where_the_object_was); -static void storage_weak_notify (void *data, GObject *where_the_object_was); - -struct _DiscoveryData { - EShell *shell; - EShellView *parent; - GtkWidget *dialog; - char *user_email_address; - char *folder_name; - EStorage *storage; -}; -typedef struct _DiscoveryData DiscoveryData; - -static void -cleanup_discovery (DiscoveryData *discovery_data) -{ - if (discovery_data->dialog != NULL) - gtk_widget_destroy (discovery_data->dialog); - - if (discovery_data->shell != NULL) - g_object_weak_unref (G_OBJECT (discovery_data->shell), shell_weak_notify, discovery_data); - - if (discovery_data->parent != NULL) - g_object_weak_unref (G_OBJECT (discovery_data->parent), shell_view_weak_notify, discovery_data); - - if (discovery_data->storage != NULL) - g_object_weak_unref (G_OBJECT (discovery_data->storage), storage_weak_notify, discovery_data); - - g_free (discovery_data->user_email_address); - g_free (discovery_data->folder_name); - g_object_unref (discovery_data->storage); - g_free (discovery_data); -} - -static int -progress_bar_timeout_callback (void *data) -{ - gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); - - return TRUE; -} - -static void -progress_bar_weak_notify (void *data, - GObject *where_the_object_was) -{ - int timeout_id; - - timeout_id = GPOINTER_TO_INT (data); - g_source_remove (timeout_id); -} - -/* This is invoked if the "Cancel" button is clicked. */ -static void -progress_dialog_clicked_callback (GtkDialog *dialog, - int response, - void *data) -{ - DiscoveryData *discovery_data; - - discovery_data = (DiscoveryData *) data; - - e_storage_cancel_discover_shared_folder (discovery_data->storage, - discovery_data->user_email_address, - discovery_data->folder_name); - - cleanup_discovery (discovery_data); -} - -static int -progress_dialog_show_timeout_callback (void *data) -{ - GtkWidget *dialog; - - dialog = GTK_WIDGET (data); - gtk_widget_show_all (dialog); - return FALSE; -} - -static GtkWidget * -create_progress_dialog (EShell *shell, - EStorage *storage, - const char *user_email_address, - const char *folder_name) -{ - GtkWidget *dialog; - GtkWidget *label; - GtkWidget *progress_bar; - int timeout_id; - char *text; - - dialog = gtk_dialog_new_with_buttons (_("Opening Folder"), NULL, 0, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - gtk_widget_set_size_request (dialog, 300, -1); - gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); - - text = g_strdup_printf (_("Opening Folder \"%s\""), folder_name); - label = gtk_label_new (text); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, TRUE, 0); - g_free (text); - - text = g_strdup_printf (_("in \"%s\" ..."), e_storage_get_name (storage)); - label = gtk_label_new (text); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, TRUE, 0); - g_free (text); - - progress_bar = gtk_progress_bar_new (); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), progress_bar, FALSE, TRUE, 0); - - timeout_id = g_timeout_add (50, progress_bar_timeout_callback, progress_bar); - 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_object_weak_ref (G_OBJECT (progress_bar), progress_bar_weak_notify, GINT_TO_POINTER (timeout_id)); - - return dialog; -} - -static void -shell_weak_notify (void *data, - GObject *where_the_object_was) -{ - DiscoveryData *discovery_data; - - discovery_data = (DiscoveryData *) data; - discovery_data->shell = NULL; - - cleanup_discovery (discovery_data); -} - -static void -shell_view_weak_notify (void *data, - GObject *where_the_object_was) -{ - DiscoveryData *discovery_data; - - discovery_data = (DiscoveryData *) data; - discovery_data->parent = NULL; -} - -static void -storage_weak_notify (void *data, - GObject *where_the_object_was) -{ - DiscoveryData *discovery_data; - - discovery_data = (DiscoveryData *) data; - discovery_data->storage = NULL; - - cleanup_discovery (discovery_data); - - /* FIXME: Should we signal the user when this happens? I.e. when the - storage dies for some reason before the folder is discovered. */ -} - -static void -shared_folder_discovery_callback (EStorage *storage, - EStorageResult result, - const char *path, - void *data) -{ - DiscoveryData *discovery_data; - EShell *shell; - EShellView *parent; - - discovery_data = (DiscoveryData *) data; - shell = discovery_data->shell; - parent = discovery_data->parent; - - /* Make sure the progress dialog doesn't show up now. */ - cleanup_discovery (discovery_data); - - if (result == E_STORAGE_OK) { - char *uri; - - uri = g_strconcat (E_SHELL_URI_PREFIX, "/", - e_storage_get_name (storage), - path, NULL); - - if (discovery_data->parent != NULL) - e_shell_view_display_uri (parent, uri, TRUE); - else - e_shell_create_view (shell, uri, NULL); - } else { - e_notice (parent, GTK_MESSAGE_ERROR, - _("Could not open shared folder: %s."), - e_storage_result_to_string (result)); - } -} - -static void -discover_folder (EShell *shell, - EShellView *parent, - const char *user_email_address, - const char *storage_name, - const char *folder_name) -{ - EStorageSet *storage_set; - EStorage *storage; - GtkWidget *dialog; - DiscoveryData *discovery_data; - - storage_set = e_shell_get_storage_set (shell); - if (storage_set == NULL) - goto error; - - storage = e_storage_set_get_storage (storage_set, storage_name); - if (storage == NULL || ! e_storage_supports_shared_folders (storage)) - goto error; - - dialog = create_progress_dialog (shell, storage, user_email_address, folder_name); - - discovery_data = g_new (DiscoveryData, 1); - discovery_data->dialog = dialog; - discovery_data->shell = shell; - discovery_data->parent = parent; - discovery_data->user_email_address = g_strdup (user_email_address); - discovery_data->folder_name = g_strdup (folder_name); - discovery_data->storage = storage; - g_object_ref (storage); - - 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); - - e_storage_async_discover_shared_folder (storage, - user_email_address, - folder_name, - shared_folder_discovery_callback, - discovery_data); - return; - - error: - /* FIXME: Be more verbose? */ - e_notice (parent, GTK_MESSAGE_ERROR, - _("Cannot find the specified shared folder.")); -} - - -void -e_shell_show_shared_folder_picker_dialog (EShell *shell, - EShellView *parent) -{ - char *user_email_address = NULL; - char *storage_name = NULL; - char *folder_name = NULL; - - g_return_if_fail (E_IS_SHELL (shell)); - - if (! show_dialog (shell, parent, &user_email_address, &storage_name, &folder_name)) - return; - - discover_folder (shell, parent, user_email_address, storage_name, folder_name); - - g_free (user_email_address); - g_free (storage_name); - g_free (folder_name); -} diff --git a/shell/e-shell-shared-folder-picker-dialog.h b/shell/e-shell-shared-folder-picker-dialog.h deleted file mode 100644 index 721cbaec6a..0000000000 --- a/shell/e-shell-shared-folder-picker-dialog.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-shared-folder-picker-dialog.h - Implementation for the shared folder - * picker dialog. - * - * 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 - */ - -#ifndef E_SHELL_SHARED_FOLDER_PICKER_DIALOG_H -#define E_SHELL_SHARED_FOLDER_PICKER_DIALOG_H - -#include "e-shell.h" -#include "e-shell-view.h" - -void e_shell_show_shared_folder_picker_dialog (EShell *shell, - EShellView *parent); - -#endif /* E_SHELL_SHARED_FOLDER_PICKER_DIALOG_H */ diff --git a/shell/e-storage-set-store.c b/shell/e-storage-set-store.c deleted file mode 100644 index e2816d87d2..0000000000 --- a/shell/e-storage-set-store.c +++ /dev/null @@ -1,1361 +0,0 @@ -/* e-storage-set-store.c - * Copyright (C) 2002 Ximian, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include -#include - -#include "e-icon-factory.h" -#include "e-storage-set-store.h" -#include "e-shell-constants.h" - -struct _EStorageSetStorePrivate { - EStorageSet *storage_set; - GHashTable *checkboxes; - GHashTable *path_to_node; - GHashTable *type_name_to_pixbuf; - GNode *root; - gint stamp; - EStorageSetStoreHasCheckBoxFunc has_checkbox_func; - gpointer has_checkbox_func_data; -}; - -#define G_NODE(node) ((GNode *)(node)) -#define VALID_ITER(iter, store) ((iter) != NULL && (iter)->user_data != NULL && (store)->priv->stamp == (iter)->stamp) -#define VALID_COL(col) ((col) >= 0 && (col) < E_STORAGE_SET_STORE_COLUMN_COUNT) - -static GObjectClass *parent_class = NULL; - -static gboolean -has_checkbox (EStorageSetStore *store, const gchar *folder_path) -{ - EStorageSetStorePrivate *priv = store->priv; - - g_return_val_if_fail (folder_path != NULL, FALSE); - - if (strchr (folder_path + 1, '/') == NULL) { - /* If it's a toplevel, never allow checking it. */ - return FALSE; - } - -#if 0 - if (priv->has_checkbox_func) - return (* priv->has_checkbox_func) (priv->storage_set, - folder_path, - priv->has_checkbox_func_data); -#endif - - return TRUE; -} - - -/* GtkTreeModel interface implementation */ - -static guint -esss_get_flags(GtkTreeModel *tree_model) -{ - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), 0); - - return GTK_TREE_MODEL_ITERS_PERSIST; -} - -static gint -esss_get_n_columns(GtkTreeModel *tree_model) -{ - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), 0); - - return E_STORAGE_SET_STORE_COLUMN_COUNT; -} - -static GType -esss_get_column_type(GtkTreeModel *tree_model, gint index) -{ - EStorageSetStore *store = (EStorageSetStore *) tree_model; - GType retval; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), G_TYPE_INVALID); - g_return_val_if_fail(VALID_COL(index), G_TYPE_INVALID); - - switch (index) { - case E_STORAGE_SET_STORE_COLUMN_NAME: - retval = G_TYPE_STRING; - break; - case E_STORAGE_SET_STORE_COLUMN_HIGHLIGHT: - retval = G_TYPE_INT; - break; - case E_STORAGE_SET_STORE_COLUMN_CHECKED: - case E_STORAGE_SET_STORE_COLUMN_CHECKABLE: - retval = G_TYPE_BOOLEAN; - break; - case E_STORAGE_SET_STORE_COLUMN_ICON: - retval = GDK_TYPE_PIXBUF; - break; - default: - g_assert_not_reached (); - } - - return retval; -} - -static gboolean -esss_get_iter(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path) -{ - EStorageSetStore *store = (EStorageSetStore *) tree_model; - GtkTreeIter parent; - gint *indices; - gint depth, i; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), FALSE); - g_return_val_if_fail(iter != NULL, FALSE); - - indices = gtk_tree_path_get_indices(path); - depth = gtk_tree_path_get_depth(path); - - g_return_val_if_fail(depth > 0, FALSE); - - parent.stamp = store->priv->stamp; - parent.user_data = store->priv->root; - - for (i = 0; i < depth; i++) { - if (!gtk_tree_model_iter_nth_child (tree_model, iter, &parent, indices[i])) - return FALSE; - parent = *iter; - } - - return TRUE; -} - -static GtkTreePath * -tree_path_from_node (EStorageSetStore *store, GNode *node) -{ - GtkTreePath *retval; - GNode *tmp_node, *curr_node; - gint i = 0; - - if (node == store->priv->root) - return NULL; - - retval = gtk_tree_path_new(); - - for (curr_node = node; curr_node != store->priv->root; curr_node = curr_node->parent) { - - if (curr_node->parent == NULL) { - gtk_tree_path_free(retval); - return NULL; - } - - for (i = 0, tmp_node = curr_node->parent->children; - tmp_node && tmp_node != curr_node; - i++, tmp_node = tmp_node->next); - - if (tmp_node == NULL) { - gtk_tree_path_free(retval); - return NULL; - } - - gtk_tree_path_prepend_index(retval, i); - } - - return retval; -} - -static GtkTreePath * -esss_get_path(GtkTreeModel *tree_model, GtkTreeIter *iter) -{ - EStorageSetStore *store = (EStorageSetStore *) tree_model; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), NULL); - g_return_val_if_fail(VALID_ITER(iter, store), NULL); - - if (iter->user_data == store->priv->root) - return NULL; - - return tree_path_from_node (store, G_NODE (iter->user_data)); -} - -static GdkPixbuf * -get_pixbuf_for_folder (EStorageSetStore *store, EFolder *folder) -{ - const char *type_name; - EStorageSetStorePrivate *priv; - EFolderTypeRegistry *folder_type_registry; - EStorageSet *storage_set; - GdkPixbuf *icon_pixbuf; - GdkPixbuf *scaled_pixbuf; - const char *custom_icon_name; - int icon_pixbuf_width, icon_pixbuf_height; - - priv = store->priv; - - custom_icon_name = e_folder_get_custom_icon_name (folder); - if (custom_icon_name != NULL) - return e_icon_factory_get_icon (custom_icon_name, TRUE); - - type_name = e_folder_get_type_string (folder); - - scaled_pixbuf = g_hash_table_lookup (priv->type_name_to_pixbuf, type_name); - if (scaled_pixbuf != NULL) - return scaled_pixbuf; - - storage_set = priv->storage_set; - folder_type_registry = e_storage_set_get_folder_type_registry (storage_set); - - icon_pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, - type_name, TRUE); - - if (icon_pixbuf == NULL) - return NULL; - - icon_pixbuf_width = gdk_pixbuf_get_width (icon_pixbuf); - icon_pixbuf_height = gdk_pixbuf_get_height (icon_pixbuf); - - if (icon_pixbuf_width == E_SHELL_MINI_ICON_SIZE && icon_pixbuf_height == E_SHELL_MINI_ICON_SIZE) { - scaled_pixbuf = g_object_ref (icon_pixbuf); - } else { - scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf), - gdk_pixbuf_get_has_alpha (icon_pixbuf), - gdk_pixbuf_get_bits_per_sample (icon_pixbuf), - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE); - - gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf, - 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - 0.0, 0.0, - (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf), - (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf), - GDK_INTERP_HYPER); - } - - g_hash_table_insert (priv->type_name_to_pixbuf, g_strdup (type_name), scaled_pixbuf); - - return scaled_pixbuf; -} - -static void -esss_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value) -{ - gchar *folder_path; - const gchar *folder_name; - int unread_count; - EStorageSetStore *store = (EStorageSetStore *) tree_model; - EFolder *folder; - GNode *node; - gboolean is_storage; - - g_return_if_fail(E_IS_STORAGE_SET_STORE(tree_model)); - g_return_if_fail(VALID_ITER(iter, store)); - g_return_if_fail(VALID_COL(column)); - - node = G_NODE (iter->user_data); - g_value_init(value, esss_get_column_type(tree_model, column)); - - is_storage = (node->parent == store->priv->root); - - if (is_storage) - folder_path = g_strconcat ("/", node->data, NULL); - else - folder_path = g_strdup (node->data); - - folder = e_storage_set_get_folder(store->priv->storage_set, folder_path); - g_free (folder_path); - - switch (column) { - case E_STORAGE_SET_STORE_COLUMN_NAME: - if (!folder) { - g_value_set_string(value, "?"); - return; - } - folder_name = e_folder_get_name(folder); - unread_count = e_folder_get_unread_count(folder); - if (unread_count > 0) { - gchar *with_unread = g_strdup_printf("%s (%d)", folder_name, unread_count); - g_object_set_data_full(G_OBJECT(folder), "name_with_unread", - with_unread, g_free); - g_value_set_string(value, with_unread); - } else - g_value_set_string(value, folder_name); - break; - - case E_STORAGE_SET_STORE_COLUMN_HIGHLIGHT: - if (!folder) { - g_value_set_boolean(value, FALSE); - return; - } - g_value_set_int(value, is_storage || e_folder_get_highlighted(folder) ? PANGO_WEIGHT_BOLD : 0); - break; - - case E_STORAGE_SET_STORE_COLUMN_CHECKED: - if (is_storage || !store->priv->checkboxes) { - g_value_set_boolean(value, FALSE); - return; - } - g_value_set_boolean(value, - g_hash_table_lookup(store->priv->checkboxes, folder_path) ? TRUE : FALSE); - break; - - case E_STORAGE_SET_STORE_COLUMN_CHECKABLE: - g_value_set_boolean(value, !is_storage && has_checkbox(store, (gchar *)node->data)); - break; - - case E_STORAGE_SET_STORE_COLUMN_ICON: - if (!is_storage) - g_value_set_object (value, get_pixbuf_for_folder (store, folder)); - break; - - default: - g_assert_not_reached (); - break; - } -} - -static gboolean -esss_iter_next(GtkTreeModel *tree_model, GtkTreeIter *iter) -{ - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), FALSE); - g_return_val_if_fail(VALID_ITER(iter, E_STORAGE_SET_STORE(tree_model)), FALSE); - - if (G_NODE(iter->user_data)->next) { - iter->user_data = G_NODE(iter->user_data)->next; - return TRUE; - } else - return FALSE; -} - -static gboolean -esss_iter_children(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent) -{ - GNode *children; - EStorageSetStore *store = (EStorageSetStore *) tree_model; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), FALSE); - g_return_val_if_fail(iter != NULL, FALSE); - g_return_val_if_fail(parent == NULL || parent->user_data != NULL, FALSE); - g_return_val_if_fail(parent == NULL || parent->stamp == store->priv->stamp, FALSE); - - if (parent) - children = G_NODE(parent->user_data)->children; - else - children = - G_NODE(store->priv->root)->children; - - if (children) { - iter->stamp = store->priv->stamp; - iter->user_data = children; - return TRUE; - } else - return FALSE; -} - -static gboolean -esss_iter_has_child(GtkTreeModel *tree_model, GtkTreeIter *iter) -{ - EStorageSetStore *store = (EStorageSetStore *) tree_model; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), FALSE); - g_return_val_if_fail(VALID_ITER(iter, store), FALSE); - - return G_NODE(iter->user_data)->children != NULL; -} - -static gint -esss_iter_n_children(GtkTreeModel *tree_model, GtkTreeIter *iter) -{ - GNode *node; - gint i = 0; - EStorageSetStore *store = (EStorageSetStore *) tree_model; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), 0); - g_return_val_if_fail(iter == NULL || iter->user_data != NULL, FALSE); - - if (iter == NULL) - node = G_NODE(store->priv->root)->children; - else - node = G_NODE(iter->user_data)->children; - - while (node) { - i++; - node = node->next; - } - - return i; -} - -static gboolean -esss_iter_nth_child(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n) -{ - GNode *parent_node; - GNode *child; - EStorageSetStore *store = (EStorageSetStore *) tree_model; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), FALSE); - g_return_val_if_fail(iter != NULL, FALSE); - g_return_val_if_fail(parent == NULL || parent->user_data != NULL, FALSE); - - if (parent == NULL) - parent_node = store->priv->root; - else - parent_node = parent->user_data; - - child = g_node_nth_child(parent_node, n); - - if (child) { - iter->user_data = child; - iter->stamp = store->priv->stamp; - return TRUE; - } else - return FALSE; -} - -static gboolean -esss_iter_parent(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child) -{ - GNode *parent; - EStorageSetStore *store = (EStorageSetStore *) tree_model; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(tree_model), FALSE); - g_return_val_if_fail(iter != NULL, FALSE); - g_return_val_if_fail(VALID_ITER(child, store), FALSE); - - parent = G_NODE(child->user_data)->parent; - - g_assert(parent != NULL); - - if (parent != store->priv->root) { - iter->user_data = parent; - iter->stamp = store->priv->stamp; - return TRUE; - } else - return FALSE; -} - -static void -esss_tree_model_init(GtkTreeModelIface *iface) -{ - iface->get_flags = esss_get_flags; - iface->get_n_columns = esss_get_n_columns; - iface->get_column_type = esss_get_column_type; - iface->get_iter = esss_get_iter; - iface->get_path = esss_get_path; - iface->get_value = esss_get_value; - iface->iter_next = esss_iter_next; - iface->iter_children = esss_iter_children; - iface->iter_has_child = esss_iter_has_child; - iface->iter_n_children = esss_iter_n_children; - iface->iter_nth_child = esss_iter_nth_child; - iface->iter_parent = esss_iter_parent; -} - -/* GtkTreeDragSource interface implementation */ - -static gboolean -esss_drag_data_delete(GtkTreeDragSource *source, GtkTreePath *path) -{ - GtkTreeIter iter; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(source), FALSE); - - if (gtk_tree_model_get_iter(GTK_TREE_MODEL(source), &iter, path)) { -#if 0 - e_storage_set_store_remove(E_STORAGE_SET_STORE(source), &iter); -#endif - return TRUE; - } else { - return FALSE; - } -} - -static gboolean -esss_drag_data_get(GtkTreeDragSource *source, GtkTreePath *path, GtkSelectionData *selection_data) -{ - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(source), FALSE); - - /* Note that we don't need to handle the GTK_TREE_MODEL_ROW - * target, because the default handler does it for us, but - * we do anyway for the convenience of someone maybe overriding the - * default handler. - */ - - if (gtk_tree_set_row_drag_data(selection_data, GTK_TREE_MODEL(source), path)) { - return TRUE; - } else { - /* FIXME handle text targets at least. */ - } - - return FALSE; -} - -static void -esss_drag_source_init(GtkTreeDragSourceIface * iface) -{ - iface->drag_data_delete = esss_drag_data_delete; - iface->drag_data_get = esss_drag_data_get; -} - -/* GtkTreeDragDest interface implementation */ - -static void -copy_node_data(EStorageSetStore *store, GtkTreeIter *src_iter, GtkTreeIter *dest_iter) -{ -} - -static void -recursive_node_copy(EStorageSetStore * store, - GtkTreeIter * src_iter, GtkTreeIter * dest_iter) -{ -} - -static gboolean -esss_drag_data_received(GtkTreeDragDest * drag_dest, - GtkTreePath * dest, - GtkSelectionData * selection_data) -{ -#if 0 - GtkTreeModel *tree_model; - EStorageSetStore *store; - GtkTreeModel *src_model = NULL; - GtkTreePath *src_path = NULL; - gboolean retval = FALSE; - - g_return_val_if_fail(E_IS_STORAGE_SET_STORE(drag_dest), FALSE); - - tree_model = GTK_TREE_MODEL(drag_dest); - store = E_STORAGE_SET_STORE(drag_dest); - - validate_tree(store); - - if (gtk_tree_get_row_drag_data(selection_data, - &src_model, - &src_path) && - src_model == tree_model) { - /* Copy the given row to a new position */ - GtkTreeIter src_iter; - GtkTreeIter dest_iter; - GtkTreePath *prev; - - if (!gtk_tree_model_get_iter(src_model, - &src_iter, src_path)) { - goto out; - } - - /* Get the path to insert _after_ (dest is the path to insert _before_) */ - prev = gtk_tree_path_copy(dest); - - if (!gtk_tree_path_prev(prev)) { - GtkTreeIter dest_parent; - GtkTreePath *parent; - GtkTreeIter *dest_parent_p; - - /* dest was the first spot at the current depth; which means - * we are supposed to prepend. - */ - - /* Get the parent, NULL if parent is the root */ - dest_parent_p = NULL; - parent = gtk_tree_path_copy(dest); - if (gtk_tree_path_up(parent) && - gtk_tree_path_get_depth(parent) > 0) { - gtk_tree_model_get_iter(tree_model, - &dest_parent, - parent); - dest_parent_p = &dest_parent; - } - gtk_tree_path_free(parent); - parent = NULL; - - e_storage_set_store_prepend(E_STORAGE_SET_STORE(tree_model), - &dest_iter, dest_parent_p); - - retval = TRUE; - } else { - if (gtk_tree_model_get_iter - (GTK_TREE_MODEL(tree_model), &dest_iter, - prev)) { - GtkTreeIter tmp_iter = dest_iter; - - if (GPOINTER_TO_INT - (g_object_get_data - (G_OBJECT(tree_model), - "gtk-tree-model-drop-append"))) { - GtkTreeIter parent; - - if (gtk_tree_model_iter_parent - (GTK_TREE_MODEL(tree_model), - &parent, &tmp_iter)) - e_storage_set_store_append - (E_STORAGE_SET_STORE - (tree_model), - &dest_iter, &parent); - else - e_storage_set_store_append - (E_STORAGE_SET_STORE - (tree_model), - &dest_iter, NULL); - } else - e_storage_set_store_insert_after - (E_STORAGE_SET_STORE(tree_model), - &dest_iter, NULL, &tmp_iter); - retval = TRUE; - - } - } - - g_object_set_data(G_OBJECT(tree_model), - "gtk-tree-model-drop-append", NULL); - - gtk_tree_path_free(prev); - - /* If we succeeded in creating dest_iter, walk src_iter tree branch, - * duplicating it below dest_iter. - */ - - if (retval) { - recursive_node_copy(store, - &src_iter, &dest_iter); - } - } else { - /* FIXME maybe add some data targets eventually, or handle text - * targets in the simple case. - */ - - } - - out: - - if (src_path) - gtk_tree_path_free(src_path); - - return retval; -#else - return FALSE; -#endif -} - -static gboolean -esss_row_drop_possible(GtkTreeDragDest * drag_dest, - GtkTreePath * dest_path, - GtkSelectionData * selection_data) -{ -#if 0 - GtkTreeModel *src_model = NULL; - GtkTreePath *src_path = NULL; - GtkTreePath *tmp = NULL; - gboolean retval = FALSE; - - if (!gtk_tree_get_row_drag_data(selection_data, - &src_model, &src_path)) - goto out; - - /* can only drag to ourselves */ - if (src_model != GTK_TREE_MODEL(drag_dest)) - goto out; - - /* Can't drop into ourself. */ - if (gtk_tree_path_is_ancestor(src_path, dest_path)) - goto out; - - /* Can't drop if dest_path's parent doesn't exist */ - { - GtkTreeIter iter; - - if (gtk_tree_path_get_depth(dest_path) > 1) { - tmp = gtk_tree_path_copy(dest_path); - gtk_tree_path_up(tmp); - - if (!gtk_tree_model_get_iter - (GTK_TREE_MODEL(drag_dest), &iter, tmp)) - goto out; - } - } - - /* Can otherwise drop anywhere. */ - retval = TRUE; - - out: - - if (src_path) - gtk_tree_path_free(src_path); - if (tmp) - gtk_tree_path_free(tmp); - - return retval; -#else - return FALSE; -#endif -} - -static void -esss_drag_dest_init(GtkTreeDragDestIface * iface) -{ - iface->drag_data_received = esss_drag_data_received; - iface->row_drop_possible = esss_row_drop_possible; -} - -typedef struct { - gint offset; - GNode *node; -} SortTuple; - -static gint -folder_sort_callback (gconstpointer a, gconstpointer b, gpointer user_data) -{ - EStorageSetStore *store = (EStorageSetStore *) user_data; - EStorageSetStorePrivate *priv = store->priv; - EFolder *folder_1, *folder_2; - char *folder_path_1, *folder_path_2; - int priority_1, priority_2; - - - folder_path_1 = (gchar *)((SortTuple *)a)->node->data; - folder_path_2 = (gchar *)((SortTuple *)b)->node->data; - - folder_1 = e_storage_set_get_folder (priv->storage_set, folder_path_1); - folder_2 = e_storage_set_get_folder (priv->storage_set, folder_path_2); - - priority_1 = e_folder_get_sorting_priority (folder_1); - priority_2 = e_folder_get_sorting_priority (folder_2); - - if (priority_1 == priority_2) - return g_utf8_collate (e_folder_get_name (folder_1), e_folder_get_name (folder_2)); - else if (priority_1 < priority_2) - return -1; - else /* priority_1 > priority_2 */ - return +1; -} - -static gint -storage_sort_callback (gconstpointer a, gconstpointer b, gpointer user_data) -{ - char *folder_path_1; - char *folder_path_2; - gboolean path_1_local; - gboolean path_2_local; - - folder_path_1 = (gchar *)((SortTuple *)a)->node->data; - folder_path_2 = (gchar *)((SortTuple *)b)->node->data; - - /* FIXME bad hack to put the "my evolution" and "local" storages on - * top. */ - - if (strcmp (folder_path_1, E_SUMMARY_STORAGE_NAME) == 0) - return -1; - if (strcmp (folder_path_2, E_SUMMARY_STORAGE_NAME) == 0) - return +1; - - path_1_local = ! strcmp (folder_path_1, E_LOCAL_STORAGE_NAME); - path_2_local = ! strcmp (folder_path_2, E_LOCAL_STORAGE_NAME); - - if (path_1_local && path_2_local) - return 0; - if (path_1_local) - return -1; - if (path_2_local) - return 1; - - return g_utf8_collate (folder_path_1, folder_path_2); -} - -static void -esss_sort (EStorageSetStore *store, GNode *parent, GCompareDataFunc callback) -{ - GtkTreeIter iter; - GArray *sort_array; - GNode *node; - GNode *tmp_node; - gint list_length; - gint i; - gint *new_order; - GtkTreePath *path; - - node = parent->children; - if (node == NULL || node->next == NULL) - return; - - list_length = 0; - for (tmp_node = node; tmp_node; tmp_node = tmp_node->next) - list_length++; - - sort_array = g_array_sized_new(FALSE, FALSE, sizeof(SortTuple), list_length); - - i = 0; - for (tmp_node = node; tmp_node; tmp_node = tmp_node->next) { - SortTuple tuple; - - tuple.offset = i; - tuple.node = tmp_node; - g_array_append_val(sort_array, tuple); - i++; - } - - /* Sort the array */ - g_array_sort_with_data(sort_array, callback, store); - - for (i = 0; i < list_length - 1; i++) { - g_array_index(sort_array, SortTuple, i).node->next = - g_array_index(sort_array, SortTuple, i + 1).node; - g_array_index(sort_array, SortTuple, i + 1).node->prev = - g_array_index(sort_array, SortTuple, i).node; - } - g_array_index(sort_array, SortTuple, list_length - 1).node->next = NULL; - g_array_index(sort_array, SortTuple, 0).node->prev = NULL; - parent->children = g_array_index(sort_array, SortTuple, 0).node; - - /* Let the world know about our new order */ - new_order = g_new(gint, list_length); - for (i = 0; i < list_length; i++) - new_order[i] = g_array_index(sort_array, SortTuple, i).offset; - - iter.stamp = store->priv->stamp; - iter.user_data = parent; - path = esss_get_path(GTK_TREE_MODEL(store), &iter); - gtk_tree_model_rows_reordered(GTK_TREE_MODEL(store), path, &iter, new_order); - if (path) - gtk_tree_path_free(path); - g_free(new_order); - g_array_free(sort_array, TRUE); -} - -static void -esss_init(EStorageSetStore *store) -{ - store->priv = g_new0(EStorageSetStorePrivate, 1); - - store->priv->storage_set = NULL; - store->priv->checkboxes = NULL; - store->priv->root = g_node_new(NULL); - do { - store->priv->stamp = g_random_int(); - } while (store->priv->stamp == 0); - - store->priv->path_to_node = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - store->priv->type_name_to_pixbuf = g_hash_table_new (g_str_hash, g_str_equal); -} - -static void -esss_dispose(GObject *object) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE(object); - - if (store->priv->storage_set) - g_object_unref(store->priv->storage_set); - store->priv->storage_set = NULL; - - (*parent_class->dispose) (object); -} - -static void -node_free (GNode *node, gpointer data) -{ - g_free (node->data); -} - -static void -pixbuf_free_func (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); - g_object_unref (value); -} - -static void -esss_finalize(GObject *object) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE(object); - - g_node_children_foreach(store->priv->root, G_TRAVERSE_ALL, node_free, NULL); - - g_hash_table_foreach (store->priv->type_name_to_pixbuf, pixbuf_free_func, NULL); - g_hash_table_destroy (store->priv->type_name_to_pixbuf); - g_hash_table_destroy (store->priv->path_to_node); - if (store->priv->checkboxes) - g_hash_table_destroy (store->priv->checkboxes); - - g_free (store->priv); - - (*parent_class->finalize) (object); -} - -static void -esss_class_init(EStorageSetStoreClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_peek_parent(class); - object_class = (GObjectClass *) class; - - object_class->dispose = esss_dispose; - object_class->finalize = esss_finalize; -} - -GType -e_storage_set_store_get_type(void) -{ - static GType store_type = 0; - - if (!store_type) { - static const GTypeInfo store_info = { - sizeof(EStorageSetStoreClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) esss_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(EStorageSetStore), - 0, /* n_preallocs */ - (GInstanceInitFunc) esss_init - }; - - static const GInterfaceInfo tree_model_info = { - (GInterfaceInitFunc) - esss_tree_model_init, - NULL, - NULL - }; - - static const GInterfaceInfo drag_source_info = { - (GInterfaceInitFunc) - esss_drag_source_init, - NULL, - NULL - }; - - static const GInterfaceInfo drag_dest_info = { - (GInterfaceInitFunc) esss_drag_dest_init, - NULL, - NULL - }; - - store_type = g_type_register_static(G_TYPE_OBJECT, "EStorageSetStore", &store_info, 0); - - g_type_add_interface_static(store_type, GTK_TYPE_TREE_MODEL, &tree_model_info); - g_type_add_interface_static(store_type, GTK_TYPE_TREE_DRAG_SOURCE, &drag_source_info); - g_type_add_interface_static(store_type, GTK_TYPE_TREE_DRAG_DEST, &drag_dest_info); - } - - return store_type; -} - -/* Handling of the "changed" signal in EFolders displayed in the EStorageSetStore. */ - -typedef struct { - EStorageSetStore *store; - GNode * node; -} FolderChangedCallbackData; - -static void -folder_changed_cb (EFolder *folder, void *data) -{ - FolderChangedCallbackData *callback_data; - GtkTreePath *path; - GtkTreeIter iter; - - callback_data = (FolderChangedCallbackData *) data; - iter.user_data = callback_data->node; - iter.stamp = callback_data->store->priv->stamp; - path = esss_get_path (GTK_TREE_MODEL (callback_data->store), &iter); - - gtk_tree_model_row_changed (GTK_TREE_MODEL (callback_data->store), path, &iter); - if (path) - gtk_tree_path_free (path); -} - -static void -folder_name_changed_cb (EFolder *folder, void *data) -{ - FolderChangedCallbackData *callback_data; - - callback_data = (FolderChangedCallbackData *) data; - - esss_sort (callback_data->store, callback_data->node->parent, folder_sort_callback); -} - -static void -setup_folder_changed_callbacks (EStorageSetStore *store, EFolder *folder, GNode *node) -{ - FolderChangedCallbackData *callback_data = g_new0 (FolderChangedCallbackData, 1); - callback_data->store = store; - callback_data->node = node; - - g_signal_connect (G_OBJECT (folder), "changed", - G_CALLBACK (folder_changed_cb), callback_data); - - g_signal_connect_data (G_OBJECT (folder), "name_changed", - G_CALLBACK (folder_name_changed_cb), - callback_data, (GClosureNotify)g_free, 0); -} - -static void -insert_folders (EStorageSetStore *store, GNode *parent, EStorage *storage, const gchar *path) -{ - EStorageSetStorePrivate *priv; - GList *folder_path_list, *p; - const gchar *storage_name = e_storage_get_name (storage); - - priv = store->priv; - - folder_path_list = e_storage_get_subfolder_paths (storage, path); - if (folder_path_list == NULL) - return; - - for (p = folder_path_list; p != NULL; p = p->next) { - EFolder *folder; - const char *subpath = (const char *) p->data; - char *folder_path = g_strconcat ("/", storage_name, subpath, NULL); - gchar *key = g_strdup (folder_path+1); - GNode *node = g_node_new (folder_path); - - g_node_append (parent, node); - g_hash_table_replace (priv->path_to_node, key, node); - - folder = e_storage_get_folder (storage, subpath); - setup_folder_changed_callbacks (store, folder, node); - - insert_folders (store, node, storage, subpath); - } - - esss_sort (store, parent, folder_sort_callback); - - e_free_string_list (folder_path_list); -} - -/* StorageSet signal handling. */ - -static void -new_storage_cb (EStorageSet *storage_set, EStorage *storage, void *data) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE (data); - EStorageSetStorePrivate *priv = store->priv; - gchar *storage_name = g_strdup (e_storage_get_name (storage)); - GNode *node = g_node_new (g_strdup (e_storage_get_name (storage))); - GtkTreePath *path; - GtkTreeIter iter; - - g_hash_table_replace (priv->path_to_node, storage_name, node); - g_node_append (priv->root, node); - esss_sort (store, priv->root, storage_sort_callback); - - iter.user_data = node; - iter.stamp = store->priv->stamp; - path = esss_get_path (GTK_TREE_MODEL (store), &iter); - gtk_tree_model_row_inserted (GTK_TREE_MODEL (store), path, &iter); - if (path) - gtk_tree_path_free (path); -} - -static void -removed_storage_cb (EStorageSet *storage_set, EStorage *storage, void *data) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE (data); - EStorageSetStorePrivate *priv = store->priv; - const gchar *name = e_storage_get_name (storage); - GNode *node = g_hash_table_lookup (priv->path_to_node, name); - GtkTreePath *path; - - if (node == NULL) { - g_warning ("EStorageSetStore: unknown storage removed -- %s", name); - return; - } - - g_hash_table_remove (priv->path_to_node, name); - /* FIXME: subfolder hashtable entries might be leaked */ - - path = tree_path_from_node (store, node); - gtk_tree_model_row_deleted (GTK_TREE_MODEL (store), path); - if (path) - gtk_tree_path_free (path); - g_node_destroy (node); -} - -static void -new_folder_cb (EStorageSet *storage_set, const char *path, void *data) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE (data); - EStorageSetStorePrivate *priv = store->priv; - GNode *parent_node, *new_node; - const char *last_separator; - char *parent_path; - char *copy_of_path; - GtkTreeIter iter; - GtkTreePath *treepath; - - last_separator = strrchr (path, E_PATH_SEPARATOR); - - parent_path = g_strndup (path + 1, last_separator - path - 1); - parent_node = g_hash_table_lookup (priv->path_to_node, parent_path); - g_free (parent_path); - if (parent_node == NULL) { - g_warning ("EStorageSetStore: EStorageSet reported new subfolder for non-existing folder -- %s", parent_path); - return; - } - - copy_of_path = g_strdup (path); - new_node = g_node_new (copy_of_path); - g_node_append (parent_node, new_node); - iter.user_data = new_node; - iter.stamp = priv->stamp; - treepath = esss_get_path (GTK_TREE_MODEL (store), &iter); - gtk_tree_model_row_inserted (GTK_TREE_MODEL (store), treepath, &iter); - if (treepath) - gtk_tree_path_free (treepath); - - g_hash_table_replace (priv->path_to_node, g_strdup (path + 1), new_node); - - setup_folder_changed_callbacks (store, e_storage_set_get_folder (storage_set, path), new_node); - esss_sort (store, parent_node, folder_sort_callback); -} - -static void -updated_folder_cb (EStorageSet *storage_set, const char *path, void *data) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE (data); - EStorageSetStorePrivate *priv = store->priv; - GNode *node; - GtkTreeIter iter; - GtkTreePath *treepath; - - node = g_hash_table_lookup (priv->path_to_node, path+1); - if (node == NULL) { - g_warning ("EStorageSetStore: unknown folder updated -- %s", path); - return; - } - - iter.user_data = node; - iter.stamp = priv->stamp; - treepath = esss_get_path (GTK_TREE_MODEL (store), &iter); - gtk_tree_model_row_changed (GTK_TREE_MODEL (store), treepath, &iter); - if (treepath) - gtk_tree_path_free (treepath); -} - -static void -removed_folder_cb (EStorageSet *storage_set, const char *path, void *data) -{ - EStorageSetStore *store = E_STORAGE_SET_STORE (data); - EStorageSetStorePrivate *priv = store->priv; - GNode *node; - GtkTreePath *treepath; - - node = g_hash_table_lookup (priv->path_to_node, path+1); - if (node == NULL) { - g_warning ("EStorageSetStore: unknown folder removed -- %s", path); - return; - } - - g_hash_table_remove (priv->path_to_node, path+1); - /* FIXME: subfolder hashtable entries might be leaked */ - - treepath = tree_path_from_node (store, node); - gtk_tree_model_row_deleted (GTK_TREE_MODEL (store), treepath); - if (treepath) - gtk_tree_path_free (treepath); - g_node_destroy (node); -} - -static void -close_folder_cb (EStorageSet *storage_set, - const char *path, - void *data) -{ - g_warning ("FIXME: EStorageSetStore: needs to handle close_folder properly"); -#if 0 - EStorageSetStore *store; - EStorageSetStorePrivate *priv; - ETreeModel *etree; - ETreePath node; - - store = E_STORAGE_SET_STORE (data); - priv = store->priv; - etree = priv->etree_model; - - node = lookup_node_in_hash (store, path); - e_tree_model_node_request_collapse (priv->etree_model, node); -#endif -} - -static void -connect_storage_set (EStorageSetStore *store, EStorageSet *storage_set, gboolean show_folders) -{ - EStorageSetStorePrivate *priv; - GList *storage_list; - GList *p; - - priv = store->priv; - priv->storage_set = storage_set; - g_object_ref (storage_set); - - storage_list = e_storage_set_get_storage_list (storage_set); - - for (p = storage_list; p != NULL; p = p->next) { - EStorage *storage = E_STORAGE (p->data); - const char *name = e_storage_get_name (storage); - GNode *node = g_node_new (g_strdup (name)); - g_node_append (priv->root, node); - g_hash_table_replace (priv->path_to_node, g_strdup (name), node); - - if (show_folders) - insert_folders (store, node, storage, "/"); - } - - esss_sort (store, priv->root, storage_sort_callback); - - e_free_object_list (storage_list); - - g_signal_connect_object (storage_set, "new_storage", G_CALLBACK (new_storage_cb), store, 0); - g_signal_connect_object (storage_set, "removed_storage", G_CALLBACK (removed_storage_cb), store, 0); - if (!show_folders) - return; - - g_signal_connect_object (storage_set, "new_folder", G_CALLBACK (new_folder_cb), store, 0); - g_signal_connect_object (storage_set, "updated_folder", G_CALLBACK (updated_folder_cb), store, 0); - g_signal_connect_object (storage_set, "removed_folder", G_CALLBACK (removed_folder_cb), store, 0); - g_signal_connect_object (storage_set, "close_folder", G_CALLBACK (close_folder_cb), store, 0); -} - -/** - * e_storage_set_store_new: - * @storage_set: the #EStorageSet that the store exposes - * @show_folders: flag indicating if subfolders should be shown - * - * Creates a new tree store from the provided #EStorageSet. - * - * Return value: a new #EStorageSetStore - **/ -EStorageSetStore * -e_storage_set_store_new(EStorageSet *storage_set, gboolean show_folders) -{ - EStorageSetStore *store; - g_return_val_if_fail (E_IS_STORAGE_SET(storage_set), NULL); - - store = E_STORAGE_SET_STORE (g_object_new (E_STORAGE_SET_STORE_TYPE, NULL)); - connect_storage_set (store, storage_set, show_folders); - - return store; -} - -static gboolean -esss_real_set_value(EStorageSetStore *store, GtkTreeIter *iter, gint column, GValue *value) -{ - gchar *path; - - if (column != E_STORAGE_SET_STORE_COLUMN_CHECKED) - return FALSE; - - path = G_NODE (iter->user_data)->data; - - if (g_value_get_boolean (value)) { - g_hash_table_insert (store->priv->checkboxes, path, path); - } else { - g_hash_table_remove (store->priv->checkboxes, path); - } - - return TRUE; -} - -/** - * e_storage_set_store_set_value: - * @store: a #EStorageSetStore - * @iter: A valid #GtkTreeIter for the row being modified - * @column: column number to modify - * @value: new value for the cell - * - * Sets the data in the cell specified by @iter and @column. - * The type of @value must be convertible to the type of the - * column. - * - **/ -void -e_storage_set_store_set_value(EStorageSetStore *store, GtkTreeIter *iter, - gint column, GValue *value) -{ - g_return_if_fail(E_IS_STORAGE_SET_STORE(store)); - g_return_if_fail(VALID_ITER(iter, store)); - g_return_if_fail(VALID_COL(column)); - g_return_if_fail(G_IS_VALUE(value)); - - if (esss_real_set_value (store, iter, column, value)) { - GtkTreePath *path; - - path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), iter); - gtk_tree_model_row_changed(GTK_TREE_MODEL(store), path, iter); - if (path) - gtk_tree_path_free(path); - } -} - -/** - * e_storage_set_store_get_tree_path: - * @store: a #EStorageSetStore - * @folder_path: a string representing the #EStorageSet folder path - * - * Gets a #GtkTreePath corresponding to the folder path specified. - * - * Return value: the tree path of the folder - **/ -GtkTreePath * -e_storage_set_store_get_tree_path (EStorageSetStore *store, const gchar *folder_path) -{ - GNode *node; - - g_return_if_fail(E_IS_STORAGE_SET_STORE(store)); - - node = g_hash_table_lookup (store->priv->path_to_node, folder_path+1); - - return tree_path_from_node (store, node); -} - -/** - * e_storage_set_store_get_folder_path: - * @store: a #EStorageSetStore - * @folder_path: a string representing the #EStorageSet folder path - * - * Gets a #GtkTreePath corresponding to the folder path specified. - * - * Return value: the tree path of the folder - **/ -const gchar * -e_storage_set_store_get_folder_path (EStorageSetStore *store, GtkTreePath *tree_path) -{ - GtkTreeIter iter; - GNode *node; - - g_return_if_fail(E_IS_STORAGE_SET_STORE(store)); - - if (!esss_get_iter (GTK_TREE_MODEL (store), &iter, tree_path)) - return NULL; - - node = G_NODE (iter.user_data); - - return (const gchar *)node->data; -} - -/** - * e_storage_set_store_set_has_checkbox_func: - * @store: a #EStorageSetStore - * @func: a callback to determine if a row is checked - * @data: callback data - * - * Sets a callback function for checkbox visibility determination - **/ -void -e_storage_set_store_set_has_checkbox_func (EStorageSetStore *store, EStorageSetStoreHasCheckBoxFunc func, gpointer data) -{ - g_return_if_fail(E_IS_STORAGE_SET_STORE(store)); - - store->priv->has_checkbox_func = func; - store->priv->has_checkbox_func_data = data; -} - diff --git a/shell/e-storage-set-store.h b/shell/e-storage-set-store.h deleted file mode 100644 index 251b61e519..0000000000 --- a/shell/e-storage-set-store.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-store.h - * - * 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: Mike Kestner - */ - -#ifndef __E_STORAGE_SET_STORE_H__ -#define __E_STORAGE_SET_STORE_H__ - -#include -#include "e-storage-set.h" -#include "e-storage-set-store.h" - -G_BEGIN_DECLS - -#define E_STORAGE_SET_STORE_TYPE (e_storage_set_store_get_type ()) -#define E_STORAGE_SET_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_STORAGE_SET_STORE_TYPE, EStorageSetStore)) -#define E_STORAGE_SET_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_STORAGE_SET_STORE_TYPE, EStorageSetStoreClass)) -#define E_IS_STORAGE_SET_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_STORAGE_SET_STORE_TYPE)) -#define E_IS_STORAGE_SET_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_STORAGE_SET_STORE_TYPE)) -#define E_STORAGE_SET_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_STORAGE_SET_STORE_TYPE, EStorageSetStoreClass)) - -typedef gboolean (* EStorageSetStoreHasCheckBoxFunc) (EStorageSet *storage_set, - const char *path, - void *data); - -typedef enum { - E_STORAGE_SET_STORE_COLUMN_NAME, - E_STORAGE_SET_STORE_COLUMN_HIGHLIGHT, - E_STORAGE_SET_STORE_COLUMN_CHECKED, - E_STORAGE_SET_STORE_COLUMN_CHECKABLE, - E_STORAGE_SET_STORE_COLUMN_ICON, - E_STORAGE_SET_STORE_COLUMN_COUNT -} E_STORAGE_SET_STORE_COLUMN_TYPE; - -typedef struct _EStorageSetStore EStorageSetStore; -typedef struct _EStorageSetStorePrivate EStorageSetStorePrivate; -typedef struct _EStorageSetStoreClass EStorageSetStoreClass; - -struct _EStorageSetStore { - GObject parent; - - EStorageSetStorePrivate *priv; -}; - -struct _EStorageSetStoreClass { - GObjectClass parent_class; -}; - - -GType e_storage_set_store_get_type (void); - -EStorageSetStore *e_storage_set_store_new (EStorageSet *storage_set, gboolean show_folders); - -EStorageSet *e_storage_set_store_get_storage_set (EStorageSetStore *storage_set_store); - -void e_storage_set_store_set_checkboxes_list (EStorageSetStore *storage_set_store, - GSList *checkboxes); -GSList *e_storage_set_store_get_checkboxes_list (EStorageSetStore *storage_set_store); - -void e_storage_set_store_set_allow_dnd (EStorageSetStore *storage_set_store, - gboolean allow_dnd); -gboolean e_storage_set_store_get_allow_dnd (EStorageSetStore *storage_set_store); - -GtkTreePath *e_storage_set_store_get_tree_path (EStorageSetStore *store, const gchar *folder_path); - -const gchar *e_storage_set_store_get_folder_path (EStorageSetStore *store, GtkTreePath *tree_path); - -void e_storage_set_store_set_has_checkbox_func (EStorageSetStore *storage_set_store, - EStorageSetStoreHasCheckBoxFunc func, - gpointer data); - -G_END_DECLS - -#endif /* __E_STORAGE_SET_STORE_H__ */ diff --git a/shell/e-storage-set-view-checkboxes.etstate b/shell/e-storage-set-view-checkboxes.etstate deleted file mode 100644 index 302fb15321..0000000000 --- a/shell/e-storage-set-view-checkboxes.etstate +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/shell/e-storage-set-view-no-checkboxes.etstate b/shell/e-storage-set-view-no-checkboxes.etstate deleted file mode 100644 index f3df4f8991..0000000000 --- a/shell/e-storage-set-view-no-checkboxes.etstate +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/shell/e-storage-set-view.etspec b/shell/e-storage-set-view.etspec deleted file mode 100644 index f0a8bbfc11..0000000000 --- a/shell/e-storage-set-view.etspec +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/shell/e-uri-schema-registry.c b/shell/e-uri-schema-registry.c deleted file mode 100644 index 468d640fd3..0000000000 --- a/shell/e-uri-schema-registry.c +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-uri-schema-registry.c - * - * Copyright (C) 2001 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-uri-schema-registry.h" - -#include - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -struct _SchemaHandler { - char *schema; - EvolutionShellComponentClient *component; -}; -typedef struct _SchemaHandler SchemaHandler; - -struct _EUriSchemaRegistryPrivate { - GHashTable *schema_to_handler; -}; - - -/* SchemaHandler. */ - -static SchemaHandler * -schema_handler_new (const char *schema, - EvolutionShellComponentClient *component) -{ - SchemaHandler *handler; - - handler = g_new (SchemaHandler, 1); - handler->schema = g_strdup (schema); - handler->component = component; - - g_object_ref (component); - - return handler; -} - -static void -schema_handler_free (SchemaHandler *handler) -{ - g_free (handler->schema); - g_object_unref (handler->component); - - g_free (handler); -} - - -static void -schema_to_handler_destroy_foreach_callback (void *key, - void *value, - void *data) -{ - schema_handler_free ((SchemaHandler *) value); -} - - -/* GtkObject methods. */ - -static void -impl_finalize (GObject *object) -{ - EUriSchemaRegistry *registry; - EUriSchemaRegistryPrivate *priv; - - registry = E_URI_SCHEMA_REGISTRY (object); - priv = registry->priv; - - g_hash_table_foreach (priv->schema_to_handler, schema_to_handler_destroy_foreach_callback, NULL); - g_hash_table_destroy (priv->schema_to_handler); - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -class_init (GObjectClass *object_class) -{ - parent_class = g_type_class_ref(PARENT_TYPE); - - object_class->finalize = impl_finalize; -} - -static void -init (EUriSchemaRegistry *uri_schema_registry) -{ - EUriSchemaRegistryPrivate *priv; - - priv = g_new (EUriSchemaRegistryPrivate, 1); - priv->schema_to_handler = g_hash_table_new (g_str_hash, g_str_equal); - - uri_schema_registry->priv = priv; - - GTK_OBJECT_UNSET_FLAGS (uri_schema_registry, GTK_FLOATING); -} - - -EUriSchemaRegistry * -e_uri_schema_registry_new (void) -{ - EUriSchemaRegistry *registry; - - registry = g_object_new (e_uri_schema_registry_get_type (), NULL); - - return registry; -} - - -void -e_uri_schema_registry_set_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema, - EvolutionShellComponentClient *shell_component) -{ - EUriSchemaRegistryPrivate *priv; - SchemaHandler *existing_handler; - SchemaHandler *new_handler; - - g_return_if_fail (registry != NULL); - g_return_if_fail (E_IS_URI_SCHEMA_REGISTRY (registry)); - g_return_if_fail (schema != NULL); - g_return_if_fail (shell_component == NULL || EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component)); - - priv = registry->priv; - - existing_handler = g_hash_table_lookup (priv->schema_to_handler, schema); - if (existing_handler != NULL) { - g_hash_table_remove (priv->schema_to_handler, existing_handler->schema); - schema_handler_free (existing_handler); - } - - new_handler = schema_handler_new (schema, shell_component); - g_hash_table_insert (priv->schema_to_handler, new_handler->schema, new_handler); -} - -EvolutionShellComponentClient * -e_uri_schema_registry_get_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema) -{ - EUriSchemaRegistryPrivate *priv; - const SchemaHandler *handler; - - g_return_val_if_fail (registry != NULL, NULL); - g_return_val_if_fail (E_IS_URI_SCHEMA_REGISTRY (registry), NULL); - g_return_val_if_fail (schema != NULL, NULL); - - priv = registry->priv; - - handler = g_hash_table_lookup (priv->schema_to_handler, schema); - if (handler == NULL) - return NULL; - - return handler->component; -} - - -E_MAKE_TYPE (e_uri_schema_registry, "EUriSchemaRegistry", EUriSchemaRegistry, class_init, init, PARENT_TYPE) diff --git a/shell/e-uri-schema-registry.h b/shell/e-uri-schema-registry.h deleted file mode 100644 index 1826f8a65a..0000000000 --- a/shell/e-uri-schema-registry.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-uri-schema-registry.h - * - * Copyright (C) 2001 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 - */ - -#ifndef _E_URI_SCHEMA_REGISTRY_H_ -#define _E_URI_SCHEMA_REGISTRY_H_ - -#include "evolution-shell-component-client.h" - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_URI_SCHEMA_REGISTRY (e_uri_schema_registry_get_type ()) -#define E_URI_SCHEMA_REGISTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_URI_SCHEMA_REGISTRY, EUriSchemaRegistry)) -#define E_URI_SCHEMA_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_URI_SCHEMA_REGISTRY, EUriSchemaRegistryClass)) -#define E_IS_URI_SCHEMA_REGISTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_URI_SCHEMA_REGISTRY)) -#define E_IS_URI_SCHEMA_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_URI_SCHEMA_REGISTRY)) - - -typedef struct _EUriSchemaRegistry EUriSchemaRegistry; -typedef struct _EUriSchemaRegistryPrivate EUriSchemaRegistryPrivate; -typedef struct _EUriSchemaRegistryClass EUriSchemaRegistryClass; - -struct _EUriSchemaRegistry { - GtkObject parent; - - EUriSchemaRegistryPrivate *priv; -}; - -struct _EUriSchemaRegistryClass { - GtkObjectClass parent_class; -}; - - -GtkType e_uri_schema_registry_get_type (void); -EUriSchemaRegistry *e_uri_schema_registry_new (void); - -void e_uri_schema_registry_set_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema, - EvolutionShellComponentClient *shell_component); -EvolutionShellComponentClient *e_uri_schema_registry_get_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_URI_SCHEMA_REGISTRY_H_ */ diff --git a/shell/evolution-activity-client.c b/shell/evolution-activity-client.c deleted file mode 100644 index 9b2fc8da70..0000000000 --- a/shell/evolution-activity-client.c +++ /dev/null @@ -1,461 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-activity-client.c - * - * Copyright (C) 2001 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 - */ - -/* Another evil GTK+ object wrapper for a CORBA API. In this case, the wrapper - is needed to avoid sending too frequent CORBA requests across the wire, thus - slowing the client down. The wrapper makes sure that there is a minimum - amount of time between each CORBA method invocation. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "evolution-activity-client.h" - -#include "e-shell-corba-icon-utils.h" - -#include "e-shell-marshal.h" - -#include - -#include -#include - -#include -#include - -#include - -#include - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -/* The minimum time between updates, in msecs. */ -#define UPDATE_DELAY 1000 - -enum { - SHOW_DETAILS, - CANCEL, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -struct _EvolutionActivityClientPrivate { - /* The ::Activity interface that we QI from the shell. */ - GNOME_Evolution_Activity activity_interface; - - /* BonoboListener used to get notification about actions that the user - requested on the activity. */ - BonoboListener *listener; - - /* Id of this activity. */ - GNOME_Evolution_Activity_ActivityId activity_id; - - /* Id for the GTK+ timeout used to do updates. */ - int next_update_timeout_id; - - /* Wether we have to actually push an update at this timeout. */ - int have_pending_update; - - /* Data for the next update. */ - char *new_information; - double new_progress; -}; - - -/* Utility functions. */ - -static gboolean -corba_update_progress (EvolutionActivityClient *activity_client, - const char *information, - double progress) -{ - EvolutionActivityClientPrivate *priv; - CORBA_Environment ev; - gboolean retval; - - priv = activity_client->priv; - - CORBA_exception_init (&ev); - - GNOME_Evolution_Activity_operationProgressing (priv->activity_interface, - priv->activity_id, - information, - progress, - &ev); - - if (! BONOBO_EX (&ev)) { - retval = TRUE; - } else { - g_warning ("EvolutionActivityClient: Error updating progress -- %s", - BONOBO_EX_REPOID (&ev)); - retval = FALSE; - } - - CORBA_exception_free (&ev); - - return retval; -} - -static gboolean -update_timeout_callback (void *data) -{ - EvolutionActivityClient *activity_client; - EvolutionActivityClientPrivate *priv; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (data); - priv = activity_client->priv; - - if (priv->have_pending_update) { - priv->have_pending_update = FALSE; - corba_update_progress (activity_client, priv->new_information, priv->new_progress); - return TRUE; - } else { - priv->next_update_timeout_id = 0; - return FALSE; - } -} - -static CORBA_Object -get_shell_activity_iface (GNOME_Evolution_Shell shell_iface) -{ - CORBA_Object iface_object; - const char *iface_name = "IDL:GNOME/Evolution/Activity:" BASE_VERSION; - - iface_object = bonobo_object_query_remote (shell_iface, iface_name, NULL); - if (iface_object == CORBA_OBJECT_NIL) - g_warning ("EvolutionActivityClient: No iface %s on Shell", iface_name); - - return iface_object; -} - - -/* BonoboListener callback. */ - -static void -listener_callback (BonoboListener *listener, - const char *event_name, - const CORBA_any *any, - CORBA_Environment *ev, - void *data) -{ - EvolutionActivityClient *activity_client; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (data); - - if (strcmp (event_name, "ShowDetails") == 0) - g_signal_emit (activity_client, signals[SHOW_DETAILS], 0); - else if (strcmp (event_name, "Cancel") == 0) - g_signal_emit (activity_client, signals[CANCEL], 0); - else - g_warning ("EvolutionActivityClient: Unknown event from listener -- %s", event_name); -} - - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - EvolutionActivityClient *activity_client; - EvolutionActivityClientPrivate *priv; - CORBA_Environment ev; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (object); - priv = activity_client->priv; - - if (priv->next_update_timeout_id != 0) { - g_source_remove (priv->next_update_timeout_id); - priv->next_update_timeout_id = 0; - } - - CORBA_exception_init (&ev); - - if (! CORBA_Object_is_nil (priv->activity_interface, &ev)) { - GNOME_Evolution_Activity_operationFinished (priv->activity_interface, - priv->activity_id, - &ev); - if (BONOBO_EX (&ev)) - g_warning ("EvolutionActivityClient: Error reporting completion of operation -- %s", - BONOBO_EX_REPOID (&ev)); - - CORBA_Object_release (priv->activity_interface, &ev); - - priv->activity_interface = CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - if (priv->listener != NULL) { - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - } - - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -impl_finalize (GObject *object) -{ - EvolutionActivityClient *activity_client; - EvolutionActivityClientPrivate *priv; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (object); - priv = activity_client->priv; - - g_free (priv->new_information); - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -class_init (EvolutionActivityClientClass *klass) -{ - GObjectClass *object_class; - - parent_class = g_type_class_ref(PARENT_TYPE); - - object_class = G_OBJECT_CLASS (klass); - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; - - signals[SHOW_DETAILS] - = g_signal_new ("show_details", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionActivityClientClass, show_details), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - signals[CANCEL] - = g_signal_new ("cancel", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionActivityClientClass, cancel), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - - -static void -init (EvolutionActivityClient *activity_client) -{ - EvolutionActivityClientPrivate *priv; - - priv = g_new (EvolutionActivityClientPrivate, 1); - priv->activity_interface = CORBA_OBJECT_NIL; - priv->listener = bonobo_listener_new (listener_callback, activity_client); - priv->activity_id = (GNOME_Evolution_Activity_ActivityId) 0; - priv->next_update_timeout_id = 0; - priv->have_pending_update = FALSE; - priv->new_information = NULL; - priv->new_progress = 0.0; - - activity_client->priv = priv; -} - - -gboolean -evolution_activity_client_construct (EvolutionActivityClient *activity_client, - GNOME_Evolution_Shell shell_iface, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return) -{ - EvolutionActivityClientPrivate *priv; - GNOME_Evolution_Activity activity_interface; - CORBA_Environment ev; - CORBA_boolean suggest_display; - GNOME_Evolution_AnimatedIcon *corba_animated_icon; - - g_return_val_if_fail (activity_client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), FALSE); - g_return_val_if_fail (animated_icon != NULL, FALSE); - g_return_val_if_fail (*animated_icon != NULL, FALSE); - g_return_val_if_fail (information != NULL, FALSE); - g_return_val_if_fail (suggest_display_return != NULL, FALSE); - - priv = activity_client->priv; - g_return_val_if_fail (priv->activity_interface == CORBA_OBJECT_NIL, FALSE); - - GTK_OBJECT_UNSET_FLAGS (activity_client, GTK_FLOATING); - - CORBA_exception_init (&ev); - - activity_interface = get_shell_activity_iface (shell_iface); - priv->activity_interface = CORBA_Object_duplicate (activity_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - priv->activity_interface = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return FALSE; - } - - corba_animated_icon = e_new_corba_animated_icon_from_pixbuf_array (animated_icon); - - GNOME_Evolution_Activity_operationStarted (activity_interface, - component_id, - corba_animated_icon, - information, - cancellable, - bonobo_object_corba_objref (BONOBO_OBJECT (priv->listener)), - &priv->activity_id, - &suggest_display, - &ev); - - CORBA_free (corba_animated_icon); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return FALSE; - } - - *suggest_display_return = (gboolean) suggest_display; - - CORBA_exception_free (&ev); - return TRUE; -} - -EvolutionActivityClient * -evolution_activity_client_new (GNOME_Evolution_Shell shell_iface, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return) -{ - EvolutionActivityClient *activity_client; - - g_return_val_if_fail (shell_iface != CORBA_OBJECT_NIL, NULL); - g_return_val_if_fail (animated_icon != NULL, NULL); - g_return_val_if_fail (*animated_icon != NULL, NULL); - g_return_val_if_fail (information != NULL, NULL); - g_return_val_if_fail (suggest_display_return != NULL, NULL); - - activity_client = g_object_new (evolution_activity_client_get_type (), NULL); - - if (! evolution_activity_client_construct (activity_client, - shell_iface, - component_id, - animated_icon, - information, - cancellable, - suggest_display_return)) { - g_object_unref (activity_client); - return NULL; - } - - return activity_client; -} - - -gboolean -evolution_activity_client_update (EvolutionActivityClient *activity_client, - const char *information, - double progress) -{ - EvolutionActivityClientPrivate *priv; - gboolean retval; - - g_return_val_if_fail (activity_client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), FALSE); - g_return_val_if_fail (information != NULL, FALSE); - g_return_val_if_fail (progress == -1.0 || (progress >= 0.0 && progress <= 1.0), FALSE); - - priv = activity_client->priv; - - if (priv->next_update_timeout_id == 0) { - /* There is no pending timeout, so the last CORBA update - happened more than UPDATE_DELAY msecs ago. So we set up a - timeout so we can check against it at the next update - request. - - Notice that GLib timeouts or other operations on this object - can be invoked within a remote CORBA invocation, so we need - to set `next_update_timeout_id' and `have_pending_update' - before doing the CORBA call, or nasty race conditions might - happen. */ - - priv->have_pending_update = FALSE; - - priv->next_update_timeout_id = g_timeout_add (UPDATE_DELAY, - update_timeout_callback, - activity_client); - - retval = corba_update_progress (activity_client, information, progress); - } else { - /* There is a pending timeout, so the last CORBA update - happened less than UPDATE_DELAY msecs ago. So just queue an - update instead. */ - - g_free (priv->new_information); - priv->new_information = g_strdup (information); - priv->new_progress = progress; - - priv->have_pending_update = TRUE; - - retval = TRUE; - } - - return retval; -} - -GNOME_Evolution_Activity_DialogAction -evolution_activity_client_request_dialog (EvolutionActivityClient *activity_client, - GNOME_Evolution_Activity_DialogType dialog_type) -{ - EvolutionActivityClientPrivate *priv; - GNOME_Evolution_Activity_DialogAction retval; - CORBA_Environment ev; - - g_return_val_if_fail (activity_client != NULL, GNOME_Evolution_Activity_DIALOG_ACTION_ERROR); - g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), GNOME_Evolution_Activity_DIALOG_ACTION_ERROR); - - priv = activity_client->priv; - - CORBA_exception_init (&ev); - - retval = GNOME_Evolution_Activity_requestDialog (priv->activity_interface, - priv->activity_id, - dialog_type, - &ev); - if (BONOBO_EX (&ev) != CORBA_NO_EXCEPTION) { - g_warning ("EvolutionActivityClient: Error requesting a dialog -- %s", BONOBO_EX_REPOID (&ev)); - retval = GNOME_Evolution_Activity_DIALOG_ACTION_ERROR; - } - - CORBA_exception_free (&ev); - - return retval; -} - - -E_MAKE_TYPE (evolution_activity_client, "EvolutionActivityClient", EvolutionActivityClient, - class_init, init, PARENT_TYPE) diff --git a/shell/evolution-startup-wizard.glade b/shell/evolution-startup-wizard.glade new file mode 100644 index 0000000000..7b5ff163c9 --- /dev/null +++ b/shell/evolution-startup-wizard.glade @@ -0,0 +1,90 @@ + + + + + + + + 6 + Evolution Setup Assistant + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + + + + 6 + True + False + + + + True + GNOME_EDGE_START + Welcome + Welcome to Evolution. The next few screens will allow +Evolution to connect to your email accounts, and to import +files from other applications. + +Please click the "Forward" button to continue. + + + + + + True + Timezone + + + + 16 + True + False + 0 + + + + + + + + + + + + True + Importing Files + + + + 16 + True + False + 0 + + + + + + + + + + + + True + GNOME_EDGE_FINISH + Done + You have successfully entered all of the information +needed to set up Evolution. + +Click the "Apply" button to save your settings. + + + + + + + diff --git a/shell/evolution-storage-set-view-factory.c b/shell/evolution-storage-set-view-factory.c deleted file mode 100644 index 7782d4cb5e..0000000000 --- a/shell/evolution-storage-set-view-factory.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-factory.c - * - * Copyright (C) 2000 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-storage-set-view.h" -#include "e-shell.h" -#include "evolution-storage-set-view.h" - -#include "evolution-storage-set-view-factory.h" - -#include - - -BonoboControl * -evolution_storage_set_view_factory_new_view (EShell *shell) -{ - EStorageSet *storage_set; - GtkWidget *storage_set_view; - BonoboControl *control; - EvolutionStorageSetView *storage_set_view_interface; - GtkWidget *scrolled_window; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - storage_set = e_shell_get_storage_set (shell); - storage_set_view = e_storage_set_create_new_view (storage_set, NULL /*XXX*/); - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE); - - storage_set_view_interface = evolution_storage_set_view_new (E_STORAGE_SET_VIEW (storage_set_view)); - if (storage_set_view_interface == NULL) { - gtk_widget_destroy (storage_set_view); - return NULL; - } - - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_SHADOW_IN); - - gtk_container_add (GTK_CONTAINER (scrolled_window), storage_set_view); - - gtk_widget_show (scrolled_window); - gtk_widget_show (storage_set_view); - - control = bonobo_control_new (scrolled_window); - bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (storage_set_view_interface)); - - return control; -} diff --git a/shell/evolution-storage-set-view-factory.h b/shell/evolution-storage-set-view-factory.h deleted file mode 100644 index 75d45cf1b8..0000000000 --- a/shell/evolution-storage-set-view-factory.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-factory.h - * - * Copyright (C) 2000 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 - */ - -#ifndef _EVOLUTION_STORAGE_SET_VIEW_FACTORY_H -#define _EVOLUTION_STORAGE_SET_VIEW_FACTORY_H - -#include "e-shell.h" - -BonoboControl *evolution_storage_set_view_factory_new_view (EShell *shell); - -#endif /* _EVOLUTION_STORAGE_SET_VIEW_FACTORY_H */ diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c deleted file mode 100644 index 4d495e0dc1..0000000000 --- a/shell/evolution-storage-set-view.c +++ /dev/null @@ -1,481 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view.c - * - * 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 - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "evolution-storage-set-view.h" -#include "e-shell-constants.h" - -#include - -#include - -#include - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionStorageSetViewPrivate { - GtkWidget *storage_set_view_widget; - GList *listeners; -}; - - -/* EStorageSet widget callbacks. */ - -static void -storage_set_view_widget_folder_selected_cb (EStorageSetView *storage_set_view_widget, - const char *uri, - void *data) -{ - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - GList *p; - - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - for (p = priv->listeners; p != NULL; p = p->next) { - CORBA_Environment ev; - GNOME_Evolution_StorageSetViewListener listener; - - CORBA_exception_init (&ev); - - listener = (GNOME_Evolution_StorageSetViewListener) p->data; - GNOME_Evolution_StorageSetViewListener_notifyFolderSelected (listener, uri, &ev); - - /* FIXME: What if we fail? */ - - CORBA_exception_free (&ev); - } -} - -static void -storage_set_view_widget_folder_toggled_cb (EStorageSetView *storage_set_view_widget, - void *data) -{ - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - GList *p; - - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - for (p = priv->listeners; p != NULL; p = p->next) { - CORBA_Environment ev; - GNOME_Evolution_StorageSetViewListener listener; - - CORBA_exception_init (&ev); - - listener = (GNOME_Evolution_StorageSetViewListener) p->data; - GNOME_Evolution_StorageSetViewListener_notifyFolderToggled (listener, &ev); - - /* FIXME: What if we fail? */ - - CORBA_exception_free (&ev); - } -} - - -/* Listener handling. */ - -static GList * -find_listener_in_list (GNOME_Evolution_StorageSetViewListener listener, - GList *list) -{ - CORBA_Environment ev; - GList *p; - - CORBA_exception_init (&ev); - - for (p = list; p != NULL; p = p->next) { - GNOME_Evolution_StorageSetViewListener listener_item; - - listener_item = (GNOME_Evolution_StorageSetViewListener) p->data; - if (CORBA_Object_is_equivalent (listener, listener_item, &ev)) - break; - } - - CORBA_exception_free (&ev); - - return p; -} - -static gboolean -add_listener (EvolutionStorageSetView *storage_set_view, - GNOME_Evolution_StorageSetViewListener listener) -{ - EvolutionStorageSetViewPrivate *priv; - CORBA_Environment ev; - const char *current_uri; - GNOME_Evolution_StorageSetViewListener copy_of_listener; - - priv = storage_set_view->priv; - - if (find_listener_in_list (listener, priv->listeners) != NULL) - return FALSE; - - CORBA_exception_init (&ev); - - copy_of_listener = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return FALSE; - } - - priv->listeners = g_list_prepend (priv->listeners, copy_of_listener); - - current_uri = e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view_widget)); - if (current_uri != NULL) - GNOME_Evolution_StorageSetViewListener_notifyFolderSelected (listener, current_uri, &ev); - - CORBA_exception_free (&ev); - - return TRUE; -} - -static gboolean -remove_listener (EvolutionStorageSetView *storage_set_view, - GNOME_Evolution_StorageSetViewListener listener) -{ - EvolutionStorageSetViewPrivate *priv; - GList *listener_node; - CORBA_Environment ev; - - priv = storage_set_view->priv; - - listener_node = find_listener_in_list (listener, priv->listeners); - if (listener_node == NULL) - return FALSE; - - CORBA_exception_init (&ev); - CORBA_Object_release ((CORBA_Object) listener_node->data, &ev); - CORBA_exception_free (&ev); - - priv->listeners = g_list_remove_link (priv->listeners, listener_node); - - return TRUE; -} - - -/* CORBA interface implementation. */ - -static void -impl_StorageSetView_add_listener (PortableServer_Servant servant, - const GNOME_Evolution_StorageSetViewListener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - - if (! add_listener (storage_set_view, listener)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_StorageSetView_AlreadyListening, NULL); -} - -static void -impl_StorageSetView_remove_listener (PortableServer_Servant servant, - const GNOME_Evolution_StorageSetViewListener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - - if (! remove_listener (storage_set_view, listener)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_StorageSetView_NotFound, NULL); -} - -static CORBA_boolean -impl_StorageSetView__get_showFolders (PortableServer_Servant servant, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - return e_storage_set_view_get_show_folders (E_STORAGE_SET_VIEW (priv->storage_set_view_widget)); -} - -static void -impl_StorageSetView__set_showFolders (PortableServer_Servant servant, - const CORBA_boolean value, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - e_storage_set_view_set_show_folders (E_STORAGE_SET_VIEW (priv->storage_set_view_widget), value); -} - -static void -impl_StorageSetView__set_showCheckboxes (PortableServer_Servant servant, - const CORBA_boolean value, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - e_storage_set_view_set_show_checkboxes (E_STORAGE_SET_VIEW (priv->storage_set_view_widget), - value, NULL, NULL); -} - -static CORBA_boolean -impl_StorageSetView__get_showCheckboxes (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - return e_storage_set_view_get_show_checkboxes (E_STORAGE_SET_VIEW (priv->storage_set_view_widget)); -} - -static void -impl_StorageSetView__set_checkedFolders (PortableServer_Servant servant, - const GNOME_Evolution_FolderList *list, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - GSList *path_list = NULL; - int i; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - for (i = 0; i < list->_length; i++) { - if (strncmp (list->_buffer[i].evolutionUri, "evolution:", 10) != 0) - continue; - - path_list = g_slist_append (path_list, g_strdup (list->_buffer[i].evolutionUri + 10)); - } - - e_storage_set_view_set_checkboxes_list (E_STORAGE_SET_VIEW (priv->storage_set_view_widget), - path_list); - - g_slist_foreach (path_list, (GFunc) g_free, NULL); - g_slist_free (path_list); -} - -static GNOME_Evolution_FolderList * -impl_StorageSetView__get_checkedFolders (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - EStorageSet *storage_set; - GNOME_Evolution_FolderList *return_list; - GSList *path_list; - GSList *p; - int num_folders; - int i; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - path_list = e_storage_set_view_get_checkboxes_list (E_STORAGE_SET_VIEW (priv->storage_set_view_widget)); - num_folders = g_slist_length (path_list); - - return_list = GNOME_Evolution_FolderList__alloc (); - return_list->_maximum = num_folders; - return_list->_length = num_folders; - return_list->_buffer = CORBA_sequence_GNOME_Evolution_Folder_allocbuf (return_list->_maximum); - - storage_set = e_storage_set_view_get_storage_set (E_STORAGE_SET_VIEW (priv->storage_set_view_widget)); - - for (p = path_list, i = 0; p != NULL; p = p->next, i ++) { - EFolder *folder; - const char *path; - char *evolution_uri; - - path = (const char *) p->data; - - folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL) { - g_warning ("Cannot find folder -- %s", path); - - /* Subtract here so that we don't start putting - ininitialised blanks into the CORBA list */ - return_list->_length--; - i--; - continue; - } - - evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - e_folder_to_corba (folder, evolution_uri, return_list->_buffer + i); - g_free (evolution_uri); - } - - g_slist_foreach (path_list, (GFunc) g_free, NULL); - g_slist_free (path_list); - - CORBA_sequence_set_release (return_list, TRUE); - return return_list; -} - - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - /* (Nothing to do here.) */ - - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -impl_finalize (GObject *object) -{ - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - CORBA_Environment ev; - GList *p; - - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (object); - priv = storage_set_view->priv; - - CORBA_exception_init (&ev); - - for (p = priv->listeners; p != NULL; p = p->next) { - GNOME_Evolution_StorageSetViewListener listener; - - listener = (GNOME_Evolution_StorageSetViewListener) p->data; - CORBA_Object_release (listener, &ev); - } - - CORBA_exception_free (&ev); - - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -evolution_storage_set_view_class_init (EvolutionStorageSetViewClass *klass) -{ - POA_GNOME_Evolution_StorageSetView__epv *epv; - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; - - epv = & (klass->epv); - epv->addListener = impl_StorageSetView_add_listener; - epv->removeListener = impl_StorageSetView_remove_listener; - epv->_set_showFolders = impl_StorageSetView__set_showFolders; - epv->_get_showFolders = impl_StorageSetView__get_showFolders; - epv->_set_showCheckboxes = impl_StorageSetView__set_showCheckboxes; - epv->_get_showCheckboxes = impl_StorageSetView__get_showCheckboxes; - epv->_set_checkedFolders = impl_StorageSetView__set_checkedFolders; - epv->_get_checkedFolders = impl_StorageSetView__get_checkedFolders; - - parent_class = g_type_class_ref(PARENT_TYPE); -} - -static void -evolution_storage_set_view_init (EvolutionStorageSetView *storage_set_view) -{ - EvolutionStorageSetViewPrivate *priv; - - priv = g_new (EvolutionStorageSetViewPrivate, 1); - priv->storage_set_view_widget = NULL; - priv->listeners = NULL; - - storage_set_view->priv = priv; -} - - -void -evolution_storage_set_view_construct (EvolutionStorageSetView *storage_set_view, - EStorageSetView *storage_set_view_widget) -{ - EvolutionStorageSetViewPrivate *priv; - - g_return_if_fail (EVOLUTION_IS_STORAGE_SET_VIEW (storage_set_view)); - g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view_widget)); - - priv = storage_set_view->priv; - - g_assert (priv->storage_set_view_widget == NULL); - priv->storage_set_view_widget = GTK_WIDGET (storage_set_view_widget); - - g_signal_connect (priv->storage_set_view_widget, "folder_selected", - G_CALLBACK (storage_set_view_widget_folder_selected_cb), storage_set_view); - g_signal_connect (priv->storage_set_view_widget, "checkboxes_changed", - G_CALLBACK (storage_set_view_widget_folder_toggled_cb), storage_set_view); -} - -EvolutionStorageSetView * -evolution_storage_set_view_new (EStorageSetView *storage_set_view_widget) -{ - EvolutionStorageSetView *new; - - g_return_val_if_fail (storage_set_view_widget != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view_widget), NULL); - - new = g_object_new (evolution_storage_set_view_get_type (), NULL); - - evolution_storage_set_view_construct (new, storage_set_view_widget); - - return new; -} - - -BONOBO_TYPE_FUNC_FULL (EvolutionStorageSetView, - GNOME_Evolution_StorageSetView, - PARENT_TYPE, - evolution_storage_set_view) diff --git a/shell/evolution-storage-set-view.h b/shell/evolution-storage-set-view.h deleted file mode 100644 index fcfbafc9a9..0000000000 --- a/shell/evolution-storage-set-view.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view.h - * - * Copyright (C) 2000 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 - */ - -#ifndef _EVOLUTION_STORAGE_SET_VIEW_H_ -#define _EVOLUTION_STORAGE_SET_VIEW_H_ - -#include - -#include "e-storage-set-view.h" - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_STORAGE_SET_VIEW (evolution_storage_set_view_get_type ()) -#define EVOLUTION_STORAGE_SET_VIEW(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW, EvolutionStorageSetView)) -#define EVOLUTION_STORAGE_SET_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_STORAGE_SET_VIEW, EvolutionStorageSetViewClass)) -#define EVOLUTION_IS_STORAGE_SET_VIEW(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW)) -#define EVOLUTION_IS_STORAGE_SET_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW)) - - -typedef struct _EvolutionStorageSetView EvolutionStorageSetView; -typedef struct _EvolutionStorageSetViewPrivate EvolutionStorageSetViewPrivate; -typedef struct _EvolutionStorageSetViewClass EvolutionStorageSetViewClass; - -struct _EvolutionStorageSetView { - BonoboObject parent; - - EvolutionStorageSetViewPrivate *priv; -}; - -struct _EvolutionStorageSetViewClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_StorageSetView__epv epv; -}; - - -GtkType evolution_storage_set_view_get_type (void); -void evolution_storage_set_view_construct (EvolutionStorageSetView *storage_set_view, - EStorageSetView *storage_set_view_widget); -EvolutionStorageSetView *evolution_storage_set_view_new (EStorageSetView *storage_set_view_widget); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _EVOLUTION_STORAGE_SET_VIEW_H_ */ diff --git a/shell/glade/.cvsignore b/shell/glade/.cvsignore deleted file mode 100644 index 3045c518dc..0000000000 --- a/shell/glade/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.deps -.libs -Makefile.in -Makefile diff --git a/shell/glade/Makefile.am b/shell/glade/Makefile.am deleted file mode 100644 index 7e90c140e2..0000000000 --- a/shell/glade/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -glade_DATA = \ - e-active-connection-dialog.glade \ - e-shell-config-default-folders.glade \ - e-shell-folder-creation-dialog.glade \ - e-shell-shared-folder-picker-dialog.glade \ - evolution-startup-wizard.glade \ - e-folder-list.glade - -EXTRA_DIST = $(glade_DATA) diff --git a/shell/glade/e-active-connection-dialog.glade b/shell/glade/e-active-connection-dialog.glade deleted file mode 100644 index aab9ad6577..0000000000 --- a/shell/glade/e-active-connection-dialog.glade +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - True - Active Connections - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 256 - 192 - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - -6 - - - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 12 - True - False - 12 - - - - True - <b>Active Connections</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - - - - - 0 - True - True - - - - - - True - Click OK to close these connections and go offline - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - diff --git a/shell/glade/e-folder-list.glade b/shell/glade/e-folder-list.glade deleted file mode 100644 index d644f34a35..0000000000 --- a/shell/glade/e-folder-list.glade +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - - - - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - True - False - 0 - - - - True - create_custom_optionmenu - 0 - 0 - Fri, 22 Mar 2002 15:09:48 GMT - - - 0 - False - True - - - - - - True - False - 0 - - - - True - create_custom_folder_list - 0 - 0 - Tue, 19 Mar 2002 18:07:28 GMT - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_START - 6 - - - - True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - - - - - - True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - - - - - 0 - False - False - - - - - 0 - True - True - - - - - - - - - diff --git a/shell/glade/e-shell-config-default-folders.glade b/shell/glade/e-shell-config-default-folders.glade deleted file mode 100644 index 2cf2734304..0000000000 --- a/shell/glade/e-shell-config-default-folders.glade +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - - - - 12 - True - 4 - 2 - False - 6 - 6 - - - - True - _Mail: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Tasks: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - _Contacts: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - C_alendar: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - e_shell_config_default_folder_selector_button_new - 0 - 0 - Wed, 10 Apr 2002 17:54:56 GMT - - - 1 - 2 - 0 - 1 - fill - - - - - - True - e_shell_config_default_folder_selector_button_new - 0 - 0 - Wed, 10 Apr 2002 17:55:01 GMT - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - e_shell_config_default_folder_selector_button_new - 0 - 0 - Wed, 10 Apr 2002 17:55:06 GMT - - - 1 - 2 - 2 - 3 - fill - fill - - - - - - True - e_shell_config_default_folder_selector_button_new - 0 - 0 - Wed, 10 Apr 2002 17:55:12 GMT - - - 1 - 2 - 3 - 4 - fill - fill - - - - - - - diff --git a/shell/glade/e-shell-folder-creation-dialog.glade b/shell/glade/e-shell-folder-creation-dialog.glade deleted file mode 100644 index 9fc32dc5ee..0000000000 --- a/shell/glade/e-shell-folder-creation-dialog.glade +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - 6 - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 350 - 410 - True - False - True - - - - True - False - 12 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 6 - - - - True - Folder _name: - True - False - GTK_JUSTIFY_CENTER - False - False - 7.45058e-09 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - True - True - True - True - 0 - - True - * - False - - - 0 - False - False - - - - - - True - Folder _type: - True - False - GTK_JUSTIFY_CENTER - False - False - 7.45058e-09 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - True - -1 - - - - True - - - - - 0 - False - False - - - - - - True - Specify where to create the folder: - False - False - GTK_JUSTIFY_CENTER - False - False - 7.45058e-09 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - - - diff --git a/shell/glade/e-shell-shared-folder-picker-dialog.glade b/shell/glade/e-shell-shared-folder-picker-dialog.glade deleted file mode 100644 index 181e454fb5..0000000000 --- a/shell/glade/e-shell-shared-folder-picker-dialog.glade +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - Open Other User's Folder - GTK_WINDOW_TOPLEVEL - no - no - no - 350 - yes - GTK_WIN_POS_NONE - - - - no - 8 - yes - - - - GTK_BUTTONBOX_END - 8 - yes - - - - yes - yes - yes - gtk-cancel - yes - yes - -6 - - - - - - yes - yes - yes - yes - gtk-ok - yes - yes - -5 - - - - - - 0 - no - yes - GTK_PACK_END - - - - - - no - 3 - 3 - 3 - 2 - yes - - - - _Account: - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - server-option-menu - yes - yes - - - 0 - 1 - 0 - 1 - 0 - 0 - fill - - - - - - - _Folder Name: - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - folder-name-entry - yes - yes - - - 0 - 1 - 2 - 3 - 0 - 0 - fill - - - - - - - yes - 0 - yes - - - - yes - - - - - 1 - 2 - 0 - 1 - 0 - 0 - fill - - - - - - - no - no - yes - no - yes - yes - - - - yes - yes - - 0 - yes - yes - - - - - - yes - - - - yes - - - - - 0.0 - yes - - - - - - - - - 1 - 2 - 2 - 3 - 0 - 0 - expand|fill - - - - - - - no - 0 - yes - - - - - - - 1 - 2 - 1 - 2 - 0 - 0 - fill - - - - - - - yes - _User: - GTK_RELIEF_NORMAL - yes - yes - - - 0 - 1 - 1 - 2 - 0 - 0 - fill - - - - - - 2 - yes - yes - - - - - 4 - yes - yes - - - - diff --git a/shell/glade/evolution-startup-wizard.glade b/shell/glade/evolution-startup-wizard.glade deleted file mode 100644 index 7b5ff163c9..0000000000 --- a/shell/glade/evolution-startup-wizard.glade +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - 6 - Evolution Setup Assistant - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - - - - 6 - True - False - - - - True - GNOME_EDGE_START - Welcome - Welcome to Evolution. The next few screens will allow -Evolution to connect to your email accounts, and to import -files from other applications. - -Please click the "Forward" button to continue. - - - - - - True - Timezone - - - - 16 - True - False - 0 - - - - - - - - - - - - True - Importing Files - - - - 16 - True - False - 0 - - - - - - - - - - - - True - GNOME_EDGE_FINISH - Done - You have successfully entered all of the information -needed to set up Evolution. - -Click the "Apply" button to save your settings. - - - - - - - -- cgit v1.2.3