aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am22
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c4
-rw-r--r--calendar/gui/alarm-notify/notify-main.c2
-rw-r--r--calendar/gui/cal-search-bar.c32
-rw-r--r--calendar/gui/calendar-commands.c90
-rw-r--r--calendar/gui/calendar-config.c174
-rw-r--r--calendar/gui/calendar-model.c11
-rw-r--r--calendar/gui/control-factory.c61
-rw-r--r--calendar/gui/dialogs/comp-editor.c283
-rw-r--r--calendar/gui/dialogs/event-editor.c28
-rw-r--r--calendar/gui/dialogs/meeting-page.c11
-rw-r--r--calendar/gui/dialogs/task-editor.c43
-rw-r--r--calendar/gui/e-day-view.c407
-rw-r--r--calendar/gui/e-itip-control.c351
-rw-r--r--calendar/gui/e-meeting-model.c40
-rw-r--r--calendar/gui/e-tasks.c251
-rw-r--r--calendar/gui/e-week-view.c378
-rw-r--r--calendar/gui/gnome-cal.c290
-rw-r--r--calendar/gui/main.c11
-rw-r--r--calendar/gui/print.c23
-rw-r--r--calendar/gui/tasks-control.c298
21 files changed, 740 insertions, 2070 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 9c842635f7..1a7699b8d6 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -49,13 +49,16 @@ INCLUDES = \
-I$(top_builddir)/addressbook/backend/ebook \
-I$(top_srcdir)/widgets \
-I$(includedir) \
+ $(BONOBO_HTML_GNOME_CFLAGS) \
+ $(GNOME_VFS_CFLAGS) \
+ $(GAL_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" \
- $(EVOLUTION_CALENDAR_CFLAGS)
+ -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\"
iconsdir = $(datadir)/images/evolution
@@ -87,8 +90,6 @@ evolution_calendar_SOURCES = \
comp-editor-factory.h \
comp-util.c \
comp-util.h \
- config-control-factory.c \
- config-control-factory.h \
control-factory.c \
control-factory.h \
component-factory.c \
@@ -97,8 +98,6 @@ evolution_calendar_SOURCES = \
e-calendar-table.c \
e-cell-date-edit-text.h \
e-cell-date-edit-text.c \
- e-comp-editor-registry.c \
- e-comp-editor-registry.h \
e-day-view-layout.c \
e-day-view-layout.h \
e-day-view-main-item.c \
@@ -168,16 +167,23 @@ evolution_calendar_LDADD = \
$(top_builddir)/calendar/cal-client/libcal-client.la \
$(top_builddir)/calendar/cal-util/libcal-util.la \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/libical/src/libical/libical-evolution.la \
$(top_builddir)/libwombat/libwombat.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/camel/libcamel.la \
- $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/libibex/libibex.la \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
dialogs/libcal-dialogs.a \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(EVOLUTION_CALENDAR_LIBS)
+ $(EXTRA_GNOME_LIBS) \
+ $(BONOBO_HTML_GNOME_LIBS) \
+ $(GNOME_VFS_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(GAL_LIBS) \
+ $(INTLLIBS)
evolution_calendar_LDFLAGS = -export-dynamic
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index 2f7889b4db..88c3ee2bad 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -358,7 +358,7 @@ static gboolean
retry_timeout_cb (gpointer data)
{
RetryData *retry_data = data;
-
+
if (cal_client_get_load_state (retry_data->client) != CAL_CLIENT_LOAD_LOADED) {
cal_client_open_calendar (retry_data->client, retry_data->str_uri, FALSE);
}
@@ -458,7 +458,9 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
lc->refcount = 1;
g_hash_table_insert (priv->uri_client_hash,
g_strdup (str_uri), lc);
+
} else {
+ remove_uri_to_load (uri);
gtk_object_unref (GTK_OBJECT (client));
client = NULL;
}
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index 06fe87b611..148dab6865 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -118,7 +118,7 @@ load_calendars (gpointer user_data)
uris = get_calendars_to_load ();
if (!uris) {
g_message ("load_calendars(): Could not get the list of calendars to load");
- return TRUE; /* should we continue retrying? */;
+ return TRUE; /* should we continue retrying? */
}
for (i = 0; i < uris->len; i++) {
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index 2483b2b126..329795c518 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -36,6 +36,12 @@
+/* Menu items for the ESearchBar */
+static ESearchBarItem search_menu_items[] = {
+ E_FILTERBAR_RESET,
+ { NULL, -1, NULL }
+};
+
/* IDs and option items for the ESearchBar */
enum {
SEARCH_ANY_FIELD_CONTAINS,
@@ -72,6 +78,7 @@ static void cal_search_bar_init (CalSearchBar *cal_search);
static void cal_search_bar_destroy (GtkObject *object);
static void cal_search_bar_search_activated (ESearchBar *search);
+static void cal_search_bar_menu_activated (ESearchBar *search, int item);
static ESearchBarClass *parent_class = NULL;
@@ -153,6 +160,7 @@ cal_search_bar_class_init (CalSearchBarClass *class)
class->category_changed = NULL;
e_search_bar_class->search_activated = cal_search_bar_search_activated;
+ e_search_bar_class->menu_activated = cal_search_bar_menu_activated;
object_class->destroy = cal_search_bar_destroy;
}
@@ -360,6 +368,28 @@ cal_search_bar_search_activated (ESearchBar *search)
regen_query (cal_search);
}
+/* menu_activated handler for the calendar search bar */
+static void
+cal_search_bar_menu_activated (ESearchBar *search, int item)
+{
+ CalSearchBar *cal_search;
+
+ cal_search = CAL_SEARCH_BAR (search);
+
+ switch (item) {
+ case E_FILTERBAR_RESET_ID:
+ notify_sexp_changed (cal_search, "#t"); /* match all */
+ /* FIXME: should we change the rest of the search bar so that
+ * the user sees that he selected "show all" instead of some
+ * type/text search combination?
+ */
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+}
+
/* Creates the suboptions menu for the ESearchBar with the list of categories */
@@ -434,7 +464,7 @@ cal_search_bar_construct (CalSearchBar *cal_search)
g_return_val_if_fail (cal_search != NULL, NULL);
g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL);
- e_search_bar_construct (E_SEARCH_BAR (cal_search), NULL, search_option_items);
+ e_search_bar_construct (E_SEARCH_BAR (cal_search), search_menu_items, search_option_items);
make_suboptions (cal_search);
e_search_bar_set_ids (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, CATEGORIES_ALL);
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 30a1654f1b..446c32a8a3 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -45,7 +45,6 @@
#include <libgnome/gnome-util.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
#include <cal-util/timeutil.h>
#include "shell/Evolution.h"
#include "calendar-commands.h"
@@ -60,6 +59,9 @@
/* A list of all of the calendars started */
static GList *all_calendars = NULL;
+/* We have one global preferences dialog. */
+static CalPrefsDialog *preferences_dialog = NULL;
+
/* 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.
*/
@@ -68,6 +70,36 @@ typedef struct {
guint taskpad_focused : 1;
} FocusData;
+/* Callback for the new appointment command */
+static void
+new_appointment_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ GnomeCalendar *gcal;
+
+ gcal = GNOME_CALENDAR (data);
+ gnome_calendar_new_appointment (gcal);
+}
+
+static void
+new_event_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ GnomeCalendar *gcal;
+ time_t dtstart, dtend;
+
+ gcal = GNOME_CALENDAR (data);
+ gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend);
+ gnome_calendar_new_appointment_for (gcal, dtstart, dtend, TRUE);
+}
+
+static void
+new_task_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ GnomeCalendar *gcal;
+
+ gcal = GNOME_CALENDAR (data);
+ gnome_calendar_new_task (gcal);
+}
+
/* Prints the calendar at its current view and time range */
static void
print (GnomeCalendar *gcal, gboolean preview)
@@ -247,6 +279,15 @@ show_month_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path
static void
+settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ if (!preferences_dialog)
+ preferences_dialog = cal_prefs_dialog_new (CAL_PREFS_DIALOG_PAGE_CALENDAR);
+ else
+ cal_prefs_dialog_show (preferences_dialog, CAL_PREFS_DIALOG_PAGE_CALENDAR);
+}
+
+static void
cut_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
GnomeCalendar *gcal;
@@ -340,7 +381,7 @@ get_shell_view_interface (BonoboControl *control)
shell_view = Bonobo_Unknown_queryInterface (control_frame,
"IDL:GNOME/Evolution/ShellView:1.0",
&ev);
- if (BONOBO_EX (&ev)) {
+ if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("get_shell_view_interface(): "
"Could not queryInterface() on the control frame");
shell_view = CORBA_OBJECT_NIL;
@@ -465,37 +506,12 @@ control_util_set_folder_bar_label (BonoboControl *control, char *label)
CORBA_exception_init (&ev);
GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, label, &ev);
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
g_message ("control_util_set_folder_bar_label(): Could not set the folder bar label");
CORBA_exception_free (&ev);
}
-void
-control_util_show_settings (GnomeCalendar *gcal)
-{
- BonoboControl *control;
- GNOME_Evolution_ShellView shell_view;
- CORBA_Environment ev;
-
- control = gtk_object_get_data (GTK_OBJECT (gcal), "control");
- if (control == NULL)
- return;
-
- shell_view = get_shell_view_interface (control);
- if (shell_view == CORBA_OBJECT_NIL)
- return;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_ShellView_showSettings (shell_view, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("control_util_show_settings(): Could not show settings");
-
- CORBA_exception_free (&ev);
-}
-
/* Sensitizes the UI Component menu/toolbar calendar commands based on the
* number of selected events. (This will always be 0 or 1 currently.) If enable
* is FALSE, all will be disabled. Otherwise, the currently-selected number of
@@ -652,6 +668,12 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("CalendarPrint", file_print_cb),
BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb),
+ BONOBO_UI_VERB ("CalendarNewAppointment", new_appointment_cb),
+ BONOBO_UI_VERB ("CalendarNewEvent", new_event_cb),
+ BONOBO_UI_VERB ("CalendarNewTask", new_task_cb),
+
+ BONOBO_UI_VERB ("CalendarSettings", settings_cmd),
+
BONOBO_UI_VERB ("Cut", cut_cmd),
BONOBO_UI_VERB ("Copy", copy_cmd),
BONOBO_UI_VERB ("Paste", paste_cmd),
@@ -675,7 +697,6 @@ static BonoboUIVerb verbs [] = {
static EPixmap pixmaps [] =
{
E_PIXMAP ("/menu/File/New/NewFirstItem/NewAppointment", "new_appointment.xpm"),
- E_PIXMAP ("/menu/File/New/NewFirstItem/NewMeeting", "meeting.xpm"),
E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "new_task-16.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/Cut", "16_cut.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/Copy", "16_copy.png"),
@@ -683,6 +704,10 @@ static EPixmap pixmaps [] =
E_PIXMAP ("/menu/EditPlaceholder/Edit/Delete", "evolution-trash-mini.png"),
E_PIXMAP ("/menu/File/Print/Print", "print.xpm"),
E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"),
+ E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewAppointment", "new_appointment.xpm"),
+ E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewEvent", "new_appointment.xpm"),
+ E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewTask", "new_task-16.png"),
+ E_PIXMAP ("/menu/Tools/ComponentPlaceholder/CalendarSettings", "configure_16_calendar.xpm"),
E_PIXMAP ("/menu/View/ViewBegin/Goto", "goto-16.png"),
E_PIXMAP ("/Toolbar/New", "buttons/new_appointment.png"),
@@ -715,8 +740,6 @@ calendar_control_activate (BonoboControl *control,
bonobo_ui_component_set_container (uic, remote_uih);
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);
@@ -762,13 +785,10 @@ void
calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal)
{
FocusData *focus;
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (control);
+ BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
- gnome_calendar_set_ui_component (gcal, uic);
-
focus = gtk_object_get_data (GTK_OBJECT (control), "focus_data");
g_assert (focus != NULL);
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 572db1fe2c..b2b7514b0a 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -45,6 +45,8 @@
typedef struct
{
+ gchar *default_uri;
+ gchar *default_tasks_uri;
gchar *timezone;
CalWeekdays working_days;
gboolean use_24_hour_format;
@@ -68,7 +70,6 @@ typedef struct
CalUnits hide_completed_tasks_units;
gint hide_completed_tasks_value;
gboolean confirm_delete;
- gboolean confirm_expunge;
gboolean use_default_reminder;
int default_reminder_interval;
CalUnits default_reminder_units;
@@ -127,6 +128,26 @@ config_read (void)
CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ config->default_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultUri", &ev);
+ if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound))
+ config->default_uri = NULL;
+ else if (BONOBO_EX (&ev))
+ g_message ("config_read(): Could not get the /Calendar/DefaultUri");
+
+ CORBA_exception_free (&ev);
+
+ CORBA_exception_init (&ev);
+ config->default_tasks_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultTasksUri", &ev);
+ if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound))
+ config->default_tasks_uri = NULL;
+ else if (BONOBO_EX (&ev))
+ g_message ("config_read(): Could not get the /Calendar/DefaultTasksUri");
+
+ CORBA_exception_free (&ev);
+
/* Default to UTC if the timezone is not set or is "". */
config->timezone = bonobo_config_get_string_with_default (db,
"/Calendar/Display/Timezone", "UTC", NULL);
@@ -225,8 +246,6 @@ config_read (void)
/* Confirmation */
config->confirm_delete = bonobo_config_get_boolean_with_default (
db, "/Calendar/Other/ConfirmDelete", TRUE, NULL);
- config->confirm_expunge = bonobo_config_get_boolean_with_default (
- db, "/Calendar/Other/ConfirmExpunge", TRUE, NULL);
/* Default reminders */
config->use_default_reminder = bonobo_config_get_boolean_with_default (
@@ -287,6 +306,14 @@ calendar_config_write (void)
return;
}
+ if (config->default_uri)
+ bonobo_config_set_string (db, "/Calendar/DefaultUri",
+ config->default_uri, NULL);
+
+ if (config->default_tasks_uri)
+ bonobo_config_set_string (db, "/Calendar/DefaultTasksUri",
+ config->default_tasks_uri, NULL);
+
if (config->timezone)
bonobo_config_set_string (db, "/Calendar/Display/Timezone",
config->timezone, NULL);
@@ -331,7 +358,6 @@ calendar_config_write (void)
config->hide_completed_tasks_value, NULL);
bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmDelete", config->confirm_delete, NULL);
- bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmExpunge", config->confirm_expunge, NULL);
bonobo_config_set_boolean (db, "/Calendar/Other/UseDefaultReminder",
config->use_default_reminder, NULL);
@@ -377,9 +403,6 @@ calendar_config_write_on_exit (void)
bonobo_config_set_float (db, "/Calendar/Display/MonthVPanePosition",
config->month_vpane_pos, NULL);
- bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmExpunge",
- config->confirm_expunge, NULL);
-
Bonobo_ConfigDatabase_sync (db, &ev);
bonobo_object_release_unref (db, NULL);
@@ -392,6 +415,62 @@ calendar_config_write_on_exit (void)
* Calendar Settings.
*/
+/* The default URI is the one that will be used in places where there
+ might be some action on a calendar from outside, such as adding
+ a meeting request. */
+gchar *
+calendar_config_get_default_uri (void)
+{
+ static gchar *default_uri = NULL;
+
+ if (config->default_uri)
+ return config->default_uri;
+
+ if (!default_uri)
+ default_uri = g_strdup_printf ("%s/evolution/local/Calendar/calendar.ics",
+ g_get_home_dir ());
+
+ return default_uri;
+}
+
+/* Sets the default calendar URI */
+void
+calendar_config_set_default_uri (gchar *default_uri)
+{
+ g_free (config->default_uri);
+
+ if (default_uri && default_uri[0])
+ config->default_uri = g_strdup (default_uri);
+ else
+ config->default_uri = NULL;
+}
+
+gchar *
+calendar_config_get_default_tasks_uri (void)
+{
+ static gchar *default_tasks_uri = NULL;
+
+ if (config->default_tasks_uri)
+ return config->default_tasks_uri;
+
+ if (!default_tasks_uri)
+ default_tasks_uri = g_strdup_printf ("%s/evolution/local/Tasks/tasks.ics",
+ g_get_home_dir ());
+
+ return default_tasks_uri;
+}
+
+void
+calendar_config_set_default_tasks_uri (gchar *default_tasks_uri)
+{
+ g_free (config->default_tasks_uri);
+
+ if (default_tasks_uri && default_tasks_uri[0])
+ config->default_tasks_uri = g_strdup (default_tasks_uri);
+ else
+ config->default_tasks_uri = NULL;
+}
+
/* The current timezone, e.g. "Europe/London". It may be NULL, in which case
you should assume UTC (though Evolution will show the timezone-setting
dialog the next time a calendar or task folder is selected). */
@@ -719,32 +798,6 @@ calendar_config_set_confirm_delete (gboolean confirm)
config->confirm_delete = confirm;
}
-/**
- * calendar_config_get_confirm_expunge:
- *
- * Queries the configuration value for whether a confirmation dialog is
- * presented when expunging calendar/tasks items.
- *
- * Return value: Whether confirmation is required when expunging items.
- **/
-gboolean
-calendar_config_get_confirm_expunge (void)
-{
- return config->confirm_expunge;
-}
-
-/**
- * calendar_config_set_confirm_expunge:
- * @confirm: Whether confirmation is required when expunging items.
- *
- * Sets the configuration value for whether a confirmation dialog is presented
- * when expunging calendar/tasks items.
- **/
-void
-calendar_config_set_confirm_expunge (gboolean confirm)
-{
- config->confirm_expunge = confirm;
-}
/* This sets all the common config settings for an ECalendar widget.
These are the week start day, and whether we show week numbers. */
@@ -1146,58 +1199,3 @@ calendar_config_get_hide_completed_tasks_sexp (void)
return sexp;
}
-
-char *
-calendar_config_default_calendar_folder (void)
-{
- Bonobo_ConfigDatabase db;
- char *uri;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
-
- if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- uri = bonobo_config_get_string (db, "/DefaultFolders/calendar_uri", &ev);
- bonobo_object_release_unref (db, NULL);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- return uri;
-}
-
-char *
-calendar_config_default_tasks_folder (void)
-{
- Bonobo_ConfigDatabase db;
- char *uri;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
-
- if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_uri", &ev);
- bonobo_object_release_unref (db, NULL);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- return uri;
-}
-
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 927b986212..f2b9d8b428 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -1320,7 +1320,7 @@ calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *val
return;
}
- if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (priv->client, comp))
g_message ("calendar_model_set_value_at(): Could not update the object!");
}
@@ -1399,7 +1399,7 @@ calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row)
set_complete (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETE, row));
set_status (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_STATUS, row));
- if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS) {
+ if (!cal_client_update_object (priv->client, comp)) {
/* FIXME: Show error dialog. */
g_message ("calendar_model_append_row(): Could not add new object!");
}
@@ -1891,7 +1891,7 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err
calendar_model_set_status_message (model, NULL);
if (status != CAL_QUERY_DONE_SUCCESS)
- g_warning ("query done: %s\n", error_str);
+ fprintf (stderr, "query done: %s\n", error_str);
}
/* Callback used when an evaluation error occurs when running a query */
@@ -1906,7 +1906,7 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
calendar_model_set_status_message (model, NULL);
- g_warning ("eval error: %s\n", error_str);
+ fprintf (stderr, "eval error: %s\n", error_str);
}
/* Builds a complete query sexp for the calendar model by adding the predicates
@@ -1987,7 +1987,6 @@ update_query (CalendarModel *model)
if (!priv->query) {
g_message ("update_query(): Could not create the query");
- calendar_model_set_status_message (model, NULL);
return;
}
@@ -2270,7 +2269,7 @@ calendar_model_mark_task_complete (CalendarModel *model,
ensure_task_complete (comp, -1);
- if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (priv->client, comp))
g_message ("calendar_model_mark_task_complete(): Could not update the object!");
}
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index a17790f197..9f0a17c999 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -37,11 +37,9 @@
#include "control-factory.h"
-#define PROPERTY_CALENDAR_URI "folder_uri"
-#define PROPERTY_CALENDAR_URI_IDX 1
+#define PROPERTY_CALENDAR_URI "folder_uri"
-#define PROPERTY_CALENDAR_VIEW "view"
-#define PROPERTY_CALENDAR_VIEW_IDX 2
+#define PROPERTY_CALENDAR_URI_IDX 1
#define CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ControlFactory"
@@ -71,7 +69,7 @@ get_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
GnomeCalendar *gcal = user_data;
- const char *uri;
+ char *uri;
switch (arg_id) {
@@ -80,23 +78,6 @@ get_prop (BonoboPropertyBag *bag,
BONOBO_ARG_SET_STRING (arg, uri);
break;
- case PROPERTY_CALENDAR_VIEW_IDX:
- switch (gnome_calendar_get_view (gcal)) {
- case GNOME_CAL_DAY_VIEW:
- BONOBO_ARG_SET_STRING (arg, "day");
- break;
- case GNOME_CAL_WEEK_VIEW:
- BONOBO_ARG_SET_STRING (arg, "week");
- break;
- case GNOME_CAL_WORK_WEEK_VIEW:
- BONOBO_ARG_SET_STRING (arg, "workweek");
- break;
- case GNOME_CAL_MONTH_VIEW:
- BONOBO_ARG_SET_STRING (arg, "month");
- break;
- }
- break;
-
default:
g_warning ("Unhandled arg %d\n", arg_id);
}
@@ -111,16 +92,15 @@ set_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
GnomeCalendar *gcal = user_data;
- char *string;
- GnomeCalendarViewType view;
+ char *uri;
switch (arg_id) {
case PROPERTY_CALENDAR_URI_IDX:
- string = BONOBO_ARG_GET_STRING (arg);
- if (!gnome_calendar_open (gcal, string)) {
+ uri = BONOBO_ARG_GET_STRING (arg);
+ if (!gnome_calendar_open (gcal, uri)) {
char *msg;
- msg = g_strdup_printf (_("Could not open the folder in '%s'"), string);
+ msg = g_strdup_printf (_("Could not open the folder in '%s'"), uri);
gnome_error_dialog_parented (
msg,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
@@ -128,23 +108,6 @@ set_prop (BonoboPropertyBag *bag,
}
break;
- case PROPERTY_CALENDAR_VIEW_IDX:
- string = BONOBO_ARG_GET_STRING (arg);
- if (!g_strcasecmp (string, "week"))
- view = GNOME_CAL_WEEK_VIEW;
- else if (!g_strcasecmp (string, "workweek"))
- view = GNOME_CAL_WORK_WEEK_VIEW;
- else if (!g_strcasecmp (string, "month"))
- view = GNOME_CAL_MONTH_VIEW;
- else
- view = GNOME_CAL_DAY_VIEW;
-
- /* This doesn't actually work, because the GalView
- * comes along and resets the view. FIXME.
- */
- gnome_calendar_set_view (gcal, view, FALSE, TRUE);
- break;
-
default:
g_warning ("Unhandled arg %d\n", arg_id);
break;
@@ -166,13 +129,6 @@ calendar_properties_init (GnomeCalendar *gcal, BonoboControl *control)
NULL,
_("The URI that the calendar will display"),
0);
- bonobo_property_bag_add (pbag,
- PROPERTY_CALENDAR_VIEW,
- PROPERTY_CALENDAR_VIEW_IDX,
- BONOBO_ARG_STRING,
- NULL,
- _("The type of view to show"),
- 0);
bonobo_control_set_properties (control, pbag);
bonobo_object_unref (BONOBO_OBJECT (pbag));
@@ -203,7 +159,7 @@ control_factory_init (void)
factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, control_factory_fn, NULL);
bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-
+
if (factory == NULL)
g_error ("I could not register a Calendar control factory.");
}
@@ -253,7 +209,6 @@ control_factory_new_control (void)
g_message ("control_factory_fn(): could not create the control!");
return NULL;
}
- gtk_object_set_data (GTK_OBJECT (gcal), "control", control);
calendar_properties_init (gcal, control);
#if 0
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 3e245a0c98..00584c51de 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -26,19 +26,15 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <glib.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock.h>
-#include <libgnomeui/gnome-window-icon.h>
+#include <gnome.h>
+#include <bonobo/bonobo-win.h>
+#include <bonobo/bonobo-ui-component.h>
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>
#include <gal/widgets/e-unicode.h>
-#include <e-util/e-dialog-utils.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-window-icon.h>
#include <evolution-shell-component-utils.h>
#include "../print.h"
#include "save-comp.h"
@@ -60,7 +56,8 @@ struct _CompEditorPrivate {
/* The pages we have */
GList *pages;
- /* UI Component for the dialog */
+ /* Toplevel window for the dialog */
+ GtkWidget *window;
BonoboUIComponent *uic;
/* Notebook to hold the pages */
@@ -70,7 +67,6 @@ struct _CompEditorPrivate {
gboolean changed;
gboolean needs_send;
- gboolean needs_send_new;
gboolean updating;
};
@@ -78,17 +74,16 @@ struct _CompEditorPrivate {
static void comp_editor_class_init (CompEditorClass *class);
static void comp_editor_init (CompEditor *editor);
-static gint comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e);
static void comp_editor_destroy (GtkObject *object);
static void real_set_cal_client (CompEditor *editor, CalClient *client);
static void real_edit_comp (CompEditor *editor, CalComponent *comp);
static void real_send_comp (CompEditor *editor, CalComponentItipMethod method);
-static gboolean prompt_to_save_changes (CompEditor *editor, gboolean send);
static void delete_comp (CompEditor *editor);
static void close_dialog (CompEditor *editor);
static void page_changed_cb (GtkObject *obj, gpointer data);
+static void page_needs_send_cb (GtkObject *obj, gpointer data);
static void page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data);
static void page_dates_changed_cb (GtkObject *obj, CompEditorPageDates *dates, gpointer data);
@@ -137,6 +132,8 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB_END
};
+#define CLASS(page) (COMP_EDITOR_CLASS (GTK_OBJECT (page)->klass))
+
static GtkObjectClass *parent_class;
@@ -158,7 +155,7 @@ comp_editor_get_type (void)
(GtkClassInitFunc) NULL
};
- comp_editor_type = gtk_type_unique (BONOBO_TYPE_WINDOW,
+ comp_editor_type = gtk_type_unique (GTK_TYPE_OBJECT,
&comp_editor_info);
}
@@ -170,18 +167,15 @@ static void
comp_editor_class_init (CompEditorClass *klass)
{
GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- object_class = GTK_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
+ object_class = (GtkObjectClass *) klass;
- parent_class = gtk_type_class (BONOBO_TYPE_WINDOW);
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
klass->set_cal_client = real_set_cal_client;
klass->edit_comp = real_edit_comp;
klass->send_comp = real_send_comp;
- widget_class->key_press_event = comp_editor_key_press_event;
object_class->destroy = comp_editor_destroy;
}
@@ -196,16 +190,15 @@ setup_widgets (CompEditor *editor)
priv = editor->priv;
/* Window and basic vbox */
- bonobo_window_construct (BONOBO_WINDOW (editor),
- "event-editor", "iCalendar Editor");
- gtk_signal_connect (GTK_OBJECT (editor), "delete_event",
+ priv->window = bonobo_window_new ("event-editor", "iCalendar Editor");
+ gtk_signal_connect (GTK_OBJECT (priv->window), "delete_event",
GTK_SIGNAL_FUNC (delete_event_cb), editor);
priv->uic = bonobo_ui_component_new_default ();
container = bonobo_ui_container_new ();
- bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor));
+ bonobo_ui_container_set_win (container, BONOBO_WINDOW (priv->window));
bonobo_ui_component_set_container (priv->uic, BONOBO_OBJREF (container));
- bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (editor)),
+ bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (priv->window)),
"/evolution/UIConf/kvps");
bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor);
@@ -217,7 +210,7 @@ setup_widgets (CompEditor *editor)
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
gtk_widget_show (vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
- bonobo_window_set_contents (BONOBO_WINDOW (editor), vbox);
+ bonobo_window_set_contents (BONOBO_WINDOW (priv->window), vbox);
/* Notebook */
priv->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
@@ -240,23 +233,6 @@ comp_editor_init (CompEditor *editor)
priv->pages = NULL;
priv->changed = FALSE;
priv->needs_send = FALSE;
- priv->needs_send_new = FALSE;
-}
-
-
-static gint
-comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e)
-{
- if (e->keyval == GDK_Escape) {
- if (prompt_to_save_changes (COMP_EDITOR (d), TRUE))
- close_dialog (COMP_EDITOR (d));
- return TRUE;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->key_press_event)
- return (* GTK_WIDGET_CLASS (parent_class)->key_press_event) (d, e);
-
- return FALSE;
}
/* Destroy handler for the calendar component editor */
@@ -272,6 +248,11 @@ comp_editor_destroy (GtkObject *object)
gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), editor);
+ if (priv->window) {
+ gtk_widget_destroy (priv->window);
+ priv->window = NULL;
+ }
+
/* We want to destroy the pages after the widgets get destroyed,
since they have lots of signal handlers connected to the widgets
with the pages as the data. */
@@ -297,7 +278,6 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CalComponent *clone;
GList *l;
- CalClientResult result;
priv = editor->priv;
@@ -317,29 +297,11 @@ save_comp (CompEditor *editor)
priv->updating = TRUE;
- result = cal_client_update_object (priv->client, priv->comp);
- if (result != CAL_CLIENT_RESULT_SUCCESS) {
+ if (!cal_client_update_object (priv->client, priv->comp)) {
GtkWidget *dlg;
- char *msg;
-
- switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
- msg = g_strdup (_("Could not update invalid object"));
- break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
- msg = g_strdup (_("Object not found, not updated"));
- break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
- msg = g_strdup (_("You don't have permissions to update this object"));
- break;
- default :
- msg = g_strdup (_("Could not update object"));
- break;
- }
- dlg = gnome_error_dialog (msg);
+ dlg = gnome_error_dialog (_("Could not update object!"));
gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- g_free (msg);
return FALSE;
} else {
@@ -364,7 +326,7 @@ save_comp_with_send (CompEditor *editor)
if (!save_comp (editor))
return FALSE;
- if (send && send_component_dialog (priv->comp, priv->needs_send_new))
+ if (send && send_component_dialog (priv->comp))
comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST);
return TRUE;
@@ -395,7 +357,7 @@ prompt_to_save_changes (CompEditor *editor, gboolean send)
if (!priv->changed)
return TRUE;
- switch (save_component_dialog (GTK_WINDOW (editor))) {
+ switch (save_component_dialog (GTK_WINDOW (priv->window))) {
case 0: /* Save */
if (send && save_comp_with_send (editor))
return TRUE;
@@ -411,19 +373,6 @@ prompt_to_save_changes (CompEditor *editor, gboolean send)
}
}
-/* This sets the focus to the toplevel, so any field being edited is committed.
- FIXME: In future we may also want to check some of the fields are valid,
- e.g. the EDateEdit fields. */
-static void
-commit_all_fields (CompEditor *editor)
-{
- CompEditorPrivate *priv;
-
- priv = editor->priv;
-
- gtk_window_set_focus (GTK_WINDOW (editor), NULL);
-}
-
/* Closes the dialog box and emits the appropriate signals */
static void
close_dialog (CompEditor *editor)
@@ -432,6 +381,8 @@ close_dialog (CompEditor *editor)
priv = editor->priv;
+ g_assert (priv->window != NULL);
+
gtk_object_destroy (GTK_OBJECT (editor));
}
@@ -587,6 +538,8 @@ comp_editor_append_page (CompEditor *editor,
gtk_notebook_append_page (priv->notebook, page_widget, label_widget);
/* Listen for things happening on the page */
+ gtk_signal_connect (GTK_OBJECT (page), "needs_send",
+ GTK_SIGNAL_FUNC (page_needs_send_cb), editor);
gtk_signal_connect (GTK_OBJECT (page), "changed",
GTK_SIGNAL_FUNC (page_changed_cb), editor);
gtk_signal_connect (GTK_OBJECT (page), "summary_changed",
@@ -782,7 +735,7 @@ set_title_from_comp (CompEditor *editor)
priv = editor->priv;
title = make_title_from_comp (priv->comp);
- gtk_window_set_title (GTK_WINDOW (editor), title);
+ gtk_window_set_title (GTK_WINDOW (priv->window), title);
g_free (title);
}
@@ -794,7 +747,7 @@ set_icon_from_comp (CompEditor *editor)
priv = editor->priv;
file = make_icon_from_comp (priv->comp);
- gnome_window_icon_set_from_file (GTK_WINDOW (editor), file);
+ gnome_window_icon_set_from_file (GTK_WINDOW (priv->window), file);
}
static void
@@ -867,8 +820,6 @@ real_edit_comp (CompEditor *editor, CalComponent *comp)
if (comp)
priv->comp = cal_component_clone (comp);
- priv->needs_send_new = !priv->needs_send;
-
set_title_from_comp (editor);
set_icon_from_comp (editor);
fill_widgets (editor);
@@ -913,19 +864,6 @@ comp_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
CalComponent *
-comp_editor_get_comp (CompEditor *editor)
-{
- CompEditorPrivate *priv;
-
- g_return_val_if_fail (editor != NULL, NULL);
- g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
-
- priv = editor->priv;
-
- return priv->comp;
-}
-
-CalComponent *
comp_editor_get_current_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
@@ -991,23 +929,6 @@ comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
klass->send_comp (editor, method);
}
-gboolean
-comp_editor_close (CompEditor *editor)
-{
- gboolean close;
-
- g_return_val_if_fail (editor != NULL, FALSE);
- g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
-
- commit_all_fields (editor);
-
- close = prompt_to_save_changes (editor, TRUE);
- if (close)
- close_dialog (editor);
-
- return close;
-}
-
/**
* comp_editor_merge_ui:
* @editor:
@@ -1017,10 +938,7 @@ comp_editor_close (CompEditor *editor)
*
**/
void
-comp_editor_merge_ui (CompEditor *editor,
- const char *filename,
- BonoboUIVerb *verbs,
- EPixmap *component_pixmaps)
+comp_editor_merge_ui (CompEditor *editor, const char *filename, BonoboUIVerb *verbs)
{
CompEditorPrivate *priv;
@@ -1031,9 +949,6 @@ comp_editor_merge_ui (CompEditor *editor,
bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, filename, "evolution-calendar");
bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor);
-
- if (component_pixmaps != NULL)
- e_pixmaps_update (priv->uic, component_pixmaps);
}
/**
@@ -1087,8 +1002,21 @@ comp_editor_focus (CompEditor *editor)
priv = editor->priv;
- gtk_widget_show (GTK_WIDGET (editor));
- raise_and_focus (GTK_WIDGET (editor));
+ gtk_widget_show (priv->window);
+ raise_and_focus (priv->window);
+}
+
+/* This sets the focus to the toplevel, so any field being edited is committed.
+ FIXME: In future we may also want to check some of the fields are valid,
+ e.g. the EDateEdit fields. */
+static void
+commit_all_fields (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ gtk_window_set_focus (GTK_WINDOW (priv->window), NULL);
}
/* Menu Commands */
@@ -1114,37 +1042,89 @@ save_close_cmd (GtkWidget *widget, gpointer data)
}
static void
-save_as_cmd (GtkWidget *widget, gpointer data)
+save_as_ok (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
- char *filename;
- char *ical_string;
- FILE *file;
-
+ struct stat s;
+ char *path;
+ int ret = 0;
+
priv = editor->priv;
- commit_all_fields (editor);
+ path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (priv->filesel));
- filename = e_file_dialog_save (_("Save as..."));
- if (filename == NULL)
- return;
-
- ical_string = cal_client_get_component_as_string (priv->client, priv->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
+ if (stat (path, &s) == 0) {
+ GtkWidget *dlg;
+ GtkWidget *text;
+
+ dlg = gnome_dialog_new (_("Overwrite file?"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+ text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4);
+ gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE);
+ gtk_widget_show (text);
+
+ ret = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
}
-
- file = fopen (filename, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- return;
+
+ if (ret == 0) {
+ FILE *file;
+ gchar *ical_string;
+
+ ical_string = cal_client_get_component_as_string (priv->client, priv->comp);
+ if (ical_string == NULL) {
+ g_warning ("Couldn't convert item to a string");
+ gtk_main_quit ();
+ return;
+ }
+
+ file = fopen (path, "w");
+ if (file == NULL) {
+ g_warning ("Couldn't save item");
+ gtk_main_quit ();
+ return;
+ }
+
+ fprintf (file, ical_string);
+ g_free (ical_string);
+ fclose (file);
+
+ gtk_main_quit ();
}
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
+}
+
+static void
+save_as_cmd (GtkWidget *widget, gpointer data)
+{
+ CompEditor *editor = COMP_EDITOR (data);
+ CompEditorPrivate *priv;
+ GtkFileSelection *fs;
+ char *path;
+
+ priv = editor->priv;
+
+ commit_all_fields (editor);
+
+ fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As...")));
+ path = g_strdup_printf ("%s/", g_get_home_dir ());
+ gtk_file_selection_set_filename (fs, path);
+ g_free (path);
+
+ gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
+ GTK_SIGNAL_FUNC (save_as_ok), editor);
+ gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+
+ priv->filesel = GTK_WIDGET (fs);
+ gtk_widget_show (priv->filesel);
+ gtk_grab_add (priv->filesel);
+ gtk_main ();
+
+ gtk_widget_destroy (priv->filesel);
+ priv->filesel = NULL;
}
static void
@@ -1158,7 +1138,7 @@ delete_cmd (GtkWidget *widget, gpointer data)
vtype = cal_component_get_vtype (priv->comp);
- if (delete_component_dialog (priv->comp, FALSE, 1, vtype, GTK_WIDGET (editor)))
+ if (delete_component_dialog (priv->comp, FALSE, 1, vtype, priv->window))
delete_comp (editor);
}
@@ -1221,6 +1201,17 @@ page_changed_cb (GtkObject *obj, gpointer data)
priv->changed = TRUE;
}
+static void
+page_needs_send_cb (GtkObject *obj, gpointer data)
+{
+ CompEditor *editor = COMP_EDITOR (data);
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ priv->needs_send = TRUE;
+}
+
/* Page signal callbacks */
static void
page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data)
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 08c98dfaba..3531ac02d3 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -69,11 +69,6 @@ static void forward_cmd (GtkWidget *widget, gpointer data);
static void model_row_changed_cb (ETableModel *etm, int row, gpointer data);
static void row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data);
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/Toolbar/Actions/ActionScheduleMeeting", "schedule-meeting-24.png"),
- E_PIXMAP_END
-};
-
static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ActionScheduleMeeting", schedule_meeting_cmd),
BONOBO_UI_UNSAFE_VERB ("ActionRefreshMeeting", refresh_meeting_cmd),
@@ -211,7 +206,7 @@ event_editor_init (EventEditor *ee)
COMP_EDITOR_PAGE (priv->meet_page),
_("Meeting"));
- comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs, pixmaps);
+ comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs);
priv->meeting_shown = TRUE;
priv->existing_org = FALSE;
@@ -358,8 +353,9 @@ event_editor_new (void)
}
static void
-show_meeting (EventEditor *ee)
+schedule_meeting_cmd (GtkWidget *widget, gpointer data)
{
+ EventEditor *ee = EVENT_EDITOR (data);
EventEditorPrivate *priv;
priv = ee->priv;
@@ -382,24 +378,6 @@ show_meeting (EventEditor *ee)
COMP_EDITOR_PAGE (priv->meet_page));
}
-void
-event_editor_show_meeting (EventEditor *ee)
-{
- g_return_if_fail (ee != NULL);
- g_return_if_fail (IS_EVENT_EDITOR (ee));
-
-
- show_meeting (ee);
-}
-
-static void
-schedule_meeting_cmd (GtkWidget *widget, gpointer data)
-{
- EventEditor *ee = EVENT_EDITOR (data);
-
- show_meeting (ee);
-}
-
static void
refresh_meeting_cmd (GtkWidget *widget, gpointer data)
{
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 2504ed3993..7333380195 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -698,12 +698,14 @@ enum {
static EPopupMenu context_menu[] = {
#if 0
- E_POPUP_ITEM (N_("_Delegate To..."), GTK_SIGNAL_FUNC (popup_delegate_cb), CAN_DELEGATE),
+ { N_("_Delegate To..."), NULL,
+ GTK_SIGNAL_FUNC (popup_delegate_cb),NULL, CAN_DELEGATE },
E_POPUP_SEPARATOR,
#endif
- E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (popup_delete_cb), CAN_DELETE),
+ { N_("_Delete"), GNOME_STOCK_MENU_TRASH,
+ GTK_SIGNAL_FUNC (popup_delete_cb), NULL, CAN_DELETE },
E_POPUP_TERMINATOR
};
@@ -721,10 +723,7 @@ right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer da
view_row = e_table_model_to_view_row (etable, row);
priv->row = e_meeting_model_etable_view_to_model_row (etable, priv->model, view_row);
-
- /* FIXME: if you enable Delegate, then change index to '1' */
- context_menu[0].pixmap_widget = gnome_stock_new_with_icon (GNOME_STOCK_MENU_TRASH);
-
+
menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, data);
e_auto_kill_popup_menu_on_hide (menu);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index e3acaaf13a..c5c4d61826 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -42,7 +42,7 @@ struct _TaskEditorPrivate {
EMeetingModel *model;
- gboolean assignment_shown;
+ gboolean meeting_shown;
gboolean existing_org;
gboolean updating;
};
@@ -134,7 +134,7 @@ set_menu_sens (TaskEditor *te)
priv = te->priv;
- sens = priv->assignment_shown;
+ sens = priv->meeting_shown;
comp_editor_set_ui_prop (COMP_EDITOR (te),
"/commands/ActionAssignTask",
"sensitive", sens ? "0" : "1");
@@ -189,9 +189,9 @@ task_editor_init (TaskEditor *te)
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
- comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL);
+ comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs);
- priv->assignment_shown = TRUE;
+ priv->meeting_shown = TRUE;
priv->existing_org = FALSE;
priv->updating = FALSE;
@@ -217,11 +217,11 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_remove_all_attendees (priv->model);
if (attendees == NULL) {
comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page));
- priv->assignment_shown = FALSE;
+ priv->meeting_shown = FALSE;
} else {
GSList *l;
- if (!priv->assignment_shown)
+ if (!priv->meeting_shown)
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
@@ -233,12 +233,12 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_add_attendee (priv->model, ia);
gtk_object_unref (GTK_OBJECT (ia));
}
- priv->assignment_shown = TRUE;
+ priv->meeting_shown = TRUE;
}
cal_component_free_attendee_list (attendees);
set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
priv->updating = FALSE;
@@ -312,44 +312,27 @@ task_editor_new (void)
}
static void
-show_assignment (TaskEditor *te)
+assign_task_cmd (GtkWidget *widget, gpointer data)
{
+ TaskEditor *te = TASK_EDITOR (data);
TaskEditorPrivate *priv;
priv = te->priv;
- if (!priv->assignment_shown) {
+ if (!priv->meeting_shown) {
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
- priv->assignment_shown = TRUE;
+ priv->meeting_shown = TRUE;
set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
- comp_editor_set_changed (COMP_EDITOR (te), TRUE);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
}
comp_editor_show_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page));
}
-void
-task_editor_show_assignment (TaskEditor *te)
-{
- g_return_if_fail (te != NULL);
- g_return_if_fail (IS_TASK_EDITOR (te));
-
- show_assignment (te);
-}
-
-static void
-assign_task_cmd (GtkWidget *widget, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
-
- show_assignment (te);
-}
-
static void
refresh_task_cmd (GtkWidget *widget, gpointer data)
{
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index d305190352..fc03a044c1 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -41,19 +41,15 @@
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkwindow.h>
#include <gal/e-text/e-text.h>
+#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-canvas-utils.h>
-#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-exec.h>
-#include <libgnome/gnome-util.h>
-#include <e-util/e-dialog-utils.h>
#include "cal-util/timeutil.h"
#include "dialogs/delete-comp.h"
#include "dialogs/send-comp.h"
-#include "print.h"
#include "comp-util.h"
#include "itip-utils.h"
#include "calendar-commands.h"
@@ -335,32 +331,12 @@ static void e_day_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_day_view_on_new_event (GtkWidget *widget,
gpointer data);
-static void e_day_view_on_new_meeting (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_new_task (GtkWidget *widget,
- gpointer data);
static void e_day_view_on_goto_today (GtkWidget *widget,
gpointer data);
static void e_day_view_on_goto_date (GtkWidget *widget,
gpointer data);
static void e_day_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
-static void e_day_view_on_save_as (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_print (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_print_event (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_meeting (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_forward (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_publish (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_settings (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_pilot_settings (GtkWidget *widget,
- gpointer data);
static void e_day_view_on_delete_occurrence (GtkWidget *widget,
gpointer data);
static void e_day_view_on_delete_appointment (GtkWidget *widget,
@@ -2945,7 +2921,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
&dtend);
gnome_calendar_new_appointment_for (day_view->calendar,
dtstart, dtend,
- TRUE, FALSE);
+ TRUE);
return TRUE;
}
@@ -3079,7 +3055,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
&dtend);
gnome_calendar_new_appointment_for (day_view->calendar,
dtstart, dtend,
- FALSE, FALSE);
+ FALSE);
return TRUE;
}
@@ -3515,7 +3491,7 @@ e_day_view_on_event_double_click (EDayView *day_view,
gtk_signal_disconnect (GTK_OBJECT (event->comp), id);
if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
+ gnome_calendar_edit_object (day_view->calendar, event->comp);
else
g_warning ("Calendar not set");
}
@@ -3546,88 +3522,57 @@ enum {
};
static EPopupMenu main_items [] = {
- E_POPUP_ITEM (N_("New _Appointment"),
- e_day_view_on_new_appointment, 0),
- E_POPUP_ITEM (N_("New All Day _Event"),
- e_day_view_on_new_event, 0),
- E_POPUP_ITEM (N_("New Meeting"),
- e_day_view_on_new_meeting, 0),
- E_POPUP_ITEM (N_("New Task"),
- e_day_view_on_new_task, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Print..."),
- e_day_view_on_print, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Paste"),
- e_day_view_on_paste, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_SUBMENU (N_("Current View"), NULL, 0),
-
- E_POPUP_ITEM (N_("Go to _Today"),
- e_day_view_on_goto_today, 0),
- E_POPUP_ITEM (N_("_Go to Date..."),
- e_day_view_on_goto_date, 0),
+ { N_("New _Appointment"), NULL,
+ e_day_view_on_new_appointment, NULL, 0 },
+ { N_("New All Day _Event"), NULL,
+ e_day_view_on_new_event, NULL, 0 },
- E_POPUP_SEPARATOR,
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_ITEM (N_("_Publish Free/Busy Information"),
- e_day_view_on_publish, 0),
+ { N_("_Paste"), NULL,
+ e_day_view_on_paste, NULL, 0 },
- E_POPUP_SEPARATOR,
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_ITEM (N_("_Configure..."),
- e_day_view_on_settings, 0),
- E_POPUP_ITEM (N_("_Configure Pilot..."),
- e_day_view_on_pilot_settings, 0),
+ { N_("Go to _Today"), NULL,
+ e_day_view_on_goto_today, NULL, 0 },
+ { N_("_Go to Date..."), NULL,
+ e_day_view_on_goto_date, NULL, 0 },
- E_POPUP_TERMINATOR
+ { NULL, NULL, NULL, NULL, 0 }
};
static EPopupMenu child_items [] = {
-
- E_POPUP_ITEM (N_("_Open"), e_day_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Save As..."), e_day_view_on_save_as, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Print..."), e_day_view_on_print_event, MASK_EDITABLE | MASK_EDITING),
+ { N_("_Open"), NULL,
+ e_day_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("_Delete this Appointment"), NULL,
+ e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
/* Only show this separator if one of the above is shown. */
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("C_ut"), e_day_view_on_cut, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Copy"), e_day_view_on_copy, 0),
- E_POPUP_ITEM (N_("_Paste"), e_day_view_on_paste, 0),
+ { "", NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Schedule Meeting..."), e_day_view_on_meeting, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_day_view_on_forward, MASK_EDITABLE | MASK_EDITING),
-
- E_POPUP_SEPARATOR,
+ { N_("C_ut"), NULL,
+ e_day_view_on_cut, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("_Copy"), NULL,
+ e_day_view_on_copy, NULL, 0 },
+ { N_("_Paste"), NULL,
+ e_day_view_on_paste, NULL, 0 },
- E_POPUP_ITEM (N_("_Delete"), e_day_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_day_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete this _Occurrence"), e_day_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete _All Occurrences"), e_day_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING),
-
- E_POPUP_TERMINATOR
-};
-static void
-free_view_popup (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view = E_DAY_VIEW (data);
-
- if (day_view->view_menu == NULL)
- return;
+ /*
+ * The following are only shown if this is a recurring event
+ */
+ { "", NULL, NULL, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Make this Occurrence _Movable"), NULL,
+ e_day_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete this _Occurrence"), NULL,
+ e_day_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete _All Occurrences"), NULL,
+ e_day_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING },
- gnome_calendar_discard_view_popup (day_view->calendar, day_view->view_menu);
- day_view->view_menu = NULL;
-}
+ { NULL, NULL, NULL, NULL, 0 }
+};
static void
e_day_view_on_event_right_click (EDayView *day_view,
@@ -3639,7 +3584,6 @@ e_day_view_on_event_right_click (EDayView *day_view,
int have_selection;
gboolean being_edited;
EPopupMenu *context_menu;
- GtkMenu *popup;
int hide_mask = 0;
int disable_mask = 0;
@@ -3655,11 +3599,9 @@ e_day_view_on_event_right_click (EDayView *day_view,
have_selection = GTK_WIDGET_HAS_FOCUS (day_view)
&& day_view->selection_start_day != -1;
- if (event_num == -1) {
- day_view->view_menu = gnome_calendar_setup_view_popup (day_view->calendar);
- main_items[9].submenu = day_view->view_menu;
+ if (event_num == -1)
context_menu = main_items;
- } else {
+ else {
context_menu = child_items;
if (day == E_DAY_VIEW_LONG_EVENT)
@@ -3680,11 +3622,8 @@ e_day_view_on_event_right_click (EDayView *day_view,
day_view->popup_event_day = day;
day_view->popup_event_num = event_num;
-
- popup = e_popup_menu_create (context_menu, disable_mask, hide_mask, day_view);
- gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
- GTK_SIGNAL_FUNC (free_view_popup), day_view);
- e_popup_menu (popup, (GdkEvent *) bevent);
+
+ e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, day_view);
}
static void
@@ -3714,7 +3653,7 @@ e_day_view_on_new_appointment (GtkWidget *widget, gpointer data)
}
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, FALSE, FALSE);
+ day_view->calendar, dtstart, dtend, FALSE);
}
static void
@@ -3725,45 +3664,7 @@ e_day_view_on_new_event (GtkWidget *widget, gpointer data)
e_day_view_get_selected_time_range (day_view, &dtstart, &dtend);
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, TRUE, FALSE);
-}
-
-static void
-e_day_view_on_new_meeting (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view = E_DAY_VIEW (data);
- time_t dtstart, dtend;
- struct icaltimetype itt;
-
- /* Edit a new event. If only one day is selected in the top canvas,
- we set the time to the first 1/2-hour of the working day. */
- if (day_view->selection_in_top_canvas
- && day_view->selection_start_day != -1
- && day_view->selection_start_day == day_view->selection_end_day) {
- dtstart = day_view->day_starts[day_view->selection_start_day];
- itt = icaltime_from_timet_with_zone (dtstart, FALSE,
- day_view->zone);
- itt.hour = calendar_config_get_day_start_hour ();
- itt.minute = calendar_config_get_day_start_minute ();
- dtstart = icaltime_as_timet_with_zone (itt, day_view->zone);
-
- icaltime_adjust (&itt, 0, 0, 30, 0);
- dtend = icaltime_as_timet_with_zone (itt, day_view->zone);
- } else {
- e_day_view_get_selected_time_range (day_view, &dtstart,
- &dtend);
- }
-
- gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, FALSE, TRUE);
-}
-
-static void
-e_day_view_on_new_task (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view = E_DAY_VIEW (data);
-
- gnome_calendar_new_task (day_view->calendar);
+ day_view->calendar, dtstart, dtend, TRUE);
}
static void
@@ -3795,188 +3696,11 @@ e_day_view_on_edit_appointment (GtkWidget *widget, gpointer data)
return;
if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
+ gnome_calendar_edit_object (day_view->calendar, event->comp);
else
g_warning ("Calendar not set");
}
-static void
-e_day_view_on_save_as (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
- char *filename;
- char *ical_string;
- FILE *file;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- filename = e_file_dialog_save (_("Save as..."));
- if (filename == NULL)
- return;
-
- ical_string = cal_client_get_component_as_string (day_view->client, event->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
- }
-
- file = fopen (filename, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- return;
- }
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
-}
-
-static void
-e_day_view_on_print (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- time_t start;
- GnomeCalendarViewType view_type;
- PrintView print_view;
-
- day_view = E_DAY_VIEW (data);
-
- gnome_calendar_get_current_time_range (day_view->calendar, &start, NULL);
- view_type = gnome_calendar_get_view (day_view->calendar);
-
- switch (view_type) {
- case GNOME_CAL_DAY_VIEW:
- print_view = PRINT_VIEW_DAY;
- break;
-
- case GNOME_CAL_WORK_WEEK_VIEW:
- print_view = PRINT_VIEW_WEEK;
- break;
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- print_calendar (day_view->calendar, FALSE, start, print_view);
-}
-
-static void
-e_day_view_on_print_event (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- print_comp (event->comp, day_view->client, FALSE);
-}
-
-static void
-e_day_view_on_meeting (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, TRUE);
- else
- g_warning ("Calendar not set");
-}
-
-static void
-e_day_view_on_forward (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp,
- day_view->client, NULL);
-}
-
-static void
-e_day_view_on_publish (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- icaltimezone *utc;
- time_t start = time (NULL), end;
- GList *comp_list;
-
- day_view = E_DAY_VIEW (data);
-
- utc = icaltimezone_get_utc_timezone ();
- start = time_day_begin_with_zone (start, utc);
- end = time_add_week_with_zone (start, 6, utc);
-
- comp_list = cal_client_get_free_busy (day_view->client, NULL, start, end);
- if (comp_list) {
- GList *l;
-
- for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
- day_view->client, NULL);
-
- gtk_object_unref (GTK_OBJECT (comp));
- }
-
- g_list_free (comp_list);
- }
-}
-
-static void
-e_day_view_on_settings (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
-
- day_view = E_DAY_VIEW (data);
-
- control_util_show_settings (day_view->calendar);
-}
-
-static void
-e_day_view_on_pilot_settings (GtkWidget *widget, gpointer data)
-{
- char *args[] = {
- "gpilotd-control-applet",
- NULL
- };
- int pid;
-
- args[0] = gnome_is_program_in_path ("gpilotd-control-applet");
- if (!args[0]) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("The GNOME Pilot tools do not appear to be installed on this system."));
- return;
- }
-
- pid = gnome_execute_async (NULL, 4, args);
- if (pid == -1)
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Error executing %s."), args[0]);
-
- g_free (args[0]);
-}
static void
e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
@@ -3996,7 +3720,7 @@ e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
comp = cal_component_clone (event->comp);
cal_comp_util_add_exdate (comp, event->start, day_view->zone);
- if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (day_view->client, comp))
g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
@@ -4172,12 +3896,12 @@ e_day_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
/* Now update both CalComponents. Note that we do this last since at
* present the updates happen synchronously so our event may disappear.
*/
- if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (day_view->client, comp))
g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
- if (cal_client_update_object (day_view->client, new_comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (day_view->client, new_comp))
g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (new_comp));
@@ -4712,8 +4436,8 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
- if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
+ if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_finish_long_event_resize(): Could not update the object!");
@@ -4773,8 +4497,8 @@ e_day_view_finish_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
- if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
+ if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_finish_resize(): Could not update the object!");
@@ -6116,10 +5840,9 @@ e_day_view_on_editing_stopped (EDayView *day_view,
summary.altrep = NULL;
cal_component_set_summary (event->comp, &summary);
- if (cal_client_update_object (day_view->client, event->comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp,
- day_view->client, NULL);
+ if (cal_client_update_object (day_view->client, event->comp)) {
+ if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp, day_view->client, NULL);
} else {
g_message ("e_day_view_on_editing_stopped(): Could not update the object!");
}
@@ -7165,11 +6888,9 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_client_update_object (day_view->client, comp)
- == CAL_CLIENT_RESULT_SUCCESS) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- day_view->client, NULL);
+ if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_on_top_canvas_drag_data_received(): Could "
"not update the object!");
@@ -7279,11 +7000,9 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_client_update_object (day_view->client, comp)
- == CAL_CLIENT_RESULT_SUCCESS) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- day_view->client, NULL);
+ if (cal_client_update_object (day_view->client, comp)) {
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_on_main_canvas_drag_data_received(): "
"Could not update the object!");
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 75be4d098d..73b7bdff04 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -37,7 +37,6 @@
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <bonobo/bonobo-exception.h>
#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-unicode.h>
#include <gtkhtml/gtkhtml.h>
@@ -48,8 +47,6 @@
#include <cal-client/cal-client.h>
#include <e-util/e-time-utils.h>
#include <e-util/e-dialog-widgets.h>
-#include <evolution-shell-client.h>
-#include <evolution-folder-selector-button.h>
#include "calendar-config.h"
#include "itip-utils.h"
#include "e-itip-control.h"
@@ -63,11 +60,9 @@ struct _EItipControlPrivate {
GtkWidget *prev;
#endif
- GPtrArray *event_clients;
CalClient *event_client;
- GPtrArray *task_clients;
CalClient *task_client;
-
+
char *vcalendar;
CalComponent *comp;
icalcomponent *main_comp;
@@ -122,11 +117,6 @@ struct _EItipControlPrivate {
<input TYPE=Submit name=\"ok\" value=\"OK\"></form>"
#endif
-extern EvolutionShellClient *global_shell_client;
-
-static const char *calendar_types[] = { "calendar", NULL };
-static const char *tasks_types[] = { "tasks", NULL };
-
static void class_init (EItipControlClass *klass);
static void init (EItipControl *itip);
static void destroy (GtkObject *obj);
@@ -136,7 +126,6 @@ static void prev_clicked_cb (GtkWidget *widget, gpointer data);
static void next_clicked_cb (GtkWidget *widget, gpointer data);
#endif
static void url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpointer data);
-static gboolean object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data);
static void ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar *encoding, gpointer data);
static GtkVBoxClass *parent_class = NULL;
@@ -196,35 +185,10 @@ start_calendar_server_cb (CalClient *cal_client,
}
static CalClient *
-start_calendar_server (char *uri)
-{
- CalClient *client;
- gboolean success = FALSE;
-
- client = cal_client_new ();
-
- gtk_signal_connect (GTK_OBJECT (client), "cal_opened",
- start_calendar_server_cb, &success);
-
- cal_client_open_calendar (client, uri, TRUE);
-
- /* run a sub event loop to turn cal-client's async load
- notification into a synchronous call */
- gtk_main ();
-
- if (success)
- return client;
-
- gtk_object_unref (GTK_OBJECT (client));
-
- return NULL;
-}
-
-static CalClient *
-start_default_server (gboolean tasks)
+start_calendar_server (gboolean tasks)
{
CalClient *client;
- gboolean success = FALSE;
+ gboolean success;
client = cal_client_new ();
@@ -238,7 +202,7 @@ start_default_server (gboolean tasks)
if (!cal_client_open_default_calendar (client, FALSE))
goto error;
}
-
+
/* run a sub event loop to turn cal-client's async load
notification into a synchronous call */
gtk_main ();
@@ -252,88 +216,6 @@ start_default_server (gboolean tasks)
return NULL;
}
-static GPtrArray *
-get_servers (EvolutionShellClient *shell_client, const char *possible_types[], gboolean tasks)
-{
- GNOME_Evolution_StorageRegistry registry;
- GNOME_Evolution_StorageRegistry_StorageList *storage_list;
- GPtrArray *servers;
- int i, j, k;
- CORBA_Environment ev;
-
- servers = g_ptr_array_new ();
-
- bonobo_object_ref (BONOBO_OBJECT (shell_client));
- registry = evolution_shell_client_get_storage_registry_interface (shell_client);
-
- CORBA_exception_init (&ev);
- storage_list = GNOME_Evolution_StorageRegistry_getStorageList (registry, &ev);
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return servers;
- }
-
- for (i = 0; i < storage_list->_length; i++) {
- GNOME_Evolution_Storage storage;
- GNOME_Evolution_FolderList *folder_list;
-
- storage = storage_list->_buffer[i];
- folder_list = GNOME_Evolution_Storage__get_folderList (storage, &ev);
-
- for (j = 0; j < folder_list->_length; j++) {
- GNOME_Evolution_Folder folder;
-
- folder = folder_list->_buffer[j];
- for (k = 0; possible_types[k] != NULL; k++) {
- CalClient *client;
- char *uri;
-
- if (strcmp (possible_types[k], folder.type))
- continue;
-
- uri = cal_util_expand_uri (folder.physicalUri, tasks);
- client = start_calendar_server (uri);
- if (client != NULL)
- g_ptr_array_add (servers, client);
- g_free (uri);
-
- break;
- }
- }
-
- CORBA_free (folder_list);
- }
-
- bonobo_object_unref (BONOBO_OBJECT (shell_client));
-
- return servers;
-}
-
-static CalClient *
-find_server (GPtrArray *servers, CalComponent *comp)
-{
- const char *uid;
- int i;
-
- cal_component_get_uid (comp, &uid);
- for (i = 0; i < servers->len; i++) {
- CalClient *client;
- CalComponent *found_comp;
- CalClientGetStatus status;
-
- client = g_ptr_array_index (servers, i);
- status = cal_client_get_object (client, uid, &found_comp);
- if (status == CAL_CLIENT_GET_SUCCESS) {
- gtk_object_unref (GTK_OBJECT (found_comp));
- gtk_object_ref (GTK_OBJECT (client));
-
- return client;
- }
- }
-
- return NULL;
-}
-
static void
init (EItipControl *itip)
{
@@ -367,15 +249,19 @@ init (EItipControl *itip)
#endif
/* Get the cal clients */
- priv->event_clients = get_servers (global_shell_client, calendar_types, FALSE);
- priv->event_client = NULL;
- priv->task_clients = get_servers (global_shell_client, tasks_types, TRUE);
- priv->task_client = NULL;
-
+ priv->event_client = start_calendar_server (FALSE);
+ if (priv->event_client == NULL)
+ g_warning ("Unable to start calendar client");
+
+ priv->task_client = start_calendar_server (TRUE);
+ if (priv->task_client == NULL)
+ g_warning ("Unable to start calendar client");
+
/* Html Widget */
priv->html = gtk_html_new ();
gtk_html_set_default_content_type (GTK_HTML (priv->html),
"text/html; charset=utf-8");
+
gtk_widget_show (priv->html);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -390,9 +276,6 @@ init (EItipControl *itip)
gtk_signal_connect (GTK_OBJECT (priv->html), "url_requested",
url_requested_cb, itip);
- gtk_signal_connect (GTK_OBJECT (priv->html), "object_requested",
- GTK_SIGNAL_FUNC (object_requested_cb),
- itip);
gtk_signal_connect (GTK_OBJECT (priv->html), "submit",
ok_clicked_cb, itip);
@@ -432,8 +315,7 @@ destroy (GtkObject *obj)
{
EItipControl *itip = E_ITIP_CONTROL (obj);
EItipControlPrivate *priv;
- int i;
-
+
priv = itip->priv;
clean_up (itip);
@@ -441,12 +323,8 @@ destroy (GtkObject *obj)
itip_addresses_free (priv->addresses);
priv->addresses = NULL;
- for (i = 0; i < priv->event_clients->len; i++)
- gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->event_clients, i)));
- g_ptr_array_free (priv->event_clients, TRUE);
- for (i = 0; i < priv->task_clients->len; i++)
- gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->task_clients, i)));
- g_ptr_array_free (priv->task_clients, TRUE);
+ gtk_object_unref (GTK_OBJECT (priv->event_client));
+ gtk_object_unref (GTK_OBJECT (priv->task_client));
g_free (priv);
@@ -939,12 +817,9 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
gtk_html_write (GTK_HTML (priv->html), html_stream, HTML_SEP, strlen (HTML_SEP));
/* Options */
- if (options != NULL) {
- const_html = "</td></tr><tr><td valign=\"center\">";
- gtk_html_write (GTK_HTML (priv->html), html_stream, const_html, strlen (const_html));
+ if (options != NULL)
gtk_html_write (GTK_HTML (priv->html), html_stream, options, strlen (options));
- }
-
+
const_html = "</td></tr></table>";
gtk_html_write (GTK_HTML (priv->html), html_stream, const_html, strlen(const_html));
@@ -958,11 +833,9 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
static char*
-get_publish_options (gboolean selector)
+get_publish_options ()
{
- char *html;
-
- html = g_strdup_printf ("<form><b>%s</b>&nbsp"
+ return g_strdup_printf ("<form><b>%s</b>&nbsp"
"<select NAME=\"action\" SIZE=\"1\"> "
"<option VALUE=\"U\">%s</option>"
"</select>&nbsp &nbsp "
@@ -971,24 +844,12 @@ get_publish_options (gboolean selector)
U_("Choose an action:"),
U_("Update"),
U_("OK"));
-
- if (selector) {
- char *sel;
-
- sel = g_strconcat (html, "<object classid=\"gtk:label\">", NULL);
- g_free (html);
- html = sel;
- }
-
- return html;
}
static char*
-get_request_options (gboolean selector)
+get_request_options ()
{
- char *html;
-
- html = g_strdup_printf ("<form><b>%s</b>&nbsp"
+ return g_strdup_printf ("<form><b>%s</b>&nbsp"
"<select NAME=\"action\" SIZE=\"1\"> "
"<option VALUE=\"A\">%s</option> "
"<option VALUE=\"T\">%s</option> "
@@ -1002,16 +863,6 @@ get_request_options (gboolean selector)
U_("Decline"),
U_("RSVP"),
U_("OK"));
-
- if (selector) {
- char *sel;
-
- sel = g_strconcat (html, "<object classid=\"gtk:label\">", NULL);
- g_free (html);
- html = sel;
- }
-
- return html;
}
static char*
@@ -1073,7 +924,7 @@ get_real_item (EItipControl *itip)
EItipControlPrivate *priv;
CalComponent *comp;
CalComponentVType type;
- CalClientGetStatus status = CAL_CLIENT_GET_NOT_FOUND;
+ CalClientGetStatus status;
const char *uid;
priv = itip->priv;
@@ -1083,12 +934,10 @@ get_real_item (EItipControl *itip)
switch (type) {
case CAL_COMPONENT_EVENT:
- if (priv->event_client != NULL)
- status = cal_client_get_object (priv->event_client, uid, &comp);
+ status = cal_client_get_object (priv->event_client, uid, &comp);
break;
case CAL_COMPONENT_TODO:
- if (priv->task_client != NULL)
- status = cal_client_get_object (priv->task_client, uid, &comp);
+ status = cal_client_get_object (priv->task_client, uid, &comp);
break;
default:
status = CAL_CLIENT_GET_NOT_FOUND;
@@ -1110,23 +959,21 @@ show_current_event (EItipControl *itip)
priv = itip->priv;
- priv->event_client = find_server (priv->event_clients, priv->comp);
-
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
itip_desc = U_("<b>%s</b> has published meeting information.");
itip_title = U_("Meeting Information");
- options = get_publish_options (priv->event_client ? FALSE : TRUE);
+ options = get_publish_options ();
break;
case ICAL_METHOD_REQUEST:
itip_desc = U_("<b>%s</b> requests your presence at a meeting.");
itip_title = U_("Meeting Proposal");
- options = get_request_options (priv->event_client ? FALSE : TRUE);
+ options = get_request_options ();
break;
case ICAL_METHOD_ADD:
itip_desc = U_("<b>%s</b> wishes to add to an existing meeting.");
itip_title = U_("Meeting Update");
- options = get_publish_options (priv->event_client ? FALSE : TRUE);
+ options = get_publish_options ();
break;
case ICAL_METHOD_REFRESH:
itip_desc = U_("<b>%s</b> wishes to receive the latest meeting information.");
@@ -1182,23 +1029,21 @@ show_current_todo (EItipControl *itip)
priv = itip->priv;
- priv->task_client = find_server (priv->task_clients, priv->comp);
-
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
itip_desc = U_("<b>%s</b> has published task information.");
itip_title = U_("Task Information");
- options = get_publish_options (priv->task_client ? FALSE : TRUE);
+ options = get_publish_options ();
break;
case ICAL_METHOD_REQUEST:
itip_desc = U_("<b>%s</b> requests you perform a task.");
itip_title = U_("Task Proposal");
- options = get_request_options (priv->task_client ? FALSE : TRUE);
+ options = get_request_options ();
break;
case ICAL_METHOD_ADD:
itip_desc = U_("<b>%s</b> wishes to add to an existing task.");
itip_title = U_("Task Update");
- options = get_publish_options (priv->task_client ? FALSE : TRUE);
+ options = get_publish_options ();
break;
case ICAL_METHOD_REFRESH:
itip_desc = U_("<b>%s</b> wishes to receive the latest task information.");
@@ -1334,12 +1179,6 @@ show_current (EItipControl *itip)
if (priv->comp)
gtk_object_unref (GTK_OBJECT (priv->comp));
- if (priv->event_client != NULL)
- gtk_object_unref (GTK_OBJECT (priv->event_client));
- priv->event_client = NULL;
- if (priv->task_client != NULL)
- gtk_object_unref (GTK_OBJECT (priv->task_client));
- priv->task_client = NULL;
/* Strip out alarms for security purposes */
alarm_iter = icalcomponent_begin_component (priv->ical_comp, ICAL_VALARM_COMPONENT);
@@ -1548,7 +1387,6 @@ update_item (EItipControl *itip)
CalClient *client;
CalComponentVType type;
GtkWidget *dialog;
- CalClientResult result;
priv = itip->priv;
@@ -1561,27 +1399,10 @@ update_item (EItipControl *itip)
clone = icalcomponent_new_clone (priv->ical_comp);
icalcomponent_add_component (priv->top_level, clone);
- result = cal_client_update_objects (client, priv->top_level);
- switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
- dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
- break;
- case CAL_CLIENT_RESULT_CORBA_ERROR :
- dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n"));
- break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
- dialog = gnome_warning_dialog (_("Object could not be found\n"));
- break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
- dialog = gnome_warning_dialog (_("You don't have permissions to update the calendar\n"));
- break;
- case CAL_CLIENT_RESULT_SUCCESS :
- dialog = gnome_ok_dialog (_("Update complete\n"));
- break;
- default :
+ if (!cal_client_update_objects (client, priv->top_level))
dialog = gnome_warning_dialog (_("Calendar file could not be updated!\n"));
- break;
- }
+ else
+ dialog = gnome_ok_dialog (_("Update complete\n"));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
icalcomponent_remove_component (priv->top_level, clone);
@@ -1593,11 +1414,10 @@ update_attendee_status (EItipControl *itip)
EItipControlPrivate *priv;
CalClient *client;
CalClientGetStatus status;
- CalComponent *comp = NULL;
+ CalComponent *comp;
CalComponentVType type;
const char *uid;
GtkWidget *dialog;
- CalClientResult result;
priv = itip->priv;
@@ -1607,12 +1427,6 @@ update_attendee_status (EItipControl *itip)
else
client = priv->event_client;
- if (client == NULL) {
- dialog = gnome_warning_dialog (_("Attendee status can not be updated "
- "because the item no longer exists"));
- goto cleanup;
- }
-
/* Obtain our version */
cal_component_get_uid (priv->comp, &uid);
status = cal_client_get_object (client, uid, &comp);
@@ -1629,10 +1443,11 @@ update_attendee_status (EItipControl *itip)
itip_strip_mailto (a->value));
if (prop == NULL) {
- dialog = gnome_question_dialog_modal (_("This response is not from a current "
+ dialog = gnome_question_dialog_modal (_("This response is not from a current"
"attendee. Add as an attendee?"),
NULL, NULL);
if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == GNOME_YES) {
+ icalparameter *param;
change_status (cal_component_get_icalcomponent (comp),
itip_strip_mailto (a->value),
a->status);
@@ -1653,34 +1468,17 @@ update_attendee_status (EItipControl *itip)
}
}
- result = cal_client_update_object (client, comp);
- switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
- dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
- break;
- case CAL_CLIENT_RESULT_CORBA_ERROR :
- dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n"));
- break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
- dialog = gnome_warning_dialog (_("Object could not be found\n"));
- break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
- dialog = gnome_warning_dialog (_("You don't have permissions to update the calendar\n"));
- break;
- case CAL_CLIENT_RESULT_SUCCESS :
- dialog = gnome_ok_dialog (_("Attendee status updated\n"));
- break;
- default :
+ if (!cal_client_update_object (client, comp))
dialog = gnome_warning_dialog (_("Attendee status could not be updated!\n"));
- }
+ else
+ dialog = gnome_ok_dialog (_("Attendee status updated\n"));
} else {
dialog = gnome_warning_dialog (_("Attendee status can not be updated "
"because the item no longer exists"));
}
cleanup:
- if (comp != NULL)
- gtk_object_unref (GTK_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
@@ -1701,11 +1499,8 @@ remove_item (EItipControl *itip)
else
client = priv->event_client;
- if (client == NULL)
- return;
-
cal_component_get_uid (priv->comp, &uid);
- if (cal_client_remove_object (client, uid) == CAL_CLIENT_RESULT_SUCCESS) {
+ if (cal_client_remove_object (client, uid)) {
dialog = gnome_ok_dialog (_("Removal Complete"));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
@@ -1826,28 +1621,6 @@ next_clicked_cb (GtkWidget *widget, gpointer data)
#endif
static void
-button_selected_cb (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *folder, gpointer data)
-{
- EItipControl *itip = E_ITIP_CONTROL (data);
- EItipControlPrivate *priv;
- CalComponentVType type;
- char *uri;
-
- priv = itip->priv;
-
- type = cal_component_get_vtype (priv->comp);
- if (type == CAL_COMPONENT_TODO)
- uri = cal_util_expand_uri (folder->physicalUri, TRUE);
- else
- uri = cal_util_expand_uri (folder->physicalUri, FALSE);
-
- gtk_object_unref (GTK_OBJECT (priv->event_client));
- priv->event_client = start_calendar_server (uri);
-
- g_free (uri);
-}
-
-static void
url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpointer data)
{ unsigned char buffer[4096];
int len, fd;
@@ -1878,46 +1651,6 @@ url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpoint
g_free (path);
}
-static gboolean
-object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
-{
- EItipControl *itip = E_ITIP_CONTROL (data);
- EItipControlPrivate *priv;
- GtkWidget *button;
- CalComponentVType vtype;
-
- priv = itip->priv;
-
- vtype = cal_component_get_vtype (priv->comp);
-
- switch (vtype) {
- case CAL_COMPONENT_EVENT:
- button = evolution_folder_selector_button_new (
- global_shell_client, _("Select Calendar Folder"),
- calendar_config_default_calendar_folder (),
- calendar_types);
- priv->event_client = start_default_server (FALSE);
- break;
- case CAL_COMPONENT_TODO:
- button = evolution_folder_selector_button_new (
- global_shell_client, _("Select Tasks Folder"),
- calendar_config_default_tasks_folder (),
- tasks_types);
- priv->task_client = start_default_server (TRUE);
- break;
- default:
- button = NULL;
- }
-
- gtk_signal_connect (GTK_OBJECT (button), "selected",
- button_selected_cb, itip);
-
- gtk_container_add (GTK_CONTAINER (eb), button);
- gtk_widget_show (button);
-
- return TRUE;
-}
-
static void
ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar *encoding, gpointer data)
{
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index 6adfb9c1c9..d9f648879d 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -690,23 +690,23 @@ destroy (GtkObject *obj)
gtk_object_unref (GTK_OBJECT (priv->client));
if (priv->ebook != NULL)
- gtk_object_unref (GTK_OBJECT (priv->ebook));
+ gtk_object_unref (GTK_OBJECT (priv->ebook));
if (priv->corba_select_names != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
+ CORBA_Environment ev;
CORBA_exception_init (&ev);
bonobo_object_release_unref (priv->corba_select_names, &ev);
CORBA_exception_free (&ev);
- }
+ }
- while (priv->refresh_queue->len > 0)
- refresh_queue_remove (im, g_ptr_array_index (priv->refresh_queue, 0));
- g_ptr_array_free (priv->refresh_queue, TRUE);
- g_hash_table_destroy (priv->refresh_data);
-
- if (priv->refresh_idle_id)
- g_source_remove (priv->refresh_idle_id);
-
+ while (priv->refresh_queue->len > 0)
+ refresh_queue_remove (im, g_ptr_array_index (priv->refresh_queue, 0));
+ g_ptr_array_free (priv->refresh_queue, TRUE);
+ g_hash_table_destroy (priv->refresh_data);
+
+ if (priv->refresh_idle_id)
+ g_source_remove (priv->refresh_idle_id);
+
g_free (priv);
}
@@ -1252,20 +1252,22 @@ process_free_busy_comp (EMeetingAttendee *ia,
static void
process_free_busy (EMeetingModelQueueData *qdata, char *text)
{
- EMeetingModel *im = qdata->im;
- EMeetingModelPrivate *priv;
- EMeetingAttendee *ia = qdata->ia;
+ EMeetingModel *im = qdata->im;
+ EMeetingModelPrivate *priv;
+ EMeetingAttendee *ia = qdata->ia;
icalcomponent *main_comp;
icalcomponent_kind kind = ICAL_NO_COMPONENT;
priv = im->priv;
main_comp = icalparser_parse_string (text);
- if (main_comp == NULL) {
- process_callbacks (qdata);
- return;
- }
-
+ if (main_comp == NULL) {
+ process_callbacks (qdata);
+ return;
+ }
+
+ e_meeting_attendee_set_has_calendar_info (ia, TRUE);
+
kind = icalcomponent_isa (main_comp);
if (kind == ICAL_VCALENDAR_COMPONENT) {
icalcompiter iter;
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index db00d2f8f3..7510ef897f 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -26,7 +26,7 @@
#include <gnome.h>
#include <gal/util/e-util.h>
#include <gal/e-table/e-table-scrolled.h>
-#include <gal/menus/gal-view-instance.h>
+#include <gal/menus/gal-view-collection.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
#include "e-util/e-url.h"
@@ -47,16 +47,15 @@ static GList *all_tasks = NULL;
struct _ETasksPrivate {
/* The calendar client object we monitor */
CalClient *client;
- CalQuery *query;
-
+
/* The ECalendarTable showing the tasks. */
GtkWidget *tasks_view;
/* Calendar search bar for tasks */
GtkWidget *search_bar;
- /* View instance and the view menus handler */
- GalViewInstance *view_instance;
+ /* View collection and the view menus handler */
+ GalViewCollection *view_collection;
GalViewMenus *view_menus;
};
@@ -121,10 +120,10 @@ e_tasks_init (ETasks *tasks)
priv = g_new0 (ETasksPrivate, 1);
tasks->priv = priv;
- priv->client = NULL;
- priv->query = NULL;
- priv->view_instance = NULL;
+ priv->view_collection = NULL;
priv->view_menus = NULL;
+
+ setup_widgets (tasks);
}
/* Callback used when the selection changes in the table. */
@@ -242,8 +241,6 @@ e_tasks_construct (ETasks *tasks)
priv = tasks->priv;
- setup_widgets (tasks);
-
priv->client = cal_client_new ();
if (!priv->client)
return NULL;
@@ -281,17 +278,6 @@ e_tasks_new (void)
}
-void
-e_tasks_set_ui_component (ETasks *tasks,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_TASKS (tasks));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (tasks->priv->search_bar), ui_component);
-}
-
-
static void
e_tasks_destroy (GtkObject *object)
{
@@ -325,17 +311,6 @@ e_tasks_destroy (GtkObject *object)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
-static void
-set_status_message (ETasks *tasks, const char *message)
-{
- ETasksPrivate *priv;
- CalendarModel *model;
-
- priv = tasks->priv;
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- calendar_model_set_status_message (model, message);
-}
gboolean
e_tasks_open (ETasks *tasks,
@@ -360,7 +335,9 @@ e_tasks_open (ETasks *tasks,
real_uri = g_strdup (file);
message = g_strdup_printf (_("Opening tasks at %s"), real_uri);
- set_status_message (tasks, message);
+ calendar_model_set_status_message (
+ e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view)),
+ message);
g_free (message);
if (!cal_client_open_calendar (priv->client, real_uri, FALSE)) {
@@ -406,17 +383,6 @@ method_error (ETasks *tasks,
g_free (msg);
}
-/* Displays an error to indicate permission problems */
-static void
-permission_error (ETasks *tasks, const char *uri)
-{
- char *msg;
-
- msg = g_strdup_printf (_("You don't have permission to open the folder in `%s'"), uri);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
- g_free (msg);
-}
-
/* Callback from the calendar client when a calendar is opened */
static void
cal_opened_cb (CalClient *client,
@@ -431,7 +397,8 @@ cal_opened_cb (CalClient *client,
tasks = E_TASKS (data);
priv = tasks->priv;
- set_status_message (tasks, NULL);
+ calendar_model_set_status_message (
+ e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view)), NULL);
switch (status) {
case CAL_CLIENT_OPEN_SUCCESS:
@@ -457,10 +424,6 @@ cal_opened_cb (CalClient *client,
method_error (tasks, cal_client_get_uri (client));
break;
- case CAL_CLIENT_OPEN_PERMISSION_DENIED:
- permission_error (tasks, cal_client_get_uri (client));
- break;
-
default:
g_assert_not_reached ();
}
@@ -537,30 +500,6 @@ e_tasks_new_task (ETasks *tasks)
}
/**
- * e_tasks_complete_selected:
- * @tasks: A tasks control widget
- *
- * Marks the selected tasks complete
- **/
-void
-e_tasks_complete_selected (ETasks *tasks)
-{
- ETasksPrivate *priv;
- ECalendarTable *cal_table;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- cal_table = E_CALENDAR_TABLE (priv->tasks_view);
-
- set_status_message (tasks, _("Completing tasks..."));
- e_calendar_table_complete_selected (cal_table);
- set_status_message (tasks, NULL);
-}
-
-/**
* e_tasks_delete_selected:
* @tasks: A tasks control widget.
*
@@ -578,120 +517,12 @@ e_tasks_delete_selected (ETasks *tasks)
priv = tasks->priv;
cal_table = E_CALENDAR_TABLE (priv->tasks_view);
- set_status_message (tasks, _("Deleting selected objects..."));
e_calendar_table_delete_selected (cal_table);
- set_status_message (tasks, NULL);
-}
-
-static char *
-create_sexp (void)
-{
- char *sexp;
-
- sexp = g_strdup ("(and (= (get-vtype) \"VTODO\") (is-completed?))");
-#if 0
- g_print ("Calendar model sexp:\n%s\n", sexp);
-#endif
-
- return sexp;
-}
-
-/* Callback used when a component is updated in the live query */
-static void
-query_obj_updated_cb (CalQuery *query, const char *uid,
- gboolean query_in_progress, int n_scanned, int total,
- gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- cal_client_remove_object (priv->client, uid);
-}
-
-/* Callback used when an evaluation error occurs when running a query */
-static void
-query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- g_warning ("eval error: %s\n", error_str);
-
- set_status_message (tasks, NULL);
-
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->query), tasks);
- gtk_object_unref (GTK_OBJECT (priv->query));
- priv->query = NULL;
-}
-
-static void
-query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- if (status != CAL_QUERY_DONE_SUCCESS)
- g_warning ("query done: %s\n", error_str);
-
- set_status_message (tasks, NULL);
-
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->query), tasks);
- gtk_object_unref (GTK_OBJECT (priv->query));
- priv->query = NULL;
-}
-/**
- * e_tasks_expunge:
- * @tasks: A tasks control widget
- *
- * Removes all tasks marked as completed
- **/
-void
-e_tasks_delete_completed (ETasks *tasks)
-{
- ETasksPrivate *priv;
- char *sexp;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- /* If we have a query, we are already expunging */
- if (priv->query)
- return;
-
- sexp = create_sexp ();
-
- set_status_message (tasks, _("Expunging"));
- priv->query = cal_client_get_query (priv->client, sexp);
- g_free (sexp);
-
- if (!priv->query) {
- set_status_message (tasks, NULL);
- g_message ("update_query(): Could not create the query");
- return;
- }
-
- gtk_signal_connect (GTK_OBJECT (priv->query), "obj_updated",
- GTK_SIGNAL_FUNC (query_obj_updated_cb), tasks);
- gtk_signal_connect (GTK_OBJECT (priv->query), "query_done",
- GTK_SIGNAL_FUNC (query_query_done_cb), tasks);
- gtk_signal_connect (GTK_OBJECT (priv->query), "eval_error",
- GTK_SIGNAL_FUNC (query_eval_error_cb), tasks);
}
/* Callback used from the view collection when we need to display a new view */
static void
-display_view_cb (GalViewInstance *instance, GalView *view, gpointer data)
+display_view_cb (GalViewCollection *collection, GalView *view, gpointer data)
{
ETasks *tasks;
@@ -719,7 +550,6 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
GalViewFactory *factory;
ETableSpecification *spec;
char *dir;
- static GalViewCollection *collection = NULL;
g_return_if_fail (tasks != NULL);
g_return_if_fail (E_IS_TASKS (tasks));
@@ -728,45 +558,40 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
priv = tasks->priv;
- g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_collection == NULL);
- g_assert (priv->view_instance == NULL);
+ g_assert (priv->view_collection == NULL);
g_assert (priv->view_menus == NULL);
- /* Create the view instance */
-
- if (collection == NULL) {
- collection = gal_view_collection_new ();
+ /* Create the view collection */
- dir = gnome_util_prepend_user_home ("/evolution/views/tasks/");
- gal_view_collection_set_storage_directories (collection,
- EVOLUTION_DATADIR "/evolution/views/tasks/",
- dir);
- g_free (dir);
+ priv->view_collection = gal_view_collection_new ();
- /* Create the views */
+ dir = gnome_util_prepend_user_home ("/evolution/views/tasks/");
+ gal_view_collection_set_storage_directories (priv->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/tasks/",
+ dir);
+ g_free (dir);
- spec = e_table_specification_new ();
- e_table_specification_load_from_file (spec,
- EVOLUTION_ETSPECDIR "/e-calendar-table.etspec");
+ /* Create the views */
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
+ spec = e_table_specification_new ();
+ e_table_specification_load_from_file (spec,
+ EVOLUTION_ETSPECDIR "/e-calendar-table.etspec");
- /* Load the collection and create the menus */
+ factory = gal_view_factory_etable_new (spec);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (priv->view_collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
- gal_view_collection_load (collection);
- }
+ /* Load the collection and create the menus */
- priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
+ gal_view_collection_load (priv->view_collection);
- priv->view_menus = gal_view_menus_new (priv->view_instance);
+ priv->view_menus = gal_view_menus_new (priv->view_collection);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gtk_signal_connect (GTK_OBJECT (priv->view_instance), "display_view",
+ gtk_signal_connect (GTK_OBJECT (priv->view_collection), "display_view",
GTK_SIGNAL_FUNC (display_view_cb), tasks);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), tasks);
}
/**
@@ -787,13 +612,13 @@ e_tasks_discard_view_menus (ETasks *tasks)
priv = tasks->priv;
- g_return_if_fail (priv->view_instance != NULL);
+ g_return_if_fail (priv->view_collection != NULL);
- g_assert (priv->view_instance != NULL);
+ g_assert (priv->view_collection != NULL);
g_assert (priv->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (priv->view_instance));
- priv->view_instance = NULL;
+ gtk_object_unref (GTK_OBJECT (priv->view_collection));
+ priv->view_collection = NULL;
gtk_object_unref (GTK_OBJECT (priv->view_menus));
priv->view_menus = NULL;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 514558cc58..797e277827 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -41,16 +41,12 @@
#include <gtk/gtkmain.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-exec.h>
-#include <libgnome/gnome-util.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
#include <gal/e-text/e-text.h>
+#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-canvas-utils.h>
-#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
-#include <e-util/e-dialog-utils.h>
#include "dialogs/delete-comp.h"
#include "dialogs/send-comp.h"
#include "comp-util.h"
@@ -58,7 +54,6 @@
#include "cal-util/timeutil.h"
#include "calendar-commands.h"
#include "calendar-config.h"
-#include "print.h"
#include "goto.h"
#include "e-week-view-event-item.h"
#include "e-week-view-layout.h"
@@ -179,32 +174,12 @@ static void e_week_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_week_view_on_new_event (GtkWidget *widget,
gpointer data);
-static void e_week_view_on_new_meeting (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_new_task (GtkWidget *widget,
- gpointer data);
static void e_week_view_on_goto_today (GtkWidget *widget,
gpointer data);
static void e_week_view_on_goto_date (GtkWidget *widget,
gpointer data);
static void e_week_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
-static void e_week_view_on_save_as (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_print (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_print_event (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_meeting (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_forward (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_publish (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_settings (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_pilot_settings (GtkWidget *widget,
- gpointer data);
static void e_week_view_on_delete_occurrence (GtkWidget *widget,
gpointer data);
static void e_week_view_on_delete_appointment (GtkWidget *widget,
@@ -618,10 +593,6 @@ e_week_view_realize (GtkWidget *widget)
week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].green = 65535;
week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].blue = 65535;
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY].red = 65535;
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY].green = 0;
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY].blue = 0;
-
nfailed = gdk_colormap_alloc_colors (colormap, week_view->colors,
E_WEEK_VIEW_COLOR_LAST, FALSE,
TRUE, success);
@@ -2162,7 +2133,7 @@ e_week_view_on_button_press (GtkWidget *widget,
dtend = week_view->day_starts[day + 1];
gnome_calendar_new_appointment_for (week_view->calendar,
dtstart, dtend,
- TRUE, FALSE);
+ TRUE);
return TRUE;
}
@@ -2998,7 +2969,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
if (week_view->calendar)
gnome_calendar_edit_object (week_view->calendar,
- event->comp, FALSE);
+ event->comp);
else
g_warning ("Calendar not set");
@@ -3216,10 +3187,9 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
summary.altrep = NULL;
cal_component_set_summary (event->comp, &summary);
- if (cal_client_update_object (week_view->client, event->comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp,
- week_view->client, NULL);
+ if (cal_client_update_object (week_view->client, event->comp)) {
+ if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp, week_view->client, NULL);
} else {
g_message ("e_week_view_on_editing_stopped(): Could not update the object!");
}
@@ -3435,77 +3405,63 @@ enum {
};
static EPopupMenu main_items [] = {
- E_POPUP_ITEM (N_("New _Appointment..."), e_week_view_on_new_appointment, 0),
- E_POPUP_ITEM (N_("New All Day _Event"), e_week_view_on_new_event, 0),
- E_POPUP_ITEM (N_("New Meeting"), e_week_view_on_new_meeting, 0),
- E_POPUP_ITEM (N_("New Task"), e_week_view_on_new_task, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print, 0),
-
- E_POPUP_SEPARATOR,
+ { N_("New _Appointment..."), NULL,
+ e_week_view_on_new_appointment, NULL, 0 },
+ { N_("New All Day _Event"), NULL,
+ e_week_view_on_new_event, NULL, 0 },
- E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0),
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_SEPARATOR,
+ { N_("_Paste"), NULL,
+ e_week_view_on_paste, NULL, 0 },
- E_POPUP_SUBMENU (N_("Current View"), NULL, 0),
-
- E_POPUP_ITEM (N_("Go to _Today"), e_week_view_on_goto_today, 0),
- E_POPUP_ITEM (N_("_Go to Date..."), e_week_view_on_goto_date, 0),
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Publish Free/Busy Information"), e_week_view_on_publish, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Configure..."), e_week_view_on_settings, 0),
- E_POPUP_ITEM (N_("_Configure Pilot..."), e_week_view_on_pilot_settings, 0),
-
- E_POPUP_TERMINATOR
+ { N_("Go to _Today"), NULL,
+ e_week_view_on_goto_today, NULL, 0 },
+ { N_("_Go to Date..."), NULL,
+ e_week_view_on_goto_date, NULL, 0 },
+ { NULL, NULL, NULL, NULL, 0 }
};
static EPopupMenu child_items [] = {
- E_POPUP_ITEM (N_("_Open"), e_week_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Save As..."), e_week_view_on_save_as, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print_event, MASK_EDITABLE | MASK_EDITING),
+ { N_("_Open"), NULL,
+ e_week_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("_Delete this Appointment"), NULL,
+ e_week_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
/* Only show this separator if one of the above is shown. */
- E_POPUP_SEPARATOR,
+ { "", NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
- E_POPUP_ITEM (N_("C_ut"), e_week_view_on_cut, MASK_EDITING | MASK_EDITABLE),
- E_POPUP_ITEM (N_("_Copy"), e_week_view_on_copy, MASK_EDITING | MASK_EDITABLE),
- E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0),
- E_POPUP_SEPARATOR,
+ { N_("C_ut"), NULL,
+ e_week_view_on_cut, NULL, MASK_EDITING | MASK_EDITABLE },
+ { N_("_Copy"), NULL,
+ e_week_view_on_copy, NULL, MASK_EDITING | MASK_EDITABLE },
+ { N_("_Paste"), NULL,
+ e_week_view_on_paste, NULL, 0 },
- E_POPUP_ITEM (N_("_Schedule Meeting..."), e_week_view_on_meeting, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_week_view_on_forward, MASK_EDITABLE | MASK_EDITING),
+ { "", NULL, NULL, NULL, 0},
- E_POPUP_SEPARATOR,
+ { N_("New _Appointment..."), NULL,
+ e_week_view_on_new_appointment, NULL, 0 },
- E_POPUP_ITEM (N_("_Delete this Appointment"), e_week_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_week_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete this _Occurrence"), e_week_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete _All Occurrences"), e_week_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING),
+ { "", NULL, NULL, NULL, MASK_SINGLE },
- E_POPUP_TERMINATOR
+ /*
+ * The following are only shown if this is a recurring event
+ */
+ { "", NULL, NULL, NULL, MASK_SINGLE},
+ { N_("Make this Occurrence _Movable"), NULL,
+ e_week_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete this _Occurrence"), NULL,
+ e_week_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete _All Occurrences"), NULL,
+ e_week_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+
+ { NULL, NULL, NULL, NULL, 0 }
};
-static void
-free_view_popup (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view = E_WEEK_VIEW (data);
-
- if (week_view->view_menu == NULL)
- return;
-
- gnome_calendar_discard_view_popup (week_view->calendar, week_view->view_menu);
- week_view->view_menu = NULL;
-}
-
void
e_week_view_show_popup_menu (EWeekView *week_view,
GdkEventButton *bevent,
@@ -3516,8 +3472,7 @@ e_week_view_show_popup_menu (EWeekView *week_view,
gboolean being_edited;
guint32 disable_mask = 0, hide_mask = 0;
EPopupMenu *context_menu;
- GtkMenu *popup;
-
+
have_selection = GTK_WIDGET_HAS_FOCUS (week_view)
&& week_view->selection_start_day != -1;
@@ -3529,8 +3484,6 @@ e_week_view_show_popup_menu (EWeekView *week_view,
being_edited = FALSE;
if (event_num == -1) {
- week_view->view_menu = gnome_calendar_setup_view_popup (week_view->calendar);
- main_items[9].submenu = week_view->view_menu;
context_menu = main_items;
} else {
context_menu = child_items;
@@ -3546,10 +3499,7 @@ e_week_view_show_popup_menu (EWeekView *week_view,
disable_mask |= MASK_EDITING;
week_view->popup_event_num = event_num;
- popup = e_popup_menu_create (context_menu, disable_mask, hide_mask, week_view);
- gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
- GTK_SIGNAL_FUNC (free_view_popup), week_view);
- e_popup_menu (popup, (GdkEvent *) bevent);
+ e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, week_view);
}
static void
@@ -3577,7 +3527,7 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data)
}
gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, FALSE, FALSE);
+ week_view->calendar, dtstart, dtend, FALSE);
}
static void
@@ -3589,41 +3539,7 @@ e_week_view_on_new_event (GtkWidget *widget, gpointer data)
dtstart = week_view->day_starts[week_view->selection_start_day];
dtend = week_view->day_starts[week_view->selection_end_day + 1];
gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, TRUE, FALSE);
-}
-
-static void
-e_week_view_on_new_meeting (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view = E_WEEK_VIEW (data);
- time_t dtstart, dtend;
- struct icaltimetype itt;
-
- if (week_view->selection_start_day == week_view->selection_end_day) {
- dtstart = week_view->day_starts[week_view->selection_start_day];
- itt = icaltime_from_timet_with_zone (dtstart, FALSE,
- week_view->zone);
- itt.hour = calendar_config_get_day_start_hour ();
- itt.minute = calendar_config_get_day_start_minute ();
- dtstart = icaltime_as_timet_with_zone (itt, week_view->zone);
-
- icaltime_adjust (&itt, 0, 0, 30, 0);
- dtend = icaltime_as_timet_with_zone (itt, week_view->zone);
- } else {
- dtstart = week_view->day_starts[week_view->selection_start_day];
- dtend = week_view->day_starts[week_view->selection_end_day + 1];
- }
-
- gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, FALSE, TRUE);
-}
-
-static void
-e_week_view_on_new_task (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view = E_WEEK_VIEW (data);
-
- gnome_calendar_new_task (week_view->calendar);
+ week_view->calendar, dtstart, dtend, TRUE);
}
static void
@@ -3657,197 +3573,11 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
week_view->popup_event_num);
if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp,
- FALSE);
- else
- g_warning ("Calendar not set");
-}
-
-static void
-e_week_view_on_print (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- time_t start;
- GnomeCalendarViewType view_type;
- PrintView print_view;
-
- week_view = E_WEEK_VIEW (data);
-
- gnome_calendar_get_current_time_range (week_view->calendar, &start, NULL);
- view_type = gnome_calendar_get_view (week_view->calendar);
-
- switch (view_type) {
- case GNOME_CAL_WEEK_VIEW:
- print_view = PRINT_VIEW_WEEK;
- break;
-
- case GNOME_CAL_MONTH_VIEW:
- print_view = PRINT_VIEW_MONTH;
- break;
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- print_calendar (week_view->calendar, FALSE, start, print_view);
-}
-
-static void
-e_week_view_on_save_as (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
- char *filename;
- char *ical_string;
- FILE *file;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- filename = e_file_dialog_save (_("Save as..."));
- if (filename == NULL)
- return;
-
- ical_string = cal_client_get_component_as_string (week_view->client, event->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
- }
-
- file = fopen (filename, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- return;
- }
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
-}
-
-static void
-e_week_view_on_print_event (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- print_comp (event->comp, week_view->client, FALSE);
-}
-
-static void
-e_week_view_on_meeting (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp, TRUE);
+ gnome_calendar_edit_object (week_view->calendar, event->comp);
else
g_warning ("Calendar not set");
}
-static void
-e_week_view_on_forward (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp,
- week_view->client, NULL);
-}
-
-static void
-e_week_view_on_publish (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- icaltimezone *utc;
- time_t start = time (NULL), end;
- GList *comp_list;
-
- week_view = E_WEEK_VIEW (data);
-
- utc = icaltimezone_get_utc_timezone ();
- start = time_day_begin_with_zone (start, utc);
- end = time_add_week_with_zone (start, 6, utc);
-
- comp_list = cal_client_get_free_busy (week_view->client, NULL, start, end);
- if (comp_list) {
- GList *l;
-
- for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
- week_view->client, NULL);
-
- gtk_object_unref (GTK_OBJECT (comp));
- }
-
- g_list_free (comp_list);
- }
-}
-
-static void
-e_week_view_on_settings (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
-
- week_view = E_WEEK_VIEW (data);
-
- control_util_show_settings (week_view->calendar);
-}
-
-static void
-e_week_view_on_pilot_settings (GtkWidget *widget, gpointer data)
-{
- char *args[] = {
- "gpilotd-control-applet",
- NULL
- };
- int pid;
-
- args[0] = gnome_is_program_in_path ("gpilotd-control-applet");
- if (!args[0]) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("The GNOME Pilot tools do not appear to be installed on this system."));
- return;
- }
-
- pid = gnome_execute_async (NULL, 4, args);
- if (pid == -1)
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Error executing %s."), args[0]);
-
- g_free (args[0]);
-}
static void
e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
@@ -3870,7 +3600,7 @@ e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
comp = cal_component_clone (event->comp);
cal_comp_util_add_exdate (comp, event->start, week_view->zone);
- if (cal_client_update_object (week_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (week_view->client, comp))
g_message ("e_week_view_on_delete_occurrence(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
@@ -4030,12 +3760,12 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
/* Now update both CalComponents. Note that we do this last since at
present the updates happen synchronously so our event may disappear.
*/
- if (cal_client_update_object (week_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (week_view->client, comp))
g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (comp));
- if (cal_client_update_object (week_view->client, new_comp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (!cal_client_update_object (week_view->client, new_comp))
g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
gtk_object_unref (GTK_OBJECT (new_comp));
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 67b84575c0..44e3b2b840 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -35,13 +35,11 @@
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <liboaf/liboaf.h>
-#include <bonobo/bonobo-exception.h>
#include <gal/e-paned/e-hpaned.h>
#include <gal/e-paned/e-vpaned.h>
#include "e-util/e-url.h"
#include <cal-util/timeutil.h>
#include "widgets/menus/gal-view-menus.h"
-#include "e-comp-editor-registry.h"
#include "dialogs/event-editor.h"
#include "dialogs/task-editor.h"
#include "comp-util.h"
@@ -57,8 +55,6 @@
#include "calendar-view-factory.h"
#include "tag-calendar.h"
-extern ECompEditorRegistry *comp_editor_registry;
-
/* Private part of the GnomeCalendar structure */
@@ -87,6 +83,9 @@ struct _GnomeCalendarPrivate {
* Fields for the calendar view
*/
+ /* Mapping of component UIDs to event editors */
+ GHashTable *object_editor_hash;
+
/* This is the last selection explicitly selected by the user. We try
to keep it the same when we switch views, but we may have to alter
it depending on the view (e.g. the week views only select days, so
@@ -130,10 +129,15 @@ struct _GnomeCalendarPrivate {
/* The signal handler id for our GtkCalendar "day_selected" handler. */
guint day_selected_id;
- /* View instance and menus for the control */
- GalViewInstance *view_instance;
+ /* View collection and menus for the control */
+ GalViewCollection *view_collection;
GalViewMenus *view_menus;
+ /* Whether we are being destroyed and should not mess with the object
+ * editor hash table.
+ */
+ guint in_destroy : 1;
+
/* Our current timezone. */
icaltimezone *zone;
@@ -638,7 +642,13 @@ get_current_time (ECalendarItem *calitem, gpointer data)
cal->priv->zone);
/* Now copy it to the struct tm and return it. */
- tmp_tm = icaltimetype_to_tm (&tt);
+ tmp_tm.tm_year = tt.year - 1900;
+ tmp_tm.tm_mon = tt.month - 1;
+ tmp_tm.tm_mday = tt.day;
+ tmp_tm.tm_hour = tt.hour;
+ tmp_tm.tm_min = tt.minute;
+ tmp_tm.tm_sec = tt.second;
+ tmp_tm.tm_isdst = -1;
return tmp_tm;
}
@@ -900,6 +910,8 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->cal_categories = NULL;
priv->tasks_categories = NULL;
+ priv->object_editor_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
priv->current_view_type = GNOME_CAL_DAY_VIEW;
priv->range_selected = FALSE;
@@ -911,7 +923,7 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->zone);
priv->selection_end_time = time_add_day_with_zone (priv->selection_start_time, 1, priv->zone);
- priv->view_instance = NULL;
+ priv->view_collection = NULL;
priv->view_menus = NULL;
priv->visible_start = -1;
@@ -933,6 +945,16 @@ free_categories (GPtrArray *categories)
g_ptr_array_free (categories, TRUE);
}
+/* Used from g_hash_table_foreach(); frees an UID string */
+static void
+destroy_editor_cb (gpointer key, gpointer value, gpointer data)
+{
+ EventEditor *ee;
+
+ ee = EVENT_EDITOR (value);
+ gtk_object_unref (GTK_OBJECT (ee));
+}
+
static void
gnome_calendar_destroy (GtkObject *object)
{
@@ -978,9 +1000,14 @@ gnome_calendar_destroy (GtkObject *object)
priv->task_pad_client = NULL;
}
- if (priv->view_instance) {
- gtk_object_unref (GTK_OBJECT (priv->view_instance));
- priv->view_instance = NULL;
+ priv->in_destroy = TRUE;
+ g_hash_table_foreach (priv->object_editor_hash, destroy_editor_cb, NULL);
+ g_hash_table_destroy (priv->object_editor_hash);
+ priv->object_editor_hash = NULL;
+
+ if (priv->view_collection) {
+ gtk_object_unref (GTK_OBJECT (priv->view_collection));
+ priv->view_collection = NULL;
}
if (priv->view_menus) {
@@ -1215,8 +1242,7 @@ set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
GnomeCalendarPrivate *priv;
gboolean round_selection;
GtkWidget *focus_widget;
- const char *view_id;
-
+
priv = gcal->priv;
round_selection = FALSE;
@@ -1224,27 +1250,23 @@ set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
switch (view_type) {
case GNOME_CAL_DAY_VIEW:
- view_id = "Day_View";
focus_widget = priv->day_view;
-
+
if (!range_selected)
e_day_view_set_days_shown (E_DAY_VIEW (priv->day_view), 1);
break;
case GNOME_CAL_WORK_WEEK_VIEW:
- view_id = "Work_Week_View";
focus_widget = priv->work_week_view;
break;
case GNOME_CAL_WEEK_VIEW:
- view_id = "Week_View";
focus_widget = priv->week_view;
round_selection = TRUE;
break;
case GNOME_CAL_MONTH_VIEW:
- view_id = "Month_View";
focus_widget = priv->month_view;
if (!range_selected)
@@ -1267,7 +1289,6 @@ set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
calendar_config_set_default_view (view_type);
gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), (int) view_type);
- gal_view_instance_set_current_view_id (priv->view_instance, view_id);
if (grab_focus)
gtk_widget_grab_focus (focus_widget);
@@ -1310,7 +1331,7 @@ gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
/* Callback used when the view collection asks us to display a particular view */
static void
-display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data)
+display_view_cb (GalViewCollection *view_collection, GalView *view, gpointer data)
{
GnomeCalendar *gcal;
CalendarView *cal_view;
@@ -1340,7 +1361,6 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
GnomeCalendarPrivate *priv;
char *path;
CalendarViewFactory *factory;
- static GalViewCollection *collection = NULL;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
@@ -1349,54 +1369,47 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
priv = gcal->priv;
- g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_collection == NULL);
- g_assert (priv->view_instance == NULL);
+ g_assert (priv->view_collection == NULL);
g_assert (priv->view_menus == NULL);
- /* Create the view instance */
+ /* Create the view collection */
- if (collection == NULL) {
- collection = gal_view_collection_new ();
+ priv->view_collection = gal_view_collection_new ();
- path = gnome_util_prepend_user_home ("/evolution/views/calendar/");
- gal_view_collection_set_storage_directories (collection,
- EVOLUTION_DATADIR "/evolution/views/calendar/",
- path);
- g_free (path);
+ path = gnome_util_prepend_user_home ("/evolution/views/calendar/");
+ gal_view_collection_set_storage_directories (priv->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/calendar/",
+ path);
+ g_free (path);
- /* Create the views */
+ /* Create the views */
- factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- /* Load the collection and create the menus */
+ /* Load the collection and create the menus */
- gal_view_collection_load (collection);
- }
-
- priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
+ gal_view_collection_load (priv->view_collection);
- priv->view_menus = gal_view_menus_new (priv->view_instance);
+ priv->view_menus = gal_view_menus_new (priv->view_collection);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gnome_calendar_set_view (gcal, priv->current_view_type, TRUE, FALSE);
-
- gtk_signal_connect (GTK_OBJECT (priv->view_instance), "display_view",
+ gtk_signal_connect (GTK_OBJECT (priv->view_collection), "display_view",
GTK_SIGNAL_FUNC (display_view_cb), gcal);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), gcal);
}
/**
@@ -1416,50 +1429,18 @@ gnome_calendar_discard_view_menus (GnomeCalendar *gcal)
priv = gcal->priv;
- g_return_if_fail (priv->view_instance != NULL);
+ g_return_if_fail (priv->view_collection != NULL);
- g_assert (priv->view_instance != NULL);
+ g_assert (priv->view_collection != NULL);
g_assert (priv->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (priv->view_instance));
- priv->view_instance = NULL;
+ gtk_object_unref (GTK_OBJECT (priv->view_collection));
+ priv->view_collection = NULL;
gtk_object_unref (GTK_OBJECT (priv->view_menus));
priv->view_menus = NULL;
}
-EPopupMenu *
-gnome_calendar_setup_view_popup (GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
-
- g_return_val_if_fail (gcal != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- priv = gcal->priv;
-
- g_return_val_if_fail (priv->view_instance != NULL, NULL);
-
- return gal_view_instance_get_popup_menu (priv->view_instance);
-}
-
-void
-gnome_calendar_discard_view_popup (GnomeCalendar *gcal, EPopupMenu *popup)
-{
-
-
- GnomeCalendarPrivate *priv;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- priv = gcal->priv;
-
- g_return_if_fail (priv->view_instance != NULL);
-
- gal_view_instance_free_popup_menu (priv->view_instance, popup);
-}
-
static void
gnome_calendar_set_pane_positions (GnomeCalendar *gcal)
{
@@ -1531,17 +1512,6 @@ method_error (GnomeCalendar *gcal, const char *uri)
g_free (msg);
}
-/* Displays an error to indicate permission problems */
-static void
-permission_error (GnomeCalendar *gcal, const char *uri)
-{
- char *msg;
-
- msg = g_strdup_printf (_("You don't have permission to open the folder in `%s'"), uri);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
- g_free (msg);
-}
-
/* Callback from the calendar client when a calendar is loaded */
static void
client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
@@ -1580,10 +1550,6 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da
method_error (gcal, cal_client_get_uri (client));
break;
- case CAL_CLIENT_OPEN_PERMISSION_DENIED :
- permission_error (gcal, cal_client_get_uri (client));
- break;
-
default:
g_assert_not_reached ();
return;
@@ -1780,16 +1746,6 @@ gnome_calendar_new (void)
return GTK_WIDGET (gcal);
}
-void
-gnome_calendar_set_ui_component (GnomeCalendar *gcal,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (gcal->priv->search_bar), ui_component);
-}
-
/**
* gnome_calendar_get_cal_client:
* @gcal: A calendar view.
@@ -1845,7 +1801,7 @@ add_alarms (const char *uri)
CORBA_exception_init (&ev);
an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
- if (BONOBO_EX (&ev)) {
+ if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("add_alarms(): Could not activate the alarm notification service");
CORBA_exception_free (&ev);
return;
@@ -1857,13 +1813,18 @@ add_alarms (const char *uri)
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_AlarmNotify_addCalendar (an, uri, &ev);
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI))
- g_message ("add_calendar(): Invalid URI reported from the "
- "alarm notification service");
- else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError))
- g_message ("add_calendar(): The alarm notification service could "
- "not contact the backend");
- else if (BONOBO_EX (&ev))
+ if (ev._major == CORBA_USER_EXCEPTION) {
+ char *ex_id;
+
+ ex_id = CORBA_exception_id (&ev);
+ if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI) == 0)
+ g_message ("add_calendar(): Invalid URI reported from the "
+ "alarm notification service");
+ else if (strcmp (ex_id,
+ ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError) == 0)
+ g_message ("add_calendar(): The alarm notification service could "
+ "not contact the backend");
+ } else if (ev._major != CORBA_NO_EXCEPTION)
g_message ("add_calendar(): Could not issue the addCalendar request");
CORBA_exception_free (&ev);
@@ -1872,7 +1833,7 @@ add_alarms (const char *uri)
CORBA_exception_init (&ev);
bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
g_message ("add_alarms(): Could not unref the alarm notification service");
CORBA_exception_free (&ev);
@@ -1927,25 +1888,31 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
if (!uri) {
tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
+
+ add_alarms (tasks_uri);
g_free (tasks_uri);
}
else {
if (!g_strncasecmp (uri->protocol, "file", 4)) {
tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
- success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
- g_free (tasks_uri);
}
else {
- success = cal_client_open_default_tasks (priv->task_pad_client, FALSE);
+ /* we use the default uri for tasks */
+ tasks_uri = calendar_config_get_default_tasks_uri ();
+ if (!tasks_uri)
+ tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
}
+
+ success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
+ add_alarms (tasks_uri);
+ g_free (tasks_uri);
+
}
g_free (real_uri);
e_uri_free (uri);
- if (success)
- add_alarms (cal_client_get_uri (priv->task_pad_client));
- else {
+ if (!success) {
g_message ("gnome_calendar_open(): Could not issue the request");
return FALSE;
}
@@ -2117,12 +2084,47 @@ gnome_calendar_get_selected_time_range (GnomeCalendar *gcal,
*end_time = priv->selection_end_time;
}
+
+/* Callback used when an event editor dialog is closed */
+struct editor_closure
+{
+ GnomeCalendar *gcal;
+ char *uid;
+};
+
+static void
+editor_closed_cb (GtkWidget *widget, gpointer data)
+{
+ GnomeCalendar *gcal;
+ GnomeCalendarPrivate *priv;
+ struct editor_closure *ec;
+ gboolean result;
+ gpointer orig_key;
+ char *orig_uid;
+
+ ec = (struct editor_closure *) data;
+ gcal = ec->gcal;
+ priv = gcal->priv;
+
+ result = g_hash_table_lookup_extended (priv->object_editor_hash, ec->uid, &orig_key, NULL);
+ g_assert (result != FALSE);
+
+ orig_uid = orig_key;
+
+ if (!priv->in_destroy)
+ g_hash_table_remove (priv->object_editor_hash, orig_uid);
+
+ g_free (orig_uid);
+
+ g_free (ec);
+}
+
void
-gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
- gboolean meeting)
+gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp)
{
GnomeCalendarPrivate *priv;
EventEditor *ee;
+ struct editor_closure *ec;
const char *uid;
g_return_if_fail (gcal != NULL);
@@ -2133,20 +2135,27 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
cal_component_get_uid (comp, &uid);
- ee = EVENT_EDITOR (e_comp_editor_registry_find (comp_editor_registry, uid));
+ ee = g_hash_table_lookup (priv->object_editor_hash, uid);
if (!ee) {
+ ec = g_new0 (struct editor_closure, 1);
+
ee = event_editor_new ();
if (!ee) {
g_message ("gnome_calendar_edit_object(): Could not create the event editor");
return;
}
+ ec->gcal = gcal;
+ ec->uid = g_strdup (uid);
+
+ g_hash_table_insert (priv->object_editor_hash, ec->uid, ee);
+
+ gtk_signal_connect (GTK_OBJECT (ee), "destroy",
+ GTK_SIGNAL_FUNC (editor_closed_cb),
+ ec);
+
comp_editor_set_cal_client (COMP_EDITOR (ee), priv->client);
comp_editor_edit_comp (COMP_EDITOR (ee), comp);
- if (meeting)
- event_editor_show_meeting (ee);
-
- e_comp_editor_registry_add (comp_editor_registry, COMP_EDITOR (ee), FALSE);
}
comp_editor_focus (COMP_EDITOR (ee));
@@ -2166,8 +2175,7 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
void
gnome_calendar_new_appointment_for (GnomeCalendar *cal,
time_t dtstart, time_t dtend,
- gboolean all_day,
- gboolean meeting)
+ gboolean all_day)
{
GnomeCalendarPrivate *priv;
struct icaltimetype itt;
@@ -2224,7 +2232,7 @@ gnome_calendar_new_appointment_for (GnomeCalendar *cal,
cal_component_commit_sequence (comp);
- gnome_calendar_edit_object (cal, comp, meeting);
+ gnome_calendar_edit_object (cal, comp);
gtk_object_unref (GTK_OBJECT (comp));
}
@@ -2245,7 +2253,7 @@ gnome_calendar_new_appointment (GnomeCalendar *gcal)
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend);
- gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE, FALSE);
+ gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE);
}
/**
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index b9b504826b..b74b1040cd 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -34,7 +34,6 @@
#include <liboaf/liboaf.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-exception.h>
#include <gal/widgets/e-cursors.h>
@@ -42,18 +41,14 @@
#include "calendar-commands.h"
#include "calendar-config.h"
#include "component-factory.h"
-#include "e-comp-editor-registry.h"
#include "comp-editor-factory.h"
#include "control-factory.h"
#include "itip-control-factory.h"
#include "tasks-control-factory.h"
-ECompEditorRegistry *comp_editor_registry = NULL;
-
/* The component editor factory */
static CompEditorFactory *comp_editor_factory = NULL;
-
static void
init_bonobo (int argc, char **argv)
{
@@ -108,7 +103,7 @@ launch_alarm_daemon (void)
CORBA_exception_init (&ev);
an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
- if (BONOBO_EX (&ev)) {
+ if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("add_alarms(): Could not activate the alarm notification service");
CORBA_exception_free (&ev);
return;
@@ -119,7 +114,7 @@ launch_alarm_daemon (void)
CORBA_exception_init (&ev);
bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
g_message ("add_alarms(): Could not unref the alarm notification service");
CORBA_exception_free (&ev);
@@ -148,8 +143,6 @@ main (int argc, char **argv)
G_LOG_LEVEL_WARNING);
#endif
- comp_editor_registry = E_COMP_EDITOR_REGISTRY (e_comp_editor_registry_new ());
-
calendar_config_init ();
control_factory_init ();
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index b353fc24fb..6e385a065d 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -1132,29 +1132,6 @@ print_day_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence,
qsort (pdi.events[0]->data, pdi.events[0]->len,
sizeof (EDayViewEvent), e_day_view_event_sort_func);
- /* Also print events outside of work hours */
- if (pdi.events[0]->len > 0) {
- icaltimezone *zone = get_timezone ();
- struct icaltimetype tt;
-
- event = &g_array_index (pdi.events[0], EDayViewEvent, 0);
- tt = icaltime_from_timet_with_zone (event->start, FALSE, zone);
- if (tt.hour < pdi.start_hour)
- pdi.start_hour = tt.hour;
- pdi.start_minute_offset = pdi.start_hour * 60;
-
- event = &g_array_index (pdi.events[0], EDayViewEvent, pdi.events[0]->len - 1);
- tt = icaltime_from_timet_with_zone (event->end, FALSE, zone);
- if (tt.hour > pdi.end_hour || tt.hour == 0) {
- pdi.end_hour = tt.hour ? tt.hour : 24;
- if (tt.minute > 0)
- pdi.end_hour++;
- }
- pdi.end_minute_offset = pdi.end_hour * 60;
-
- pdi.rows = (pdi.end_hour - pdi.start_hour) * 2;
- }
-
/* Lay them out the long events, across the top of the page. */
e_day_view_layout_long_events (pdi.long_events, pdi.days_shown,
pdi.day_starts, &rows_in_top_display);
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 53e3eb239f..1a1321b130 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -25,21 +25,9 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-paper.h>
#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock.h>
-#include <libgnomeprint/gnome-print.h>
-#include <libgnomeprint/gnome-print-copies.h>
-#include <libgnomeprint/gnome-print-master.h>
-#include <libgnomeprint/gnome-print-master-preview.h>
-#include <libgnomeprint/gnome-print-preview.h>
-#include <libgnomeprint/gnome-printer-dialog.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-ui-util.h>
-#include <gal/widgets/e-gui-utils.h>
-#include <e-util/e-dialog-utils.h>
#include "dialogs/cal-prefs-dialog.h"
#include "calendar-config.h"
#include "calendar-commands.h"
@@ -86,22 +74,13 @@ static void tasks_control_paste_cmd (BonoboUIComponent *uic,
static void tasks_control_delete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_complete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_expunge_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_print_preview_cmd (BonoboUIComponent *uic,
+static void tasks_control_settings_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
BonoboControl *
-tasks_control_new (void)
+tasks_control_new (void)
{
BonoboControl *control;
GtkWidget *tasks;
@@ -109,11 +88,11 @@ tasks_control_new (void)
tasks = e_tasks_new ();
if (!tasks)
return NULL;
+
gtk_widget_show (tasks);
control = bonobo_control_new (tasks);
if (!control) {
- gtk_widget_destroy (tasks);
g_message ("control_factory_fn(): could not create the control!");
return NULL;
}
@@ -243,9 +222,6 @@ sensitize_commands (ETasks *tasks, BonoboControl *control, int n_selected)
bonobo_ui_component_set_prop (uic, "/commands/TasksDelete", "sensitive",
n_selected == 0 ? "0" : "1",
NULL);
- bonobo_ui_component_set_prop (uic, "/commands/TasksMarkComplete", "sensitive",
- n_selected == 0 ? "0" : "1",
- NULL);
}
/* Callback used when the selection in the table changes */
@@ -265,18 +241,13 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
- BONOBO_UI_VERB ("TasksMarkComplete", tasks_control_complete_cmd),
- BONOBO_UI_VERB ("TasksExpunge", tasks_control_expunge_cmd),
- BONOBO_UI_VERB ("TasksPrint", tasks_control_print_cmd),
- BONOBO_UI_VERB ("TasksPrintPreview", tasks_control_print_preview_cmd),
+ BONOBO_UI_VERB ("TasksSettings", tasks_control_settings_cmd),
BONOBO_UI_VERB_END
};
static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "new_task-16.png"),
- E_PIXMAP ("/menu/File/Print/Print", "print.xpm"),
- E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/TasksCut", "16_cut.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/TasksCopy", "16_copy.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/TasksPaste", "16_paste.png"),
@@ -287,7 +258,6 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/Toolbar/Copy", "buttons/copy.png"),
E_PIXMAP ("/Toolbar/Paste", "buttons/paste.png"),
E_PIXMAP ("/Toolbar/Delete", "buttons/delete-message.png"),
- E_PIXMAP ("/Toolbar/Print", "buttons/print.png"),
E_PIXMAP_END
};
@@ -303,8 +273,6 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks)
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
- e_tasks_set_ui_component (tasks, uic);
-
remote_uih = bonobo_control_get_remote_ui_container (control);
bonobo_ui_component_set_container (uic, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
@@ -349,11 +317,8 @@ static void
tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
{
BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
-
g_assert (uic != NULL);
- e_tasks_set_ui_component (tasks, NULL);
-
e_tasks_discard_view_menus (tasks);
/* Stop monitoring the "selection_changed" signal */
@@ -425,260 +390,17 @@ tasks_control_delete_cmd (BonoboUIComponent *uic,
e_tasks_delete_selected (tasks);
}
+/* Callback used for the tasks settings command */
static void
-tasks_control_complete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
+tasks_control_settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)
{
ETasks *tasks;
+ static CalPrefsDialog *prefs_dialog = NULL;
tasks = E_TASKS (data);
- e_tasks_complete_selected (tasks);
-}
-static gboolean
-confirm_expunge (ETasks *tasks)
-{
- GtkWidget *dialog, *label, *checkbox;
- int button;
-
- if (!calendar_config_get_confirm_expunge ())
- return TRUE;
-
- dialog = gnome_dialog_new (_("Warning"),
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
- e_gnome_dialog_set_parent (GNOME_DIALOG (dialog),
- GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (tasks),
- GTK_TYPE_WINDOW)));
-
- label = gtk_label_new (_("This operation will permanently erase all tasks marked as completed. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
-
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
-
- checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
- gtk_widget_show (checkbox);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
-
- button = gnome_dialog_run (GNOME_DIALOG (dialog));
- if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
- calendar_config_set_confirm_expunge (FALSE);
- gnome_dialog_close (GNOME_DIALOG (dialog));
-
- if (button == 0)
- return TRUE;
+ if (!prefs_dialog)
+ prefs_dialog = cal_prefs_dialog_new (CAL_PREFS_DIALOG_PAGE_TASKS);
else
- return FALSE;
-}
-
-static void
-tasks_control_expunge_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
-
- if (confirm_expunge (tasks))
- e_tasks_delete_completed (tasks);
-}
-
-
-static void
-print_title (GnomePrintContext *pc,
- double page_width, double page_height)
-{
- GnomeFont *font;
- char *text;
- double w, x, y;
-
- font = gnome_font_new_closest ("Times", GNOME_FONT_BOLD, 0, 18);
-
- text = _("Tasks");
- w = gnome_font_get_width_utf8 (font, text);
-
- x = (page_width - w) / 2;
- y = page_height - gnome_font_get_ascender (font);
-
- gnome_print_moveto (pc, x, y);
- gnome_print_setfont (pc, font);
- gnome_print_setrgbcolor (pc, 0, 0, 0);
- gnome_print_show (pc, text);
-
- gtk_object_unref (GTK_OBJECT (font));
+ cal_prefs_dialog_show (prefs_dialog, CAL_PREFS_DIALOG_PAGE_TASKS);
}
-
-
-static void
-print_tasks (ETasks *tasks, gboolean preview, gboolean landscape,
- int copies, gboolean collate)
-{
- ECalendarTable *cal_table;
- EPrintable *printable;
- ETable *etable;
- GnomePrintMaster *master;
- GnomePrintContext *pc;
- const GnomePaper *paper_info;
- double l, r, t, b, page_width, page_height, left_margin, bottom_margin;
-
- cal_table = e_tasks_get_calendar_table (tasks);
- etable = e_calendar_table_get_table (E_CALENDAR_TABLE (cal_table));
- printable = e_table_get_printable (etable);
-
- master = gnome_print_master_new ();
-
- paper_info = gnome_paper_with_name (gnome_paper_name_default ());
- gnome_print_master_set_paper (master, paper_info);
-
- gnome_print_master_set_copies (master, copies, collate);
- pc = gnome_print_master_get_context (master);
- e_printable_reset (printable);
-
- l = gnome_paper_lmargin (paper_info);
- r = gnome_paper_pswidth (paper_info)
- - gnome_paper_rmargin (paper_info);
- t = gnome_paper_psheight (paper_info)
- - gnome_paper_tmargin (paper_info);
- b = gnome_paper_bmargin (paper_info);
-
- if (landscape) {
- page_width = t - b;
- page_height = r - l;
- left_margin = b;
- bottom_margin = gnome_paper_rmargin (paper_info);
- } else {
- page_width = r - l;
- page_height = t - b;
- left_margin = l;
- bottom_margin = b;
- }
-
- while (e_printable_data_left (printable)) {
- gnome_print_beginpage (pc, "Tasks");
- gnome_print_gsave (pc);
- if (landscape) {
- gnome_print_rotate (pc, 90);
- gnome_print_translate (pc, 0, -gnome_paper_pswidth (paper_info));
- }
-
- gnome_print_translate (pc, left_margin, bottom_margin);
-
- print_title (pc, page_width, page_height);
-
- e_printable_print_page (printable, pc,
- page_width, page_height - 24, TRUE);
-
- gnome_print_grestore (pc);
- gnome_print_showpage (pc);
- }
- gnome_print_master_close (master);
-
- if (preview) {
- GnomePrintMasterPreview *gpmp;
- gpmp = gnome_print_master_preview_new_with_orientation (master, _("Print Preview"), landscape);
- gtk_widget_show (GTK_WIDGET (gpmp));
- } else {
- gnome_print_master_print (master);
- }
-
- gtk_object_unref (GTK_OBJECT (master));
- gtk_object_unref (GTK_OBJECT (printable));
-}
-
-
-/* File/Print callback */
-static void
-tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- GtkWidget *gpd, *mode_box, *portrait_radio, *landscape_radio;
- GtkWidget *dialog_vbox, *dialog_hbox, *mode_frame;
- GList *children;
- GSList *group;
- gboolean preview = FALSE, landscape = FALSE;
- GnomePrinter *printer;
- int copies;
- gboolean collate;
-
- tasks = E_TASKS (data);
-
- gpd = gnome_print_dialog_new (_("Print Tasks"),
- GNOME_PRINT_DIALOG_COPIES);
-
- mode_frame = gtk_frame_new (_("Orientation"));
-
- mode_box = gtk_vbox_new (FALSE, 4);
- gtk_container_add (GTK_CONTAINER (mode_frame), mode_box);
-
- /* Portrait */
- portrait_radio = gtk_radio_button_new_with_label (NULL, _("Portrait"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (portrait_radio));
- gtk_box_pack_start (GTK_BOX (mode_box), portrait_radio,
- FALSE, FALSE, 0);
-
- /* Landscape */
- landscape_radio = gtk_radio_button_new_with_label (group,
- _("Landscape"));
- gtk_box_pack_start (GTK_BOX (mode_box), landscape_radio,
- FALSE, FALSE, 0);
-
- gtk_widget_show_all (mode_frame);
-
- /* A bit of a hack to insert our own Orientation option. */
- dialog_vbox = GNOME_DIALOG (gpd)->vbox;
- children = gtk_container_children (GTK_CONTAINER (dialog_vbox));
- dialog_hbox = children->next->data;
- g_list_free (children);
- gtk_box_pack_start (GTK_BOX (dialog_hbox), mode_frame,
- FALSE, FALSE, 3);
-
- gnome_dialog_set_default (GNOME_DIALOG (gpd), GNOME_PRINT_PRINT);
-
- /* Run dialog */
- switch (gnome_dialog_run (GNOME_DIALOG (gpd))) {
- case GNOME_PRINT_PRINT:
- break;
-
- case GNOME_PRINT_PREVIEW:
- preview = TRUE;
- break;
-
- case -1:
- return;
-
- default:
- gnome_dialog_close (GNOME_DIALOG (gpd));
- return;
- }
-
- gnome_print_dialog_get_copies (GNOME_PRINT_DIALOG (gpd),
- &copies, &collate);
- if (GTK_TOGGLE_BUTTON (landscape_radio)->active)
- landscape = TRUE;
-
- printer = gnome_print_dialog_get_printer (GNOME_PRINT_DIALOG (gpd));
-
- gnome_dialog_close (GNOME_DIALOG (gpd));
-
- print_tasks (tasks, preview, landscape, copies, collate);
-}
-
-static void
-tasks_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
-
- print_tasks (tasks, TRUE, FALSE, 1, FALSE);
-}
-