aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-tasks.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-04-30 03:36:53 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-04-30 03:36:53 +0800
commit87e60de4aae77bc239ceb67aaa2c7c8bd6a24343 (patch)
tree36d286e28e9d702ade684a014b40810b89a2ebb0 /calendar/gui/e-tasks.c
parent68a179bc703eb13cbe758a28cec6cccf6bd8766b (diff)
downloadgsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.tar
gsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.tar.gz
gsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.tar.bz2
gsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.tar.lz
gsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.tar.xz
gsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.tar.zst
gsoc2013-evolution-87e60de4aae77bc239ceb67aaa2c7c8bd6a24343.zip
remove prototypes
2004-04-29 JP Rosevear <jpr@ximian.com> * gui/tasks-component.h (tasks_component_peek_source_list): remove prototypes * gui/tasks-component.c (source_removed_cb): unselect the source in the selector if source removed from calendar (create_component_view): create the activity handler and listen to source remove signal * gui/gnome-cal.h: add signals, protos * gui/gnome-cal.c (gnome_calendar_class_init): add source added and removed signals (client_cal_opened_cb): emit source removed signal (open_ecal): set the status message (backend_died_cb): emit source removed signal (gnome_calendar_set_activity_handler): allow an activity handler to be set (gnome_calendar_add_source): emit source added signal (gnome_calendar_remove_source): emit source removed signal (display_view): update the active activity handler * gui/e-tasks.h: add signal prototypes * gui/e-tasks.c (e_tasks_class_init): add source added and removed signals (backend_died_cb): emit source removed signal (e_tasks_add_todo_source): emit source added/removed signals (e_tasks_remove_todo_source): emit source removed signal * gui/e-calendar-view.h: add proto * gui/e-calendar-view.c (e_calendar_view_set_activity_handler): allow an activity handler to be set (e_calendar_view_set_status_message): use private activity handler (if any) to set status message * gui/e-calendar-table.h: add data member and proto * gui/e-calendar-table.c (e_calendar_table_set_activity_handler): allow an activity handler to be set (e_calendar_table_set_status_message): use private activity handler (if any) to set status message * gui/e-calendar-marshal.list: add extra marshallers * gui/calendar-component.h: kill protos * gui/calendar-component.c (source_removed_cb): unselect the source in the selector if source removed from calendar (create_component_view): create the activity handler and listen to source remove signal svn path=/trunk/; revision=25694
Diffstat (limited to 'calendar/gui/e-tasks.c')
-rw-r--r--calendar/gui/e-tasks.c56
1 files changed, 46 insertions, 10 deletions
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index fab404b38d..e48e954c12 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -42,6 +42,7 @@
#include "widgets/menus/gal-view-menus.h"
#include "dialogs/delete-error.h"
#include "dialogs/task-editor.h"
+#include "e-calendar-marshal.h"
#include "cal-search-bar.h"
#include "calendar-config.h"
#include "calendar-component.h"
@@ -92,6 +93,8 @@ static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
enum {
SELECTION_CHANGED,
+ SOURCE_ADDED,
+ SOURCE_REMOVED,
LAST_SIGNAL
};
@@ -383,9 +386,33 @@ e_tasks_class_init (ETasksClass *class)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
+ e_tasks_signals[SOURCE_ADDED] =
+ g_signal_new ("source_added",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ETasksClass, source_added),
+ NULL, NULL,
+ e_calendar_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_OBJECT);
+
+ e_tasks_signals[SOURCE_REMOVED] =
+ g_signal_new ("source_removed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ETasksClass, source_removed),
+ NULL, NULL,
+ e_calendar_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_OBJECT);
+
object_class->destroy = e_tasks_destroy;
class->selection_changed = NULL;
+ class->source_added = NULL;
+ class->source_removed = NULL;
}
@@ -534,16 +561,23 @@ backend_died_cb (ECal *client, gpointer data)
{
ETasks *tasks;
ETasksPrivate *priv;
+ ESource *source;
char *message;
GtkWidget *dialog;
-
+
tasks = E_TASKS (data);
priv = tasks->priv;
- /* FIXME: this doesn't remove the task list from the list or anything */
- message = g_strdup_printf (_("The task backend for\n%s\n has crashed."), e_cal_get_uri (client));
+ source = g_object_ref (e_cal_get_source (client));
+
+ priv->clients_list = g_list_remove (priv->clients_list, client);
+ g_hash_table_remove (priv->clients, e_cal_get_uri (client));
+
+ gtk_signal_emit (GTK_OBJECT (tasks), e_tasks_signals[SOURCE_REMOVED], source);
+
e_calendar_table_set_status_message (E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)), NULL);
+ message = g_strdup_printf (_("The task backend for '%s' has crashed."), e_source_peek_name (source));
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))),
0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
message);
@@ -551,13 +585,7 @@ backend_died_cb (ECal *client, gpointer data)
gtk_widget_destroy (dialog);
g_free (message);
- e_source_selector_unselect_source (
- tasks_component_peek_source_selector (tasks_component_peek ()),
- e_cal_get_source (client));
-
- g_hash_table_remove (priv->clients, e_cal_get_uri (client));
- priv->clients_list = g_list_remove (priv->clients_list, client);
- g_object_unref (client);
+ g_object_unref (source);
}
void
@@ -621,6 +649,8 @@ e_tasks_add_todo_source (ETasks *tasks, ESource *source)
return TRUE;
}
+ /* FIXME Loading should be async */
+ /* FIXME With no event handling here the status message never actually changes */
set_status_message (tasks, _("Opening tasks at %s"), str_uri);
client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
@@ -636,6 +666,8 @@ e_tasks_add_todo_source (ETasks *tasks, ESource *source)
g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), tasks);
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), tasks);
+ gtk_signal_emit (GTK_OBJECT (tasks), e_tasks_signals[SOURCE_ADDED], source);
+
if (!e_cal_open (client, FALSE, &error)) {
GtkWidget *dialog;
@@ -653,6 +685,8 @@ e_tasks_add_todo_source (ETasks *tasks, ESource *source)
/* Do this last because it unrefs the client */
g_hash_table_remove (priv->clients, str_uri);
+ gtk_signal_emit (GTK_OBJECT (tasks), e_tasks_signals[SOURCE_REMOVED], source);
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -702,6 +736,8 @@ e_tasks_remove_todo_source (ETasks *tasks, ESource *source)
g_hash_table_remove (priv->clients, str_uri);
g_free (str_uri);
+ gtk_signal_emit (GTK_OBJECT (tasks), e_tasks_signals[SOURCE_REMOVED], source);
+
return TRUE;
}