aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-04-03 05:22:58 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-03 05:22:58 +0800
commit167b482c9e39a093dcfecc5ef430261c0504e370 (patch)
treef9f4e9c0fbe5c6282f158015bd373a3cd5e68abf /calendar/gui
parentfabb6b035c40673e7c263040db323d6b7607606e (diff)
downloadgsoc2013-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.
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-commands.c.dead380
-rw-r--r--calendar/gui/calendar-commands.h.dead44
-rw-r--r--calendar/gui/calendar-component.c.dead710
-rw-r--r--calendar/gui/calendar-component.h.dead55
4 files changed, 0 insertions, 1189 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_ */