aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2004-01-11 04:19:08 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-01-11 04:19:08 +0800
commitd6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5 (patch)
tree92597e29ba83f7b518d4062214a413a0dc48dd65 /calendar/gui
parent2fd22d547c519e90f3dc6850d2235e122964f477 (diff)
downloadgsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.tar
gsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.tar.gz
gsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.tar.bz2
gsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.tar.lz
gsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.tar.xz
gsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.tar.zst
gsoc2013-evolution-d6c9d8bf84fc5d59c4a8e0f6d1693627ef7414e5.zip
added missing headers.
2003-01-10 Rodrigo Moya <rodrigo@ximian.com> * gui/alarm-notify/notify-main.c: added missing headers. * gui/alarm-notify/alarm-notify.c (alarm_notify_remove_calendar): use the correct variable when calling alarm_queue_remove_client(). * gui/calendar-component.c (impl_upgradeFromVersion): removed redundant variable declarations. * gui/migration.c (process_old_dir): * gui/e-timezone-entry.c (e_timezone_entry_mnemonic_activate): * gui/e-date-time-list.c (e_date_time_list_finalize): * gui/e-alarm-list.c (e_alarm_list_finalize): fixed warnings. * gui/e-calendar-table.c: added missing prototypes at the top to avoid warnings. * gui/e-week-view.c (e_week_view_scroll_a_step): * gui/e-day-view.c (e_day_view_event_move): directly return in the default: case. * gui/e-tasks.c (setup_widgets): connect to changes on the model. (model_row_changed_cb): callback to update the HTML detailed view when the currently selected task changes. (client_obj_updated_cb): removed unused function. (set_status_message): changed to accept a variable list of arguments. (e_tasks_add_todo_uri): display status messages and get error message from backend and display it in a dialog. (cal_opened_cb, load_error, method_error, permission_error): removed unused functions. * gui/gnome-cal.c (open_ecal): added a GnomeCalendar argument, and display status messages. (gnome_calendar_construct, gnome_calendar_add_event_source): adapted to changes in open_ecal(). svn path=/trunk/; revision=24147
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c3
-rw-r--r--calendar/gui/alarm-notify/notify-main.c1
-rw-r--r--calendar/gui/calendar-component.c11
-rw-r--r--calendar/gui/e-alarm-list.c2
-rw-r--r--calendar/gui/e-calendar-table.c2
-rw-r--r--calendar/gui/e-date-time-list.c2
-rw-r--r--calendar/gui/e-day-view.c2
-rw-r--r--calendar/gui/e-tasks.c179
-rw-r--r--calendar/gui/e-timezone-entry.c4
-rw-r--r--calendar/gui/e-week-view.c2
-rw-r--r--calendar/gui/gnome-cal.c16
-rw-r--r--calendar/gui/migration.c3
12 files changed, 90 insertions, 137 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index b1efc7b5f1..a88cfccb91 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -189,13 +189,12 @@ void
alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri)
{
AlarmNotifyPrivate *priv;
- ECal *client;
gpointer orig_key, orig_value;
priv = an->priv;
if (g_hash_table_lookup_extended (priv->uri_client_hash, str_uri, &orig_key, &orig_value)) {
- alarm_queue_remove_client (client);
+ alarm_queue_remove_client (E_CAL (orig_value));
g_hash_table_remove (priv->uri_client_hash, str_uri);
g_free (orig_key);
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index 9c9af7c62d..79a2468f8a 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <glib.h>
+#include <gtk/gtkmain.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-init.h>
#include <libgnome/gnome-sound.h>
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index c7eaec9570..7f3b686def 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -557,11 +557,7 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
/* create calendar for birthdays & anniversaries */
if ((major < 0) ||
((major == 1) && (minor < 5)) ||
- ((major == 1) && (minor == 5) && (revision < 2))) {
- ESourceGroup *group;
- ESource *source;
- char *base_uri, *new_dir;
-
+ ((major == 1) && (minor == 5) && (revision < 2))) {
group = e_source_group_new (_("Contacts"), "contacts://");
source = e_source_new (_("Birthdays & Anniversaries"), "/");
e_source_group_add_source (group, source, -1);
@@ -573,10 +569,7 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
/* create calendar for birthdays & anniversaries */
if ((major < 0) ||
((major == 1) && (minor < 5)) ||
- ((major == 1) && (minor == 5) && (revision < 2))) {
- ESource *source;
- char *base_uri, *new_dir;
-
+ ((major == 1) && (minor == 5) && (revision < 2))) {
group = e_source_group_new (_("Birthdays"), "contacts://");
source = e_source_new (_("Birthdays & Anniversaries"), "/");
e_source_group_add_source (group, source, -1);
diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c
index c1429f8705..2c3a24525e 100644
--- a/calendar/gui/e-alarm-list.c
+++ b/calendar/gui/e-alarm-list.c
@@ -224,8 +224,6 @@ row_updated (EAlarmList *alarm_list, gint n)
static void
e_alarm_list_finalize (GObject *object)
{
- EAlarmList *alarm_list = E_ALARM_LIST (object);
-
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 2f459a33e2..4226628b35 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -108,6 +108,8 @@ static gint e_calendar_table_on_key_press (ETable *table,
static struct tm e_calendar_table_get_current_time (ECellDateEdit *ecde,
gpointer data);
static void mark_row_complete_cb (int model_row, gpointer data);
+static ECalModelComponent *get_selected_comp (ECalendarTable *cal_table);
+static void open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean assign);
/* The icons to represent the task. */
diff --git a/calendar/gui/e-date-time-list.c b/calendar/gui/e-date-time-list.c
index 348ccc86a9..1a1fbbd783 100644
--- a/calendar/gui/e-date-time-list.c
+++ b/calendar/gui/e-date-time-list.c
@@ -222,8 +222,6 @@ row_updated (EDateTimeList *date_time_list, gint n)
static void
e_date_time_list_finalize (GObject *object)
{
- EDateTimeList *date_time_list = E_DATE_TIME_LIST (object);
-
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index bdf3483c62..ed35a118ce 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -5617,7 +5617,7 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
end_dt = icaltime_as_timet (end_time);
break;
default:
- break;
+ return;
}
e_day_view_change_event_time (day_view, start_dt, end_dt);
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index b092fc5cfe..085751c1da 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -82,7 +82,6 @@ static void e_tasks_init (ETasks *tasks);
static void setup_widgets (ETasks *tasks);
static void e_tasks_destroy (GtkObject *object);
-static void cal_opened_cb (ECal *client, ECalendarStatus status, gpointer data);
static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
@@ -456,6 +455,33 @@ timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer
}
static void
+model_row_changed_cb (ETableModel *etm, int row, gpointer data)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+ ECalModelComponent *comp_data;
+
+ tasks = E_TASKS (data);
+ priv = tasks->priv;
+
+ if (priv->current_uid) {
+ const char *uid;
+
+ comp_data = e_cal_model_get_component_at (E_CAL_MODEL (etm), row);
+ if (comp_data) {
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ if (!strcmp (uid ? uid : "", priv->current_uid)) {
+ ETable *etable;
+
+ etable = e_table_scrolled_get_table (
+ E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable));
+ table_cursor_change_cb (etable, 0, tasks);
+ }
+ }
+ }
+}
+
+static void
setup_config (ETasks *tasks)
{
ETasksPrivate *priv;
@@ -485,6 +511,7 @@ setup_widgets (ETasks *tasks)
{
ETasksPrivate *priv;
ETable *etable;
+ ECalModel *model;
GtkWidget *paned, *scroll;
priv = tasks->priv;
@@ -540,10 +567,14 @@ setup_widgets (ETasks *tasks)
gtk_container_add (GTK_CONTAINER (scroll), priv->html);
gtk_paned_add2 (GTK_PANED (paned), scroll);
gtk_widget_show_all (scroll);
+
+ model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
+ g_signal_connect (G_OBJECT (model), "model_row_changed",
+ G_CALLBACK (model_row_changed_cb), tasks);
}
/* Class initialization function for the gnome calendar */
- static void
+static void
e_tasks_class_init (ETasksClass *class)
{
GtkObjectClass *object_class;
@@ -599,27 +630,6 @@ client_categories_changed_cb (ECal *client, GPtrArray *categories, gpointer data
cal_search_bar_set_categories (CAL_SEARCH_BAR (priv->search_bar), categories);
}
-static void
-client_obj_updated_cb (ECal *client, const char *uid, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- if (priv->current_uid) {
- if (!strcmp (uid, priv->current_uid)) {
- ETable *etable;
-
- etable = e_table_scrolled_get_table (
- E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable));
- table_cursor_change_cb (etable, 0, tasks);
- }
- }
-}
-
-
GtkWidget *
e_tasks_new (void)
{
@@ -689,99 +699,19 @@ e_tasks_destroy (GtkObject *object)
}
static void
-set_status_message (ETasks *tasks, const char *message)
+set_status_message (ETasks *tasks, const char *message, ...)
{
ETasksPrivate *priv;
+ va_list args;
+ char sz[2048];
- priv = tasks->priv;
-
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->tasks_view), message);
-}
-
-/* Displays an error to indicate that loading a calendar failed */
-static void
-load_error (ETasks *tasks,
- const char *uri)
-{
- char *msg;
- char *urinopwd;
-
- urinopwd = get_uri_without_password (uri);
- msg = g_strdup_printf (_("Could not load the tasks in `%s'"), urinopwd);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
- g_free (msg);
- g_free (urinopwd);
-}
-
-/* Displays an error to indicate that the specified URI method is not supported */
-static void
-method_error (ETasks *tasks,
- const char *uri)
-{
- char *msg;
- char *urinopwd;
-
- urinopwd = get_uri_without_password (uri);
- msg = g_strdup_printf (_("The method required to load `%s' is not supported"), urinopwd);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
- g_free (msg);
- g_free (urinopwd);
-}
-
-/* Displays an error to indicate permission problems */
-static void
-permission_error (ETasks *tasks, const char *uri)
-{
- char *msg;
- char *urinopwd;
-
- urinopwd = get_uri_without_password (uri);
- msg = g_strdup_printf (_("You don't have permission to open the folder in `%s'"), urinopwd);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
- g_free (msg);
- g_free (urinopwd);
-}
-
-/* Callback from the calendar client when a calendar is opened */
-static void
-cal_opened_cb (ECal *client,
- ECalendarStatus status,
- gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
+ va_start (args, message);
+ vsnprintf (sz, sizeof sz, message, args);
+ va_end (args);
- tasks = E_TASKS (data);
priv = tasks->priv;
-
- set_status_message (tasks, NULL);
-
- switch (status) {
- case E_CALENDAR_STATUS_OK:
- /* Everything is OK */
- set_timezone (tasks);
- return;
-
- case E_CALENDAR_STATUS_OTHER_ERROR:
- load_error (tasks, e_cal_get_uri (client));
- break;
-
- case E_CALENDAR_STATUS_NO_SUCH_CALENDAR:
- /* bullshit; we did not specify only_if_exists */
- g_assert_not_reached ();
- return;
-
- case E_CALENDAR_STATUS_PROTOCOL_NOT_SUPPORTED:
- method_error (tasks, e_cal_get_uri (client));
- break;
-
- case E_CALENDAR_STATUS_PERMISSION_DENIED:
- permission_error (tasks, e_cal_get_uri (client));
- break;
-
- default:
- g_assert_not_reached ();
- }
+
+ e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->tasks_view), sz);
}
/* Callback from the calendar client when an error occurs in the backend */
@@ -848,7 +778,8 @@ e_tasks_add_todo_uri (ETasks *tasks, const char *str_uri)
ETasksPrivate *priv;
ECal *client;
ECalModel *model;
-
+ GError *error = NULL;
+
g_return_val_if_fail (tasks != NULL, FALSE);
g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
g_return_val_if_fail (str_uri != NULL, FALSE);
@@ -858,7 +789,9 @@ e_tasks_add_todo_uri (ETasks *tasks, const char *str_uri)
client = g_hash_table_lookup (priv->clients, str_uri);
if (client)
return TRUE;
-
+
+ set_status_message (tasks, _("Opening tasks at %s"), str_uri);
+
client = auth_new_cal_from_uri (str_uri, E_CAL_SOURCE_TYPE_TODO);
g_hash_table_insert (priv->clients, g_strdup (str_uri), client);
priv->clients_list = g_list_prepend (priv->clients_list, client);
@@ -866,18 +799,36 @@ e_tasks_add_todo_uri (ETasks *tasks, const char *str_uri)
g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), tasks);
g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), tasks);
- if (!e_cal_open (client, FALSE, NULL)) {
+ if (!e_cal_open (client, FALSE, &error)) {
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))),
+ GTK_DIALOG_NO_SEPARATOR,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Error opening %s:\n%s"),
+ str_uri, error ? error->message : "");
+
+ g_error_free (error);
g_hash_table_remove (priv->clients, str_uri);
priv->clients_list = g_list_prepend (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, tasks);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ set_status_message (tasks, NULL);
+
return FALSE;
}
+ set_status_message (tasks, _("Loading tasks"));
model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
e_cal_model_add_client (model, client);
+ set_timezone (tasks);
+ set_status_message (tasks, NULL);
+
return TRUE;
}
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index 6f6a965f7a..7c361a9cf4 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -310,9 +310,9 @@ e_timezone_entry_mnemonic_activate (GtkWidget *widget,
GtkButton *button = NULL;
if (GTK_WIDGET_CAN_FOCUS (widget)) {
- button=((ETimezoneEntryPrivate*) ((ETimezoneEntry*) widget)->priv)->button;
+ button = GTK_BUTTON (((ETimezoneEntryPrivate *) ((ETimezoneEntry *) widget)->priv)->button);
if (button != NULL)
- gtk_widget_grab_focus (button);
+ gtk_widget_grab_focus (GTK_WIDGET (button));
}
return TRUE;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index cc4019d4a5..025bd1cadc 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3061,7 +3061,7 @@ e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction
new_value = adj->value + adj->step_increment;
break;
default:
- break;
+ return;
}
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 9c78aa6641..d03354331e 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1746,11 +1746,16 @@ copy_categories (GPtrArray *categories)
}
static gboolean
-open_ecal (ECal *cal, gboolean only_if_exists)
+open_ecal (GnomeCalendar *gcal, ECal *cal, gboolean only_if_exists)
{
gboolean retval;
+ char *msg;
GError *error = NULL;
+ msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
+ e_calendar_view_set_status_message (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)), msg);
+ g_free (msg);
+
retval = e_cal_open (cal, only_if_exists, &error);
if (!retval) {
GtkWidget *dialog;
@@ -1762,8 +1767,13 @@ open_ecal (ECal *cal, gboolean only_if_exists)
e_cal_get_uri (cal),
error ? error->message : "");
g_error_free (error);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
}
+ e_calendar_view_set_status_message (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)), NULL);
+
return retval;
}
@@ -1961,7 +1971,7 @@ gnome_calendar_construct (GnomeCalendar *gcal)
g_free (uid);
- if (!open_ecal (priv->task_pad_client, TRUE))
+ if (!open_ecal (gcal, priv->task_pad_client, TRUE))
return NULL;
e_cal_model_add_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)),
@@ -2100,7 +2110,7 @@ gnome_calendar_add_event_source (GnomeCalendar *gcal, ESource *source)
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal);
/* FIXME Do this async? */
- if (!open_ecal (client, FALSE)) {
+ if (!open_ecal (gcal, client, FALSE)) {
priv->clients_list = g_list_remove (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c
index afb0a59b68..2809b59313 100644
--- a/calendar/gui/migration.c
+++ b/calendar/gui/migration.c
@@ -84,7 +84,8 @@ process_old_dir (ESourceGroup *source_group, const char *path,
s = g_build_filename (path, "subfolders", NULL);
dir = g_dir_open (s, 0, NULL);
if (dir) {
- const char *name, *tmp_s;
+ const char *name;
+ char *tmp_s;
while ((name = g_dir_read_name (dir))) {
tmp_s = g_build_filename (s, name, NULL);