From 9b448074a4aeabc87a65db1c2ef89ed3ba6c1ffb Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 3 Dec 2003 15:39:41 +0000 Subject: Remove. Remove. * e-folder-list.c: Remove. * e-folder-list.h: Remove. * e-folder-tree.c: Remove. * e-folder-tree.h: Remove. * e-folder.c: Remove. * e-folder.h: Remove. * evolution-shell-component.c: Remove. * evolution-shell-component.h: Remove. * evolution-shell-client.c: Remove. * evolution-shell-client.h: Remove. * evolution-folder-selector-button.c: Remove. * evolution-folder-selector-button.h: Remove. * evolution-activity-client.c: Remove. * evolution-activity-client.h: Remove. * evolution-storage.c: Remove. * evolution-storage.h: Remove. svn path=/trunk/; revision=23598 --- shell/e-folder-list.c | 692 ----------------- shell/e-folder-list.h | 115 --- shell/e-folder-tree.c | 460 ----------- shell/e-folder-tree.h | 60 -- shell/e-folder.c | 551 ------------- shell/e-folder.h | 108 --- shell/evolution-activity-client.h | 91 --- shell/evolution-folder-selector-button.h | 81 -- shell/evolution-shell-client.h | 97 --- shell/evolution-shell-component.c | 1230 ------------------------------ shell/evolution-shell-component.h | 217 ------ shell/evolution-storage.h | 185 ----- 12 files changed, 3887 deletions(-) delete mode 100644 shell/e-folder-list.c delete mode 100644 shell/e-folder-list.h delete mode 100644 shell/e-folder-tree.c delete mode 100644 shell/e-folder-tree.h delete mode 100644 shell/e-folder.c delete mode 100644 shell/e-folder.h delete mode 100644 shell/evolution-activity-client.h delete mode 100644 shell/evolution-folder-selector-button.h delete mode 100644 shell/evolution-shell-client.h delete mode 100644 shell/evolution-shell-component.c delete mode 100644 shell/evolution-shell-component.h delete mode 100644 shell/evolution-storage.h (limited to 'shell') diff --git a/shell/e-folder-list.c b/shell/e-folder-list.c deleted file mode 100644 index fb199be2a9..0000000000 --- a/shell/e-folder-list.c +++ /dev/null @@ -1,692 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-folder-list.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * 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 - -#include -#include - -#include - -#include -#include -#include -#include - -#include "e-folder-list.h" -#include "e-shell-marshal.h" - -#include "Evolution.h" - -static GtkVBoxClass *parent_class = NULL; -#define PARENT_TYPE (gtk_vbox_get_type ()) - -enum { - CHANGED, - OPTION_MENU_CHANGED, - LAST_SIGNAL -}; - -static guint signals [LAST_SIGNAL] = { 0, }; - -/* The arguments we take */ -enum { - PROP_0, - PROP_TITLE, - PROP_POSSIBLE_TYPES, -}; - -struct _EFolderListPrivate { - GladeXML *gui; - - ETableScrolled *scrolled_table; - char *title; - GtkFrame *frame; - ETableMemoryStore *model; - EvolutionShellClient *client; - GNOME_Evolution_StorageRegistry corba_storage_registry; - EOptionMenu *option_menu; - - char **possible_types; -}; - - -static GNOME_Evolution_Folder * -get_folder_for_uri (EFolderList *efl, - const char *uri) -{ - EFolderListPrivate *priv = efl->priv; - CORBA_Environment ev; - GNOME_Evolution_Folder *folder; - - CORBA_exception_init (&ev); - folder = GNOME_Evolution_StorageRegistry_getFolderByUri ( - priv->corba_storage_registry, uri, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - folder = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - - return folder; -} - -static char * -create_display_string (EFolderList *efl, char *folder_uri, char *folder_name) -{ - char *storage_lname, *p; - char *label_text; - - storage_lname = NULL; - p = strchr (folder_uri, '/'); - if (p) { - p = strchr (p + 1, '/'); - if (p) { - GNOME_Evolution_Folder *storage_folder; - char *storage_uri; - - storage_uri = g_strndup (folder_uri, - p - folder_uri); - storage_folder = get_folder_for_uri (efl, storage_uri); - storage_lname = g_strdup (storage_folder->displayName); - CORBA_free (storage_folder); - g_free (storage_uri); - } - } - - if (storage_lname) { - label_text = g_strdup_printf (_("\"%s\" in \"%s\""), folder_name, - storage_lname); - g_free (storage_lname); - } else - label_text = g_strdup_printf ("\"%s\"", folder_name); - - return label_text; -} - - - -static void -e_folder_list_changed (EFolderList *efl) -{ - g_signal_emit (efl, signals[CHANGED], 0); -} - -static void -e_folder_list_dispose (GObject *object) -{ - EFolderList *efl = E_FOLDER_LIST (object); - - if (efl->priv != NULL) { - g_object_unref (efl->priv->gui); - g_object_unref (efl->priv->client); - g_free (efl->priv); - efl->priv = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -set_frame_label (EFolderList *efl) -{ - GtkFrame *frame = efl->priv->frame; - char *title = efl->priv->title; - if (frame) { - if (title) { - gtk_frame_set_label (frame, title); - gtk_frame_set_shadow_type (frame, GTK_SHADOW_ETCHED_IN); - } else { - gtk_frame_set_label (frame, ""); - gtk_frame_set_shadow_type (frame, GTK_SHADOW_NONE); - } - } -} - -static void -e_folder_list_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - EFolderList *efl = E_FOLDER_LIST(object); - - switch (property_id) { - case PROP_TITLE: - g_free (efl->priv->title); - efl->priv->title = g_strdup (g_value_get_string (value)); - set_frame_label (efl); - break; - case PROP_POSSIBLE_TYPES: - g_strfreev (efl->priv->possible_types); - efl->priv->possible_types = e_strdupv (g_value_get_pointer (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -e_folder_list_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - EFolderList *efl = E_FOLDER_LIST(object); - - switch (property_id) { - case PROP_TITLE: - g_value_set_string (value, efl->priv->title); - break; - case PROP_POSSIBLE_TYPES: - g_value_set_pointer (value, e_strdupv ((const gchar **) efl->priv->possible_types)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -e_folder_list_class_init (EFolderListClass *klass) -{ - GObjectClass *object_class; - GtkVBoxClass *vbox_class; - - object_class = (GObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - - glade_init(); - - object_class->set_property = e_folder_list_set_property; - object_class->get_property = e_folder_list_get_property; - object_class->dispose = e_folder_list_dispose; - - klass->changed = NULL; - klass->option_menu_changed = NULL; - - signals [OPTION_MENU_CHANGED] = - g_signal_new ("option_menu_changed", - E_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EFolderListClass, option_menu_changed), - NULL, NULL, - e_shell_marshal_NONE__INT, - G_TYPE_NONE, 1, - G_TYPE_INT); - - signals [CHANGED] = - g_signal_new ("changed", - E_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EFolderListClass, changed), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, LAST_SIGNAL); - - g_object_class_install_property (object_class, PROP_TITLE, - g_param_spec_string ("title", - NULL, - NULL, - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_POSSIBLE_TYPES, - g_param_spec_pointer ("possible_types", - NULL, - NULL, - G_PARAM_READWRITE)); -} - -#define SPEC "" \ - " " \ - " " \ - " " \ - " " \ - " " \ - " " \ - " " \ - " " \ - "" - - -static ETableMemoryStoreColumnInfo columns[] = { - E_TABLE_MEMORY_STORE_PIXBUF, - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_TERMINATOR -}; - -GtkWidget * -create_custom_optionmenu (char *name, char *string1, char *string2, int int1, int int2); - -GtkWidget * -create_custom_optionmenu (char *name, char *string1, char *string2, int int1, int int2) -{ - return e_option_menu_new (NULL); -} - -GtkWidget * -create_custom_folder_list (char *name, char *string1, char *string2, int int1, int int2); - -GtkWidget * -create_custom_folder_list (char *name, char *string1, char *string2, int int1, int int2) -{ - ETableModel *model; - GtkWidget *scrolled; - - model = e_table_memory_store_new (columns); - scrolled = e_table_scrolled_new (model, NULL, SPEC, NULL); - g_object_set_data (G_OBJECT (scrolled), "table-model", model); - return scrolled; -} - -static void -add_clicked (GtkButton *button, EFolderList *efl) -{ - GNOME_Evolution_Folder *folder; - - evolution_shell_client_user_select_folder (efl->priv->client, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (efl))), - _("Add a Folder"), - "", - (const gchar **) efl->priv->possible_types, - &folder); - - if (folder != NULL) { - GdkPixbuf *pixbuf; - char *display_string = create_display_string (efl, folder->evolutionUri, folder->displayName); - - pixbuf = evolution_shell_client_get_pixbuf_for_type (efl->priv->client, folder->type, TRUE); - e_table_memory_store_insert (efl->priv->model, -1, NULL, pixbuf, display_string, - folder->displayName, folder->evolutionUri, folder->physicalUri); - e_folder_list_changed (efl); - g_object_unref (pixbuf); - g_free (display_string); - } -} - -static void -make_list (int model_row, gpointer closure) -{ - GList **list = closure; - *list = g_list_prepend (*list, GINT_TO_POINTER (model_row)); -} - -static void -remove_row (gpointer data, gpointer user_data) -{ - ETableMemoryStore *etms = user_data; - int row = GPOINTER_TO_INT (data); - - e_table_memory_store_remove (etms, row); -} - -static void -remove_clicked (GtkButton *button, EFolderList *efl) -{ - GList *list = NULL; - ETable *table; - - table = e_table_scrolled_get_table (efl->priv->scrolled_table); - - e_table_selected_row_foreach (table, make_list, &list); - - g_list_foreach (list, remove_row, efl->priv->model); - - g_list_free (list); - - e_folder_list_changed (efl); -} - -static void -optionmenu_changed (EOptionMenu *option_menu, int value, EFolderList *efl) -{ - g_signal_emit (efl, signals[OPTION_MENU_CHANGED], 0, value); -} - -static void -update_buttons (EFolderList *efl) -{ - int cursor_row; - int selection_count; - ETable *table; - - table = e_table_scrolled_get_table (efl->priv->scrolled_table); - cursor_row = e_table_get_cursor_row (table); - selection_count = e_table_selected_count (table); - - e_glade_xml_set_sensitive (efl->priv->gui, "button-remove", selection_count >= 1); -} - -static void -cursor_changed (ESelectionModel *selection_model, int row, int col, EFolderList *efl) -{ - update_buttons (efl); -} - -static void -selection_changed (ESelectionModel *selection_model, EFolderList *efl) -{ - update_buttons (efl); -} - -static void -e_folder_list_init (EFolderList *efl) -{ - GladeXML *gui; - ESelectionModel *selection_model; - - efl->priv = g_new (EFolderListPrivate, 1); - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-folder-list.glade", NULL, NULL); - efl->priv->gui = gui; - - efl->priv->title = NULL; - efl->priv->frame = GTK_FRAME (glade_xml_get_widget(gui, "frame-toplevel")); - if (efl->priv->frame == NULL) - return; - - gtk_widget_reparent(GTK_WIDGET (efl->priv->frame), - GTK_WIDGET (efl)); - - efl->priv->option_menu = E_OPTION_MENU(glade_xml_get_widget (gui, "custom-optionmenu")); - e_folder_list_set_option_menu_strings (efl, NULL); - efl->priv->scrolled_table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "custom-folder-list")); - efl->priv->model = E_TABLE_MEMORY_STORE (g_object_get_data (G_OBJECT (efl->priv->scrolled_table), "table-model")); - - e_glade_xml_connect_widget (gui, "button-add", "clicked", - G_CALLBACK (add_clicked), efl); - e_glade_xml_connect_widget (gui, "button-remove", "clicked", - G_CALLBACK (remove_clicked), efl); - e_glade_xml_connect_widget (gui, "custom-optionmenu", "changed", - G_CALLBACK (optionmenu_changed), efl); - - selection_model = e_table_get_selection_model (e_table_scrolled_get_table (efl->priv->scrolled_table)); - - g_signal_connect (selection_model, "selection_changed", - G_CALLBACK (selection_changed), efl); - g_signal_connect (selection_model, "cursor_changed", - G_CALLBACK (cursor_changed), efl); - - /* XXX libglade2 seems to not show custom widgets even when - they're flagged Visible.*/ - gtk_widget_show_all (GTK_WIDGET (efl->priv->scrolled_table)); - - efl->priv->possible_types = NULL; - set_frame_label (efl); -} - -EFolderListItem * -e_folder_list_parse_xml (const char *xml) -{ - xmlDoc *doc = NULL; - xmlNode *root; - xmlNode *node; - int i; - EFolderListItem *items; - - if (xml && *xml) { - doc = xmlParseMemory (xml, strlen (xml)); - if (!doc) - g_warning ("malformed EFolderList xml"); - } - - if (!doc) { - items = g_new (EFolderListItem, 1); - items[0].uri = NULL; - items[0].physical_uri = NULL; - items[0].display_name = NULL; - return items; - } - - root = xmlDocGetRootElement (doc); - - for (node = root->xmlChildrenNode, i = 0; node; node = node->next, i++) - /* Intentionally empty */; - - items = g_new (EFolderListItem, i + 1); - - for (node = root->xmlChildrenNode, i = 0; node; node = node->next) { - if (node->name && !strcmp (node->name, "folder")) { - items[i].uri = e_xml_get_string_prop_by_name_with_default (node, "uri", ""); - items[i].physical_uri = e_xml_get_string_prop_by_name_with_default (node, "physical-uri", ""); - items[i].display_name = e_xml_get_string_prop_by_name_with_default (node, "display-name", ""); - i++; - } - } - items[i].uri = NULL; - items[i].physical_uri = NULL; - items[i].display_name = NULL; - - xmlFreeDoc (doc); - - return items; -} - -char * -e_folder_list_create_xml (EFolderListItem *items) -{ - xmlDoc *doc; - xmlNode *root; - char *xml; - xmlChar *temp; - int length; - int i; - - doc = xmlNewDoc ("1.0"); - - root = xmlNewDocNode (doc, NULL, "EvolutionFolderList", NULL); - - xmlDocSetRootElement (doc, root); - - for (i = 0; items[i].uri; i++) { - xmlNode *node = xmlNewChild (root, NULL, "folder", NULL); - e_xml_set_string_prop_by_name (node, "uri", items[i].uri); - e_xml_set_string_prop_by_name (node, "physical-uri", items[i].physical_uri); - e_xml_set_string_prop_by_name (node, "display-name", items[i].display_name); - } - - xmlDocDumpMemory (doc, &temp, &length); - - xml = g_strdup (temp); - - xmlFree (temp); - xmlFreeDoc (doc); - - return xml; -} - -void -e_folder_list_free_items (EFolderListItem *items) -{ - int i; - for (i = 0; items[i].uri; i++) { - g_free (items[i].uri); - g_free (items[i].physical_uri); - g_free (items[i].display_name); - } - g_free (items); -} - -GtkWidget* -e_folder_list_new (EvolutionShellClient *client, const char *xml) -{ - GtkWidget *widget = GTK_WIDGET (g_object_new (e_folder_list_get_type (), NULL)); - - e_folder_list_construct (E_FOLDER_LIST (widget), client, xml); - return widget; -} - -GtkWidget* -e_folder_list_construct (EFolderList *efl, EvolutionShellClient *client, const char *xml) -{ - g_object_ref (client); - efl->priv->client = client; - - efl->priv->corba_storage_registry = evolution_shell_client_get_storage_registry_interface (client); - e_folder_list_set_xml (efl, xml); - return GTK_WIDGET (efl); -} - -void -e_folder_list_set_items (EFolderList *efl, EFolderListItem *items) -{ - int i; - e_table_memory_store_clear (efl->priv->model); - for (i = 0; items[i].uri; i++) { - GNOME_Evolution_Folder *folder; - GdkPixbuf *pixbuf; - char *display_string; - - folder = get_folder_for_uri (efl, items[i].uri); - if (!folder) - continue; - display_string = create_display_string (efl, items[i].uri, items[i].display_name); - - pixbuf = evolution_shell_client_get_pixbuf_for_type (efl->priv->client, folder->type, TRUE); - - e_table_memory_store_insert (efl->priv->model, -1, NULL, - pixbuf, display_string, - items[i].display_name, items[i].uri, items[i].physical_uri); - CORBA_free (folder); - g_object_unref (pixbuf); - g_free (display_string); - } -} - -EFolderListItem * -e_folder_list_get_items (EFolderList *efl) -{ - EFolderListItem *items; - int count; - int i; - - count = e_table_model_row_count (E_TABLE_MODEL (efl->priv->model)); - - items = g_new (EFolderListItem, count + 1); - - for (i = 0; i < count; i++) { - items[i].display_name = g_strdup (e_table_model_value_at (E_TABLE_MODEL (efl->priv->model), 2, i)); - items[i].uri = g_strdup (e_table_model_value_at (E_TABLE_MODEL (efl->priv->model), 3, i)); - items[i].physical_uri = g_strdup (e_table_model_value_at (E_TABLE_MODEL (efl->priv->model), 4, i)); - } - items[i].uri = NULL; - items[i].physical_uri = NULL; - - return items; -} - -void -e_folder_list_set_xml (EFolderList *efl, const char *xml) -{ - EFolderListItem *items; - - items = e_folder_list_parse_xml (xml); - e_folder_list_set_items (efl, items); - e_folder_list_free_items (items); -} - -char * -e_folder_list_get_xml (EFolderList *efl) -{ - EFolderListItem *items; - char *xml; - - items = e_folder_list_get_items (efl); - xml = e_folder_list_create_xml (items); - e_folder_list_free_items (items); - - return xml; -} - -void -e_folder_list_set_option_menu_strings_from_array (EFolderList *efl, const char **strings) -{ - e_option_menu_set_strings_from_array (efl->priv->option_menu, strings); - if (strings && *strings) - gtk_widget_show (GTK_WIDGET (efl->priv->option_menu)); - else - gtk_widget_hide (GTK_WIDGET (efl->priv->option_menu)); -} - -void -e_folder_list_set_option_menu_strings (EFolderList *efl, const char *first_label, ...) -{ - GPtrArray *labels; - va_list args; - char *s; - - labels = g_ptr_array_new (); - - va_start (args, first_label); - for (s = (char *)first_label; s; s = va_arg (args, char *)) - g_ptr_array_add (labels, s); - va_end (args); - - e_folder_list_set_option_menu_strings_from_array (efl, (const char **)labels->pdata); - - g_ptr_array_free (labels, TRUE); -} - -int -e_folder_list_get_option_menu_value (EFolderList *efl) -{ - return e_option_menu_get_value (efl->priv->option_menu); -} - -void -e_folder_list_set_option_menu_value (EFolderList *efl, int value) -{ - gtk_option_menu_set_history (GTK_OPTION_MENU (efl->priv->option_menu), value); -} - - -E_MAKE_TYPE (e_folder_list, "EFolderList", EFolderList, e_folder_list_class_init, e_folder_list_init, PARENT_TYPE) diff --git a/shell/e-folder-list.h b/shell/e-folder-list.h deleted file mode 100644 index 5e7ce3493d..0000000000 --- a/shell/e-folder-list.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-folder-list.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * 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. - */ - -#ifndef __E_FOLDER_LIST_H__ -#define __E_FOLDER_LIST_H__ - -#include - -#include - -#include "evolution-shell-client.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EFolderList - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_FOLDER_LIST_TYPE (e_folder_list_get_type ()) -#define E_FOLDER_LIST(obj) (GTK_CHECK_CAST ((obj), E_FOLDER_LIST_TYPE, EFolderList)) -#define E_FOLDER_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_FOLDER_LIST_TYPE, EFolderListClass)) -#define E_IS_FOLDER_LIST(obj) (GTK_CHECK_TYPE ((obj), E_FOLDER_LIST_TYPE)) -#define E_IS_FOLDER_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_FOLDER_LIST_TYPE)) - - -typedef struct _EFolderListPrivate EFolderListPrivate; -typedef struct _EFolderList EFolderList; -typedef struct _EFolderListClass EFolderListClass; - -struct _EFolderList -{ - GtkVBox parent; - - /* item specific fields */ - EFolderListPrivate *priv; -}; - -struct _EFolderListClass -{ - GtkVBoxClass parent_class; - - void (*changed) (EFolderList *efl); - void (*option_menu_changed) (EFolderList *efl, int value); -}; - -typedef struct { - char *uri; - char *physical_uri; - char *display_name; -} EFolderListItem; - - -EFolderListItem *e_folder_list_parse_xml (const char *xml); -char *e_folder_list_create_xml (EFolderListItem *items); -void e_folder_list_free_items (EFolderListItem *items); - -/* Standard functions */ -GtkType e_folder_list_get_type (void); -GtkWidget *e_folder_list_new (EvolutionShellClient *client, - const char *xml); -GtkWidget *e_folder_list_construct (EFolderList *efl, - EvolutionShellClient *client, - const char *xml); - -/* data access functions */ -void e_folder_list_set_items (EFolderList *efl, - EFolderListItem *items); -EFolderListItem *e_folder_list_get_items (EFolderList *efl); -void e_folder_list_set_xml (EFolderList *efl, - const char *xml); -char *e_folder_list_get_xml (EFolderList *efl); - -/* Option Menu functions */ -void e_folder_list_set_option_menu_strings_from_array (EFolderList *efl, - const char **strings); -void e_folder_list_set_option_menu_strings (EFolderList *efl, - const char *first_label, - ...); -int e_folder_list_get_option_menu_value (EFolderList *efl); -void e_folder_list_set_option_menu_value (EFolderList *efl, - int value); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_FOLDER_LIST_H__ */ diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c deleted file mode 100644 index c10f1aa241..0000000000 --- a/shell/e-folder-tree.c +++ /dev/null @@ -1,460 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-set.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 "e-folder-tree.h" - -#include "e-shell-constants.h" - -#include -#include - - -struct _Folder { - struct _Folder *parent; - char *path; - void *data; - GList *subfolders; -}; -typedef struct _Folder Folder; - -struct _EFolderTree { - GHashTable *path_to_folder; - GHashTable *data_to_path; - - EFolderDestroyNotify folder_destroy_notify; - void *folder_destroy_notify_closure; -}; - - -/* Utility functions. */ - -static char * -get_parent_path (const char *path) -{ - const char *last_separator; - - g_assert (g_path_is_absolute (path)); - - last_separator = strrchr (path, E_PATH_SEPARATOR); - - if (last_separator == path) - return g_strdup (E_PATH_SEPARATOR_S); - - return g_strndup (path, last_separator - path); -} - -static void -traverse_subtree (EFolderTree *tree, - Folder *root_folder, - EFolderTreeForeachFunc foreach_func, - void *data) -{ - GList *p; - - g_assert (foreach_func != NULL); - - (* foreach_func) (tree, root_folder->path, root_folder->data, data); - - for (p = root_folder->subfolders; p != NULL; p = p->next) { - Folder *folder; - - folder = (Folder *) p->data; - traverse_subtree (tree, folder, foreach_func, data); - } -} - - -/* Folder handling. */ - -static Folder * -folder_new (const char *path, - void *data) -{ - Folder *folder; - - folder = g_new (Folder, 1); - folder->parent = NULL; - folder->path = g_strdup (path); - folder->data = data; - folder->subfolders = NULL; - - return folder; -} - -static void -folder_remove_subfolder (Folder *folder, - Folder *subfolder) -{ - folder->subfolders = g_list_remove (folder->subfolders, subfolder); - subfolder->parent = NULL; -} - -static void -folder_add_subfolder (Folder *folder, - Folder *subfolder) -{ - folder->subfolders = g_list_prepend (folder->subfolders, subfolder); - subfolder->parent = folder; -} - -static void -folder_destroy (Folder *folder) -{ - g_assert (folder->subfolders == NULL); - - if (folder->parent != NULL) - folder_remove_subfolder (folder->parent, folder); - - g_free (folder->path); - - g_free (folder); -} - -static void -remove_folder (EFolderTree *folder_tree, - Folder *folder) -{ - if (folder->subfolders != NULL) { - GList *p; - - for (p = folder->subfolders; p != NULL; p = p->next) { - Folder *subfolder; - - subfolder = (Folder *) p->data; - subfolder->parent = NULL; - remove_folder (folder_tree, subfolder); - } - - g_list_free (folder->subfolders); - folder->subfolders = NULL; - } - - g_hash_table_remove (folder_tree->path_to_folder, folder->path); - g_hash_table_remove (folder_tree->data_to_path, folder->data); - - if (folder_tree->folder_destroy_notify != NULL) - (* folder_tree->folder_destroy_notify) (folder_tree, - folder->path, - folder->data, - folder_tree->folder_destroy_notify_closure); - - folder_destroy (folder); -} - - -/** - * e_folder_tree_new: - * @folder_destroy_notify: Function to be called when a folder gets removed from the tree - * @closure: Additional data to pass to @folder_destroy_notify - * - * Create a new EFolderTree. - * - * Return value: A pointer to the newly created EFolderTree. - **/ -EFolderTree * -e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, - void *closure) -{ - EFolderTree *new; - - new = g_new (EFolderTree, 1); - - new->folder_destroy_notify = folder_destroy_notify; - new->folder_destroy_notify_closure = closure; - - new->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal); - new->data_to_path = g_hash_table_new (g_direct_hash, g_direct_equal); - - e_folder_tree_add (new, E_PATH_SEPARATOR_S, NULL); - - return new; -} - -/** - * e_folder_tree_destroy: - * @folder_tree: A pointer to an EFolderTree - * - * Destroy @folder_tree. - **/ -void -e_folder_tree_destroy (EFolderTree *folder_tree) -{ - Folder *root_folder; - - g_return_if_fail (folder_tree != NULL); - - root_folder = g_hash_table_lookup (folder_tree->path_to_folder, E_PATH_SEPARATOR_S); - remove_folder (folder_tree, root_folder); - - g_hash_table_destroy (folder_tree->path_to_folder); - g_hash_table_destroy (folder_tree->data_to_path); - - g_free (folder_tree); -} - -/** - * e_folder_tree_add: - * @folder_tree: A pointer to an EFolderTree - * @path: Path at which the new folder must be added - * @data: Data associated with the new folder - * - * Insert a new folder at @path, with the specified @data. - * - * Return value: %TRUE if successful, %FALSE if failed. - **/ -gboolean -e_folder_tree_add (EFolderTree *folder_tree, - const char *path, - void *data) -{ - Folder *parent_folder; - Folder *folder; - const char *existing_path; - char *parent_path; - - g_return_val_if_fail (folder_tree != NULL, FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - /* Can only "add" a new root folder if the tree is empty */ - if (! strcmp (path, E_PATH_SEPARATOR_S)) { - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder) { - if (folder->subfolders) { - g_warning ("e_folder_tree_add() -- Trying to change root folder after adding children"); - return FALSE; - } - remove_folder (folder_tree, folder); - } - - folder = folder_new (path, data); - g_hash_table_insert (folder_tree->path_to_folder, folder->path, folder); - g_hash_table_insert (folder_tree->data_to_path, data, folder->path); - return TRUE; - } - - parent_path = get_parent_path (path); - - parent_folder = g_hash_table_lookup (folder_tree->path_to_folder, parent_path); - if (parent_folder == NULL) { - g_warning ("e_folder_tree_add() -- Trying to add a subfolder to a path that does not exist yet -- %s", - parent_path); - g_free (parent_path); - return FALSE; - } - g_free (parent_path); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder != NULL) { - g_warning ("e_folder_tree_add() -- Trying to add a subfolder for a path that already exists -- %s", - path); - return FALSE; - } - - existing_path = g_hash_table_lookup (folder_tree->data_to_path, data); - if (existing_path != NULL) { - g_warning ("e_folder_tree_add() -- Trying to add a folder with duplicate data -- %s", - path); - return FALSE; - } - - folder = folder_new (path, data); - folder_add_subfolder (parent_folder, folder); - - g_hash_table_insert (folder_tree->path_to_folder, folder->path, folder); - g_hash_table_insert (folder_tree->data_to_path, data, folder->path); - - return TRUE; -} - -/** - * e_folder_tree_remove: - * @folder_tree: A pointer to an EFolderTree - * @path: Path of the folder to remove - * - * Remove the folder at @path from @folder_tree. - * - * Return value: %TRUE if successful, %FALSE if failed. - **/ -gboolean -e_folder_tree_remove (EFolderTree *folder_tree, - const char *path) -{ - Folder *folder; - - g_return_val_if_fail (folder_tree != NULL, FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder == NULL) - return FALSE; - - remove_folder (folder_tree, folder); - return TRUE; -} - -static void -count_nodes (EFolderTree *tree, - const char *path, - void *data, - void *closure) -{ - int *count = closure; - - (*count)++; -} - -/** - * e_folder_tree_get_count: - * @folder_tree: A pointer to an EFolderTree - * - * Gets the number of folders in the tree - * - * Return value: The number of folders in the tree - **/ -int -e_folder_tree_get_count (EFolderTree *folder_tree) -{ - int count = 0; - - e_folder_tree_foreach (folder_tree, count_nodes, &count); - - return count; -} - -/** - * e_folder_tree_get_folder: - * @folder_tree: A pointer to an EFolderTree - * @path: Path of the folder for which we want to get the data - * - * Get the data for the folder at @path. - * - * Return value: The pointer to the data for the folder at @path. - **/ -void * -e_folder_tree_get_folder (EFolderTree *folder_tree, - const char *path) -{ - Folder *folder; - - g_return_val_if_fail (folder_tree != NULL, NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder == NULL) - return NULL; - - return folder->data; -} - -/** - * e_folder_tree_get_subfolders: - * @folder_tree: A pointer to an EFolderTree - * @path: A path in @folder_tree - * - * Get a list of the paths of the subfolders of @path. - * - * Return value: A list of pointers to the paths of the subfolders. The list - * and the strings must be freed by the caller. - **/ -GList * -e_folder_tree_get_subfolders (EFolderTree *folder_tree, - const char *path) -{ - Folder *folder; - GList *list; - GList *p; - - g_return_val_if_fail (folder_tree != NULL, NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder == NULL) - return NULL; - - list = NULL; - for (p = folder->subfolders; p != NULL; p = p->next) { - const Folder *folder; - - folder = (const Folder *) p->data; - list = g_list_prepend (list, g_strdup (folder->path)); - } - - return list; -} - - -/** - * e_folder_tree_foreach: - * @folder_tree: - * @foreach_func: - * @data: - * - * Call @foreach_func with the specified @data for all the folders - * in @folder_tree, starting at the root node. - **/ -void -e_folder_tree_foreach (EFolderTree *folder_tree, - EFolderTreeForeachFunc foreach_func, - void *data) -{ - Folder *root_node; - - g_return_if_fail (folder_tree != NULL); - g_return_if_fail (foreach_func != NULL); - - root_node = g_hash_table_lookup (folder_tree->path_to_folder, - E_PATH_SEPARATOR_S); - if (root_node == NULL) { - g_warning ("e_folder_tree_foreach -- What?! No root node!?"); - return; - } - - traverse_subtree (folder_tree, root_node, foreach_func, data); -} - - -/** - * e_folder_tree_get_path_for_data: - * @folder_tree: A pointer to an EFolderTree - * @data: The data for the folder for which the path is needed - * - * Look up the path for the specified @data. - * - * Return value: The path for the folder that holds that @data. - **/ -const char * -e_folder_tree_get_path_for_data (EFolderTree *folder_tree, - const void *data) -{ - g_return_val_if_fail (folder_tree != NULL, NULL); - g_return_val_if_fail (data != NULL, NULL); - - return (const char *) g_hash_table_lookup (folder_tree->data_to_path, data); -} diff --git a/shell/e-folder-tree.h b/shell/e-folder-tree.h deleted file mode 100644 index bb2f29702a..0000000000 --- a/shell/e-folder-tree.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-tree.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 _E_FOLDER_TREE_H_ -#define _E_FOLDER_TREE_H_ - -#include - - -typedef struct _EFolderTree EFolderTree; - -typedef void (* EFolderDestroyNotify) (EFolderTree *tree, const char *path, void *data, void *closure); -typedef void (* EFolderTreeForeachFunc) (EFolderTree *tree, const char *path, void *data, void *closure); - - -EFolderTree *e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, - void *closure); - -void e_folder_tree_destroy (EFolderTree *folder_tree); - -gboolean e_folder_tree_add (EFolderTree *folder_tree, - const char *path, - void *data); -gboolean e_folder_tree_remove (EFolderTree *folder_tree, - const char *path); - -int e_folder_tree_get_count (EFolderTree *folder_tree); - -void *e_folder_tree_get_folder (EFolderTree *folder_tree, - const char *path); -GList *e_folder_tree_get_subfolders (EFolderTree *folder_tree, - const char *path); - -void e_folder_tree_foreach (EFolderTree *folder_tree, - EFolderTreeForeachFunc foreach_func, - void *data); - -const char *e_folder_tree_get_path_for_data (EFolderTree *folder_tree, - const void *data); - -#endif /* _E_FOLDER_TREE_H_ */ diff --git a/shell/e-folder.c b/shell/e-folder.c deleted file mode 100644 index adaa31f465..0000000000 --- a/shell/e-folder.c +++ /dev/null @@ -1,551 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.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 "e-folder.h" -#include "e-shell-marshal.h" - -#include "e-util/e-corba-utils.h" - -#include -#include -#include -#include - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _EFolderPrivate { - char *name; - char *type; - char *description; - char *physical_uri; - - int child_highlight; - int unread_count; - - /* Folders have a default sorting priority of zero; when deciding the - sort order in the Evolution folder tree, folders with the same - priority value are compared by name, while folders with a higher - priority number always come after the folders with a lower priority - number. */ - int sorting_priority; - - unsigned int self_highlight : 1; - unsigned int is_stock : 1; - unsigned int can_sync_offline : 1; - unsigned int has_subfolders : 1; - - /* Custom icon for this folder; if NULL the folder will just use the - icon for its type. */ - char *custom_icon_name; -}; - -#define EF_CLASS(obj) \ - E_FOLDER_CLASS (GTK_OBJECT (obj)->klass) - - -enum { - CHANGED, - NAME_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* EFolder methods. */ - -static gboolean -impl_save_info (EFolder *folder) -{ - g_warning ("`%s' does not implement `EFolder::save_info()'", - G_OBJECT_TYPE_NAME (folder)); - return FALSE; -} - -static gboolean -impl_load_info (EFolder *folder) -{ - g_warning ("`%s' does not implement `EFolder::load_info()'", - G_OBJECT_TYPE_NAME (folder)); - return FALSE; -} - -static gboolean -impl_remove (EFolder *folder) -{ - g_warning ("`%s' does not implement `EFolder::remove()'", - G_OBJECT_TYPE_NAME (folder)); - return FALSE; -} - -static const char * -impl_get_physical_uri (EFolder *folder) -{ - return folder->priv->physical_uri; -} - - -/* GObject methods. */ - -static void -impl_finalize (GObject *object) -{ - EFolder *folder; - EFolderPrivate *priv; - - folder = E_FOLDER (object); - priv = folder->priv; - - g_free (priv->name); - g_free (priv->type); - g_free (priv->description); - g_free (priv->physical_uri); - - g_free (priv->custom_icon_name); - - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -class_init (EFolderClass *klass) -{ - GObjectClass *object_class; - - parent_class = g_type_class_ref(gtk_object_get_type ()); - - object_class = G_OBJECT_CLASS (klass); - object_class->finalize = impl_finalize; - - signals[CHANGED] = g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EFolderClass, changed), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - signals[NAME_CHANGED] = g_signal_new ("name_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EFolderClass, name_changed), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - klass->save_info = impl_save_info; - klass->load_info = impl_load_info; - klass->remove = impl_remove; - klass->get_physical_uri = impl_get_physical_uri; -} - -static void -init (EFolder *folder) -{ - EFolderPrivate *priv; - - priv = g_new (EFolderPrivate, 1); - priv->type = NULL; - priv->name = NULL; - priv->description = NULL; - priv->physical_uri = NULL; - priv->child_highlight = 0; - priv->unread_count = 0; - priv->sorting_priority = 0; - priv->self_highlight = FALSE; - priv->is_stock = FALSE; - priv->can_sync_offline = FALSE; - priv->has_subfolders = FALSE; - priv->custom_icon_name = NULL; - - folder->priv = priv; - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (folder), GTK_FLOATING); -} - - -void -e_folder_construct (EFolder *folder, - const char *name, - const char *type, - const char *description) -{ - EFolderPrivate *priv; - - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (name != NULL); - g_return_if_fail (type != NULL); - - priv = folder->priv; - - priv->name = g_strdup (name); - priv->type = g_strdup (type); - priv->description = g_strdup (description); -} - -EFolder * -e_folder_new (const char *name, - const char *type, - const char *description) -{ - EFolder *folder; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (type != NULL, NULL); - - folder = g_object_new (E_TYPE_FOLDER, NULL); - - e_folder_construct (folder, name, type, description); - - return folder; -} - - -const char * -e_folder_get_name (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->name; -} - -const char * -e_folder_get_type_string (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->type; -} - -const char * -e_folder_get_description (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->description; -} - -const char * -e_folder_get_physical_uri (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->physical_uri; -} - -int -e_folder_get_unread_count (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->unread_count; -} - -gboolean -e_folder_get_highlighted (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->child_highlight || folder->priv->unread_count; -} - -gboolean -e_folder_get_is_stock (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->is_stock; -} - -gboolean -e_folder_get_can_sync_offline (EFolder *folder) -{ - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->can_sync_offline; -} - -gboolean -e_folder_get_has_subfolders (EFolder *folder) -{ - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->has_subfolders; -} - -/** - * e_folder_get_custom_icon: - * @folder: An EFolder - * - * Get the name of the custom icon for @folder, or NULL if no custom icon is - * associated with it. - **/ -const char * -e_folder_get_custom_icon_name (EFolder *folder) -{ - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->custom_icon_name; -} - -/** - * e_folder_get_sorting_priority: - * @folder: An EFolder - * - * Get the sorting priority for @folder. - * - * Return value: Sorting priority value for @folder. - **/ -int -e_folder_get_sorting_priority (EFolder *folder) -{ - g_return_val_if_fail (E_IS_FOLDER (folder), 0); - - return folder->priv->sorting_priority; -} - - -void -e_folder_set_name (EFolder *folder, - const char *name) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (name != NULL); - - if (folder->priv->name == name) - return; - - g_free (folder->priv->name); - folder->priv->name = g_strdup (name); - - g_signal_emit (folder, signals[NAME_CHANGED], 0); - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_type_string (EFolder *folder, - const char *type) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (type != NULL); - - g_free (folder->priv->type); - folder->priv->type = g_strdup (type); - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_description (EFolder *folder, - const char *description) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (description != NULL); - - g_free (folder->priv->description); - folder->priv->description = g_strdup (description); - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_physical_uri (EFolder *folder, - const char *physical_uri) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (physical_uri != NULL); - - if (folder->priv->physical_uri == physical_uri) - return; - - g_free (folder->priv->physical_uri); - folder->priv->physical_uri = g_strdup (physical_uri); - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_unread_count (EFolder *folder, - gint unread_count) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->unread_count = unread_count; - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_child_highlight (EFolder *folder, - gboolean highlighted) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - if (highlighted) - folder->priv->child_highlight++; - else - folder->priv->child_highlight--; - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_is_stock (EFolder *folder, - gboolean is_stock) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->is_stock = !! is_stock; - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_can_sync_offline (EFolder *folder, - gboolean can_sync_offline) -{ - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->can_sync_offline = !! can_sync_offline; - - g_signal_emit (folder, signals[CHANGED], 0); -} - -void -e_folder_set_has_subfolders (EFolder *folder, - gboolean has_subfolders) -{ - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->has_subfolders = !! has_subfolders; - - g_signal_emit (folder, signals[CHANGED], 0); -} - -/** - * e_folder_set_custom_icon_name: - * @folder: An EFolder - * @icon_name: Name of the icon to be set (to be found in the standard - * Evolution icon dir) - * - * Set a custom icon for @folder (thus overriding the default icon, which is - * the one associated to the type of the folder). - **/ -void -e_folder_set_custom_icon (EFolder *folder, - const char *icon_name) -{ - g_return_if_fail (E_IS_FOLDER (folder)); - - if (icon_name == folder->priv->custom_icon_name) - return; - - if (folder->priv->custom_icon_name == NULL - || (icon_name != NULL && strcmp (icon_name, folder->priv->custom_icon_name) != 0)) { - g_free (folder->priv->custom_icon_name); - folder->priv->custom_icon_name = g_strdup (icon_name); - - g_signal_emit (folder, signals[CHANGED], 0); - } -} - -/** - * e_folder_set_sorting_priority: - * @folder: An EFolder - * @sorting_priority: A sorting priority number - * - * Set the sorting priority for @folder. Folders have a default sorting - * priority of zero; when deciding the sort order in the Evolution folder tree, - * folders with the same priority value are compared by name, while folders - * with a higher priority number always come after the folders with a lower - * priority number. - **/ -void -e_folder_set_sorting_priority (EFolder *folder, - int sorting_priority) -{ - g_return_if_fail (E_IS_FOLDER (folder)); - - if (folder->priv->sorting_priority == sorting_priority) - return; - - folder->priv->sorting_priority = sorting_priority; - - g_signal_emit (folder, signals[CHANGED], 0); -} - - -/* Gotta love CORBA. */ - -static CORBA_char * -safe_corba_string_dup (const char *s) -{ - if (s == NULL) - return CORBA_string_dup (""); - - return CORBA_string_dup (s); -} - -void -e_folder_to_corba (EFolder *folder, - const char *evolution_uri, - GNOME_Evolution_Folder *folder_return) -{ - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (folder_return != NULL); - - folder_return->type = safe_corba_string_dup (e_folder_get_type_string (folder)); - folder_return->description = safe_corba_string_dup (e_folder_get_description (folder)); - folder_return->displayName = safe_corba_string_dup (e_folder_get_name (folder)); - folder_return->physicalUri = safe_corba_string_dup (e_folder_get_physical_uri (folder)); - folder_return->evolutionUri = safe_corba_string_dup (evolution_uri); - folder_return->customIconName = safe_corba_string_dup (e_folder_get_custom_icon_name (folder)); - folder_return->unreadCount = e_folder_get_unread_count (folder); - folder_return->canSyncOffline = e_folder_get_can_sync_offline (folder); - folder_return->sortingPriority = e_folder_get_sorting_priority (folder); -} - - -E_MAKE_TYPE (e_folder, "EFolder", EFolder, class_init, init, PARENT_TYPE) diff --git a/shell/e-folder.h b/shell/e-folder.h deleted file mode 100644 index 53308fb62f..0000000000 --- a/shell/e-folder.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.h - * - * 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 - */ - -#ifndef _E_FOLDER_H_ -#define _E_FOLDER_H_ - -#include "Evolution.h" - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_FOLDER (e_folder_get_type ()) -#define E_FOLDER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_FOLDER, EFolder)) -#define E_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER, EFolderClass)) -#define E_IS_FOLDER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_FOLDER)) -#define E_IS_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER)) - - -typedef struct _EFolder EFolder; -typedef struct _EFolderPrivate EFolderPrivate; -typedef struct _EFolderClass EFolderClass; - -struct _EFolder { - GtkObject parent; - - EFolderPrivate *priv; -}; - -struct _EFolderClass { - GtkObjectClass parent_class; - - /* Virtual methods. */ - gboolean (* save_info) (EFolder *folder); - gboolean (* load_info) (EFolder *folder); - gboolean (* remove) (EFolder *folder); - const char * (* get_physical_uri) (EFolder *folder); - - /* Signals. */ - void (* changed) (EFolder *folder); - void (* name_changed) (EFolder *folder); -}; - - -GtkType e_folder_get_type (void); -void e_folder_construct (EFolder *folder, - const char *name, - const char *type, - const char *description); -EFolder *e_folder_new (const char *name, - const char *type, - const char *description); - -const char *e_folder_get_name (EFolder *folder); -const char *e_folder_get_type_string (EFolder *folder); -const char *e_folder_get_description (EFolder *folder); -const char *e_folder_get_physical_uri (EFolder *folder); -int e_folder_get_unread_count (EFolder *folder); -gboolean e_folder_get_highlighted (EFolder *folder); -gboolean e_folder_get_is_stock (EFolder *folder); -gboolean e_folder_get_can_sync_offline (EFolder *folder); -gboolean e_folder_get_has_subfolders (EFolder *folder); -const char *e_folder_get_custom_icon_name (EFolder *folder); -int e_folder_get_sorting_priority (EFolder *folder); - -void e_folder_set_name (EFolder *folder, const char *name); -void e_folder_set_type_string (EFolder *folder, const char *type); -void e_folder_set_description (EFolder *folder, const char *description); -void e_folder_set_physical_uri (EFolder *folder, const char *physical_uri); -void e_folder_set_unread_count (EFolder *folder, int unread_count); -void e_folder_set_child_highlight (EFolder *folder, gboolean highlighted); -void e_folder_set_is_stock (EFolder *folder, gboolean is_stock); -void e_folder_set_can_sync_offline (EFolder *folder, gboolean can_sync_offline); -void e_folder_set_has_subfolders (EFolder *folder, gboolean has_subfolders); -void e_folder_set_custom_icon (EFolder *folder, const char *icon_name); -void e_folder_set_sorting_priority (EFolder *folder, int sorting_priority); - -void e_folder_to_corba (EFolder *folder, - const char *evolution_uri, - GNOME_Evolution_Folder *folder_return); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_FOLDER_H_ */ diff --git a/shell/evolution-activity-client.h b/shell/evolution-activity-client.h deleted file mode 100644 index ff42ba2317..0000000000 --- a/shell/evolution-activity-client.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-activity-client.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 _EVOLUTION_ACTIVITY_CLIENT_H_ -#define _EVOLUTION_ACTIVITY_CLIENT_H_ - -#include "evolution-shell-client.h" - -#include "Evolution.h" - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_ACTIVITY_CLIENT (evolution_activity_client_get_type ()) -#define EVOLUTION_ACTIVITY_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_ACTIVITY_CLIENT, EvolutionActivityClient)) -#define EVOLUTION_ACTIVITY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_ACTIVITY_CLIENT, EvolutionActivityClientClass)) -#define EVOLUTION_IS_ACTIVITY_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_ACTIVITY_CLIENT)) -#define EVOLUTION_IS_ACTIVITY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_ACTIVITY_CLIENT)) - - -typedef struct _EvolutionActivityClient EvolutionActivityClient; -typedef struct _EvolutionActivityClientPrivate EvolutionActivityClientPrivate; -typedef struct _EvolutionActivityClientClass EvolutionActivityClientClass; - -struct _EvolutionActivityClient { - GtkObject parent; - - EvolutionActivityClientPrivate *priv; -}; - -struct _EvolutionActivityClientClass { - GtkObjectClass parent_class; - - /* Signals. */ - void (* show_details) (EvolutionActivityClient *activity_client); - void (* cancel) (EvolutionActivityClient *activity_client); -}; - - -GtkType evolution_activity_client_get_type (void); -gboolean evolution_activity_client_construct (EvolutionActivityClient *activity_client, - GNOME_Evolution_Shell shell, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return); -EvolutionActivityClient *evolution_activity_client_new (GNOME_Evolution_Shell shell, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return); - -gboolean evolution_activity_client_update (EvolutionActivityClient *activity_client, - const char *information, - double progress); - -GNOME_Evolution_Activity_DialogAction -evolution_activity_client_request_dialog (EvolutionActivityClient *activity_client, - GNOME_Evolution_Activity_DialogType dialog_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _EVOLUTION_ACTIVITY_CLIENT_H_ */ diff --git a/shell/evolution-folder-selector-button.h b/shell/evolution-folder-selector-button.h deleted file mode 100644 index b438a54862..0000000000 --- a/shell/evolution-folder-selector-button.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-folder-selector-button.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 __EVOLUTION_FOLDER_SELECTOR_BUTTON_H__ -#define __EVOLUTION_FOLDER_SELECTOR_BUTTON_H__ - -#include -#include "evolution-shell-client.h" - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON (evolution_folder_selector_button_get_type ()) -#define EVOLUTION_FOLDER_SELECTOR_BUTTON(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, EvolutionFolderSelectorButton)) -#define EVOLUTION_FOLDER_SELECTOR_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, EvolutionFolderSelectorButtonClass)) -#define EVOLUTION_IS_FOLDER_SELECTOR_BUTTON(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON)) -#define EVOLUTION_IS_FOLDER_SELECTOR_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON)) - - -typedef struct _EvolutionFolderSelectorButton EvolutionFolderSelectorButton; -typedef struct _EvolutionFolderSelectorButtonPrivate EvolutionFolderSelectorButtonPrivate; -typedef struct _EvolutionFolderSelectorButtonClass EvolutionFolderSelectorButtonClass; - -struct _EvolutionFolderSelectorButton { - GtkButton parent; - - EvolutionFolderSelectorButtonPrivate *priv; -}; - -struct _EvolutionFolderSelectorButtonClass { - GtkButtonClass parent_class; - - /* signals */ - void (*popped_up) (EvolutionFolderSelectorButton *button); - void (*selected) (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *folder); - void (*canceled) (EvolutionFolderSelectorButton *button); -}; - - -GtkType evolution_folder_selector_button_get_type (void); - -void evolution_folder_selector_button_construct (EvolutionFolderSelectorButton *folder_selector_button, - EvolutionShellClient *shell_client, - const char *title, - const char *initial_uri, - const char *possible_types[]); -GtkWidget *evolution_folder_selector_button_new (EvolutionShellClient *shell_client, - const char *title, - const char *initial_uri, - const char *possible_types[]); - -gboolean evolution_folder_selector_button_set_uri (EvolutionFolderSelectorButton *folder_selector_button, - const char *uri); -GNOME_Evolution_Folder *evolution_folder_selector_button_get_folder (EvolutionFolderSelectorButton *folder_selector_button); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_FOLDER_SELECTOR_BUTTON_H__ */ diff --git a/shell/evolution-shell-client.h b/shell/evolution-shell-client.h deleted file mode 100644 index 864d33c9e7..0000000000 --- a/shell/evolution-shell-client.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-client.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 - */ - -/* FIXME: This file will have to go away. */ - -#ifndef __EVOLUTION_SHELL_CLIENT_H__ -#define __EVOLUTION_SHELL_CLIENT_H__ - -#include -#include - -#include - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_SHELL_CLIENT (evolution_shell_client_get_type ()) -#define EVOLUTION_SHELL_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_CLIENT, EvolutionShellClient)) -#define EVOLUTION_SHELL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_CLIENT, EvolutionShellClientClass)) -#define EVOLUTION_IS_SHELL_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_CLIENT)) -#define EVOLUTION_IS_SHELL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_CLIENT)) - - -typedef struct _EvolutionShellClient EvolutionShellClient; -typedef struct _EvolutionShellClientPrivate EvolutionShellClientPrivate; -typedef struct _EvolutionShellClientClass EvolutionShellClientClass; - -struct _EvolutionShellClient { - GObject base; -}; - -struct _EvolutionShellClientClass { - GObjectClass parent_class; -}; - - -GtkType evolution_shell_client_get_type (void); -void evolution_shell_client_construct (EvolutionShellClient *shell_client, - GNOME_Evolution_Shell corba_shell); -EvolutionShellClient *evolution_shell_client_new (GNOME_Evolution_Shell shell); - -GNOME_Evolution_Shell evolution_shell_client_corba_objref (EvolutionShellClient *shell_client); - -void evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client, - GtkWindow *parent, - const char *title, - const char *default_folder, - const char **possible_types, - GNOME_Evolution_Folder **folder_return); - -GNOME_Evolution_Activity evolution_shell_client_get_activity_interface (EvolutionShellClient *shell_client); -GNOME_Evolution_Shortcuts evolution_shell_client_get_shortcuts_interface (EvolutionShellClient *shell_client); -GNOME_Evolution_StorageRegistry evolution_shell_client_get_storage_registry_interface (EvolutionShellClient *shell_client); - -GNOME_Evolution_Storage evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client); - -void evolution_shell_client_set_line_status (EvolutionShellClient *shell_client, - gboolean online); - -GdkPixbuf *evolution_shell_client_get_pixbuf_for_type (EvolutionShellClient *shell_client, - const char *folder_type, - gboolean mini); - -GtkWidget *evolution_shell_client_create_storage_set_view (EvolutionShellClient *shell_client, - Bonobo_UIComponent uic, - Bonobo_Control *bonobo_control_iface_return, - GNOME_Evolution_StorageSetView *storage_set_view_iface_return, - CORBA_Environment *ev); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_SHELL_CLIENT_H__ */ diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c deleted file mode 100644 index 7cc79d389f..0000000000 --- a/shell/evolution-shell-component.c +++ /dev/null @@ -1,1230 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component.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-shell-component.h" - -#include "e-shell-corba-icon-utils.h" -#include "e-shell-marshal.h" - -#include -#include - -#include -#include -#include -#include - -#include - - -#define PING_DELAY 10000 - - -#define PARENT_TYPE BONOBO_OBJECT_TYPE - -static BonoboObjectClass *parent_class = NULL; - -struct _UserCreatableItemType { - char *id; - char *description; - char *menu_description; - char *tooltip; - char menu_shortcut; - GdkPixbuf *icon; - char *folder_type; -}; -typedef struct _UserCreatableItemType UserCreatableItemType; - -struct _EvolutionShellComponentPrivate { - GList *folder_types; /* EvolutionShellComponentFolderType */ - GList *external_uri_schemas; /* char * */ - - EvolutionShellComponentCreateViewFn create_view_fn; - EvolutionShellComponentCreateFolderFn create_folder_fn; - EvolutionShellComponentRemoveFolderFn remove_folder_fn; - EvolutionShellComponentXferFolderFn xfer_folder_fn; - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn; - EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn; - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn; - EvolutionShellComponentRequestQuitFn request_quit_fn; - - EvolutionShellClient *owner_client; - - GSList *user_creatable_item_types; /* UserCreatableItemType */ - - /* This is used for - populateFolderContextMenu/unpopulateFolderContextMenu. */ - BonoboUIComponent *uic; - - gulong parent_view_xid; - - int ping_timeout_id; - - void *closure; -}; - -enum { - OWNER_SET, - OWNER_UNSET, - OWNER_DIED, - DEBUG, - INTERACTIVE, - HANDLE_EXTERNAL_URI, - USER_CREATE_NEW_ITEM, - SEND_RECEIVE, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* UserCreatableItemType handling. */ - -static UserCreatableItemType * -user_creatable_item_type_new (const char *id, - const char *description, - const char *menu_description, - const char *tooltip, - const char *folder_type, - char menu_shortcut, - GdkPixbuf *icon) -{ - UserCreatableItemType *type; - - type = g_new (UserCreatableItemType, 1); - type->id = g_strdup (id); - type->description = g_strdup (description); - type->menu_description = g_strdup (menu_description); - type->tooltip = g_strdup (tooltip); - type->menu_shortcut = menu_shortcut; - type->folder_type = g_strdup (folder_type); - - if (icon == NULL) - type->icon = NULL; - else - type->icon = g_object_ref (icon); - - return type; -} - -static void -user_creatable_item_type_free (UserCreatableItemType *type) -{ - g_free (type->id); - g_free (type->description); - g_free (type->menu_description); - g_free (type->tooltip); - g_free (type->folder_type); - - if (type->icon != NULL) - g_object_unref (type->icon); - - g_free (type); -} - - -/* Helper functions. */ - -/* Notice that, if passed a NULL pointer, this string will construct a - zero-element NULL-terminated string array instead of returning NULL itself - (i.e. it will return a pointer to a single g_malloc()ed NULL pointer). */ -static char ** -duplicate_null_terminated_string_array (char *array[]) -{ - char **new; - int count; - int i; - - if (array == NULL) { - count = 0; - } else { - for (count = 0; array[count] != NULL; count++) - ; - } - - new = g_new (char *, count + 1); - - for (i = 0; i < count; i++) - new[i] = g_strdup (array[i]); - new[count] = NULL; - - return new; -} - -/* The following will create a CORBA sequence of strings from the specified - * NULL-terminated array, without duplicating the strings. */ -static void -fill_corba_sequence_from_null_terminated_string_array (CORBA_sequence_CORBA_string *corba_sequence, - char **array) -{ - int count; - int i; - - g_assert (corba_sequence != NULL); - g_assert (array != NULL); - - CORBA_sequence_set_release (corba_sequence, TRUE); - - count = 0; - while (array[count] != NULL) - count++; - - corba_sequence->_maximum = count; - corba_sequence->_length = count; - corba_sequence->_buffer = CORBA_sequence_CORBA_string_allocbuf (count); - - for (i = 0; i < count; i++) - corba_sequence->_buffer[i] = CORBA_string_dup (array[i]); - - CORBA_sequence_set_release (corba_sequence, TRUE); -} - - -#if 0 -/* Owner pinging. */ - -static gboolean -owner_ping_callback (void *data) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - Bonobo_Unknown owner_objref; - CORBA_Environment ev; - gboolean alive; - - shell_component = EVOLUTION_SHELL_COMPONENT (data); - priv = shell_component->priv; - - owner_objref = evolution_shell_client_corba_objref (priv->owner_client); - - if (owner_objref == CORBA_OBJECT_NIL) - return FALSE; - - /* We are duplicating the object here, as we might get an ::unsetOwner - while we invoke the pinging, and this would make the objref invalid - and thus crash the stubs (cfr. #13802). */ - - CORBA_exception_init (&ev); - owner_objref = CORBA_Object_duplicate (owner_objref, &ev); - - alive = bonobo_unknown_ping (owner_objref, NULL); - - CORBA_Object_release (owner_objref, &ev); - CORBA_exception_free (&ev); - - if (alive) - return TRUE; - - /* This is tricky. During the pinging, we might have gotten an - ::unsetOwner invocation which has invalidated our owner_client. In - this case, no "owner_died" should be emitted. */ - - if (priv->owner_client != NULL) { - g_print ("\t*** The shell has disappeared\n"); - g_signal_emit (shell_component, signals[OWNER_DIED], 0); - } - - priv->ping_timeout_id = -1; - - return FALSE; -} - -static void -setup_owner_pinging (EvolutionShellComponent *shell_component) -{ - EvolutionShellComponentPrivate *priv; - GNOME_Evolution_Shell shell_corba_objref; - - priv = shell_component->priv; - - shell_corba_objref = evolution_shell_client_corba_objref (priv->owner_client); - - if (priv->ping_timeout_id != -1) - g_source_remove (priv->ping_timeout_id); - - priv->ping_timeout_id = g_timeout_add (PING_DELAY, owner_ping_callback, shell_component); -} -#endif - - -/* CORBA interface implementation. */ - -static GNOME_Evolution_FolderTypeList * -impl__get_supportedTypes (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_Evolution_FolderTypeList *folder_type_list; - unsigned int i; - GList *p; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - folder_type_list = GNOME_Evolution_FolderTypeList__alloc (); - CORBA_sequence_set_release (folder_type_list, TRUE); - folder_type_list->_length = g_list_length (priv->folder_types); - folder_type_list->_maximum = folder_type_list->_length; - folder_type_list->_buffer = CORBA_sequence_GNOME_Evolution_FolderType_allocbuf (folder_type_list->_maximum); - - for (p = priv->folder_types, i = 0; p != NULL; p = p->next, i++) { - GNOME_Evolution_FolderType *corba_folder_type; - EvolutionShellComponentFolderType *folder_type; - - folder_type = (EvolutionShellComponentFolderType *) p->data; - - corba_folder_type = folder_type_list->_buffer + i; - corba_folder_type->name = CORBA_string_dup (folder_type->name); - corba_folder_type->iconName = CORBA_string_dup (folder_type->icon_name); - corba_folder_type->displayName = CORBA_string_dup (folder_type->display_name); - corba_folder_type->description = CORBA_string_dup (folder_type->description); - corba_folder_type->userCreatable = folder_type->user_creatable; - - fill_corba_sequence_from_null_terminated_string_array (& corba_folder_type->acceptedDndTypes, - folder_type->accepted_dnd_types); - fill_corba_sequence_from_null_terminated_string_array (& corba_folder_type->exportedDndTypes, - folder_type->exported_dnd_types); - } - - CORBA_sequence_set_release (folder_type_list, TRUE); - - return folder_type_list; -} - -static GNOME_Evolution_URISchemaList * -impl__get_externalUriSchemas (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_Evolution_URISchemaList *uri_schema_list; - GList *p; - int i; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - uri_schema_list = GNOME_Evolution_URISchemaList__alloc (); - - /* FIXME: We could probably keep this to FALSE and avoid - CORBA_string_duplicating. */ - CORBA_sequence_set_release (uri_schema_list, TRUE); - - if (priv->external_uri_schemas == NULL) { - uri_schema_list->_length = 0; - uri_schema_list->_maximum = 0; - uri_schema_list->_buffer = NULL; - return uri_schema_list; - } - - uri_schema_list->_length = g_list_length (priv->external_uri_schemas); - uri_schema_list->_maximum = uri_schema_list->_length; - uri_schema_list->_buffer = CORBA_sequence_GNOME_Evolution_URISchema_allocbuf (uri_schema_list->_maximum); - - for (p = priv->external_uri_schemas, i = 0; p != NULL; p = p->next, i++) { - const char *schema; - - schema = (const char *) p->data; - uri_schema_list->_buffer[i] = CORBA_string_dup (schema); - } - - CORBA_sequence_set_release (uri_schema_list, TRUE); - - return uri_schema_list; -} - -static GNOME_Evolution_UserCreatableItemTypeList * -impl__get_userCreatableItemTypes (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_Evolution_UserCreatableItemTypeList *list; - GSList *p; - int i; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - list = GNOME_Evolution_UserCreatableItemTypeList__alloc (); - list->_maximum = g_slist_length (priv->user_creatable_item_types); - list->_length = list->_maximum; - list->_buffer = CORBA_sequence_GNOME_Evolution_UserCreatableItemType_allocbuf (list->_maximum); - - for (p = priv->user_creatable_item_types, i = 0; p != NULL; p = p->next, i ++) { - GNOME_Evolution_UserCreatableItemType *corba_type; - const UserCreatableItemType *type; - - corba_type = list->_buffer + i; - type = (const UserCreatableItemType *) p->data; - - corba_type->id = CORBA_string_dup (type->id); - corba_type->description = CORBA_string_dup (type->description); - corba_type->menuDescription = CORBA_string_dup (type->menu_description); - corba_type->tooltip = CORBA_string_dup (type->tooltip != NULL ? type->tooltip : ""); - corba_type->folderType = CORBA_string_dup (type->folder_type != NULL ? type->folder_type : ""); - corba_type->menuShortcut = type->menu_shortcut; - - e_store_corba_icon_from_pixbuf (type->icon, & corba_type->icon); - } - - CORBA_sequence_set_release (list, TRUE); - - return list; -} - -static void -impl_setOwner (PortableServer_Servant servant, - const GNOME_Evolution_Shell shell, - const CORBA_char *evolution_homedir, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - if (priv->owner_client != NULL) { - int owner_is_dead; - - owner_is_dead = CORBA_Object_non_existent - (evolution_shell_client_corba_objref (priv->owner_client), ev); - if (ev->_major != CORBA_NO_EXCEPTION) - owner_is_dead = TRUE; - - if (! owner_is_dead) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_AlreadyOwned, NULL); - } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_OldOwnerHasDied, NULL); - - g_signal_emit (shell_component, signals[OWNER_DIED], 0); - } - - return; - } - - if (ev->_major == CORBA_NO_EXCEPTION) { -#if 0 - BonoboObject *local_object; -#endif - - priv->owner_client = evolution_shell_client_new (shell); - g_signal_emit (shell_component, signals[OWNER_SET], 0, priv->owner_client, evolution_homedir); - -#if 0 - /* Set up pinging of the shell (to realize if it's gone unexpectedly) when in the - non-local case. */ - local_object = bonobo_object (ORBit_small_get_servant (shell)); - if (local_object == NULL) - setup_owner_pinging (shell_component); -#endif - } -} - -static void -impl_unsetOwner (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->owner_client == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_NotOwned, NULL); - return; - } - - g_signal_emit (shell_component, signals[OWNER_UNSET], 0); -} - -static void -impl_debug (PortableServer_Servant servant, - const CORBA_char *log_path, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - int fd; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - - fd = open (log_path, O_WRONLY | O_APPEND); - if (!fd) - return; - - dup2 (fd, STDOUT_FILENO); - dup2 (fd, STDERR_FILENO); - close (fd); - - g_signal_emit (shell_component, signals[DEBUG], 0); -} - -static void -impl_interactive (PortableServer_Servant servant, - CORBA_boolean interactive, - CORBA_unsigned_long new_view_xid, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - - if (interactive) - shell_component->priv->parent_view_xid = new_view_xid; - else - shell_component->priv->parent_view_xid = 0L; - - g_signal_emit (shell_component, signals[INTERACTIVE], 0, - interactive, new_view_xid); -} - -static Bonobo_Control -impl_createView (PortableServer_Servant servant, - const CORBA_char *physical_uri, - const CORBA_char *type, - const CORBA_char *view_info, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - EvolutionShellComponentResult result; - BonoboControl *control; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - result = (* priv->create_view_fn) (shell_component, physical_uri, type, - view_info, &control, priv->closure); - - if (result != EVOLUTION_SHELL_COMPONENT_OK) { - switch (result) { - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_UnsupportedType, - NULL); - break; - case EVOLUTION_SHELL_COMPONENT_INTERNALERROR: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_InternalError, - NULL); - break; - default: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_NotFound, - NULL); - } - - return CORBA_OBJECT_NIL; - } - - return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (control)), ev); -} - -static void -impl_handleExternalURI (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - - g_signal_emit (shell_component, signals[HANDLE_EXTERNAL_URI], 0, uri); -} - -static void -impl_createFolderAsync (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentListener listener, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->create_folder_fn == NULL) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->create_folder_fn) (shell_component, physical_uri, type, listener, priv->closure); -} - -static void -impl_removeFolderAsync (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentListener listener, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->remove_folder_fn == NULL) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->remove_folder_fn) (shell_component, physical_uri, type, listener, priv->closure); -} - -static void -impl_xferFolderAsync (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentListener listener, - const CORBA_char *source_physical_uri, - const CORBA_char *destination_physical_uri, - const CORBA_char *type, - const CORBA_boolean remove_source, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->xfer_folder_fn == NULL) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->xfer_folder_fn) (shell_component, - source_physical_uri, - destination_physical_uri, - type, - remove_source, - listener, - priv->closure); -} - -static void -impl_populateFolderContextMenu (PortableServer_Servant servant, - const Bonobo_UIContainer corba_uih, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->populate_folder_context_menu_fn == NULL) - return; - - if (priv->uic != NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_AlreadyPopulated, - NULL); - return; - } - - priv->uic = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (priv->uic, corba_uih, NULL); - - (* priv->populate_folder_context_menu_fn) (shell_component, priv->uic, physical_uri, type, priv->closure); -} - -static void -impl_unpopulateFolderContextMenu (PortableServer_Servant servant, - const Bonobo_UIContainer corba_uih, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->unpopulate_folder_context_menu_fn == NULL) - return; - - if (priv->uic == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_NotPopulated, - NULL); - return; - } - - (* priv->unpopulate_folder_context_menu_fn) (shell_component, priv->uic, physical_uri, type, priv->closure); - - bonobo_object_unref (BONOBO_OBJECT (priv->uic)); - priv->uic = NULL; -} - -static void -impl_userCreateNewItem (PortableServer_Servant servant, - const CORBA_char *id, - const CORBA_char *parent_physical_uri, - const CORBA_char *parent_type, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - /* FIXME: Check that the type is good. */ - - g_signal_emit (shell_component, signals[USER_CREATE_NEW_ITEM], 0, id, parent_physical_uri, parent_type); -} - -static void -impl_sendReceive (PortableServer_Servant servant, - const CORBA_boolean show_dialog, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - g_signal_emit (shell_component, signals[SEND_RECEIVE], 0, show_dialog); -} - -static void -impl_requestQuit (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentListener listener, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - gboolean allow_quit; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - - if (shell_component->priv->request_quit_fn == NULL) - allow_quit = TRUE; - else - allow_quit = (* shell_component->priv->request_quit_fn) (shell_component, - shell_component->priv->closure); - - if (allow_quit) - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_OK, - ev); - else - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_CANCEL, - ev); -} - - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - shell_component = EVOLUTION_SHELL_COMPONENT (object); - - priv = shell_component->priv; - - if (priv->ping_timeout_id != -1) { - g_source_remove (priv->ping_timeout_id); - priv->ping_timeout_id = -1; - } - - if (priv->owner_client != NULL) { - g_object_unref (priv->owner_client); - priv->owner_client = NULL; - } - - if (priv->uic != NULL) { - bonobo_object_unref (BONOBO_OBJECT (priv->uic)); - priv->uic = NULL; - } - - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -impl_finalize (GObject *object) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GSList *sp; - GList *p; - - shell_component = EVOLUTION_SHELL_COMPONENT (object); - - priv = shell_component->priv; - - for (p = priv->folder_types; p != NULL; p = p->next) { - EvolutionShellComponentFolderType *folder_type; - - folder_type = (EvolutionShellComponentFolderType *) p->data; - - g_free (folder_type->name); - g_free (folder_type->icon_name); - g_free (folder_type->display_name); - g_free (folder_type->description); - g_strfreev (folder_type->exported_dnd_types); - g_strfreev (folder_type->accepted_dnd_types); - - g_free (folder_type); - } - g_list_free (priv->folder_types); - - e_free_string_list (priv->external_uri_schemas); - - for (sp = priv->user_creatable_item_types; sp != NULL; sp = sp->next) - user_creatable_item_type_free ((UserCreatableItemType *) sp->data); - g_slist_free (priv->user_creatable_item_types); - - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -/* EvolutionShellComponent methods. */ - -static void -impl_owner_unset (EvolutionShellComponent *shell_component) -{ - EvolutionShellComponentPrivate *priv; - - priv = shell_component->priv; - - if (priv->ping_timeout_id != -1) { - g_source_remove (priv->ping_timeout_id); - priv->ping_timeout_id = -1; - } - - g_object_unref (priv->owner_client); - priv->owner_client = NULL; -} - -static void -impl_owner_died (EvolutionShellComponent *shell_component) -{ - EvolutionShellComponentPrivate *priv; - - priv = shell_component->priv; - - g_object_unref (priv->owner_client); - priv->owner_client = NULL; - - /* The default implementation for ::owner_died emits ::owner_unset, so - that we make the behavior for old components kind of correct without - even if they don't handle the new ::owner_died signal correctly - yet. */ - - g_signal_emit (shell_component, signals[OWNER_UNSET], 0); -} - - -/* Initialization. */ - -static void -evolution_shell_component_class_init (EvolutionShellComponentClass *klass) -{ - EvolutionShellComponentClass *shell_component_class; - GObjectClass *object_class; - POA_GNOME_Evolution_ShellComponent__epv *epv = &klass->epv; - - object_class = G_OBJECT_CLASS (klass); - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; - - signals[OWNER_SET] - = g_signal_new ("owner_set", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, owner_set), - NULL, NULL, - e_shell_marshal_NONE__POINTER_POINTER, - G_TYPE_NONE, 2, - G_TYPE_POINTER, G_TYPE_POINTER); - - signals[OWNER_DIED] - = g_signal_new ("owner_died", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, owner_died), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - signals[OWNER_UNSET] - = g_signal_new ("owner_unset", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, owner_unset), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - signals[DEBUG] - = g_signal_new ("debug", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, debug), - NULL, NULL, - e_shell_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - signals[INTERACTIVE] - = g_signal_new ("interactive", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, interactive), - NULL, NULL, - e_shell_marshal_NONE__BOOL_INT, - G_TYPE_NONE, 2, - G_TYPE_BOOLEAN, - G_TYPE_INT); - - signals[HANDLE_EXTERNAL_URI] - = g_signal_new ("handle_external_uri", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, handle_external_uri), - NULL, NULL, - e_shell_marshal_NONE__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - - signals[USER_CREATE_NEW_ITEM] - = g_signal_new ("user_create_new_item", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, user_create_new_item), - NULL, NULL, - e_shell_marshal_VOID__STRING_STRING_STRING, - G_TYPE_NONE, 3, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING); - - signals[SEND_RECEIVE] - = g_signal_new ("send_receive", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EvolutionShellComponentClass, send_receive), - NULL, NULL, - e_shell_marshal_NONE__BOOL, - G_TYPE_NONE, 1, - G_TYPE_BOOLEAN); - - parent_class = g_type_class_ref(PARENT_TYPE); - - epv->_get_supportedTypes = impl__get_supportedTypes; - epv->_get_externalUriSchemas = impl__get_externalUriSchemas; - epv->_get_userCreatableItemTypes = impl__get_userCreatableItemTypes; - epv->setOwner = impl_setOwner; - epv->unsetOwner = impl_unsetOwner; - epv->debug = impl_debug; - epv->interactive = impl_interactive; - epv->createView = impl_createView; - epv->handleExternalURI = impl_handleExternalURI; - epv->createFolderAsync = impl_createFolderAsync; - epv->removeFolderAsync = impl_removeFolderAsync; - epv->xferFolderAsync = impl_xferFolderAsync; - epv->populateFolderContextMenu = impl_populateFolderContextMenu; - epv->unpopulateFolderContextMenu = impl_unpopulateFolderContextMenu; - epv->userCreateNewItem = impl_userCreateNewItem; - epv->sendReceive = impl_sendReceive; - epv->requestQuit = impl_requestQuit; - - shell_component_class = EVOLUTION_SHELL_COMPONENT_CLASS (object_class); - shell_component_class->owner_died = impl_owner_died; - shell_component_class->owner_unset = impl_owner_unset; -} - -static void -evolution_shell_component_init (EvolutionShellComponent *shell_component) -{ - EvolutionShellComponentPrivate *priv; - - priv = g_new (EvolutionShellComponentPrivate, 1); - - priv->folder_types = NULL; - priv->external_uri_schemas = NULL; - - priv->create_view_fn = NULL; - priv->create_folder_fn = NULL; - priv->remove_folder_fn = NULL; - priv->xfer_folder_fn = NULL; - priv->populate_folder_context_menu_fn = NULL; - priv->unpopulate_folder_context_menu_fn = NULL; - - priv->owner_client = NULL; - priv->user_creatable_item_types = NULL; - priv->closure = NULL; - - priv->ping_timeout_id = -1; - - priv->uic = NULL; - - shell_component->priv = priv; -} - - -void -evolution_shell_component_construct (EvolutionShellComponent *shell_component, - const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - EvolutionShellComponentRequestQuitFn request_quit_fn, - void *closure) -{ - EvolutionShellComponentPrivate *priv; - int i; - - g_return_if_fail (shell_component != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component)); - g_return_if_fail (folder_types != NULL); - - priv = shell_component->priv; - - priv->create_view_fn = create_view_fn; - priv->create_folder_fn = create_folder_fn; - priv->remove_folder_fn = remove_folder_fn; - priv->xfer_folder_fn = xfer_folder_fn; - priv->populate_folder_context_menu_fn = populate_folder_context_menu_fn; - priv->unpopulate_folder_context_menu_fn = unpopulate_folder_context_menu_fn; - priv->get_dnd_selection_fn = get_dnd_selection_fn; - priv->request_quit_fn = request_quit_fn; - - priv->closure = closure; - - for (i = 0; folder_types[i].name != NULL; i++) { - EvolutionShellComponentFolderType *new; - - if (folder_types[i].icon_name == NULL - || folder_types[i].name[0] == '\0' - || folder_types[i].icon_name[0] == '\0') - continue; - - new = g_new (EvolutionShellComponentFolderType, 1); - new->name = g_strdup (folder_types[i].name); - new->icon_name = g_strdup (folder_types[i].icon_name); - - /* Notice that these get translated here. */ - new->display_name = g_strdup (_(folder_types[i].display_name)); - new->description = g_strdup (_(folder_types[i].description)); - - new->user_creatable = folder_types[i].user_creatable; - new->accepted_dnd_types = duplicate_null_terminated_string_array (folder_types[i].accepted_dnd_types); - new->exported_dnd_types = duplicate_null_terminated_string_array (folder_types[i].exported_dnd_types); - - priv->folder_types = g_list_prepend (priv->folder_types, new); - } - - if (priv->folder_types == NULL) - g_warning ("No valid folder types constructing EShellComponent %p", shell_component); - - if (external_uri_schemas != NULL) { - for (i = 0; external_uri_schemas[i] != NULL; i++) - priv->external_uri_schemas = g_list_prepend (priv->external_uri_schemas, - g_strdup (external_uri_schemas[i])); - } -} - -EvolutionShellComponent * -evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - EvolutionShellComponentRequestQuitFn request_quit_fn, - void *closure) -{ - EvolutionShellComponent *new; - - g_return_val_if_fail (folder_types != NULL, NULL); - - new = g_object_new (evolution_shell_component_get_type (), NULL); - - evolution_shell_component_construct (new, - folder_types, - external_uri_schemas, - create_view_fn, - create_folder_fn, - remove_folder_fn, - xfer_folder_fn, - populate_folder_context_menu_fn, - unpopulate_folder_context_menu_fn, - get_dnd_selection_fn, - request_quit_fn, - closure); - - return new; -} - -EvolutionShellClient * -evolution_shell_component_get_owner (EvolutionShellComponent *shell_component) -{ - g_return_val_if_fail (shell_component != NULL, NULL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component), NULL); - - return shell_component->priv->owner_client; -} - -gulong evolution_shell_component_get_parent_view_xid(EvolutionShellComponent *shell_component) -{ - g_return_val_if_fail (shell_component != NULL, 0); - g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component), 0); - - return shell_component->priv->parent_view_xid; -} - - -void -evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *shell_component, - const char *id, - const char *description, - const char *menu_description, - const char *tooltip, - const char *folder_type, - char menu_shortcut, - GdkPixbuf *icon) -{ - EvolutionShellComponentPrivate *priv; - UserCreatableItemType *type; - - g_return_if_fail (shell_component != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component)); - g_return_if_fail (id != NULL); - g_return_if_fail (description != NULL); - g_return_if_fail (menu_description != NULL); - - priv = shell_component->priv; - - type = user_creatable_item_type_new (id, description, menu_description, tooltip, folder_type, menu_shortcut, icon); - - priv->user_creatable_item_types = g_slist_prepend (priv->user_creatable_item_types, type); -} - - -/* Public utility functions. */ - -const char * -evolution_shell_component_result_to_string (EvolutionShellComponentResult result) -{ - switch (result) { - case EVOLUTION_SHELL_COMPONENT_OK: - return _("Success"); - case EVOLUTION_SHELL_COMPONENT_CANCEL: - return _("Cancel"); - case EVOLUTION_SHELL_COMPONENT_CORBAERROR: - return _("CORBA error"); - case EVOLUTION_SHELL_COMPONENT_INTERRUPTED: - return _("Interrupted"); - case EVOLUTION_SHELL_COMPONENT_INVALIDARG: - return _("Invalid argument"); - case EVOLUTION_SHELL_COMPONENT_ALREADYOWNED: - return _("Already has an owner"); - case EVOLUTION_SHELL_COMPONENT_NOTOWNED: - return _("No owner"); - case EVOLUTION_SHELL_COMPONENT_NOTFOUND: - return _("Not found"); - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE: - return _("Unsupported type"); - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDSCHEMA: - return _("Unsupported schema"); - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION: - return _("Unsupported operation"); - case EVOLUTION_SHELL_COMPONENT_INTERNALERROR: - return _("Internal error"); - case EVOLUTION_SHELL_COMPONENT_BUSY: - return _("Busy"); - case EVOLUTION_SHELL_COMPONENT_EXISTS: - return _("Exists"); - case EVOLUTION_SHELL_COMPONENT_INVALIDURI: - return _("Invalid URI"); - case EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED: - return _("Permission denied"); - case EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS: - return _("Has subfolders"); - case EVOLUTION_SHELL_COMPONENT_NOSPACE: - return _("No space left"); - case EVOLUTION_SHELL_COMPONENT_OLDOWNERHASDIED: - return _("Old owner has died"); - case EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR: - default: - return _("Unknown error"); - } -} - - -BONOBO_TYPE_FUNC_FULL (EvolutionShellComponent, - GNOME_Evolution_ShellComponent, - PARENT_TYPE, - evolution_shell_component) diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h deleted file mode 100644 index 53d9a4aae9..0000000000 --- a/shell/evolution-shell-component.h +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component.h - * - * 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 - */ - -#ifndef EVOLUTION_SHELL_COMPONENT_H -#define EVOLUTION_SHELL_COMPONENT_H - -#include "Evolution.h" - -#include "evolution-shell-client.h" - -#include - -#include -#include - -#ifdef cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_SHELL_COMPONENT (evolution_shell_component_get_type ()) -#define EVOLUTION_SHELL_COMPONENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponent)) -#define EVOLUTION_SHELL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponentClass)) -#define EVOLUTION_IS_SHELL_COMPONENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT)) -#define EVOLUTION_IS_SHELL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT)) - -#define EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER "/popups/FolderPopup/ComponentPlaceholder/Items" - - -typedef struct _EvolutionShellComponent EvolutionShellComponent; -typedef struct _EvolutionShellComponentPrivate EvolutionShellComponentPrivate; -typedef struct _EvolutionShellComponentClass EvolutionShellComponentClass; - -enum _EvolutionShellComponentResult { - EVOLUTION_SHELL_COMPONENT_OK, - EVOLUTION_SHELL_COMPONENT_CANCEL, - EVOLUTION_SHELL_COMPONENT_CORBAERROR, - EVOLUTION_SHELL_COMPONENT_INTERRUPTED, - EVOLUTION_SHELL_COMPONENT_INVALIDARG, - EVOLUTION_SHELL_COMPONENT_ALREADYOWNED, - EVOLUTION_SHELL_COMPONENT_NOTOWNED, - EVOLUTION_SHELL_COMPONENT_NOTFOUND, - EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE, - EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDSCHEMA, - EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION, - EVOLUTION_SHELL_COMPONENT_INTERNALERROR, - EVOLUTION_SHELL_COMPONENT_BUSY, - EVOLUTION_SHELL_COMPONENT_EXISTS, - EVOLUTION_SHELL_COMPONENT_INVALIDURI, - EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED, - EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS, - EVOLUTION_SHELL_COMPONENT_NOSPACE, - EVOLUTION_SHELL_COMPONENT_OLDOWNERHASDIED, - EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR -}; -typedef enum _EvolutionShellComponentResult EvolutionShellComponentResult; - -typedef EvolutionShellComponentResult (* EvolutionShellComponentCreateViewFn) - (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const char *view_info, - BonoboControl **control_return, - void *closure); -typedef void (* EvolutionShellComponentCreateFolderFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentRemoveFolderFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentXferFolderFn) (EvolutionShellComponent *shell_component, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - const GNOME_Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentPopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component, - BonoboUIComponent *uic, - const char *physical_uri, - const char *type, - void *closure); -typedef void (* EvolutionShellComponentUnpopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component, - BonoboUIComponent *uic, - const char *physical_uri, - const char *type, - void *closure); -typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - int type, - int *format_return, - const char **selection_return, - int *selection_length_return, - void *closure); - -typedef gboolean (* EvolutionShellComponentRequestQuitFn) (EvolutionShellComponent *shell_component, - void *closure); - -struct _EvolutionShellComponentFolderType { - char *name; - char *icon_name; - char *display_name; - char *description; - - gboolean user_creatable; - - /* The following are NULL-terminated arrays. */ - char **accepted_dnd_types; - char **exported_dnd_types; -}; -typedef struct _EvolutionShellComponentFolderType EvolutionShellComponentFolderType; - -struct _EvolutionShellComponent { - BonoboObject parent; - - EvolutionShellComponentPrivate *priv; -}; - -struct _EvolutionShellComponentClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_ShellComponent__epv epv; - - /* Signals. */ - - void (* owner_set) (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir); - void (* owner_unset) (EvolutionShellComponent *shell_component); - void (* owner_died) (EvolutionShellComponent *shell_component); - - void (* debug) (EvolutionShellComponent *shell_component); - - void (* interactive) (EvolutionShellComponent *shell_component, - gboolean is_interactive, - unsigned long new_view_xid); - - void (* handle_external_uri) (EvolutionShellComponent *shell_component, - const char *uri); - - void (* user_create_new_item) (EvolutionShellComponent *shell_component, - const char *id, - const char *parent_folder_physical_uri, - const char *parent_folder_type); - - void (* send_receive) (EvolutionShellComponent *shell_component, - gboolean show_dialog); -}; - - -GtkType evolution_shell_component_get_type (void); -void evolution_shell_component_construct (EvolutionShellComponent *shell_component, - const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - EvolutionShellComponentRequestQuitFn request_quit_fn, - void *closure); -EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - EvolutionShellComponentRequestQuitFn request_quit_fn, - void *closure); -EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); - -gulong evolution_shell_component_get_parent_view_xid(EvolutionShellComponent *shell_component); - -void evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *shell_component, - const char *id, - const char *description, - const char *menu_description, - const char *tooltip, - const char *folder_type, - char menu_shortcut, - GdkPixbuf *icon); - -const char *evolution_shell_component_result_to_string (EvolutionShellComponentResult result); - -#ifdef cplusplus -} -#endif /* cplusplus */ - -#endif /* EVOLUTION_SHELL_COMPONENT_H */ diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h deleted file mode 100644 index 209f43a339..0000000000 --- a/shell/evolution-storage.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage.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_H__ -#define __EVOLUTION_STORAGE_H__ - -#include "Evolution.h" - -#include -#include - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_STORAGE (evolution_storage_get_type ()) -#define EVOLUTION_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_STORAGE, EvolutionStorage)) -#define EVOLUTION_STORAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_STORAGE, EvolutionStorageClass)) -#define EVOLUTION_IS_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_STORAGE)) -#define EVOLUTION_IS_STORAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_STORAGE)) - - -typedef struct _EvolutionStorage EvolutionStorage; -typedef struct _EvolutionStoragePrivate EvolutionStoragePrivate; -typedef struct _EvolutionStorageClass EvolutionStorageClass; - -enum _EvolutionStorageResult { - EVOLUTION_STORAGE_OK, - - /* Generic errors */ - EVOLUTION_STORAGE_ERROR_GENERIC, - EVOLUTION_STORAGE_ERROR_CORBA, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER, - - /* Registration errors */ - EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED, - EVOLUTION_STORAGE_ERROR_NOTREGISTERED, - EVOLUTION_STORAGE_ERROR_NOREGISTRY, - EVOLUTION_STORAGE_ERROR_EXISTS, - EVOLUTION_STORAGE_ERROR_NOTFOUND, - - /* Folder creation/deletion errors */ - EVOLUTION_STORAGE_ERROR_UNSUPPORTED_OPERATION, - EVOLUTION_STORAGE_ERROR_UNSUPPORTED_TYPE, - EVOLUTION_STORAGE_ERROR_INVALID_URI, - EVOLUTION_STORAGE_ERROR_ALREADY_EXISTS, - EVOLUTION_STORAGE_ERROR_DOES_NOT_EXIST, - EVOLUTION_STORAGE_ERROR_PERMISSION_DENIED, - EVOLUTION_STORAGE_ERROR_NO_SPACE, - EVOLUTION_STORAGE_ERROR_NOT_EMPTY -}; -typedef enum _EvolutionStorageResult EvolutionStorageResult; - -struct _EvolutionStorage { - BonoboObject parent; - - EvolutionStoragePrivate *priv; -}; - -struct _EvolutionStorageClass { - BonoboObjectClass parent_class; - - /* signals */ - void (*create_folder) (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *type, - const char *description, - const char *parent_physical_uri); - - void (*remove_folder) (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *physical_uri); - - void (*xfer_folder) (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *source_path, - const char *destination_path, - gboolean remove_source); - - void (*open_folder) (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path); - - void (*update_folder) (EvolutionStorage *storage, - const char *path, - int unread_count); - - void (*discover_shared_folder) (EvolutionStorage *storage, - Bonobo_Listener listener, - const char *user, - const char *folder_name); - - void (*cancel_discover_shared_folder) (EvolutionStorage *storage, - const char *user, - const char *folder_name); - - void (*remove_shared_folder) (EvolutionStorage *storage, - Bonobo_Listener listener, - const char *path); - - void (*show_folder_properties) (EvolutionStorage *storage, - const char *path, - unsigned int itemNumber, - unsigned long parentWindowId); - - POA_GNOME_Evolution_Storage__epv epv; -}; - - -GType evolution_storage_get_type (void); -void evolution_storage_construct (EvolutionStorage *storage, - const char *name, - gboolean has_shared_folders); -EvolutionStorage *evolution_storage_new (const char *name, - gboolean has_shared_folders); - -void evolution_storage_rename (EvolutionStorage *storage, - const char *new_name); - -EvolutionStorageResult evolution_storage_register (EvolutionStorage *storage, - GNOME_Evolution_StorageRegistry corba_registry); -EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, - GNOME_Evolution_Shell corba_shell); -EvolutionStorageResult evolution_storage_deregister_on_shell (EvolutionStorage *storage, - GNOME_Evolution_Shell corba_shell); -EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage, - const char *path, - const char *display_name, - const char *type, - const char *physical_uri, - const char *description, - const char *custom_icon_name, - int unread_count, - gboolean can_sync_offline, - int sorting_priority); -EvolutionStorageResult evolution_storage_update_folder (EvolutionStorage *evolution_storage, - const char *path, - int unread_count); -EvolutionStorageResult evolution_storage_update_folder_by_uri (EvolutionStorage *evolution_storage, - const char *physical_uri, - int unread_count); -EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage, - const char *path); -gboolean evolution_storage_folder_exists (EvolutionStorage *evolution_storage, - const char *path); -EvolutionStorageResult evolution_storage_has_subfolders (EvolutionStorage *evolution_storage, - const char *path, - const char *message); - -void evolution_storage_add_property_item (EvolutionStorage *evolution_storage, - const char *label, - const char *tooltip, - GdkPixbuf *icon); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_STORAGE_H__ */ -- cgit