diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-04-03 05:22:58 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-04-03 05:22:58 +0800 |
commit | 167b482c9e39a093dcfecc5ef430261c0504e370 (patch) | |
tree | f9f4e9c0fbe5c6282f158015bd373a3cd5e68abf | |
parent | fabb6b035c40673e7c263040db323d6b7607606e (diff) | |
download | gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.tar gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.tar.gz gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.tar.bz2 gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.tar.lz gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.tar.xz gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.tar.zst gsoc2013-evolution-167b482c9e39a093dcfecc5ef430261c0504e370.zip |
Remove dead Bonobo-era source files.
-rw-r--r-- | calendar/gui/calendar-commands.c.dead | 380 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.h.dead | 44 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c.dead | 710 | ||||
-rw-r--r-- | calendar/gui/calendar-component.h.dead | 55 | ||||
-rw-r--r-- | mail/em-folder-browser.c.dead | 1089 | ||||
-rw-r--r-- | mail/em-folder-browser.h.dead | 62 | ||||
-rw-r--r-- | mail/em-folder-view.c.dead | 1014 | ||||
-rw-r--r-- | mail/em-folder-view.h.dead | 166 | ||||
-rw-r--r-- | mail/mail-component.c.dead | 385 | ||||
-rw-r--r-- | mail/mail-component.h.dead | 106 |
10 files changed, 0 insertions, 4011 deletions
diff --git a/calendar/gui/calendar-commands.c.dead b/calendar/gui/calendar-commands.c.dead deleted file mode 100644 index 6368857ead..0000000000 --- a/calendar/gui/calendar-commands.c.dead +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Evolution calendar - Commands for the calendar GUI control - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * Seth Alves <alves@hungry.com> - * Rodrigo Moya <rodrigo@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <ctype.h> -#include <errno.h> - -#include <gtk/gtk.h> -#include <glib/gi18n.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-exception.h> -#include <libecal/e-cal-time-util.h> -#include "shell/Evolution.h" -#include "calendar-commands.h" -#include "calendar-component.h" -#include "calendar-config.h" -#include "e-day-view.h" -#include "e-week-view.h" -#include "gnome-cal.h" -#include "goto.h" -#include "print.h" -#include "dialogs/cal-prefs-dialog.h" -#include "itip-utils.h" -#include "e-cal-list-view.h" -#include "evolution-shell-component-utils.h" -#include "e-util/e-icon-factory.h" -#include "e-util/e-util-private.h" -#include "e-cal-menu.h" - -/* Focusing information for the calendar view. We have to keep track of this - * ourselves because with Bonobo controls, we may get unpaired focus_out events. - */ -typedef struct { - guint calendar_focused : 1; - guint taskpad_focused : 1; -} FocusData; - -/* Sets a clock cursor for the specified calendar window */ -static void -set_clock_cursor (GnomeCalendar *gcal) -{ - GdkCursor *cursor; - - cursor = gdk_cursor_new (GDK_WATCH); - gdk_window_set_cursor (GTK_WIDGET (gcal)->window, cursor); - gdk_cursor_unref (cursor); - gdk_flush (); -} - -/* Resets the normal cursor for the specified calendar window */ -static void -set_normal_cursor (GnomeCalendar *gcal) -{ - gdk_window_set_cursor (GTK_WIDGET (gcal)->window, NULL); - gdk_flush (); -} - -static void -show_day_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_DAY_VIEW); -} - -static void -show_work_week_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_WORK_WEEK_VIEW); -} - -static void -show_week_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_WEEK_VIEW); -} - -static void -show_month_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_MONTH_VIEW); -} - -static void -show_list_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_LIST_VIEW); -} - -struct _sensitize_item { - const gchar *command; - guint32 enable; -}; - -static void -sensitize_items(BonoboUIComponent *uic, struct _sensitize_item *items, guint32 mask) -{ - while (items->command) { - gchar command[32]; - - if (strlen(items->command)>=21) { - g_warning ("items->command >= 21: %s\n", items->command); - continue; - } - sprintf(command, "/commands/%s", items->command); - - bonobo_ui_component_set_prop (uic, command, "sensitive", - (items->enable & mask) == 0 ? "1" : "0", - NULL); - items++; - } -} - -static struct _sensitize_item taskpad_sensitize_table[] = { - { "Cut", E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ANY }, - { "Copy", E_CAL_MENU_SELECT_ANY }, - { "Paste", E_CAL_MENU_SELECT_EDITABLE }, - { "Delete", E_CAL_MENU_SELECT_EDITABLE }, - { NULL } -}; - -/* Sensitizes the UI Component menu/toolbar tasks commands based on the number - * of selected tasks. If enable is FALSE, all will be disabled. Otherwise, the - * currently-selected number of tasks will be used. - */ -static void -sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolean enable) -{ - BonoboUIComponent *uic; - ECalendarTable *task_pad; - ECalModel *model; - GSList *selected, *l; - ECalMenu *menu; - GPtrArray *events; - ECalMenuTargetSelect *t; - - uic = bonobo_control_get_ui_component (control); - g_return_if_fail (uic != NULL); - - menu = gnome_calendar_get_calendar_menu (gcal); - task_pad = gnome_calendar_get_task_pad(gcal); - model = e_calendar_table_get_model (task_pad); - selected = e_calendar_table_get_selected(task_pad); - events = g_ptr_array_new(); - for (l=selected;l;l=g_slist_next(l)) - g_ptr_array_add(events, e_cal_model_copy_component_data((ECalModelComponent *)l->data)); - g_slist_free(selected); - - t = e_cal_menu_target_new_select(menu, model, events); - if (!enable) - t->target.mask = ~((~t->target.mask) & E_CAL_MENU_SELECT_EDITABLE); - - sensitize_items(uic, taskpad_sensitize_table, t->target.mask); -} - -/* Callback used when the selection in the calendar views changes */ -static void -gcal_calendar_selection_changed_cb (GnomeCalendar *gcal, gpointer data) -{ - BonoboControl *control; - - control = BONOBO_CONTROL (data); - - calendar_control_sensitize_calendar_commands (control, gcal, TRUE); -} - -/* Callback used when the selection in the taskpad changes */ -static void -gcal_taskpad_selection_changed_cb (GnomeCalendar *gcal, gpointer data) -{ - BonoboControl *control; - - control = BONOBO_CONTROL (data); - - sensitize_taskpad_commands (gcal, control, TRUE); -} - -/* Callback used when the focus changes for a calendar view */ -static void -gcal_calendar_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data) -{ - BonoboControl *control; - FocusData *focus; - - control = BONOBO_CONTROL (data); - - focus = g_object_get_data (G_OBJECT (control), "focus_data"); - g_return_if_fail (focus != NULL); - - if (in) { - g_signal_connect (gcal, "calendar_selection_changed", - G_CALLBACK (gcal_calendar_selection_changed_cb), control); - calendar_control_sensitize_calendar_commands (control, gcal, TRUE); - focus->calendar_focused = TRUE; - } else if (focus->calendar_focused) { - g_signal_handlers_disconnect_by_func ( - gcal, G_CALLBACK (gcal_calendar_selection_changed_cb), control); - calendar_control_sensitize_calendar_commands (control, gcal, FALSE); - focus->calendar_focused = FALSE; - } -} - -/* Callback used when the taskpad focus changes */ -static void -gcal_taskpad_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data) -{ - BonoboControl *control; - FocusData *focus; - - control = BONOBO_CONTROL (data); - - focus = g_object_get_data (G_OBJECT (control), "focus_data"); - g_return_if_fail (focus != NULL); - - if (in) { - g_signal_connect (gcal, "taskpad_selection_changed", - G_CALLBACK (gcal_taskpad_selection_changed_cb), control); - sensitize_taskpad_commands (gcal, control, TRUE); - focus->taskpad_focused = TRUE; - } else if (focus->taskpad_focused) { - /* With Bonobo controls, we may get unpaired focus_out events. - * That is why we have to keep track of this ourselves instead - * of blindly assumming that we are getting this event because - * the taskpad was in fact focused. - */ - g_signal_handlers_disconnect_by_func ( - gcal, G_CALLBACK (gcal_taskpad_selection_changed_cb), control); - sensitize_taskpad_commands (gcal, control, FALSE); - focus->taskpad_focused = FALSE; - } - -} - -static void -help_debug (BonoboUIComponent *uid, gpointer data, const gchar *path) -{ - calendar_component_show_logger ((GtkWidget *) data); -} - -static BonoboUIVerb verbs [] = { - - BONOBO_UI_VERB ("ShowDayView", show_day_view_clicked), - BONOBO_UI_VERB ("ShowWorkWeekView", show_work_week_view_clicked), - BONOBO_UI_VERB ("ShowWeekView", show_week_view_clicked), - BONOBO_UI_VERB ("ShowMonthView", show_month_view_clicked), - BONOBO_UI_VERB ("ShowListView", show_list_view_clicked), - - BONOBO_UI_VERB ("HelpDebug", help_debug), - BONOBO_UI_VERB_END -}; - -void -calendar_control_activate (BonoboControl *control, - GnomeCalendar *gcal) -{ - Bonobo_UIContainer remote_uih; - BonoboUIComponent *uic; - FocusData *focus; - gchar *xmlfile; - - uic = bonobo_control_get_ui_component (control); - g_return_if_fail (uic != NULL); - - remote_uih = bonobo_control_get_remote_ui_container (control, NULL); - bonobo_ui_component_set_container (uic, remote_uih, NULL); - bonobo_object_release_unref (remote_uih, NULL); - - gnome_calendar_set_ui_component (gcal, uic); - - bonobo_ui_component_add_verb_list_with_data (uic, verbs, gcal); - - bonobo_ui_component_freeze (uic, NULL); - - xmlfile = g_build_filename (EVOLUTION_UIDIR, - "evolution-calendar.xml", - NULL); - bonobo_ui_util_set_ui (uic, PREFIX, - xmlfile, - "evolution-calendar", - NULL); - g_free (xmlfile); - - gnome_calendar_setup_view_menus (gcal, uic); - - g_signal_connect (gcal, "calendar_focus_change", - G_CALLBACK (gcal_calendar_focus_change_cb), control); - g_signal_connect (gcal, "taskpad_focus_change", - G_CALLBACK (gcal_taskpad_focus_change_cb), control); - - e_menu_activate((EMenu *)gnome_calendar_get_calendar_menu (gcal), uic, 1); - e_menu_activate((EMenu *)gnome_calendar_get_taskpad_menu (gcal), uic, 1); - - calendar_control_sensitize_calendar_commands (control, gcal, TRUE); - sensitize_taskpad_commands (gcal, control, TRUE); - - bonobo_ui_component_thaw (uic, NULL); - - focus = g_new (FocusData, 1); - focus->calendar_focused = FALSE; - focus->taskpad_focused = FALSE; - - g_object_set_data (G_OBJECT (control), "focus_data", focus); -} - -void -calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal) -{ - FocusData *focus; - BonoboUIComponent *uic; - - uic = bonobo_control_get_ui_component (control); - g_return_if_fail (uic != NULL); - - e_menu_activate((EMenu *)gnome_calendar_get_calendar_menu (gcal), uic, 0); - e_menu_activate((EMenu *)gnome_calendar_get_taskpad_menu (gcal), uic, 0); - - gnome_calendar_set_ui_component (gcal, NULL); - - focus = g_object_get_data (G_OBJECT (control), "focus_data"); - g_return_if_fail (focus != NULL); - - g_object_set_data (G_OBJECT (control), "focus_data", NULL); - g_free (focus); - - gnome_calendar_discard_view_menus (gcal); - - g_signal_handlers_disconnect_matched (gcal, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, control); - - bonobo_ui_component_rm (uic, "/", NULL); - bonobo_ui_component_unset_container (uic, NULL); -} diff --git a/calendar/gui/calendar-commands.h.dead b/calendar/gui/calendar-commands.h.dead deleted file mode 100644 index 605230302e..0000000000 --- a/calendar/gui/calendar-commands.h.dead +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Evolution calendar - Commands for the calendar GUI control - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * Seth Alves <alves@hungry.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef CALENDAR_COMMANDS_H -#define CALENDAR_COMMANDS_H - -#include "gnome-cal.h" - -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-ui-component.h> - -void calendar_control_activate (BonoboControl *control, GnomeCalendar *gcal); -void calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal); - -void calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalendar *gcal, gboolean enable); - -void calendar_goto_today (GnomeCalendar *gcal); - -void calendar_command_print (GnomeCalendar *gcal, GtkPrintOperationAction action); - -#endif /* CALENDAR_COMMANDS_H */ diff --git a/calendar/gui/calendar-component.c.dead b/calendar/gui/calendar-component.c.dead deleted file mode 100644 index 9cd0e8eb21..0000000000 --- a/calendar/gui/calendar-component.c.dead +++ /dev/null @@ -1,710 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * Rodrigo Moya <rodrigo@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <errno.h> -#include <glib/gi18n-lib.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-exception.h> -#include <libical/icalvcal.h> -#include <libedataserver/e-data-server-util.h> -#include <libedataserver/e-url.h> -#include <libecal/e-cal-time-util.h> -#include <libedataserverui/e-source-selector.h> -#include <shell/e-user-creatable-items-handler.h> -#include <shell/e-component-view.h> -#include "e-calendar-view.h" -#include "calendar-config-keys.h" -#include "calendar-config.h" -#include "calendar-component.h" -#include "calendar-commands.h" -#include "control-factory.h" -#include "gnome-cal.h" -#include "migration.h" -#include "comp-util.h" -#include "common/authentication.h" -#include "dialogs/calendar-setup.h" -#include "dialogs/comp-editor.h" -#include "dialogs/copy-source-dialog.h" -#include "dialogs/event-editor.h" -#include "misc/e-info-label.h" -#include "e-util/e-non-intrusive-error-dialog.h" -#include "e-util/gconf-bridge.h" -#include "e-util/e-error.h" -#include "e-cal-menu.h" -#include "e-cal-popup.h" -#include "e-attachment-handler-calendar.h" - -/* IDs for user creatable items */ -#define CREATE_EVENT_ID "event" -#define CREATE_MEETING_ID "meeting" -#define CREATE_ALLDAY_EVENT_ID "allday-event" -#define CREATE_CALENDAR_ID "calendar" -#define CALENDAR_ERROR_LEVEL_KEY "/apps/evolution/calendar/display/error_level" -#define CALENDAR_ERROR_TIME_OUT_KEY "/apps/evolution/calendar/display/error_timeout" - -static BonoboObjectClass *parent_class = NULL; - -typedef struct -{ - ESourceList *source_list; - ESourceList *task_source_list; - ESourceList *memo_source_list; - - GSList *source_selection; - GSList *task_source_selection; - GSList *memo_source_selection; - - GnomeCalendar *calendar; - - GtkWidget *source_selector; - - BonoboControl *view_control; - - GList *notifications; - - gfloat vpane_pos; -} CalendarComponentView; - -struct _CalendarComponentPrivate { - - gint gconf_notify_id; - - ESourceList *source_list; - ESourceList *task_source_list; - ESourceList *memo_source_list; - - EActivityHandler *activity_handler; - ELogger *logger; - - GList *views; - - ECal *create_ecal; - - GList *notifications; -}; - -static void -calcomp_vpane_realized (GtkWidget *vpane, CalendarComponentView *view) -{ - gtk_paned_set_position (GTK_PANED (vpane), (gint)(view->vpane_pos*vpane->allocation.height)); - -} - -static gboolean -calcomp_vpane_resized (GtkWidget *vpane, GdkEventButton *e, CalendarComponentView *view) -{ - - view->vpane_pos = gtk_paned_get_position (GTK_PANED (vpane)); - calendar_config_set_tag_vpane_pos (view->vpane_pos/(gfloat)vpane->allocation.height); - - return FALSE; -} - -/* Utility functions. */ - -static gboolean -is_in_selection (GSList *selection, ESource *source) -{ - GSList *l; - - for (l = selection; l; l = l->next) { - ESource *selected_source = l->data; - - if (!strcmp (e_source_peek_uid (selected_source), e_source_peek_uid (source))) - return TRUE; - } - - return FALSE; -} - -static gboolean -is_in_uids (GSList *uids, ESource *source) -{ - GSList *l; - - for (l = uids; l; l = l->next) { - const gchar *uid = l->data; - - if (!strcmp (uid, e_source_peek_uid (source))) - return TRUE; - } - - return FALSE; -} - -static void -update_task_memo_selection (CalendarComponentView *component_view, ECalSourceType type) -{ - GSList *uids_selected, *l, *source_selection; - ESourceList *source_list = NULL; - - if (type == E_CAL_SOURCE_TYPE_TODO) { - /* Get the selection in gconf */ - uids_selected = calendar_config_get_tasks_selected (); - source_list = component_view->task_source_list; - source_selection = component_view->task_source_selection; - } else { - uids_selected = calendar_config_get_memos_selected (); - source_list = component_view->memo_source_list; - source_selection = component_view->memo_source_selection; - } - - /* Remove any that aren't there any more */ - for (l = source_selection; l; l = l->next) { - gchar *uid = l->data; - ESource *source; - - source = e_source_list_peek_source_by_uid (component_view->source_list, uid); - if (!source) - gnome_calendar_remove_source_by_uid (component_view->calendar, type, uid); - else if (!is_in_uids (uids_selected, source)) - gnome_calendar_remove_source (component_view->calendar, type, source); - - g_free (uid); - } - g_slist_free (source_selection); - - /* Make sure the whole selection is there */ - for (l = uids_selected; l; l = l->next) { - gchar *uid = l->data; - ESource *source; - - source = e_source_list_peek_source_by_uid (source_list, uid); - if (source && !gnome_calendar_add_source (component_view->calendar, type, source)) { - /* FIXME do something */; - } - } - - if (type == E_CAL_SOURCE_TYPE_TODO) - component_view->task_source_selection = uids_selected; - else - component_view->memo_source_selection = uids_selected; -} - -static void -update_primary_task_memo_selection (CalendarComponentView *component_view, ECalSourceType type) -{ - ESource *source = NULL; - gchar *uid; - ESourceList *source_list = NULL; - - if (type == E_CAL_SOURCE_TYPE_TODO) { - uid = calendar_config_get_primary_tasks (); - source_list = component_view->task_source_list; - } else { - uid = calendar_config_get_primary_memos (); - source_list = component_view->memo_source_list; - } - - if (uid) { - source = e_source_list_peek_source_by_uid (source_list, uid); - - g_free (uid); - } - - if (source) - gnome_calendar_set_default_source (component_view->calendar, type, source); -} - -static void -config_primary_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - CalendarComponent *calendar_component = data; - CalendarComponentPrivate *priv = calendar_component->priv; - - if (priv->create_ecal) { - g_object_unref (priv->create_ecal); - priv->create_ecal = NULL; - } -} - -static void -config_tasks_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - update_task_memo_selection (data, E_CAL_SOURCE_TYPE_TODO); -} - -static void -config_primary_tasks_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - update_primary_task_memo_selection (data, E_CAL_SOURCE_TYPE_TODO); -} - -static void -config_memos_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - update_task_memo_selection (data, E_CAL_SOURCE_TYPE_JOURNAL); -} - -static void -config_primary_memos_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - update_primary_task_memo_selection (data, E_CAL_SOURCE_TYPE_JOURNAL); -} - -/* Evolution::Component CORBA methods. */ -static void -impl_handleURI (PortableServer_Servant servant, const gchar *uri, CORBA_Environment *ev) -{ - CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant)); - CalendarComponentPrivate *priv; - GList *l; - CalendarComponentView *view = NULL; - gchar *src_uid = NULL; - gchar *uid = NULL; - gchar *rid = NULL; - - priv = calendar_component->priv; - - l = g_list_last (priv->views); - if (!l) - return; - - view = l->data; - - if (!strncmp (uri, "calendar:", 9)) { - EUri *euri = e_uri_new (uri); - const gchar *p; - gchar *header, *content; - gsize len, clen; - time_t start = -1, end = -1; - - p = euri->query; - if (p) { - while (*p) { - len = strcspn (p, "=&"); - - /* If it's malformed, give up. */ - if (p[len] != '=') - break; - - header = (gchar *) p; - header[len] = '\0'; - p += len + 1; - - clen = strcspn (p, "&"); - - content = g_strndup (p, clen); - - if (!g_ascii_strcasecmp (header, "startdate")) { - start = time_from_isodate (content); - } else if (!g_ascii_strcasecmp (header, "enddate")) { - end = time_from_isodate (content); - } else if (!g_ascii_strcasecmp (header, "source-uid")) { - src_uid = g_strdup (content); - } else if (!g_ascii_strcasecmp (header, "comp-uid")) { - uid = g_strdup (content); - } else if (!g_ascii_strcasecmp (header, "comp-rid")) { - rid = g_strdup (content); - } - - g_free (content); - - p += clen; - if (*p == '&') { - p++; - if (!strcmp (p, "amp;")) - p += 4; - } - } - - if (start != -1) { - - if (end == -1) - gnome_calendar_set_selected_time_range (view->calendar, start); - } - if (src_uid && uid) - gnome_calendar_edit_appointment (view->calendar, src_uid, uid, rid); - - g_free (src_uid); - g_free (uid); - g_free (rid); - } - e_uri_free (euri); - } -} - -static void -config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - CalendarComponent *calendar_component = data; - CalendarComponentPrivate *priv; - - priv = calendar_component->priv; - - g_object_unref (priv->create_ecal); - priv->create_ecal = NULL; - - priv->notifications = g_list_remove (priv->notifications, GUINT_TO_POINTER (id)); -} - -static ECal * -setup_create_ecal (CalendarComponent *calendar_component, CalendarComponentView *component_view) -{ - CalendarComponentPrivate *priv; - ESource *source = NULL; - gchar *uid; - guint not; - - priv = calendar_component->priv; - - /* Try to use the client from the calendar first to avoid re-opening things */ - if (component_view) { - ECal *default_ecal; - - default_ecal = gnome_calendar_get_default_client (component_view->calendar); - if (default_ecal) - return default_ecal; - } - - /* If there is an existing fall back, use that */ - if (priv->create_ecal) - return priv->create_ecal; - - /* Get the current primary calendar, or try to set one if it doesn't already exist */ - uid = calendar_config_get_primary_calendar (); - if (uid) { - source = e_source_list_peek_source_by_uid (priv->source_list, uid); - g_free (uid); - - priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); - } - - if (!priv->create_ecal) { - /* Try to create a default if there isn't one */ - source = e_source_list_peek_source_any (priv->source_list); - if (source) - priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); - } - - if (priv->create_ecal) { - icaltimezone *zone; - - zone = calendar_config_get_icaltimezone (); - e_cal_set_default_timezone (priv->create_ecal, zone, NULL); - - if (!e_cal_open (priv->create_ecal, FALSE, NULL)) { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open the calendar '%s' for creating events and meetings"), - e_source_peek_name (source)); - - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - g_object_unref (priv->create_ecal); - priv->create_ecal = NULL; - - return NULL; - } - - } else { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("There is no calendar available for creating events and meetings")); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - return NULL; - } - - /* Handle the fact it may change on us */ - not = calendar_config_add_notification_primary_calendar (config_create_ecal_changed_cb, - calendar_component); - priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); - - /* Save the primary source for use elsewhere */ - calendar_config_set_primary_calendar (e_source_peek_uid (source)); - - return priv->create_ecal; -} - -static CalendarComponentView * -create_component_view (CalendarComponent *calendar_component) -{ - CalendarComponentPrivate *priv; - CalendarComponentView *component_view; - GtkWidget **vpane; - guint not; - - priv = calendar_component->priv; - - /* Create the calendar component view */ - component_view = g_new0 (CalendarComponentView, 1); - - vpane = gtk_vpaned_new (); - g_signal_connect_after (vpane, "realize", - G_CALLBACK(calcomp_vpane_realized), component_view); - g_signal_connect (vpane, "button_release_event", - G_CALLBACK (calcomp_vpane_resized), component_view); - gtk_widget_show (vpane); - /* Add the source lists */ - component_view->source_list = g_object_ref (priv->source_list); - component_view->task_source_list = g_object_ref (priv->task_source_list); - component_view->memo_source_list = g_object_ref (priv->memo_source_list); - /* Create sidebar selector */ - component_view->source_selector = e_source_selector_new (calendar_component->priv->source_list); - g_signal_connect ( - component_view->source_selector, "data-dropped", - G_CALLBACK (selector_tree_data_dropped), calendar_component); - - gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types, - num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE); - - gtk_widget_show (component_view->source_selector); - - selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (selector_scrolled_window), component_view->source_selector); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window), - GTK_SHADOW_IN); - gtk_widget_show (selector_scrolled_window); - - component_view->info_label = (EInfoLabel *)e_info_label_new("x-office-calendar"); - e_info_label_set_info (component_view->info_label, _("Calendars"), ""); - gtk_widget_show (GTK_WIDGET (component_view->info_label)); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0); - gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0); - gtk_widget_show (vbox); - - gtk_paned_pack1 (GTK_PANED (vpane), vbox, FALSE, FALSE); - - component_view->sidebar_control = bonobo_control_new (vpane); - - /* Create main view */ - component_view->view_control = control_factory_new_control (); - if (!component_view->view_control) { - /* FIXME free memory */ - - return NULL; - } - - component_view->calendar = (GnomeCalendar *) bonobo_control_get_widget (component_view->view_control); - - gtk_paned_pack2 (GTK_PANED (vpane), gnome_calendar_get_tag (component_view->calendar), FALSE, FALSE); - - /* This signal is thrown if backends die - we update the selector */ - g_signal_connect (component_view->calendar, "source_added", - G_CALLBACK (source_added_cb), component_view); - g_signal_connect (component_view->calendar, "source_removed", - G_CALLBACK (source_removed_cb), component_view); - - /* Create status bar */ - statusbar_widget = e_task_bar_new (); - component_view->activity_handler = e_activity_handler_new (); - e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget)); - e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget)); - - gtk_widget_show (statusbar_widget); - - component_view->statusbar_control = bonobo_control_new (statusbar_widget); - - gnome_calendar_set_activity_handler (component_view->calendar, component_view->activity_handler); - - /* connect after setting the initial selections, or we'll get unwanted calls - to calendar_control_sensitize_calendar_commands */ - g_signal_connect (component_view->source_selector, "selection_changed", - G_CALLBACK (source_selection_changed_cb), component_view); - g_signal_connect (component_view->source_selector, "primary_selection_changed", - G_CALLBACK (primary_source_selection_changed_cb), component_view); - g_signal_connect (component_view->source_selector, "popup_event", - G_CALLBACK (popup_event_cb), component_view); - ->>>>>>> 23df769955ea54f756a579c19964df87ae6fd5c8:calendar/gui/calendar-component.c - /* Set up the "new" item handler */ - g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view); - - /* Load the selection from the last run */ - update_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_TODO); - update_primary_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_TODO); - update_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_JOURNAL); - update_primary_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_JOURNAL); - - /* If the tasks/memos selection changes elsewhere, update it for the mini - mini tasks view sidebar */ - not = calendar_config_add_notification_tasks_selected (config_tasks_selection_changed_cb, - component_view); - component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not)); - - not = calendar_config_add_notification_memos_selected (config_memos_selection_changed_cb, - component_view); - component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not)); - - not = calendar_config_add_notification_primary_tasks (config_primary_tasks_selection_changed_cb, - component_view); - component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not)); - - not = calendar_config_add_notification_primary_memos (config_primary_memos_selection_changed_cb, - component_view); - component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not)); - - return component_view; -} - -static void -destroy_component_view (CalendarComponentView *component_view) -{ - GList *l; - - if (component_view->source_list) - g_object_unref (component_view->source_list); - - if (component_view->task_source_list) - g_object_unref (component_view->task_source_list); - - if (component_view->memo_source_list) - g_object_unref (component_view->memo_source_list); - - if (component_view->source_selection) - e_source_selector_free_selection (component_view->source_selection); - - for (l = component_view->notifications; l; l = l->next) - calendar_config_remove_notification (GPOINTER_TO_UINT (l->data)); - g_list_free (component_view->notifications); - - if (component_view->task_source_selection) { - g_slist_foreach (component_view->task_source_selection, (GFunc) g_free, NULL); - g_slist_free (component_view->task_source_selection); - } - - if (component_view->memo_source_selection) { - g_slist_foreach (component_view->memo_source_selection, (GFunc) g_free, NULL); - g_slist_free (component_view->memo_source_selection); - } - - g_free (component_view); -} - -static void -view_destroyed_cb (gpointer data, GObject *where_the_object_was) -{ - CalendarComponent *calendar_component = data; - CalendarComponentPrivate *priv; - GList *l; - - priv = calendar_component->priv; - - for (l = priv->views; l; l = l->next) { - CalendarComponentView *component_view = l->data; - - if (G_OBJECT (component_view->view_control) == where_the_object_was) { - priv->views = g_list_remove (priv->views, component_view); - destroy_component_view (component_view); - - break; - } - } -} - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - CalendarComponent *calendar_component = CALENDAR_COMPONENT (object); - CalendarComponentPrivate *priv = calendar_component->priv; - GList *l; - - if (priv->source_list != NULL) { - g_object_unref (priv->source_list); - priv->source_list = NULL; - } - - if (priv->activity_handler != NULL) { - g_object_unref (priv->activity_handler); - priv->activity_handler = NULL; - } - - if (priv->activity_handler != NULL) { - g_object_unref (priv->activity_handler); - priv->activity_handler = NULL; - } - - if (priv->create_ecal) { - g_object_unref (priv->create_ecal); - priv->create_ecal = NULL; - } - - for (l = priv->views; l; l = l->next) { - CalendarComponentView *component_view = l->data; - - g_object_weak_unref (G_OBJECT (component_view->view_control), view_destroyed_cb, calendar_component); - } - g_list_free (priv->views); - priv->views = NULL; - - for (l = priv->notifications; l; l = l->next) - calendar_config_remove_notification (GPOINTER_TO_UINT (l->data)); - g_list_free (priv->notifications); - priv->notifications = NULL; - - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -calendar_component_class_init (CalendarComponentClass *class) -{ - POA_GNOME_Evolution_Component__epv *epv = &class->epv; - GObjectClass *object_class = G_OBJECT_CLASS (class); - - bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - - parent_class = g_type_class_peek_parent (class); - - epv->handleURI = impl_handleURI; - - object_class->dispose = impl_dispose; -} - -static void -calendar_component_init (CalendarComponent *component) -{ - CalendarComponentPrivate *priv; - guint not; - - not = calendar_config_add_notification_primary_calendar (config_primary_selection_changed_cb, - component); - priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); - - priv->logger = e_logger_create ("calendar"); - priv->activity_handler = e_activity_handler_new (); - e_activity_handler_set_logger (priv->activity_handler, priv->logger); - e_activity_handler_set_error_flush_time (priv->activity_handler,eni_config_get_error_timeout (CALENDAR_ERROR_TIME_OUT_KEY)*1000); - - component->priv = priv; - - e_cal_get_sources (&priv->task_source_list, E_CAL_SOURCE_TYPE_TODO, NULL); - e_cal_get_sources (&priv->memo_source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL); -} diff --git a/calendar/gui/calendar-component.h.dead b/calendar/gui/calendar-component.h.dead deleted file mode 100644 index fbdd8efd23..0000000000 --- a/calendar/gui/calendar-component.h.dead +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _CALENDAR_COMPONENT_H_ -#define _CALENDAR_COMPONENT_H_ - -#include <bonobo/bonobo-object.h> -#include <libedataserver/e-source-list.h> -#include <widgets/misc/e-activity-handler.h> -#include "Evolution.h" - -#define CALENDAR_TYPE_COMPONENT (calendar_component_get_type ()) -#define CALENDAR_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALENDAR_TYPE_COMPONENT, CalendarComponent)) -#define CALENDAR_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALENDAR_TYPE_COMPONENT, CalendarComponentClass)) -#define CALENDAR_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALENDAR_TYPE_COMPONENT)) -#define CALENDAR_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CALENDAR_TYPE_COMPONENT)) - -typedef struct _CalendarComponent CalendarComponent; -typedef struct _CalendarComponentPrivate CalendarComponentPrivate; -typedef struct _CalendarComponentClass CalendarComponentClass; - -struct _CalendarComponent { - BonoboObject parent; - - CalendarComponentPrivate *priv; -}; - -struct _CalendarComponentClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Component__epv epv; -}; - -GType calendar_component_get_type (void); - -#endif /* _CALENDAR_COMPONENT_H_ */ diff --git a/mail/em-folder-browser.c.dead b/mail/em-folder-browser.c.dead deleted file mode 100644 index 8156c4fd32..0000000000 --- a/mail/em-folder-browser.c.dead +++ /dev/null @@ -1,1089 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <string.h> - -#include <gtk/gtk.h> -#include <gdk/gdkkeysyms.h> -#include <gconf/gconf-client.h> - -#ifdef G_OS_WIN32 -/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */ -#define DATADIR crap_DATADIR -#include <windows.h> -#undef DATADIR -#undef interface -#endif - -#include "mail-mt.h" -#include "mail-ops.h" -#include "mail-tools.h" -#include "mail-config.h" - -#include <e-util/e-dialog-utils.h> -#include <e-util/e-icon-factory.h> - -#include <camel/camel-stream.h> -#include <camel/camel-url.h> -#include <camel/camel-folder.h> -#include <camel/camel-vee-folder.h> -#include <camel/camel-vee-store.h> -#include <camel/camel-operation.h> - -/* for efilterbar stuff */ -#include <libedataserver/e-sexp.h> -#include "mail-vfolder.h" -#include "em-vfolder-rule.h" -#include "em-folder-tree.h" -#include <misc/e-filter-bar.h> -#include <camel/camel-search-private.h> -#include <camel/camel-store.h> - -#include "e-util/e-dialog-utils.h" -#include "e-util/e-util.h" -#include "e-util/e-error.h" -#include "e-util/e-util-private.h" -#include "e-util/e-util-labels.h" -#include "e-mail-search-bar.h" -#include "em-utils.h" -#include "em-composer-utils.h" -#include "em-format-html-display.h" -#include "em-format-html-print.h" -#include "em-folder-browser.h" -#include "em-folder-properties.h" -#include "em-folder-utils.h" -#include "em-subscribe-editor.h" -#include "em-menu.h" -#include "em-event.h" -#include "message-list.h" - -#include "mail-component.h" -#include "mail-ops.h" - -#include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */ - -#include <gtkhtml/gtkhtml.h> - -extern CamelSession *session; -CamelStore *vfolder_store; /* the 1 static vfolder store */ - -#define d(x) - -struct _EMFolderBrowserPrivate { - GtkWidget *preview; /* container for message display */ - GtkWidget *scroll; - GtkWidget *search_bar; - - GtkWidget *subscribe_editor; - - guint search_menu_activated_id; - guint search_activated_id; - - double default_scroll_position; - guint idle_scroll_id; - guint list_scrolled_id; - - guint vpane_resize_id; - guint list_built_id; /* hook onto list-built for delayed 'select first unread' stuff */ - - gchar *select_uid; - guint folder_changed_id; - - guint show_wide:1; - guint suppress_message_selection:1; - gboolean scope_restricted; - - EMMenu *menu; /* toplevel menu manager */ - - guint labels_change_notify_id; /* mail_config's notify id */ - guint labels_change_idle_id; /* rebuild menu on idle, when all know about a change */ -}; - -typedef struct EMFBSearchBarItem { - ESearchBarItem search; - const gchar *image; -} EMFBSearchBarItem; - -static void emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, gint state); -static void emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const gchar *uri); -static void emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const gchar *uri); - -/* FilterBar stuff ... */ -static void emfb_search_config_search(EFilterBar *efb, FilterRule *rule, gint id, const gchar *query, gpointer data); -static void emfb_search_menu_activated(ESearchBar *esb, gint id, EMFolderBrowser *emfb); -static void emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb); -static void emfb_search_search_cleared(ESearchBar *esb); - -static void emfb_list_message_selected (MessageList *ml, const gchar *uid, EMFolderBrowser *emfb); - -static void emfb_expand_all_threads(BonoboUIComponent *uid, gpointer data, const gchar *path); - -static const EMFolderViewEnable emfb_enable_map[] = { - { "EditInvertSelection", EM_POPUP_SELECT_FOLDER }, - { "EditSelectAll", EM_POPUP_SELECT_FOLDER }, - { "EditSelectThread", EM_FOLDER_VIEW_SELECT_THREADED }, - { "EditSelectSubthread", EM_FOLDER_VIEW_SELECT_THREADED }, - { "FolderExpunge", EM_POPUP_SELECT_FOLDER }, - { "FolderCopy", EM_POPUP_SELECT_FOLDER }, - { "FolderMove", EM_POPUP_SELECT_FOLDER }, - { "FolderDelete", EM_POPUP_SELECT_FOLDER }, - { "FolderRename", EM_POPUP_SELECT_FOLDER }, - { "FolderRefresh", EM_POPUP_SELECT_FOLDER }, - { "ChangeFolderProperties", EM_POPUP_SELECT_FOLDER }, - { "MessageMarkAllAsRead", EM_POPUP_SELECT_FOLDER }, - { "ViewHideSelected", EM_POPUP_SELECT_MANY }, - { "ViewThreadsCollapseAll", EM_FOLDER_VIEW_SELECT_THREADED}, - { "ViewThreadsExpandAll", EM_FOLDER_VIEW_SELECT_THREADED}, - { NULL }, -}; - -enum { - ACCOUNT_SEARCH_ACTIVATED, - ACCOUNT_SEARCH_CLEARED, - LAST_SIGNAL -}; - -static guint folder_browser_signals [LAST_SIGNAL] = {0, }; - -enum { - ESB_SAVE -}; - -static ESearchBarItem emfb_search_items[] = { - E_FILTERBAR_ADVANCED, - { NULL, 0, 0 }, - E_FILTERBAR_SAVE, - E_FILTERBAR_EDIT, - { NULL, 0, 0 }, - { (gchar *) N_("C_reate Search Folder From Search..."), ESB_SAVE, 0}, - { NULL, -1, 0 } -}; - -/* IDs and option items for the ESearchBar */ -enum { - VIEW_ALL_MESSAGES, - VIEW_UNREAD_MESSAGES, - VIEW_READ_MESSAGES, - VIEW_RECENT_MESSAGES, - VIEW_LAST_FIVE_DAYS, - VIEW_WITH_ATTACHMENTS, - VIEW_NOT_JUNK, - VIEW_NO_LABEL, - VIEW_LABEL, - VIEW_ANY_FIELD_CONTAINS, - VIEW_MESSAGES_MARKED_AS_IMPORTANT, - VIEW_CUSTOMIZE -}; - -/* label IDs are set above this number */ -#define VIEW_ITEMS_MASK 63 - -static ESearchBarItem emfb_search_scope_items[] = { - E_FILTERBAR_CURRENT_FOLDER, - E_FILTERBAR_CURRENT_ACCOUNT, - E_FILTERBAR_ALL_ACCOUNTS, - { NULL, -1, 0 } -}; - -static EMFolderViewClass *emfb_parent; - -//static void -//html_scroll (GtkHTML *html, -// GtkOrientation orientation, -// GtkScrollType scroll_type, -// gfloat position, -// EMFolderBrowser *emfb) -// -//{ -// if (html->binding_handled || orientation != GTK_ORIENTATION_VERTICAL || !mail_config_get_enable_magic_spacebar ()) -// return; -// -// if (scroll_type == GTK_SCROLL_PAGE_FORWARD) { -// gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); -// message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); -// } else if (scroll_type == GTK_SCROLL_PAGE_BACKWARD) { -// gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); -// message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); -// } -//} - -static void -emfb_init(GObject *o) -{ - EMFolderBrowser *emfb = (EMFolderBrowser *)o; - RuleContext *search_context = mail_component_peek_search_context (mail_component_peek ()); - struct _EMFolderBrowserPrivate *p; - GtkWidget *html; - - EMEvent *eme; - EMEventTargetFolderBrowser *target; - - p = emfb->priv = g_malloc0(sizeof(struct _EMFolderBrowserPrivate)); - - emfb->view.preview_active = TRUE; - emfb->view.list_active = TRUE; - -// g_signal_connect_after (((EMFormatHTML *)(emfb->view.preview))->html, "scroll", G_CALLBACK (html_scroll), emfb); - -// g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL); -// g_slist_free(emfb->view.ui_files); - -// emfb->view.ui_files = g_slist_append(NULL, -// g_build_filename (EVOLUTION_UIDIR, -// "evolution-mail-global.xml", -// NULL)); -// emfb->view.ui_files = g_slist_append(emfb->view.ui_files, -// g_build_filename (EVOLUTION_UIDIR, -// "evolution-mail-list.xml", -// NULL)); -// emfb->view.ui_files = g_slist_append(emfb->view.ui_files, -// g_build_filename (EVOLUTION_UIDIR, -// "evolution-mail-message.xml", -// NULL)); - - emfb->view.enable_map = g_slist_prepend(emfb->view.enable_map, (gpointer)emfb_enable_map); - -// if (search_context) { -// const gchar *systemrules = g_object_get_data (G_OBJECT (search_context), "system"); -// const gchar *userrules = g_object_get_data (G_OBJECT (search_context), "user"); -// EFilterBar *efb; -// GConfClient *gconf; -// -// emfb->search = e_filter_bar_new(search_context, systemrules, userrules, emfb_search_config_search, emfb); -// efb = (EFilterBar *)emfb->search; -// efb->account_search_vf = NULL; -// efb->all_account_search_vf = NULL; -// efb->account_search_cancel = NULL; -// e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items); -// e_search_bar_set_scopeoption ((ESearchBar *)emfb->search, emfb_search_scope_items); -// e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); -// emfb->priv->scope_restricted = TRUE; -// g_signal_connect(emfb, "realize", G_CALLBACK(emfb_realize), NULL); -// gtk_widget_show((GtkWidget *)emfb->search); -// -// p->search_menu_activated_id = g_signal_connect(emfb->search, "menu_activated", G_CALLBACK(emfb_search_menu_activated), emfb); -// p->search_activated_id = g_signal_connect(emfb->search, "search_activated", G_CALLBACK(emfb_search_search_activated), emfb); -// g_signal_connect(emfb->search, "search_cleared", G_CALLBACK(emfb_search_search_cleared), NULL); -// -// gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0); -// -// gconf = mail_config_get_gconf_client (); -// emfb->priv->labels_change_notify_id = gconf_client_notify_add (gconf, E_UTIL_LABELS_GCONF_KEY, gconf_labels_changed, emfb, NULL, NULL); -// } -// -// emfb->priv->show_wide = gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/show_wide", NULL); -// emfb->vpane = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new(); -// -// g_signal_connect(emfb->vpane, "realize", G_CALLBACK(emfb_pane_realised), emfb); -// emfb->priv->vpane_resize_id = g_signal_connect(emfb->vpane, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); -// -// gtk_widget_show(emfb->vpane); -// -// gtk_box_pack_start_defaults((GtkBox *)emfb, emfb->vpane); -// -// gtk_paned_pack1 (GTK_PANED (emfb->vpane), GTK_WIDGET (emfb->view.list), FALSE, FALSE); -// gtk_widget_show((GtkWidget *)emfb->view.list); -// -// /* currently: just use a scrolledwindow for preview widget */ -// p->scroll = gtk_scrolled_window_new(NULL, NULL); -// gtk_scrolled_window_set_policy((GtkScrolledWindow *)p->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); -// gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)p->scroll, GTK_SHADOW_IN); -// gtk_widget_show(p->scroll); -// -// p->preview = gtk_vbox_new (FALSE, 6); -// gtk_container_add((GtkContainer *)p->scroll, (GtkWidget *)emfb->view.preview->formathtml.html); -// gtk_widget_show((GtkWidget *)emfb->view.preview->formathtml.html); -// gtk_box_pack_start ((GtkBox *)p->preview, p->scroll, TRUE, TRUE, 0); -// gtk_box_pack_start ((GtkBox *)p->preview, em_format_html_get_search_dialog (emfb->view.preview), FALSE, FALSE, 0); -// gtk_paned_pack2 (GTK_PANED (emfb->vpane), p->preview, TRUE, FALSE); -// gtk_widget_show(p->preview); - - g_signal_connect_swapped ( - p->search_bar, "changed", - G_CALLBACK (em_format_redraw), emfb->view.preview); - - /** @HookPoint-EMFolderBrower: Folder Browser - * @Id: emfb.created - * @Class: org.gnome.evolution.mail.events:1.0 - * @Target: EMFolderBrowser - */ - - eme = em_event_peek(); - target = em_event_target_new_folder_browser (eme, emfb); - - e_event_emit((EEvent *)eme, "emfb.created", (EEventTarget *)target); - - g_signal_connect (((EMFolderView *) emfb)->list, "message_selected", G_CALLBACK (emfb_list_message_selected), emfb); - -} - -static void -emfb_destroy(GtkObject *o) -{ - EMFolderBrowser *emfb = (EMFolderBrowser *)o; - - if (emfb->priv->list_built_id) { - g_signal_handler_disconnect(((EMFolderView *)emfb)->list, emfb->priv->list_built_id); - emfb->priv->list_built_id = 0; - } - - if (emfb->priv->list_scrolled_id) { - g_signal_handler_disconnect (((EMFolderView *) emfb)->list, emfb->priv->list_scrolled_id); - emfb->priv->list_scrolled_id = 0; - } - - if (emfb->priv->idle_scroll_id) { - g_source_remove (emfb->priv->idle_scroll_id); - emfb->priv->idle_scroll_id = 0; - } - -// if (emfb->view.folder && emfb->priv->folder_changed_id) -// camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id); - - if (emfb->priv->labels_change_notify_id) { - GConfClient *gconf = mail_config_get_gconf_client (); - - if (gconf) - gconf_client_notify_remove (gconf, emfb->priv->labels_change_notify_id); - - emfb->priv->labels_change_notify_id = 0; - } - - if (emfb->priv->labels_change_idle_id) { - g_source_remove (emfb->priv->labels_change_idle_id); - - emfb->priv->labels_change_idle_id = 0; - } - - ((GtkObjectClass *)emfb_parent)->destroy(o); -} - -void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) -{ - if ((emfb->view.preview_active ^ state) == 0 - || emfb->view.list == NULL) { - if (state && emfb->priv->scope_restricted && emfb->view.list->cursor_uid && *(emfb->view.list->cursor_uid)) { - emfb->priv->scope_restricted = FALSE; - } - - return; - } - - emfb->view.preview_active = state; - - if (state) { - GConfClient *gconf = mail_config_get_gconf_client (); - gint paned_size /*, y*/; - - paned_size = gconf_client_get_int(gconf, emfb->priv->show_wide ? "/apps/evolution/mail/display/hpaned_size":"/apps/evolution/mail/display/paned_size", NULL); - - /*y = save_cursor_pos (emfb);*/ - gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size); - gtk_widget_show (GTK_WIDGET (emfb->priv->preview)); - - if (emfb->view.list->cursor_uid) { - gchar *uid = g_alloca(strlen(emfb->view.list->cursor_uid)+1); - - emfb->priv->scope_restricted = FALSE; - strcpy(uid, emfb->view.list->cursor_uid); - em_folder_view_set_message(&emfb->view, uid, FALSE); - } - - /* need to load/show the current message? */ - /*do_message_selected (emfb);*/ - /*set_cursor_pos (emfb, y);*/ - } else { - em_format_format((EMFormat *)emfb->view.preview, NULL, NULL, NULL); - - g_free(emfb->view.displayed_uid); - emfb->view.displayed_uid = NULL; - - gtk_widget_hide(emfb->priv->preview); - emfb->priv->scope_restricted = TRUE; - /* - mail_display_set_message (emfb->mail_display, NULL, NULL, NULL); - emfb_ui_message_loaded (emfb);*/ - } - - /* FIXME: need to update menu's to reflect ui changes */ -} - -gboolean em_folder_browser_get_wide (EMFolderBrowser *emfb) -{ - return emfb->priv->show_wide; -} - -/* ********************************************************************** */ - -/* FIXME: Need to separate system rules from user ones */ -/* FIXME: Ugh! */ - -static void -emfb_search_menu_activated(ESearchBar *esb, gint id, EMFolderBrowser *emfb) -{ - EFilterBar *efb = (EFilterBar *)esb; - - d(printf("menu activated\n")); - - switch (id) { - case ESB_SAVE: - d(printf("Save vfolder\n")); - if (efb->current_query) { - FilterRule *rule; - gchar *name, *text; - - /* ensures vfolder is running */ - vfolder_load_storage (); - - rule = vfolder_clone_rule (efb->current_query); - text = e_search_bar_get_text(esb); - name = g_strdup_printf("%s %s", rule->name, (text&&text[0])?text:"''"); - g_free (text); - filter_rule_set_name(rule, name); - g_free (name); - - filter_rule_set_source(rule, FILTER_SOURCE_INCOMING); - em_vfolder_rule_add_source((EMVFolderRule *)rule, emfb->view.folder_uri); - vfolder_gui_add_rule((EMVFolderRule *)rule); - } - break; - } -} - -struct _setup_msg { - MailMsg base; - - CamelFolder *folder; - CamelOperation *cancel; - GList *sources_uri; - GList *sources_folder; -}; - -static gchar * -vfolder_setup_desc(struct _setup_msg *m) -{ - return g_strdup(_("Searching")); -} - -static void -vfolder_setup_exec(struct _setup_msg *m) -{ - GList *l, *list = NULL; - CamelFolder *folder; - - if (m->cancel) - camel_operation_register (m->cancel); - - d(printf("Setting up Search Folder: %s\n", m->folder->full_name)); - - l = m->sources_uri; - while (l) { - d(printf(" Adding uri: %s\n", (gchar *)l->data)); - folder = mail_tool_uri_to_folder (l->data, 0, &m->base.ex); - if (folder) { - list = g_list_append(list, folder); - } else { - g_warning("Could not open vfolder source: %s", (gchar *)l->data); - camel_exception_clear(&m->base.ex); - } - l = l->next; - } - - l = m->sources_folder; - while (l) { - d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name)); - camel_object_ref(l->data); - list = g_list_append(list, l->data); - l = l->next; - } - - camel_vee_folder_set_folders((CamelVeeFolder *)m->folder, list); - - l = list; - while (l) { - camel_object_unref(l->data); - l = l->next; - } - g_list_free(list); -} - -static void -vfolder_setup_done(struct _setup_msg *m) -{ -} - -static void -vfolder_setup_free (struct _setup_msg *m) -{ - GList *l; - - camel_object_unref(m->folder); - - l = m->sources_uri; - while (l) { - g_free(l->data); - l = l->next; - } - g_list_free(m->sources_uri); - - l = m->sources_folder; - while (l) { - camel_object_unref(l->data); - l = l->next; - } - g_list_free(m->sources_folder); -} - -static MailMsgInfo vfolder_setup_info = { - sizeof (struct _setup_msg), - (MailMsgDescFunc) vfolder_setup_desc, - (MailMsgExecFunc) vfolder_setup_exec, - (MailMsgDoneFunc) vfolder_setup_done, - (MailMsgFreeFunc) vfolder_setup_free -}; - -/* sources_uri should be camel uri's */ -static gint -vfolder_setup (CamelFolder *folder, GList *sources_uri, GList *sources_folder, CamelOperation *cancel) -{ - struct _setup_msg *m; - gint id; - - m = mail_msg_new(&vfolder_setup_info); - m->folder = folder; - camel_object_ref(folder); - m->sources_uri = sources_uri; - m->sources_folder = sources_folder; - - if (cancel) { - m->cancel = cancel; - } - - id = m->base.seq; - mail_msg_slow_ordered_push (m); - - return id; -} - -static void -emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - EFilterBar *efb = (EFilterBar *)esb; - const gchar *view_sexp; - gchar *search_state = NULL, *folder_uri=NULL; - gchar *word = NULL, *storeuri = NULL, *search_word = NULL; - gint id, i; - CamelFolder *folder; - CamelStore *store; - GPtrArray *folders; - GList *folder_list_account = NULL; - GList *l, *folder_list = NULL; - CamelException *ex; - ex = camel_exception_new (); - - if (emfv->list == NULL || emfv->folder == NULL) - return; - - id = e_search_bar_get_search_scope (esb); - - switch (id) { - case E_FILTERBAR_CURRENT_FOLDER_ID: - g_object_get (esb, "query", &search_word, NULL); - break; - - case E_FILTERBAR_CURRENT_ACCOUNT_ID: - word = e_search_bar_get_text (esb); - if (!(word && *word)) { - if (efb->account_search_vf) { - camel_object_unref (efb->account_search_vf); - efb->account_search_vf = NULL; - if (efb->account_search_cancel) { - camel_operation_cancel (efb->account_search_cancel); - camel_operation_unref (efb->account_search_cancel); - efb->account_search_cancel = NULL; - } - } - g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0); - gtk_widget_set_sensitive (esb->scopeoption, TRUE); - g_free (word); - word = NULL; - break; - } - - g_free (word); - word = NULL; - g_object_get (esb, "query", &search_word, NULL); - if (search_word && efb->account_search_vf && !strcmp (search_word, ((CamelVeeFolder *) efb->account_search_vf)->expression) ) { - break; - } - gtk_widget_set_sensitive (esb->scopeoption, FALSE); - - /* Disable the folder tree */ - g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_ACTIVATED], 0); - - if (!efb->account_search_vf) { - store = emfv->folder->parent_store; - if (store->folders) { - folders = camel_object_bag_list(store->folders); - for (i=0;i<folders->len;i++) { - folder = folders->pdata[i]; - folder_list_account = g_list_append(folder_list_account, folder); - } - } - - /* Create a camel vee folder */ - storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ())); - vfolder_store = camel_session_get_store (session, storeuri, NULL); - efb->account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO); - - /* Set the search expression */ - camel_vee_folder_set_expression (efb->account_search_vf, search_word); - - efb->account_search_cancel = camel_operation_new (NULL, NULL); - vfolder_setup ((CamelFolder *)efb->account_search_vf, NULL, folder_list_account, efb->account_search_cancel); - - folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->account_search_vf); - emfb_set_search_folder (emfv, (CamelFolder *)efb->account_search_vf, folder_uri); - g_free (folder_uri); - g_free (storeuri); - } else { - /* cancel previous filling first, if under way */ - if (efb->account_search_cancel) { - camel_operation_cancel (efb->account_search_cancel); - camel_operation_unref (efb->account_search_cancel); - efb->account_search_cancel = NULL; - } - - /* Reuse the existing search folder */ - camel_vee_folder_set_expression((CamelVeeFolder *)efb->account_search_vf, search_word); - } - - break; - - case E_FILTERBAR_ALL_ACCOUNTS_ID: - word = e_search_bar_get_text (esb); - if (!(word && *word)) { - if (efb->all_account_search_vf) { - camel_object_unref (efb->all_account_search_vf); - efb->all_account_search_vf=NULL; - if (efb->account_search_cancel) { - camel_operation_cancel (efb->account_search_cancel); - camel_operation_unref (efb->account_search_cancel); - efb->account_search_cancel = NULL; - } - } - g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0); - gtk_widget_set_sensitive (esb->scopeoption, TRUE); - g_free (word); - word = NULL; - break; - } - - g_free (word); - word = NULL; - - g_object_get (esb, "query", &search_word, NULL); - - if (search_word && efb->all_account_search_vf && !strcmp (search_word, ((CamelVeeFolder *) efb->all_account_search_vf)->expression) ) { - /* No real search apart from the existing one */ - break; - } - - gtk_widget_set_sensitive (esb->scopeoption, FALSE); - g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_ACTIVATED], 0); - - if (!efb->all_account_search_vf) { - /* Create a camel vee folder */ - storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ())); - vfolder_store = camel_session_get_store (session, storeuri, NULL); - efb->all_account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("All Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO); - - /* Set sexp */ - - /* FIXME: there got to be a better way :) */ - - /* Add the local folders */ - l = mail_vfolder_get_sources_local (); - while (l) { - folder = mail_tool_uri_to_folder ((const gchar *)l->data, 0,ex); - if (folder) - folder_list = g_list_append(folder_list, folder); - else { - g_warning("Could not open vfolder source: %s", (gchar *)l->data); - camel_exception_clear(ex); - } - l = l->next; - } - - /* Add the remote source folder */ - l = mail_vfolder_get_sources_remote (); - while (l) { - folder = mail_tool_uri_to_folder ((const gchar *)l->data, 0,ex); - if (folder) - folder_list = g_list_append(folder_list, folder); - else { - g_warning("Could not open vfolder source: %s", (gchar *)l->data); - camel_exception_clear(ex); - } - l = l->next; - } - - camel_vee_folder_set_expression (efb->all_account_search_vf, search_word); - - efb->account_search_cancel = camel_operation_new (NULL, NULL); - vfolder_setup ((CamelFolder *)efb->all_account_search_vf, NULL, folder_list, efb->account_search_cancel); - - folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->all_account_search_vf); - - emfb_set_search_folder (emfv, (CamelFolder *)efb->all_account_search_vf, folder_uri); - g_free (folder_uri); - g_free (storeuri); - } else { - /* cancel previous filling first, if under way */ - if (efb->account_search_cancel) { - camel_operation_cancel (efb->account_search_cancel); - camel_operation_unref (efb->account_search_cancel); - efb->account_search_cancel = NULL; - } - - /* Reuse the existing search folder */ - camel_vee_folder_set_expression((CamelVeeFolder *)efb->all_account_search_vf, search_word); - } - - break; - } - g_object_get (esb, "state", &search_state, NULL); - camel_object_meta_set (emfv->folder, "evolution:search_state", search_state); - camel_object_state_write (emfv->folder); - g_free (search_state); - - if (search_word) { - g_free (search_word); - search_word = NULL; - } - - /* Merge the view and search expresion*/ - view_sexp = get_view_query (esb, emfv->folder, emfv->folder_uri); - g_object_get (esb, "query", &search_word, NULL); - - word = search_word; - - if (search_word && *search_word) - search_word = g_strconcat ("(and ", view_sexp, search_word, " )", NULL); - else - search_word = g_strdup (view_sexp); - - message_list_set_search(emfb->view.list, search_word); - - g_free (word); - g_free (search_word); - - camel_exception_free (ex); -} - -static void -emfb_search_search_cleared(ESearchBar *esb) -{ - /* FIXME: It should just cancel search.*/ - mail_cancel_all(); -} - -/* ********************************************************************** */ - -static void -emfb_list_message_selected (MessageList *ml, const gchar *uid, EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - - if (emfv->folder == NULL) - return; - - if (uid && *uid && emfb->priv->scope_restricted && emfb->view.preview_active) { - emfb->priv->scope_restricted = FALSE; - } else if ( !(uid && *uid) && !emfb->priv->scope_restricted) { - emfb->priv->scope_restricted = TRUE; - } - - camel_object_meta_set (emfv->folder, "evolution:selected_uid", uid); - camel_object_state_write (emfv->folder); - g_free (emfb->priv->select_uid); - emfb->priv->select_uid = NULL; -} - -/* ********************************************************************** */ - -static void -emfb_focus_search(BonoboUIComponent *uid, gpointer data, const gchar *path) -{ - EMFolderBrowser *emfb = data; - - gtk_widget_grab_focus (((ESearchBar *)emfb->search)->entry); -} - -static void -emfb_help_debug (BonoboUIComponent *uid, gpointer data, const gchar *path) -{ - mail_component_show_logger ((GtkWidget *) data); -} - -static BonoboUIVerb emfb_verbs[] = { - BONOBO_UI_UNSAFE_VERB ("HelpDebug", emfb_help_debug), - - BONOBO_UI_UNSAFE_VERB ("FocusSearch", emfb_focus_search), - - /* ViewPreview is a toggle */ - - BONOBO_UI_VERB_END -}; - -//static gboolean -//emfb_select_all_daemon (MessageList *ml) -//{ -// message_list_select_all(ml); -// gtk_widget_grab_focus ((GtkWidget *)ml); -// return FALSE; -//} - -//static void -//emfb_hide_deleted(BonoboUIComponent *uic, const gchar *path, Bonobo_UIComponent_EventType type, const gchar *state, gpointer data) -//{ -// GConfClient *gconf; -// EMFolderView *emfv = data; -// -// if (type != Bonobo_UIComponent_STATE_CHANGED) -// return; -// -// gconf = mail_config_get_gconf_client (); -// gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_deleted", state[0] == '0', NULL); -// em_folder_view_set_hide_deleted(emfv, state[0] != '0'); -//} - -static void -emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const gchar *uri) -{ - EMFolderBrowser *emfb = (EMFolderBrowser *) emfv; - gchar *state; - - message_list_freeze(emfv->list); - - if (emfb->priv->list_scrolled_id) { - g_signal_handler_disconnect (emfv->list, emfb->priv->list_scrolled_id); - emfb->priv->list_scrolled_id = 0; - } - - if (emfb->priv->idle_scroll_id) { - g_source_remove (emfb->priv->idle_scroll_id); - emfb->priv->idle_scroll_id = 0; - } - -// if (emfb->view.folder) { -// camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id); -// emfb->priv->folder_changed_id = 0; -// } - - emfb_parent->set_folder(emfv, folder, uri); - - /* etspec for search results */ - state = "<ETableState>" - "<column source=\"0\"/> <column source=\"3\"/> <column source=\"1\"/>" - "<column source=\"14\"/> <column source=\"5\"/>" - "<column source=\"7\"/> <column source=\"13\"/> " - "<grouping><leaf column=\"7\" ascending=\"false\"/> </grouping> </ETableState>"; - e_tree_set_state (((MessageList *)emfv->list)->tree, state); - - message_list_thaw(emfv->list); -} - -static void -emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const gchar *uri) -{ - EMFolderBrowser *emfb = (EMFolderBrowser *) emfv; - struct _EMFolderBrowserPrivate *p = emfb->priv; - gboolean different_folder; - -// message_list_freeze(emfv->list); - - if (emfb->priv->list_scrolled_id) { - g_signal_handler_disconnect (emfv->list, emfb->priv->list_scrolled_id); - emfb->priv->list_scrolled_id = 0; - } - - if (emfb->priv->idle_scroll_id) { - g_source_remove (emfb->priv->idle_scroll_id); - emfb->priv->idle_scroll_id = 0; - } - -// if (emfb->view.folder && emfb->priv->folder_changed_id) { -// camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id); -// emfb->priv->folder_changed_id = 0; -// } -// -// different_folder = -// emfb->view.folder != NULL && -// folder != emfb->view.folder; -// -// emfb_parent->set_folder(emfv, folder, uri); - - /* This is required since we get activated the first time - before the folder is open and need to override the - defaults */ - if (folder) { - gchar *sstate; - gint state; - gboolean safe; - GConfClient *gconf = mail_config_get_gconf_client(); - - safe = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/safe_list", NULL); - if (safe) { - if (camel_object_meta_set(emfv->folder, "evolution:show_preview", "0") && - camel_object_meta_set(emfv->folder, "evolution:selected_uid", NULL)) { - camel_object_state_write(emfv->folder); - g_free (emfb->priv->select_uid); - emfb->priv->select_uid = NULL; - } - gconf_client_set_bool (gconf, "/apps/evolution/mail/display/safe_list", FALSE, NULL); - } - -// mail_refresh_folder(folder, NULL, NULL); -// -// emfb->priv->folder_changed_id = camel_object_hook_event(folder, "folder_changed", -// (CamelObjectEventHookFunc)emfb_folder_changed, emfb); -// -// /* FIXME: this mostly copied from activate() */ -// if ((sstate = camel_object_meta_get(folder, "evolution:show_preview"))) { -// state = sstate[0] != '0'; -// g_free(sstate); -// } else -// state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_preview", NULL); -// em_folder_browser_show_preview(emfb, state); -// if (emfv->uic) -// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewPreview", "state", state?"1":"0", NULL); -// -// if ((sstate = camel_object_meta_get(folder, "evolution:thread_list"))) { -// state = sstate[0] != '0'; -// g_free(sstate); -// } else -// state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/thread_list", NULL); -// message_list_set_threaded(emfv->list, state); -// if (emfv->uic) { -// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL); -// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); -// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); -// } - - if (emfv->uic) { - state = (folder->folder_flags & CAMEL_FOLDER_IS_TRASH) == 0; - bonobo_ui_component_set_prop(emfv->uic, "/commands/HideDeleted", "sensitive", state?"1":"0", NULL); - } - - /* Fixme */ - sstate = camel_object_meta_get(folder, "evolution:search_state"); - if (sstate) { - g_object_set(emfb->search, "state", sstate, NULL); - g_free(sstate); - } else { - gboolean outgoing; - outgoing = em_utils_folder_is_drafts (emfv->folder, emfv->folder_uri) - || em_utils_folder_is_sent (emfv->folder, emfv->folder_uri) - || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri); - - e_search_bar_set_text ((ESearchBar *)emfb->search, ""); - - if (outgoing) { - e_search_bar_set_item_id ((ESearchBar *)emfb->search, 1); - ((ESearchBar *)emfb->search)->block_search = TRUE; - e_search_bar_set_item_menu ((ESearchBar *)emfb->search, 1); - ((ESearchBar *)emfb->search)->block_search = FALSE; - - } else { - e_search_bar_set_item_id ((ESearchBar *)emfb->search, 0); - ((ESearchBar *)emfb->search)->block_search = TRUE; - e_search_bar_set_item_menu ((ESearchBar *)emfb->search, 0); - ((ESearchBar *)emfb->search)->block_search = FALSE; - - } - e_search_bar_paint ((ESearchBar *)emfb->search); - } - -// /* This function gets triggered several times at startup, -// * so we don't want to reset the message suppression state -// * unless we're actually switching to a different folder. */ -// if (different_folder) -// p->suppress_message_selection = FALSE; -// -// if (!p->suppress_message_selection) -// sstate = camel_object_meta_get ( -// folder, "evolution:selected_uid"); -// else -// sstate = NULL; -// -// g_free (p->select_uid); -// p->select_uid = sstate; -// -// if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0) -// p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv); -// } -// -// message_list_thaw(emfv->list); -} - -static void -emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, gint act) -{ - if (act) { - GConfClient *gconf; - gboolean state; - gchar *sstate; - EMFolderBrowser *emfb = (EMFolderBrowser *) emfv; - - /* Stop button */ - state = mail_msg_active((guint)-1); - bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", state?"1":"0", NULL); - -// /* HideDeleted */ -// state = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL); -// if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) { -// state = FALSE; -// bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL); -// } else -// bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "1", NULL); -// bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL); -// bonobo_ui_component_add_listener(uic, "HideDeleted", emfb_hide_deleted, emfv); -// em_folder_view_set_hide_deleted(emfv, state); /* <- not sure if this optimal, but it'll do */ - } -} - -void -em_folder_browser_suppress_message_selection (EMFolderBrowser *emfb) -{ - emfb->priv->suppress_message_selection = TRUE; -} diff --git a/mail/em-folder-browser.h.dead b/mail/em-folder-browser.h.dead deleted file mode 100644 index 966d3a3c13..0000000000 --- a/mail/em-folder-browser.h.dead +++ /dev/null @@ -1,62 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _EM_FOLDER_BROWSER_H -#define _EM_FOLDER_BROWSER_H - -#include "mail/em-folder-view.h" - -G_BEGIN_DECLS - -typedef struct _EMFolderBrowser EMFolderBrowser; -typedef struct _EMFolderBrowserClass EMFolderBrowserClass; - -struct _EMFolderBrowser { - EMFolderView view; - - struct _EMFolderBrowserPrivate *priv; - - GtkWidget *vpane; - struct _EFilterBar *search; -}; - -struct _EMFolderBrowserClass { - EMFolderViewClass parent_class; - - /* Signals*/ - void (*account_search_activated) (EMFolderBrowser *emfb); - void (*account_search_cleared) (EMFolderBrowser *emfb); -}; - -GType em_folder_browser_get_type(void); - -GtkWidget *em_folder_browser_new(void); - -void em_folder_browser_show_preview(EMFolderBrowser *emfv, gboolean state); -void em_folder_browser_show_wide(EMFolderBrowser *emfv, gboolean state); -gboolean em_folder_browser_get_wide(EMFolderBrowser *emfv); -void em_folder_browser_suppress_message_selection(EMFolderBrowser *emfb); - -G_END_DECLS - -#endif /* ! _EM_FOLDER_BROWSER_H */ diff --git a/mail/em-folder-view.c.dead b/mail/em-folder-view.c.dead deleted file mode 100644 index 3f76572f18..0000000000 --- a/mail/em-folder-view.c.dead +++ /dev/null @@ -1,1014 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <config.h> - -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <glib/gi18n.h> -#include <glib/gstdio.h> -#include <gdk/gdkkeysyms.h> - -#ifdef G_OS_WIN32 -/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */ -#define DATADIR crap_DATADIR -#include <windows.h> -#undef DATADIR -#undef interface -#endif - -#include <gconf/gconf-client.h> - -#include <camel/camel-mime-message.h> -#include <camel/camel-stream.h> -#include <camel/camel-stream-filter.h> -#include <camel/camel-mime-filter.h> -#include <camel/camel-mime-filter-tohtml.h> -#include <camel/camel-mime-filter-enriched.h> -#include <camel/camel-multipart.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-url.h> -#include <camel/camel-vee-folder.h> -#include <camel/camel-disco-store.h> -#include <camel/camel-offline-store.h> -#include <camel/camel-vee-store.h> - -#include <gtkhtml/gtkhtml.h> -#include <gtkhtml/gtkhtml-embedded.h> -#include <gtkhtml/gtkhtml-stream.h> - -#include <libedataserver/e-data-server-util.h> -#include <libedataserver/e-msgport.h> - -#include "menus/gal-view-etable.h" -#include "menus/gal-view-factory-etable.h" -#include "menus/gal-view-instance.h" - -#include "misc/e-charset-picker.h" -#include <misc/e-spinner.h> - -#include "e-util/e-error.h" -#include "e-util/e-dialog-utils.h" -#include "e-util/e-icon-factory.h" -#include "e-util/e-print.h" -#include "e-util/e-profile-event.h" -#include "e-util/e-util-private.h" -#include "e-util/e-util-labels.h" -#include "shell/e-shell.h" - -#include "filter/filter-rule.h" - -#include "em-format-html-display.h" -#include "em-format-html-print.h" -#include "em-folder-selection.h" -#include "em-folder-view.h" -#include "em-folder-browser.h" -#include "em-mailer-prefs.h" -#include "em-folder-browser.h" -#include "message-list.h" -#include "em-utils.h" -#include "em-composer-utils.h" -#include "em-menu.h" -#include "em-event.h" -#include "e-mail-shell-backend.h" - -#include "mail-mt.h" -#include "mail-ops.h" -#include "mail-config.h" -#include "mail-autofilter.h" -#include "mail-vfolder.h" -#include "mail-tools.h" - -#ifdef HAVE_XFREE -#include <X11/XF86keysym.h> -#endif - -/* this is added to emfv->enable_map in :init() */ -static const EMFolderViewEnable emfv_enable_map[] = { - { "EditCut", EM_POPUP_SELECT_MANY }, - { "EditCopy", EM_FOLDER_VIEW_SELECT_SELECTION }, - { "EditPaste", EM_POPUP_SELECT_FOLDER }, -// { "SelectAllText", EM_POPUP_SELECT_ONE }, - - /* FIXME: should these be single-selection? */ - { "MailNext", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_NEXT_MSG }, -// { "MailNextFlagged", EM_POPUP_SELECT_MANY }, -// { "MailNextUnread", EM_POPUP_SELECT_MANY }, -// { "MailNextThread", EM_POPUP_SELECT_MANY }, - { "MailPrevious", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_PREV_MSG }, -// { "MailPreviousFlagged", EM_POPUP_SELECT_MANY }, -// { "MailPreviousUnread", EM_POPUP_SELECT_MANY }, - - { "AddSenderToAddressbook", EM_POPUP_SELECT_ADD_SENDER }, - -// { "MessageApplyFilters", EM_POPUP_SELECT_MANY }, -// { "MessageFilterJunk", EM_POPUP_SELECT_MANY }, -// { "MessageCopy", EM_POPUP_SELECT_MANY }, -// { "MessageDelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_DELETE }, -// { "MessageDeleteKey", EM_POPUP_SELECT_MANY}, -// { "MessageForward", EM_POPUP_SELECT_MANY }, -// { "MessageForwardAttached", EM_POPUP_SELECT_MANY }, -// { "MessageForwardInline", EM_POPUP_SELECT_ONE }, -// { "MessageForwardQuoted", EM_POPUP_SELECT_ONE }, -// { "MessageRedirect", EM_POPUP_SELECT_ONE }, -// { "MessageMarkAsRead", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_READ }, -// { "MessageMarkAsUnRead", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNREAD }, -// { "MessageMarkAsImportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_IMPORTANT }, -// { "MessageMarkAsUnimportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNIMPORTANT }, -// { "MessageMarkAsJunk", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_JUNK }, -// { "MessageMarkAsNotJunk", EM_POPUP_SELECT_MANY}, - { "MessageFollowUpFlag", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_FOLLOWUP }, - { "MessageFollowUpComplete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_COMPLETED }, - { "MessageFollowUpClear", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_CLEAR }, -// { "MessageMove", EM_POPUP_SELECT_MANY }, -// { "MessageOpen", EM_POPUP_SELECT_MANY }, -// { "MessageReplyAll", EM_POPUP_SELECT_ONE }, -// { "MessageReplyList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST }, -// { "MessageReplySender", EM_POPUP_SELECT_ONE }, -// { "MessageEdit", EM_POPUP_SELECT_ONE }, -// { "MessageSaveAs", EM_POPUP_SELECT_MANY }, - { "MessageSearch", EM_POPUP_SELECT_ONE| EM_FOLDER_VIEW_PREVIEW_PRESENT }, -// { "MessageUndelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_UNDELETE }, -// { "PrintMessage", EM_POPUP_SELECT_ONE }, -// { "PrintPreviewMessage", EM_POPUP_SELECT_ONE }, - -// { "TextZoomIn", EM_POPUP_SELECT_ONE }, -// { "TextZoomOut", EM_POPUP_SELECT_ONE }, -// { "TextZoomReset", EM_POPUP_SELECT_ONE }, - - { "ToolsFilterMailingList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST}, - { "ToolsFilterRecipient", EM_POPUP_SELECT_ONE }, - { "ToolsFilterSender", EM_POPUP_SELECT_ONE }, - { "ToolsFilterSubject", EM_POPUP_SELECT_ONE }, - { "ToolsVFolderMailingList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST}, - { "ToolsVFolderRecipient", EM_POPUP_SELECT_ONE }, - { "ToolsVFolderSender", EM_POPUP_SELECT_ONE }, - { "ToolsVFolderSubject", EM_POPUP_SELECT_ONE }, - -// { "ViewLoadImages", EM_POPUP_SELECT_ONE }, -// { "ViewSource", EM_POPUP_SELECT_ONE }, - -// /* always enabled */ -// { "MailStop", 0 }, - - { NULL }, -}; - -struct _EMFolderViewPrivate { - guint setting_notify_id; - guint selected_id; - guint nomarkseen:1; - guint destroyed:1; - - GtkWidget *invisible; - gchar *selection_uri; - - gchar *selected_uid; -}; - -static GtkVBoxClass *emfv_parent; - -enum { - EMFV_ON_URL, - EMFV_LOADED, - EMFV_CHANGED, - LAST_SIGNAL -}; - -extern CamelSession *session; - -static guint signals[LAST_SIGNAL]; - -static void -emfv_init(GObject *o) -{ - EMFolderView *emfv = (EMFolderView *)o; - struct _EMFolderViewPrivate *p; - -// gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE); -// -// p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); -// -// emfv->statusbar_active = TRUE; -// emfv->list_active = FALSE; -// -// emfv->ui_files = g_slist_append(NULL, -// g_build_filename (EVOLUTION_UIDIR, -// "evolution-mail-message.xml", -// NULL)); -// -// emfv->ui_app_name = "evolution-mail"; - - emfv->enable_map = g_slist_prepend(NULL, (gpointer)emfv_enable_map); - -// emfv->list = (MessageList *)message_list_new(); -// g_signal_connect(emfv->list, "message_selected", G_CALLBACK(emfv_list_message_selected), emfv); -// g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfv_list_built), emfv); -// -// /* FIXME: should this hang off message-list instead? */ -// g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv); -// g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv); -// g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv); -// g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv); -// -// emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new(); -// /* FIXME: set_session should NOT be called here. Should it be a constructor attribute? */ -// em_format_set_session ((EMFormat *) emfv->preview, session); -// g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv); - g_signal_connect(emfv->preview, "popup_event", G_CALLBACK(emfv_format_popup_event), emfv); -// g_signal_connect (emfv->preview, "on_url", G_CALLBACK (emfv_on_url_cb), emfv); -// g_signal_connect (((EMFormatHTML *)emfv->preview)->html, "button-release-event", G_CALLBACK (emfv_on_html_button_released_cb), emfv); -//#ifdef ENABLE_PROFILING -// g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv); -//#endif -// p->invisible = gtk_invisible_new(); -// g_signal_connect(p->invisible, "selection_get", G_CALLBACK(emfv_selection_get), emfv); -// g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(emfv_selection_clear_event), emfv); -// gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0); -// gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1); - - emfv->async = mail_async_event_new(); -} - -static void -emfv_class_init(GObjectClass *klass) -{ - klass->finalize = emfv_finalise; - - ((GtkObjectClass *) klass)->destroy = emfv_destroy; - - ((GtkWidgetClass *) klass)->popup_menu = emfv_popup_menu; - - ((EMFolderViewClass *) klass)->update_message_style = TRUE; - - ((EMFolderViewClass *)klass)->set_folder = emfv_set_folder; - ((EMFolderViewClass *)klass)->set_folder_uri = emfv_set_folder_uri; - ((EMFolderViewClass *)klass)->set_message = emfv_set_message; - ((EMFolderViewClass *)klass)->activate = emfv_activate; - -// ((EMFolderViewClass *)klass)->on_url = emfv_on_url; - - signals[EMFV_ON_URL] = g_signal_new ("on-url", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMFolderViewClass, on_url), - NULL, NULL, - e_marshal_VOID__STRING_STRING, - G_TYPE_NONE, - 2, G_TYPE_STRING, G_TYPE_STRING); - - signals[EMFV_LOADED] = g_signal_new("loaded", - G_OBJECT_CLASS_TYPE(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(EMFolderViewClass, loaded), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); - - signals[EMFV_CHANGED] = g_signal_new("changed", - G_OBJECT_CLASS_TYPE(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(EMFolderViewClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); -} - -//static void -//emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv) -//{ -// struct _EMFolderViewPrivate *p = emfv->priv; -// -// if (p->selection_uri == NULL) -// return; -// -// gtk_selection_data_set(data, data->target, 8, (guchar *)p->selection_uri, strlen(p->selection_uri)); -//} - -//static void -//emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv) -//{ -//#if 0 /* do i care? */ -// struct _EMFolderViewPrivate *p = emfv->priv; -// -// g_free(p->selection_uri); -// p->selection_uri = NULL; -//#endif -//} - -/* ********************************************************************** */ - -/* Popup menu - In many cases these are the functions called by the bonobo callbacks too */ - -/* ********************************************************************** */ - -/* Bonobo menu's */ - -/* a lot of stuff maps directly to the popup menu equivalent */ -#define EMFV_MAP_CALLBACK(from, to) \ -static void \ -from(BonoboUIComponent *uid, gpointer data, const gchar *path) \ -{ \ - to(NULL, NULL, data); \ -} - -static void -emfv_edit_cut(BonoboUIComponent *uid, gpointer data, const gchar *path) -{ - EMFolderView *emfv = data; - - if (GTK_WIDGET_HAS_FOCUS(emfv->preview->formathtml.html)) - em_format_html_display_cut(emfv->preview); - else - message_list_copy(emfv->list, TRUE); -} - -static void -emfv_edit_copy(BonoboUIComponent *uid, gpointer data, const gchar *path) -{ - EMFolderView *emfv = data; - - if (GTK_WIDGET_HAS_FOCUS(emfv->preview->formathtml.html)) - em_format_html_display_copy(emfv->preview); - else - message_list_copy(emfv->list, FALSE); -} - -static void -emfv_edit_paste(BonoboUIComponent *uid, gpointer data, const gchar *path) -{ - EMFolderView *emfv = data; - - message_list_paste(emfv->list); -} - -//static void -//emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, gpointer data) -//{ -// EMFolderView *emfv = data; -// EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; -// CamelURL *url; -// CamelInternetAddress *addr; -// -// url = camel_url_new(t->uri, NULL); -// if (url == NULL) { -// g_warning("cannot parse url '%s'", t->uri); -// return; -// } -// -// if (url->path && url->path[0]) { -// /* ensures vfolder is running */ -// vfolder_load_storage (); -// -// addr = camel_internet_address_new (); -// camel_address_decode (CAMEL_ADDRESS (addr), url->path); -// vfolder_gui_add_from_address (addr, AUTO_FROM, emfv->folder_uri); -// camel_object_unref (addr); -// } -// -// camel_url_free(url); -// -//} - -//static void -//emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, gpointer data) -//{ -// EMFolderView *emfv = data; -// EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; -// CamelURL *url; -// CamelInternetAddress *addr; -// -// url = camel_url_new(t->uri, NULL); -// if (url == NULL) { -// g_warning("cannot parse url '%s'", t->uri); -// return; -// } -// -// if (url->path && url->path[0]) { -// /* ensures vfolder is running */ -// vfolder_load_storage (); -// -// addr = camel_internet_address_new (); -// camel_address_decode (CAMEL_ADDRESS (addr), url->path); -// vfolder_gui_add_from_address (addr, AUTO_TO, emfv->folder_uri); -// camel_object_unref (addr); -// } -// -// camel_url_free(url); -//} - -/* ********************************************************************** */ - -static BonoboUIVerb emfv_message_verbs[] = { - BONOBO_UI_UNSAFE_VERB ("EditCut", emfv_edit_cut), - BONOBO_UI_UNSAFE_VERB ("EditCopy", emfv_edit_copy), - BONOBO_UI_UNSAFE_VERB ("EditPaste", emfv_edit_paste), - -// BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text), - -// BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete), -// BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete), -// BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open), -// BONOBO_UI_UNSAFE_VERB ("MessageSearch", emfv_message_search), - -// BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source), - - BONOBO_UI_VERB_END -}; - -static void -emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, gint act) -{ - - if (act) { - em_format_mode_t style; - gboolean state; - GSList *l; - - emfv->uic = uic; - - for (l = emfv->ui_files;l;l = l->next) - bonobo_ui_util_set_ui(uic, PREFIX, (gchar *)l->data, emfv->ui_app_name, NULL); - - bonobo_ui_component_add_verb_list_with_data(uic, emfv_message_verbs, emfv); - /* must do plugin menu's after main ones because of bonobo bustedness */ - if (emfv->menu) - e_menu_activate((EMenu *)emfv->menu, uic, act); - -// state = emfv->preview->caret_mode; -// bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", state?"1":"0", NULL); -// bonobo_ui_component_add_listener(uic, "CaretMode", emfv_caret_mode, emfv); - -// style = ((EMFormat *)emfv->preview)->mode?EM_FORMAT_ALLHEADERS:EM_FORMAT_NORMAL; -// if (style) -// bonobo_ui_component_set_prop(uic, "/commands/ViewFullHeaders", "state", "1", NULL); -// bonobo_ui_component_add_listener(uic, "ViewFullHeaders", emfv_view_mode, emfv); -// em_format_set_mode((EMFormat *)emfv->preview, style); - - if (emfv->folder) - bonobo_ui_component_set_prop(uic, "/commands/MessageEdit", "sensitive", "0", NULL); - -// /* default charset used in mail view */ -// e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv); - - emfv_enable_menus(emfv); - if (emfv->statusbar_active) - bonobo_ui_component_set_translate (uic, "/", "<status><item name=\"main\"/></status>", NULL); - - /* We need to set this up to get the right view options for the message-list, even if we're not showing it */ - if (emfv->folder) - emfv_setup_view_instance(emfv); - } else { - const BonoboUIVerb *v; - - if (emfv->menu) - e_menu_activate((EMenu *)emfv->menu, uic, act); - - /* TODO: Should this just rm /? */ - for (v = &emfv_message_verbs[0]; v->cname; v++) - bonobo_ui_component_remove_verb(uic, v->cname); - - if (emfv->folder) - mail_sync_folder(emfv->folder, NULL, NULL); - - emfv->uic = NULL; - } -} - -EMPopupTargetSelect * -em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, gint on_display) -{ - EMPopupTargetSelect *t; - - t = em_popup_target_new_select(emp, emfv->folder, emfv->folder_uri, message_list_get_selected(emfv->list)); - t->target.widget = (GtkWidget *)emfv; - - if (emfv->list->threaded) - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_THREADED; - - if (message_list_hidden(emfv->list) != 0) - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_HIDDEN; - - if (message_list_can_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0)) - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_NEXT_MSG; - - if (message_list_can_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0)) - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_PREV_MSG; - - if (on_display) - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_DISPLAY; - else - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_LISTONLY; - - if (gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active")) - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_SELECTION; - else - t->target.mask &= ~EM_FOLDER_VIEW_SELECT_NOSELECTION; - - if (emfv->preview_active) - t->target.mask &= ~EM_FOLDER_VIEW_PREVIEW_PRESENT; - - /* See bug 352980 */ - /* See bug #54770 */ - /* if (!emfv->hide_deleted) - t->target.mask &= ~EM_POPUP_SELECT_DELETE;*/ - - return t; -} - -void -em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status) -{ - if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) - status = FALSE; - - emfv->hide_deleted = status; - - if (emfv->folder) { - message_list_set_hidedeleted(emfv->list, status); - g_signal_emit(emfv, signals[EMFV_CHANGED], 0); - } -} - -/* ********************************************************************** */ - -struct mst_t { - EMFolderView *emfv; - gchar *uid; -}; - -static void -mst_free (struct mst_t *mst) -{ - mst->emfv->list->seen_id = 0; - - g_free (mst->uid); - g_free (mst); -} - -static gint -do_mark_seen (gpointer user_data) -{ - struct mst_t *mst = user_data; - EMFolderView *emfv = mst->emfv; - MessageList *list = emfv->list; - - if (mst->uid && list->cursor_uid && !strcmp (mst->uid, list->cursor_uid)) - emfv_set_seen (emfv, mst->uid); - - return FALSE; -} - -static void -emfv_list_done_message_selected(CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, CamelException *ex) -{ - EMFolderView *emfv = data; - EMEvent *eme; - EMEventTargetMessage *target; - EShell *shell; - - if (emfv->preview == NULL) { - emfv->priv->nomarkseen = FALSE; - emfv_enable_menus(emfv); - g_object_unref (emfv); - return; - - } - - e_profile_event_emit("goto.loaded", emfv->displayed_uid, 0); - - shell = e_shell_backend_get_shell (mail_shell_backend); - e_shell_event (shell, "mail-icon", "evolution-mail"); - - /** @Event: message.reading - * @Title: Viewing a message - * @Target: EMEventTargetMessage - * - * message.reading is emitted whenever a user views a message. - */ - /* TODO: do we emit a message.reading with no message when we're looking at nothing or don't care? */ - eme = em_event_peek(); - target = em_event_target_new_message(eme, folder, msg, uid, 0, NULL); - e_event_emit((EEvent *)eme, "message.reading", (EEventTarget *)target); - - em_format_format((EMFormat *)emfv->preview, folder, uid, msg); - - if (emfv->list->seen_id) - g_source_remove(emfv->list->seen_id); - - if (msg && emfv->mark_seen && !emfv->priv->nomarkseen) { - if (emfv->mark_seen_timeout > 0) { - struct mst_t *mst; - - mst = g_new (struct mst_t, 1); - mst->emfv = emfv; - mst->uid = g_strdup (uid); - - emfv->list->seen_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, emfv->mark_seen_timeout, - (GSourceFunc)do_mark_seen, mst, (GDestroyNotify)mst_free); - } else { - emfv_set_seen (emfv, uid); - } - } else if (camel_exception_is_set(ex)) { - GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); - - /* Display the error inline rather than popping up an annoying box. - We also clear the exception, this stops the box popping up */ - - gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>", - _("Unable to retrieve message"), - ex->desc); - gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); - camel_exception_clear(ex); - } - - emfv->priv->nomarkseen = FALSE; - emfv_enable_menus(emfv); - g_object_unref (emfv); -} - -static gboolean -emfv_message_selected_timeout(gpointer data) -{ - EMFolderView *emfv = data; - - if (emfv->priv->selected_uid) { - if (emfv->displayed_uid == NULL || strcmp(emfv->displayed_uid, emfv->priv->selected_uid) != 0) { - /*GtkHTMLStream *hstream;*/ - - g_free(emfv->displayed_uid); - emfv->displayed_uid = emfv->priv->selected_uid; - emfv->priv->selected_uid = NULL; - g_object_ref (emfv); - /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */ - e_profile_event_emit("goto.load", emfv->displayed_uid, 0); - mail_get_messagex(emfv->folder, emfv->displayed_uid, emfv_list_done_message_selected, emfv, mail_msg_fast_ordered_push); - } else { - e_profile_event_emit("goto.empty", "", 0); - g_free(emfv->priv->selected_uid); - emfv->priv->selected_uid = NULL; - } - } else { - e_profile_event_emit("goto.empty", "", 0); - g_free(emfv->displayed_uid); - emfv->displayed_uid = NULL; - em_format_format((EMFormat *)emfv->preview, NULL, NULL, NULL); - emfv->priv->nomarkseen = FALSE; - } - - emfv->priv->selected_id = 0; - - return FALSE; -} - -static gboolean -emfv_popup_menu (GtkWidget *widget) -{ - gboolean ret = FALSE; - EMFolderView *emfv = (EMFolderView *)widget; - - /* Try to bring up menu for preview html object. - Currently we cannot directly connect to html's "popup_menu" signal - since it doesn't work. - */ - - if (GTK_WIDGET_HAS_FOCUS (emfv->preview->formathtml.html)) - ret = em_format_html_display_popup_menu (emfv->preview); - - if (!ret) - emfv_popup (emfv, NULL, FALSE); - - return TRUE; -} - -//static void -//emp_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, gpointer data) -//{ -// EMFolderView *emfv = data; -// struct _EMFolderViewPrivate *p = emfv->priv; -// -// g_free(p->selection_uri); -// p->selection_uri = em_utils_url_unescape_amp(pitem->user_data); -// -// gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time()); -// gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); -//} - -static EPopupItem emfv_uri_popups[] = { -// { E_POPUP_ITEM, (gchar *) "00.uri.15", (gchar *) N_("_Copy Link Location"), emp_uri_popup_link_copy, NULL, (gchar *) "edit-copy", EM_POPUP_URI_NOT_MAILTO }, - -// { E_POPUP_SUBMENU, (gchar *) "99.uri.00", (gchar *) N_("Create _Search Folder"), NULL, NULL, NULL, EM_POPUP_URI_MAILTO }, -// { E_POPUP_ITEM, (gchar *) "99.uri.00/00.10", (gchar *) N_("_From this Address"), emp_uri_popup_vfolder_sender, NULL, NULL, EM_POPUP_URI_MAILTO }, -// { E_POPUP_ITEM, (gchar *) "99.uri.00/00.00", (gchar *) N_("_To this Address"), emp_uri_popup_vfolder_recipient, NULL, NULL, EM_POPUP_URI_MAILTO }, -}; - -static void -emfv_uri_popup_free(EPopup *ep, GSList *list, gpointer data) -{ - while (list) { - GSList *n = list->next; - struct _EPopupItem *item = list->data; - - g_free(item->user_data); - item->user_data = NULL; - g_free (item); - g_slist_free_1(list); - - list = n; - } -} - -static void -emfv_free_em_popup (gpointer emp) -{ - EPopup *ep = (EPopup *)emp; - - if (!ep) - return; - - if (ep->target) { - /* without this the next unref on ep does nothing */ - e_popup_target_free (ep, ep->target); - ep->target = NULL; - } - - g_object_unref (ep); -} - -static GtkMenu * -emfv_append_menu (EMPopup *des_emp, GtkMenu *des_menu, EMPopup *src_emp, GtkMenu *src_menu) -{ - GtkWidget *separator; - GList *children, *p; - gchar *name; - - if (!src_menu) - return des_menu; - - if (!des_menu) - return src_menu; - - separator = gtk_separator_menu_item_new (); - gtk_widget_show (separator); - gtk_menu_shell_append (GTK_MENU_SHELL (des_menu), separator); - - children = gtk_container_get_children (GTK_CONTAINER (src_menu)); - for (p = children; p; p = p->next) { - g_object_ref (p->data); - gtk_container_remove (GTK_CONTAINER (src_menu), p->data); - gtk_menu_shell_append (GTK_MENU_SHELL (des_menu), p->data); - g_object_unref (p->data); - } - - g_list_free (children); - gtk_widget_destroy (GTK_WIDGET (src_menu)); - - /* free src_emp together with des_emp; name contains unique identifier */ - name = g_strdup_printf ("emp_%p", (gpointer) src_emp); - g_object_set_data_full (G_OBJECT (des_emp), name, src_emp, emfv_free_em_popup); - g_free (name); - - return des_menu; -} - -static gint -emfv_format_popup_event(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const gchar *uri, CamelMimePart *part, EMFolderView *emfv) -{ - GtkMenu *menu = NULL; - EMPopup *main_emp = NULL; - - if (uri == NULL && part == NULL) { - /* So we don't try and popup with nothing selected - rather odd result! */ - GPtrArray *uids = message_list_get_selected(emfv->list); - gint doit = uids->len > 0; - - message_list_free_uids(emfv->list, uids); - if (doit) - emfv_popup(emfv, (GdkEvent *)event, TRUE); - return doit; - } - - /* FIXME: this maybe should just fit on em-html-display, it has access to the - snooped part type */ - - /** @HookPoint-EMPopup: Inline URI Context Menu - * @Id: org.gnome.evolution.mail.folderview.popup - * @Class: org.gnome.evolution.mail.popup:1.0 - * @Target: EMPopupTargetURI - * - * This is the context menu shown when clicking on inline URIs, - * including addresses or normal HTML links that are displayed inside - * the message view. - */ - - /** @HookPoint-EMPopup: Inline Object Context Menu - * @Id: org.gnome.evolution.mail.folderview.popup - * @Class: org.gnome.evolution.mail.popup:1.0 - * @Target: EMPopupTargetPart - * - * This is the context menu shown when clicking on inline - * content such as a picture. - */ - - if (uri) { - gboolean have_more_uris = strchr (uri, '\n') != NULL; - const gchar *act, *next; - - for (act = uri; act; act = next) { - gchar *u; - next = strchr (act, '\n'); - if (next) { - u = g_strndup (act, next - act); - next++; - } else - u = g_strdup (act); - - if (u && *u) { - GSList *menus = NULL; - gint i; - EMPopupTargetURI *t; - EMPopup *emp; - EPopupTarget *target; - GtkMenu *mymenu; - - emp = em_popup_new ("org.gnome.evolution.mail.folderview.popup"); - t = em_popup_target_new_uri(emp, u); - target = (EPopupTarget *)t; - - for (i = 0; i < sizeof (emfv_uri_popups)/sizeof (emfv_uri_popups[0]); i++) { - EPopupItem *itm = g_malloc0 (sizeof (EPopupItem)); - - memcpy (itm, &emfv_uri_popups[i], sizeof (EPopupItem)); - itm->user_data = g_strdup (t->uri); - menus = g_slist_prepend (menus, itm); - } - e_popup_add_items ((EPopup *)emp, menus, NULL, emfv_uri_popup_free, emfv); - mymenu = e_popup_create_menu_once ((EPopup *)emp, target, 0); - - if (have_more_uris) { - GtkWidget *item; - - if (strlen (u) > 100) { - GString *str; - gchar *c; - - /* the url should be in the form of http://a.b.c/... and we want to - see where the image comes from, so skip first 10 characters and - find the first '/' there */ - c = strchr (u + 10, '/'); - if (!c) - str = g_string_new_len (u, 40); - else - str = g_string_new_len (u, MAX (c - u + 1, 40)); - - g_string_append (str, "..."); - g_string_append (str, u + strlen (u) - 40); - - item = gtk_menu_item_new_with_label (str->str); - - g_string_free (str, TRUE); - } else - item = gtk_menu_item_new_with_label (u); - - gtk_widget_set_sensitive (item, FALSE); - gtk_widget_show (item); - gtk_menu_shell_insert (GTK_MENU_SHELL (mymenu), item, 0); - } - - menu = emfv_append_menu (main_emp, menu, emp, mymenu); - if (!main_emp) - main_emp = emp; - } - - g_free (u); - } - } - - if (part) { - EMPopup *emp; - EPopupTarget *target; - - emp = em_popup_new ("org.gnome.evolution.mail.folderview.popup"); - target = (EPopupTarget *)em_popup_target_new_part(emp, part, NULL); - - menu = emfv_append_menu (main_emp, menu, emp, e_popup_create_menu_once ((EPopup *)emp, target, 0)); - if (!main_emp) - main_emp = emp; - } - - if (event == NULL) - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time()); - else - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time); - - return TRUE; -} - -static void -emfv_set_seen(EMFolderView *emfv, const gchar *uid) -{ - guint32 old_flags = camel_folder_get_message_flags(emfv->folder, uid); - - /* If we're setting the SEEN flag on a message, handle receipt requests */ - if (!(old_flags & CAMEL_MESSAGE_SEEN)) - em_utils_handle_receipt(emfv->folder, uid, (CamelMimeMessage *)((EMFormat *)emfv->preview)->message); - - camel_folder_set_message_flags(emfv->folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); -} - -/* keep these two tables in sync */ -enum { - EMFV_CHARSET = 1, - EMFV_HEADERS, - EMFV_SHOW_DELETED, - EMFV_SETTINGS /* last, for loop count */ -}; - -/* IF these get too long, update key field */ -static const gchar * const emfv_display_keys[] = { - "charset", - "headers", - "show_deleted", -}; - -static GHashTable *emfv_setting_key; - -static void -emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFolderView *emfv) -{ - GConfValue *value; - gchar *tkey; - - g_return_if_fail (gconf_entry_get_key (entry) != NULL); - - if (!(value = gconf_entry_get_value (entry))) - return; - - tkey = strrchr(entry->key, '/'); - g_return_if_fail (tkey != NULL); - - switch (GPOINTER_TO_INT(g_hash_table_lookup(emfv_setting_key, tkey+1))) { - case EMFV_CHARSET: - em_format_set_default_charset((EMFormat *)emfv->preview, gconf_value_get_string (value)); - break; - case EMFV_HEADERS: { - GSList *header_config_list, *p; - EMFormat *emf = (EMFormat *)emfv->preview; - - header_config_list = gconf_client_get_list(gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, NULL); - em_format_clear_headers((EMFormat *)emfv->preview); - p = header_config_list; - while (p) { - EMMailerPrefsHeader *h; - gchar *xml = (gchar *)p->data; - - h = em_mailer_prefs_header_from_xml(xml); - if (h && h->enabled) { - em_format_add_header(emf, h->name, EM_FORMAT_HEADER_BOLD); - } - em_mailer_prefs_header_free(h); - p = g_slist_next(p); - } - g_slist_foreach(header_config_list, (GFunc) g_free, NULL); - g_slist_free(header_config_list); - /* force a redraw */ - if (emf->message) - em_format_redraw(emf); - break; } - case EMFV_SHOW_DELETED: { - gboolean state; - - state = gconf_value_get_bool (value); - em_folder_view_set_hide_deleted (emfv, !state); - /* Set the prop only if the component has already been - * activated. */ - if (emfv->uic) - bonobo_ui_component_set_prop (emfv->uic, "/commands/HideDeleted", "state", state ? "0" : "1", NULL); - break; } - } -} diff --git a/mail/em-folder-view.h.dead b/mail/em-folder-view.h.dead deleted file mode 100644 index 2c276914c0..0000000000 --- a/mail/em-folder-view.h.dead +++ /dev/null @@ -1,166 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef EM_FOLDER_VIEW_H -#define EM_FOLDER_VIEW_H - -#include <gtk/gtk.h> -#include <bonobo/bonobo-ui-component.h> - -#include "mail/em-format-html-display.h" -#include "mail/em-menu.h" -#include "mail/em-popup.h" -#include "mail/mail-mt.h" -#include "mail/message-list.h" - -/* Standard GObject macros */ -#define EM_TYPE_FOLDER_VIEW \ - (em_folder_view_get_type ()) -#define EM_FOLDER_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), EM_TYPE_FOLDER_VIEW, EMFolderView)) -#define EM_FOLDER_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), EM_TYPE_FOLDER_VIEW, EMFolderViewClass)) -#define EM_IS_FOLDER_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), EM_TYPE_FOLDER_VIEW)) -#define EM_IS_FOLDER_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), EM_TYPE_FOLDER_VIEW)) -#define EM_FOLDER_VIEW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), EM_TYPE_FOLDER_VIEW, EMFolderViewClass)) - -G_BEGIN_DECLS - -typedef struct _EMFolderView EMFolderView; -typedef struct _EMFolderViewClass EMFolderViewClass; - -typedef struct _EMFolderViewEnable EMFolderViewEnable; - -enum { - EM_FOLDER_VIEW_SELECT_THREADED = EM_POPUP_SELECT_LAST, - EM_FOLDER_VIEW_SELECT_HIDDEN = EM_POPUP_SELECT_LAST<<1, - EM_FOLDER_VIEW_SELECT_NEXT_MSG = EM_POPUP_SELECT_LAST<<2, - EM_FOLDER_VIEW_SELECT_PREV_MSG = EM_POPUP_SELECT_LAST<<3, - EM_FOLDER_VIEW_SELECT_LISTONLY = EM_POPUP_SELECT_LAST<<4, - EM_FOLDER_VIEW_SELECT_DISPLAY = EM_POPUP_SELECT_LAST<<5, - EM_FOLDER_VIEW_SELECT_SELECTION = EM_POPUP_SELECT_LAST<<6, - EM_FOLDER_VIEW_SELECT_NOSELECTION = EM_POPUP_SELECT_LAST<<7, - EM_FOLDER_VIEW_PREVIEW_PRESENT = EM_POPUP_SELECT_LAST<<8, - EM_FOLDER_VIEW_SELECT_LAST = EM_POPUP_SELECT_LAST<<9 -}; - -struct _EMFolderViewEnable { - const gchar *name; /* bonobo name, relative to /commands/ */ - guint32 mask; /* disable mask, see EM_FOLDER_VIEW_CAN* flags */ -}; - -struct _EMFolderView { - GtkVBox parent; - - struct _EMFolderViewPrivate *priv; - - MessageList *list; - - EMFormatHTMLDisplay *preview; - - CamelFolder *folder; - gchar *folder_uri; - - gchar *displayed_uid; /* only used to stop re-loads, don't use it to represent any selection state */ - - /* used to load ui from base activate implementation */ - GSList *ui_files; /* const gchar * list, TODO: should this be on class? */ - const gchar *ui_app_name; - - /* used to manage some menus, particularly plugins */ - EMMenu *menu; - - /* for proxying jobs to main or other threads */ - MailAsyncEvent *async; - - BonoboUIComponent *uic; /* if we're active, this will be set */ - GSList *enable_map; /* bonobo menu enable map, entries are 0-terminated EMFolderViewEnable arryas - TODO: should this be on class? */ - - gint mark_seen_timeout; /* local copy of gconf stuff */ - guint mark_seen:1; - guint preview_active:1; /* is preview being used */ - guint statusbar_active:1; /* should we manage the statusbar messages ourselves? */ - guint hide_deleted:1; - guint list_active:1; /* we actually showing the list? */ -}; - -struct _EMFolderViewClass { - GtkVBoxClass parent_class; - - /* behaviour definition */ - guint update_message_style:1; - - /* if used as a control, used to activate/deactivate custom menu's */ - void (*activate)(EMFolderView *, BonoboUIComponent *uic, gint state); - - void (*set_folder_uri)(EMFolderView *emfv, const gchar *uri); - void (*set_folder)(EMFolderView *emfv, CamelFolder *folder, const gchar *uri); - void (*set_message)(EMFolderView *emfv, const gchar *uid, gint nomarkseen); - - void (*show_search_bar)(EMFolderView *emfv); - - /* Signals */ - void (*on_url)(EMFolderView *emfv, const gchar *uri, const gchar *nice_uri); - - void (*loaded)(EMFolderView *emfv); - void (*changed)(EMFolderView *emfv); -}; - -GType em_folder_view_get_type(void); - -GtkWidget *em_folder_view_new(void); - -#define em_folder_view_activate(emfv, uic, state) EM_FOLDER_VIEW_GET_CLASS (emfv)->activate((emfv), (uic), (state)) -#define em_folder_view_set_folder(emfv, folder, uri) EM_FOLDER_VIEW_GET_CLASS (emfv)->set_folder((emfv), (folder), (uri)) -#define em_folder_view_set_folder_uri(emfv, uri) EM_FOLDER_VIEW_GET_CLASS (emfv)->set_folder_uri((emfv), (uri)) -#define em_folder_view_set_message(emfv, uid, nomarkseen) EM_FOLDER_VIEW_GET_CLASS (emfv)->set_message((emfv), (uid), (nomarkseen)) - -void em_folder_view_select_next_message(EMFolderView *emfv, gint count, gboolean always_can_previous); -void em_folder_view_message_reply(EMFolderView *emfv, gint mode); - -EMPopupTargetSelect *em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, gint on_display); - -gint em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set); -gint em_folder_view_open_selected(EMFolderView *emfv); - -gint em_folder_view_print(EMFolderView *emfv, GtkPrintOperationAction action); - -/* this could be on message-list */ -guint32 em_folder_view_disable_mask(EMFolderView *emfv); - -void em_folder_view_set_statusbar(EMFolderView *emfv, gboolean statusbar); -void em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status); -void em_folder_view_setup_view_instance (EMFolderView *emfv); -void em_folder_view_show_search_bar (EMFolderView *emfv); - -G_END_DECLS - -#endif /* EM_FOLDER_VIEW_H */ diff --git a/mail/mail-component.c.dead b/mail/mail-component.c.dead deleted file mode 100644 index 46c48b5516..0000000000 --- a/mail/mail-component.c.dead +++ /dev/null @@ -1,385 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * Michael Zucchi <notzed@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> - -#include <libedataserver/e-data-server-util.h> -#include "em-utils.h" -#include "em-composer-utils.h" -#include "em-format/em-format.h" -#include "em-folder-tree.h" -#include "em-folder-browser.h" -#include "em-message-browser.h" -#include "em-folder-selector.h" -#include "em-folder-selection.h" -#include "em-folder-utils.h" -#include "em-migrate.h" - -#include "misc/e-info-label.h" -#include "e-util/e-util.h" -#include "e-util/e-error.h" -#include "e-util/e-util-private.h" -#include "e-util/e-logger.h" -#include "e-util/gconf-bridge.h" - -#include "em-search-context.h" -#include "mail-config.h" -#include "mail-component.h" -#include "mail-folder-cache.h" -#include "mail-vfolder.h" -#include "mail-mt.h" -#include "mail-ops.h" -#include "mail-tools.h" -#include "mail-send-recv.h" -#include "mail-session.h" -#include "message-list.h" - -#include "e-activity-handler.h" -#include "shell/e-user-creatable-items-handler.h" -#include "shell/e-component-view.h" - -#include "composer/e-msg-composer.h" - -#include "e-task-bar.h" - -#include <gtk/gtk.h> - -#include <e-util/e-mktemp.h> -#include <Evolution.h> - -#include <table/e-tree.h> -#include <table/e-tree-memory.h> -#include <glib/gi18n-lib.h> - -#include <camel/camel-file-utils.h> -#include <camel/camel-vtrash-folder.h> -#include <camel/camel-disco-store.h> -#include <camel/camel-offline-store.h> - -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-widget.h> - -#include "e-util/e-non-intrusive-error-dialog.h" - -#include "e-attachment-handler-mail.h" - -#define MAILER_ERROR_LEVEL_KEY "/apps/evolution/mail/display/error_level" -#define MAILER_ERROR_TIME_OUT_KEY "/apps/evolution/mail/display/error_timeout" - -#define d(x) - -struct _MailComponentPrivate { - GMutex *lock; - - /* states/data used during shutdown */ - enum { MC_QUIT_START, MC_QUIT_SYNC, MC_QUIT_THREADS } quit_state; - gint quit_count; - gint quit_expunge; /* expunge on quit this time around? */ - - gchar *base_directory; - - EMFolderTreeModel *model; - - EActivityHandler *activity_handler; - - MailAsyncEvent *async_event; - GHashTable *store_hash; /* stores store_info objects by store */ - - RuleContext *search_context; - - gchar *context_path; /* current path for right-click menu */ - - CamelStore *local_store; - ELogger *logger; - - EComponentView *component_view; - - guint mail_sync_id; /* timeout id for sync call on the stores */ - guint mail_sync_in_progress; /* is greater than 0 if still waiting to finish sync on some store */ -}; - -/* GObject methods. */ - -static void -impl_finalize (GObject *object) -{ - MailComponentPrivate *priv = MAIL_COMPONENT (object)->priv; - - g_free (priv->base_directory); - - g_hash_table_destroy (priv->store_hash); - - if (mail_async_event_destroy (priv->async_event) == -1) { - g_warning("Cannot destroy async event: would deadlock"); - g_warning(" system may be unstable at exit"); - } - - g_free (priv->context_path); - g_mutex_free(priv->lock); - g_object_unref (priv->model); - g_object_unref (priv->logger); - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - -static void -view_on_url (GObject *emitter, const gchar *url, const gchar *nice_url, MailComponent *mail_component) -{ - MailComponentPrivate *priv = mail_component->priv; - - e_activity_handler_set_message (priv->activity_handler, nice_url); -} - -static void -disable_folder_tree (gpointer *emfb, GtkWidget *widget) -{ - gtk_widget_set_sensitive (widget, FALSE); -} - -static void -enable_folder_tree (GtkWidget *emfb, GtkWidget *emft) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - CamelURL *selected_curl, *current_curl; - CamelFolder *selected_folder; - gchar *uri; - - /* Get the currently displayed folder. */ - uri = mail_tools_folder_to_url (emfv->list->folder); - current_curl = uri ? camel_url_new (uri, NULL) : NULL; - g_free (uri); - - /* Get the selected folder in the folder tree. */ - selected_folder = em_folder_tree_get_selected_folder(EM_FOLDER_TREE (emft)); - if (selected_folder) - uri = mail_tools_folder_to_url (selected_folder); - else - uri = NULL; - - selected_curl = uri ? camel_url_new (uri, NULL) : NULL; - - if (current_curl && selected_curl && !camel_url_equal (selected_curl, current_curl)) { - - g_signal_emit_by_name ( - emft, "folder-selected", emft, uri, - selected_folder->full_name, uri, selected_folder->folder_flags); - } - - gtk_widget_set_sensitive (emft, TRUE); - - camel_url_free (current_curl); - camel_url_free (selected_curl); - g_free (uri); -} - -/* Evolution::Component CORBA methods. */ - -static GNOME_Evolution_ComponentView -impl_createView (PortableServer_Servant servant, - GNOME_Evolution_ShellView parent, - CORBA_boolean select_item, - CORBA_Environment *ev) -{ - MailComponent *mail_component = MAIL_COMPONENT (bonobo_object_from_servant (servant)); - MailComponentPrivate *priv = mail_component->priv; - EComponentView *component_view; - GtkWidget *tree_widget, *vbox, *info; - GtkWidget *view_widget; - GtkWidget *statusbar_widget; - gchar *uri; - - mail_session_set_interactive(TRUE); - mc_startup(mail_component); - - view_widget = em_folder_browser_new (); - - if (!select_item) - em_folder_browser_suppress_message_selection ( - (EMFolderBrowser *) view_widget); - -// tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model); -// em_folder_tree_set_excluded ((EMFolderTree *) tree_widget, 0); -// em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget); - -// if ((uri = em_folder_tree_model_get_selected (priv->model))) { -// gboolean expanded; -// -// expanded = em_folder_tree_model_get_expanded_uri (priv->model, uri); -// em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri, FALSE); -// em_folder_view_set_folder_uri ((EMFolderView *) view_widget, uri); -// -// if (!expanded) -// em_folder_tree_model_set_expanded_uri (priv->model, uri, expanded); -// -// g_free (uri); -// } - - em_format_set_session ((EMFormat *) ((EMFolderView *) view_widget)->preview, session); - - g_signal_connect (view_widget, "on-url", G_CALLBACK (view_on_url), mail_component); - em_folder_view_set_statusbar ((EMFolderView*)view_widget, FALSE); - -// statusbar_widget = e_task_bar_new (); -// e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget)); - - gtk_widget_show (tree_widget); - gtk_widget_show (view_widget); - gtk_widget_show (statusbar_widget); - -// vbox = gtk_vbox_new(FALSE, 0); -// info = e_info_label_new("evolution-mail"); -// e_info_label_set_info((EInfoLabel *)info, _("Mail"), ""); -// gtk_box_pack_start((GtkBox *)vbox, info, FALSE, TRUE, 0); -// gtk_box_pack_start((GtkBox *)vbox, tree_widget, TRUE, TRUE, 0); - - gtk_widget_show(info); - gtk_widget_show(vbox); - -// component_view = e_component_view_new(parent, "mail", vbox, view_widget, statusbar_widget); -// -// g_object_set_data((GObject *)component_view, "info-label", info); -// -// g_object_set_data_full((GObject *)view_widget, "e-creatable-items-handler", -// e_user_creatable_items_handler_new("mail", create_local_item_cb, tree_widget), -// (GDestroyNotify)g_object_unref); - - g_signal_connect (component_view->view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget); -// g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget); - - g_signal_connect((EMFolderBrowser *)view_widget, "account_search_cleared", G_CALLBACK (enable_folder_tree), tree_widget); - g_signal_connect(((EMFolderBrowser *)view_widget), "account_search_activated", G_CALLBACK (disable_folder_tree), tree_widget); -// g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view); -// g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view); - - g_object_set_data((GObject*)info, "folderview", view_widget); - g_object_set_data((GObject*)view_widget, "foldertree", tree_widget); - - priv->component_view = component_view; - - return BONOBO_OBJREF(component_view); -} - -/* Initialization. */ - -static void -mail_component_class_init (MailComponentClass *class) -{ - POA_GNOME_Evolution_Component__epv *epv = &((EvolutionComponentClass *)class)->epv; - POA_GNOME_Evolution_MailComponent__epv *mepv = &class->epv; - GObjectClass *object_class = G_OBJECT_CLASS (class); - - bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - - parent_class = g_type_class_peek_parent (class); - - object_class->finalize = impl_finalize; - - epv->createView = impl_createView; -// epv->quit = impl_quit; -// epv->_get_userCreatableItems = impl__get_userCreatableItems; -// epv->requestCreateItem = impl_requestCreateItem; -// epv->handleURI = impl_handleURI; -// epv->sendAndReceive = impl_sendAndReceive; -// epv->upgradeFromVersion = impl_upgradeFromVersion; -// epv->setLineStatus = impl_setLineStatus; - -// mepv->test = impl_mail_test; -} - -//static void -//store_hash_free (struct _store_info *si) -//{ -// si->removed = 1; -// store_info_unref(si); -//} - -static void -mail_component_init (MailComponent *component) -{ - MailComponentPrivate *priv; - - priv = g_new0 (MailComponentPrivate, 1); - component->priv = priv; - - priv->lock = g_mutex_new(); - priv->quit_state = -1; - -// /* FIXME This is used as both a filename and URI path throughout -// * the mail code. Need to clean this up; maybe provide a -// * mail_component_get_base_uri() function. */ -// priv->base_directory = g_build_filename (e_get_user_data_dir (), "mail", NULL); -//#ifdef G_OS_WIN32 -// { -// gchar *p = priv->base_directory; -// while ((p = strchr(p, '\\'))) -// *p++ = '/'; -// } -//#endif - -// if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST) -// abort (); - -// priv->model = em_folder_tree_model_new (e_get_user_data_dir ()); - priv->logger = e_logger_create ("mail"); - priv->activity_handler = e_activity_handler_new (); - e_activity_handler_set_logger (priv->activity_handler, priv->logger); - e_activity_handler_set_error_flush_time (priv->activity_handler, mail_config_get_error_timeout ()*1000); - -// mail_session_init (e_get_user_data_dir ()); - -// priv->async_event = mail_async_event_new(); -// priv->store_hash = g_hash_table_new_full ( -// NULL, NULL, -// (GDestroyNotify) NULL, -// (GDestroyNotify) store_hash_free); - -// mail_autoreceive_init (session); - -// priv->mail_sync_in_progress = 0; -// if (g_getenv("CAMEL_FLUSH_CHANGES")) -// priv->mail_sync_id = g_timeout_add_seconds (mail_config_get_sync_timeout (), call_mail_sync, component); -// else -// priv->mail_sync_id = 0; -} - -void -mail_component_show_logger (gpointer top) -{ - MailComponent *mc = mail_component_peek (); - ELogger *logger = mc->priv->logger; - - eni_show_logger(logger, top, MAILER_ERROR_TIME_OUT_KEY, MAILER_ERROR_LEVEL_KEY); -} diff --git a/mail/mail-component.h.dead b/mail/mail-component.h.dead deleted file mode 100644 index f69a3c2cff..0000000000 --- a/mail/mail-component.h.dead +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _MAIL_COMPONENT_H_ -#define _MAIL_COMPONENT_H_ - -#include <bonobo/bonobo-object.h> -#include "shell/evolution-component.h" -#include "mail/Evolution-Mail.h" -#include "mail/em-folder-tree-model.h" -#include "filter/rule-context.h" -#include "misc/e-activity-handler.h" - -#define MAIL_TYPE_COMPONENT (mail_component_get_type ()) -#define MAIL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_TYPE_COMPONENT, MailComponent)) -#define MAIL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_TYPE_COMPONENT, MailComponentClass)) -#define MAIL_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_TYPE_COMPONENT)) -#define MAIL_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MAIL_TYPE_COMPONENT)) - -typedef struct _MailComponent MailComponent; -typedef struct _MailComponentPrivate MailComponentPrivate; -typedef struct _MailComponentClass MailComponentClass; - -enum _mail_component_folder_t { - MAIL_COMPONENT_FOLDER_INBOX = 0, - MAIL_COMPONENT_FOLDER_DRAFTS, - MAIL_COMPONENT_FOLDER_OUTBOX, - MAIL_COMPONENT_FOLDER_SENT, - MAIL_COMPONENT_FOLDER_TEMPLATES, - MAIL_COMPONENT_FOLDER_LOCAL_INBOX -}; - -struct _MailComponent { - EvolutionComponent parent; - - MailComponentPrivate *priv; -}; - -struct _MailComponentClass { - EvolutionComponentClass parent_class; - - POA_GNOME_Evolution_MailComponent__epv epv; -}; - -GType mail_component_get_type (void); - -MailComponent *mail_component_peek (void); - -/* NOTE: Using NULL as the component implies using the default component */ -const gchar *mail_component_peek_base_directory (MailComponent *component); -RuleContext *mail_component_peek_search_context (MailComponent *component); -EActivityHandler *mail_component_peek_activity_handler (MailComponent *component); - -void mail_component_add_store (MailComponent *component, - CamelStore *store, - const gchar *name); -CamelStore *mail_component_load_store_by_uri (MailComponent *component, - const gchar *uri, - const gchar *name); - -void mail_component_remove_store (MailComponent *component, - CamelStore *store); -void mail_component_remove_store_by_uri (MailComponent *component, - const gchar *uri); - -gint mail_component_get_store_count (MailComponent *component); -void mail_component_stores_foreach (MailComponent *component, - GHFunc func, - void *data); - -void mail_component_remove_folder (MailComponent *component, CamelStore *store, const gchar *path); - -EMFolderTreeModel *mail_component_peek_tree_model (MailComponent *component); - -CamelStore *mail_component_peek_local_store (MailComponent *mc); -CamelFolder *mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id); -const gchar *mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id); - -gint status_check (GNOME_Evolution_ShellState shell_state); - -void mail_indicate_new_mail (gboolean have_new_mail); -void mail_component_show_logger (gpointer); -void mail_component_show_status_bar (gboolean show); - -#endif /* _MAIL_COMPONENT_H_ */ |