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
This commit is contained in:
@ -1,3 +1,57 @@
|
||||
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
|
||||
|
||||
2004-04-29 JP Rosevear <jpr@ximian.com>
|
||||
|
||||
* gui/dialogs/comp-editor.c (send_timezone): ditto
|
||||
|
||||
@ -440,6 +440,16 @@ primary_source_selection_changed_cb (ESourceSelector *selector, CalendarComponen
|
||||
update_uri_for_primary_selection (component_view);
|
||||
}
|
||||
|
||||
static void
|
||||
source_removed_cb (GnomeCalendar *calendar, ECalSourceType source_type, ESource *source, CalendarComponentView *component_view)
|
||||
{
|
||||
switch (source_type) {
|
||||
case E_CAL_SOURCE_TYPE_EVENT:
|
||||
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
config_primary_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
|
||||
{
|
||||
@ -960,14 +970,19 @@ create_component_view (CalendarComponent *calendar_component)
|
||||
}
|
||||
|
||||
component_view->calendar = (GnomeCalendar *) bonobo_control_get_widget (component_view->view_control);
|
||||
g_signal_connect (component_view->calendar, "source_removed",
|
||||
G_CALLBACK (source_removed_cb), component_view);
|
||||
|
||||
/* Create status bar */
|
||||
statusbar_widget = e_task_bar_new ();
|
||||
component_view->activity_handler = e_activity_handler_new ();
|
||||
e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
|
||||
gtk_widget_show (statusbar_widget);
|
||||
|
||||
component_view->statusbar_control = bonobo_control_new (statusbar_widget);
|
||||
|
||||
gnome_calendar_set_activity_handler (component_view->calendar, component_view->activity_handler);
|
||||
|
||||
/* connect after setting the initial selections, or we'll get unwanted calls
|
||||
to calendar_control_sensitize_calendar_commands */
|
||||
g_signal_connect (component_view->source_selector, "selection_changed",
|
||||
@ -1300,20 +1315,6 @@ calendar_component_peek_source_list (CalendarComponent *component)
|
||||
return component->priv->source_list;
|
||||
}
|
||||
|
||||
ESourceSelector *
|
||||
calendar_component_peek_source_selector (CalendarComponent *component)
|
||||
{
|
||||
// return E_SOURCE_SELECTOR (component->priv->source_selector);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EActivityHandler *
|
||||
calendar_component_peek_activity_handler (CalendarComponent *component)
|
||||
{
|
||||
// return component->priv->activity_handler;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
calendar_component_init_publishing (void)
|
||||
{
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
#include <libedataserver/e-source-list.h>
|
||||
|
||||
#include "widgets/misc/e-source-selector.h"
|
||||
#include "e-activity-handler.h"
|
||||
#include "Evolution.h"
|
||||
|
||||
|
||||
@ -63,8 +62,6 @@ CalendarComponent *calendar_component_peek (void);
|
||||
const char *calendar_component_peek_base_directory (CalendarComponent *component);
|
||||
const char *calendar_component_peek_config_directory (CalendarComponent *component);
|
||||
ESourceList *calendar_component_peek_source_list (CalendarComponent *component);
|
||||
ESourceSelector *calendar_component_peek_source_selector (CalendarComponent *component);
|
||||
EActivityHandler *calendar_component_peek_activity_handler (CalendarComponent *component);
|
||||
|
||||
void calendar_component_init_publishing (void);
|
||||
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
NONE:INT
|
||||
NONE:POINTER
|
||||
NONE:OBJECT
|
||||
NONE:INT,STRING
|
||||
NONE:INT,BOOL
|
||||
NONE:INT,POINTER
|
||||
NONE:INT,OBJECT
|
||||
NONE:STRING,INT
|
||||
NONE:INT,INT
|
||||
NONE:ENUM,ENUM
|
||||
|
||||
@ -1359,17 +1359,25 @@ static char *test[] = {
|
||||
#define EVOLUTION_TASKS_PROGRESS_IMAGE "stock_todo"
|
||||
static GdkPixbuf *progress_icon = NULL;
|
||||
|
||||
void
|
||||
e_calendar_table_set_activity_handler (ECalendarTable *cal_table, EActivityHandler *activity_handler)
|
||||
{
|
||||
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
|
||||
|
||||
cal_table->activity_handler = activity_handler;
|
||||
}
|
||||
|
||||
void
|
||||
e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *message)
|
||||
{
|
||||
#if 0
|
||||
EActivityHandler *activity_handler = tasks_component_peek_activity_handler (tasks_component_peek ());
|
||||
|
||||
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
|
||||
|
||||
if (!cal_table->activity_handler)
|
||||
return;
|
||||
|
||||
if (!message || !*message) {
|
||||
if (cal_table->activity_id != 0) {
|
||||
e_activity_handler_operation_finished (activity_handler, cal_table->activity_id);
|
||||
e_activity_handler_operation_finished (cal_table->activity_handler, cal_table->activity_id);
|
||||
cal_table->activity_id = 0;
|
||||
}
|
||||
} else if (cal_table->activity_id == 0) {
|
||||
@ -1378,12 +1386,11 @@ e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *mes
|
||||
if (progress_icon == NULL)
|
||||
progress_icon = e_icon_factory_get_icon (EVOLUTION_TASKS_PROGRESS_IMAGE, 16);
|
||||
|
||||
cal_table->activity_id = e_activity_handler_operation_started (activity_handler, client_id,
|
||||
cal_table->activity_id = e_activity_handler_operation_started (cal_table->activity_handler, client_id,
|
||||
progress_icon, message, TRUE);
|
||||
|
||||
g_free (client_id);
|
||||
} else {
|
||||
e_activity_handler_operation_progressing (activity_handler, cal_table->activity_id, message, -1.0);
|
||||
e_activity_handler_operation_progressing (cal_table->activity_handler, cal_table->activity_id, message, -1.0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <gtk/gtktable.h>
|
||||
#include <gal/e-table/e-table-scrolled.h>
|
||||
#include <widgets/misc/e-cell-date-edit.h>
|
||||
#include "e-activity-handler.h"
|
||||
#include "e-cal-model.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -61,6 +62,7 @@ struct _ECalendarTable {
|
||||
icalcomponent *tmp_vcal;
|
||||
|
||||
/* Activity ID for the EActivityHandler (i.e. the status bar). */
|
||||
EActivityHandler *activity_handler;
|
||||
guint activity_id;
|
||||
};
|
||||
|
||||
@ -92,6 +94,8 @@ void e_calendar_table_load_state (ECalendarTable *cal_table,
|
||||
void e_calendar_table_save_state (ECalendarTable *cal_table,
|
||||
gchar *filename);
|
||||
|
||||
void e_calendar_table_set_activity_handler (ECalendarTable *cal_table,
|
||||
EActivityHandler *activity_handler);
|
||||
void e_calendar_table_set_status_message (ECalendarTable *cal_table,
|
||||
const gchar *message);
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@
|
||||
#include <gtk/gtkbindings.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <gal/util/e-util.h>
|
||||
#include "e-util/e-dialog-utils.h"
|
||||
#include <e-util/e-dialog-utils.h>
|
||||
#include <e-util/e-icon-factory.h>
|
||||
#include "e-calendar-marshal.h"
|
||||
#include <libecal/e-cal-time-util.h>
|
||||
#include <libecal/e-cal-component.h>
|
||||
@ -67,6 +68,7 @@ struct _ECalendarViewPrivate {
|
||||
ECalModel *model;
|
||||
|
||||
/* Current activity (for the EActivityHandler, i.e. the status bar). */
|
||||
EActivityHandler *activity_handler;
|
||||
guint activity_id;
|
||||
|
||||
/* The popup menu */
|
||||
@ -529,31 +531,46 @@ e_calendar_view_set_use_24_hour_format (ECalendarView *cal_view, gboolean use_24
|
||||
}
|
||||
|
||||
void
|
||||
e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message)
|
||||
e_calendar_view_set_activity_handler (ECalendarView *cal_view, EActivityHandler *activity_handler)
|
||||
{
|
||||
#if 0
|
||||
EActivityHandler *activity_handler = calendar_component_peek_activity_handler (calendar_component_peek ());
|
||||
|
||||
ECalendarViewPrivate *priv;
|
||||
|
||||
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
|
||||
|
||||
priv = cal_view->priv;
|
||||
|
||||
priv->activity_handler = activity_handler;
|
||||
}
|
||||
|
||||
void
|
||||
e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message)
|
||||
{
|
||||
ECalendarViewPrivate *priv;
|
||||
|
||||
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
|
||||
|
||||
priv = cal_view->priv;
|
||||
|
||||
if (!priv->activity_handler)
|
||||
return;
|
||||
|
||||
if (!message || !*message) {
|
||||
if (cal_view->priv->activity_id != 0) {
|
||||
e_activity_handler_operation_finished (activity_handler, cal_view->priv->activity_id);
|
||||
cal_view->priv->activity_id = 0;
|
||||
if (priv->activity_id != 0) {
|
||||
e_activity_handler_operation_finished (priv->activity_handler, priv->activity_id);
|
||||
priv->activity_id = 0;
|
||||
}
|
||||
} else if (cal_view->priv->activity_id == 0) {
|
||||
} else if (priv->activity_id == 0) {
|
||||
char *client_id = g_strdup_printf ("%p", cal_view);
|
||||
|
||||
if (progress_icon == NULL)
|
||||
progress_icon = e_icon_factory_get_icon (EVOLUTION_CALENDAR_PROGRESS_IMAGE, 16);
|
||||
|
||||
cal_view->priv->activity_id = e_activity_handler_operation_started (activity_handler, client_id, progress_icon, message, TRUE);
|
||||
priv->activity_id = e_activity_handler_operation_started (priv->activity_handler, client_id, progress_icon, message, TRUE);
|
||||
|
||||
g_free (client_id);
|
||||
} else {
|
||||
e_activity_handler_operation_progressing (activity_handler, cal_view->priv->activity_id, message, -1.0);
|
||||
e_activity_handler_operation_progressing (priv->activity_handler, priv->activity_id, message, -1.0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
GList *
|
||||
|
||||
@ -110,6 +110,7 @@ void e_calendar_view_set_default_category (ECalendarView *cal_view, co
|
||||
gboolean e_calendar_view_get_use_24_hour_format (ECalendarView *view);
|
||||
void e_calendar_view_set_use_24_hour_format (ECalendarView *view, gboolean use_24_hour);
|
||||
|
||||
void e_calendar_view_set_activity_handler (ECalendarView *cal_view, EActivityHandler *activity_handler);
|
||||
void e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message);
|
||||
|
||||
GList *e_calendar_view_get_selected_events (ECalendarView *cal_view);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +54,8 @@ struct _ETasksClass {
|
||||
|
||||
/* Notification signals */
|
||||
void (* selection_changed) (ETasks *tasks, int n_selected);
|
||||
void (* source_added) (ETasks *tasks, ESource *source);
|
||||
void (* source_removed) (ETasks *tasks, ESource *source);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
#include "dialogs/event-editor.h"
|
||||
#include "dialogs/task-editor.h"
|
||||
#include "comp-util.h"
|
||||
#include "e-calendar-marshal.h"
|
||||
#include "e-cal-model-calendar.h"
|
||||
#include "e-day-view.h"
|
||||
#include "e-day-view-config.h"
|
||||
@ -114,6 +115,9 @@ struct _GnomeCalendarPrivate {
|
||||
GtkWidget *month_view;
|
||||
GtkWidget *list_view;
|
||||
|
||||
/* Activity */
|
||||
EActivityHandler *activity_handler;
|
||||
|
||||
/* Calendar query for the date navigator */
|
||||
GList *dn_queries; /* list of CalQueries */
|
||||
char *sexp;
|
||||
@ -166,7 +170,8 @@ enum {
|
||||
CALENDAR_FOCUS_CHANGE,
|
||||
TASKPAD_FOCUS_CHANGE,
|
||||
GOTO_DATE,
|
||||
ACTIVITY,
|
||||
SOURCE_ADDED,
|
||||
SOURCE_REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -268,6 +273,28 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_BOOL);
|
||||
|
||||
gnome_calendar_signals[SOURCE_ADDED] =
|
||||
g_signal_new ("source_added",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GnomeCalendarClass, source_added),
|
||||
NULL, NULL,
|
||||
e_calendar_marshal_VOID__INT_OBJECT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_INT, G_TYPE_OBJECT);
|
||||
|
||||
gnome_calendar_signals[SOURCE_REMOVED] =
|
||||
g_signal_new ("source_removed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GnomeCalendarClass, source_removed),
|
||||
NULL, NULL,
|
||||
e_calendar_marshal_VOID__INT_OBJECT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_INT, G_TYPE_OBJECT);
|
||||
|
||||
gnome_calendar_signals[GOTO_DATE] =
|
||||
g_signal_new ("goto_date",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
@ -279,7 +306,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
|
||||
1,
|
||||
G_TYPE_INT);
|
||||
|
||||
|
||||
object_class->destroy = gnome_calendar_destroy;
|
||||
|
||||
class->dates_shown_changed = NULL;
|
||||
@ -287,6 +313,8 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
|
||||
class->taskpad_selection_changed = NULL;
|
||||
class->calendar_focus_change = NULL;
|
||||
class->taskpad_focus_change = NULL;
|
||||
class->source_added = NULL;
|
||||
class->source_removed = NULL;
|
||||
class->goto_date = gnome_calendar_goto_date;
|
||||
|
||||
/*
|
||||
@ -1526,6 +1554,7 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean gra
|
||||
if (grab_focus)
|
||||
focus_current_view (gcal);
|
||||
|
||||
gnome_calendar_set_activity_handler (gcal, priv->activity_handler);
|
||||
gnome_calendar_set_pane_positions (gcal);
|
||||
|
||||
/* For the week & month views we want the selection in the date
|
||||
@ -1754,14 +1783,21 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
|
||||
|
||||
priv = gcal->priv;
|
||||
|
||||
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), NULL);
|
||||
e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
|
||||
|
||||
source_type = e_cal_get_source_type (ecal);
|
||||
source = e_cal_get_source (ecal);
|
||||
|
||||
if (status != E_CALENDAR_STATUS_OK) {
|
||||
/* Make sure the source doesn't disappear on us */
|
||||
g_object_ref (source);
|
||||
|
||||
priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
|
||||
g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
|
||||
g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
|
||||
|
||||
g_object_unref (source);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1771,7 +1807,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
|
||||
switch (source_type) {
|
||||
case E_CAL_SOURCE_TYPE_EVENT:
|
||||
msg = g_strdup_printf (_("Loading appointments at %s"), e_cal_get_uri (ecal));
|
||||
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), msg);
|
||||
e_calendar_view_set_status_message (priv->views[priv->current_view_type], msg);
|
||||
g_free (msg);
|
||||
|
||||
/* add client to the views */
|
||||
@ -1785,17 +1821,17 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
|
||||
/* update date navigator query */
|
||||
update_query (gcal);
|
||||
|
||||
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), NULL);
|
||||
e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
|
||||
break;
|
||||
|
||||
case E_CAL_SOURCE_TYPE_TODO:
|
||||
msg = g_strdup_printf (_("Loading tasks at %s"), e_cal_get_uri (ecal));
|
||||
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), msg);
|
||||
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), msg);
|
||||
g_free (msg);
|
||||
|
||||
e_cal_model_add_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)), ecal);
|
||||
|
||||
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), NULL);
|
||||
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1807,10 +1843,13 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
|
||||
static gboolean
|
||||
open_ecal (GnomeCalendar *gcal, ECal *cal, gboolean only_if_exists)
|
||||
{
|
||||
GnomeCalendarPrivate *priv;
|
||||
char *msg;
|
||||
|
||||
msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
|
||||
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), msg);
|
||||
priv = gcal->priv;
|
||||
|
||||
msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
|
||||
e_calendar_view_set_status_message (priv->views[priv->current_view_type], msg);
|
||||
g_free (msg);
|
||||
|
||||
g_signal_connect (G_OBJECT (cal), "cal_opened", G_CALLBACK (client_cal_opened_cb), gcal);
|
||||
@ -1930,8 +1969,9 @@ backend_died_cb (ECal *ecal, gpointer data)
|
||||
gcal = GNOME_CALENDAR (data);
|
||||
priv = gcal->priv;
|
||||
|
||||
/* Make sure the source doesn't go away on us since we use it below */
|
||||
source_type = e_cal_get_source_type (ecal);
|
||||
source = e_cal_get_source (ecal);
|
||||
source = g_object_ref (e_cal_get_source (ecal));
|
||||
|
||||
priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
|
||||
g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
|
||||
@ -1943,15 +1983,14 @@ backend_died_cb (ECal *ecal, gpointer data)
|
||||
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
|
||||
e_calendar_view_set_status_message (priv->views[i], NULL);
|
||||
|
||||
/* FIXME We should probably just emit a signal here */
|
||||
e_source_selector_unselect_source (
|
||||
calendar_component_peek_source_selector (calendar_component_peek ()),
|
||||
e_cal_get_source (ecal));
|
||||
gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
|
||||
break;
|
||||
|
||||
case E_CAL_SOURCE_TYPE_TODO:
|
||||
message = g_strdup_printf (_("The task backend for '%s' has crashed."), e_source_peek_name (source));
|
||||
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1959,6 +1998,8 @@ backend_died_cb (ECal *ecal, gpointer data)
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_unref (source);
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))),
|
||||
0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
|
||||
message);
|
||||
@ -1996,6 +2037,25 @@ gnome_calendar_new (void)
|
||||
return GTK_WIDGET (gcal);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_calendar_set_activity_handler (GnomeCalendar *cal, EActivityHandler *activity_handler)
|
||||
{
|
||||
GnomeCalendarPrivate *priv;
|
||||
int i;
|
||||
|
||||
g_return_if_fail (cal != NULL);
|
||||
g_return_if_fail (GNOME_IS_CALENDAR (cal));
|
||||
|
||||
priv = cal->priv;
|
||||
|
||||
priv->activity_handler = activity_handler;
|
||||
|
||||
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
|
||||
e_calendar_view_set_activity_handler (priv->views[i], i == priv->current_view_type ? activity_handler : NULL);
|
||||
|
||||
e_calendar_table_set_activity_handler (E_CALENDAR_TABLE (priv->todo), activity_handler);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_calendar_set_ui_component (GnomeCalendar *gcal,
|
||||
BonoboUIComponent *ui_component)
|
||||
@ -2080,6 +2140,8 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou
|
||||
g_hash_table_insert (priv->clients[source_type], g_strdup (e_source_peek_uid (source)), client);
|
||||
priv->clients_list[source_type] = g_list_prepend (priv->clients_list[source_type], client);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_ADDED], source_type, source);
|
||||
|
||||
open_ecal (gcal, client, FALSE);
|
||||
|
||||
return TRUE;
|
||||
@ -2098,11 +2160,17 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou
|
||||
gboolean
|
||||
gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (gcal != NULL, FALSE);
|
||||
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
|
||||
g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
|
||||
|
||||
return gnome_calendar_remove_source_by_uid (gcal, source_type, e_source_peek_uid (source));
|
||||
result = gnome_calendar_remove_source_by_uid (gcal, source_type, e_source_peek_uid (source));
|
||||
if (result)
|
||||
gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@ -88,9 +88,12 @@ struct _GnomeCalendarClass {
|
||||
|
||||
void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in);
|
||||
void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in);
|
||||
void (* goto_date) (GnomeCalendar *gcal,
|
||||
GnomeCalendarGotoDateType date);
|
||||
|
||||
void (* source_added) (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
|
||||
void (* source_removed) (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
|
||||
|
||||
/* Action signals */
|
||||
void (* goto_date) (GnomeCalendar *gcal, GnomeCalendarGotoDateType date);
|
||||
};
|
||||
|
||||
|
||||
@ -99,8 +102,8 @@ GtkWidget *gnome_calendar_construct (GnomeCalendar *gcal);
|
||||
|
||||
GtkWidget *gnome_calendar_new (void);
|
||||
|
||||
void gnome_calendar_set_ui_component (GnomeCalendar *cal,
|
||||
BonoboUIComponent *ui_component);
|
||||
void gnome_calendar_set_activity_handler (GnomeCalendar *cal, EActivityHandler *activity_handler);
|
||||
void gnome_calendar_set_ui_component (GnomeCalendar *cal, BonoboUIComponent *ui_component);
|
||||
|
||||
ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
|
||||
|
||||
|
||||
@ -376,6 +376,11 @@ primary_source_selection_changed_cb (ESourceSelector *selector, TasksComponentVi
|
||||
update_uri_for_primary_selection (component_view);
|
||||
}
|
||||
|
||||
static void
|
||||
source_removed_cb (ETasks *tasks, ESource *source, TasksComponentView *component_view)
|
||||
{
|
||||
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
|
||||
}
|
||||
|
||||
/* Evolution::Component CORBA methods */
|
||||
|
||||
@ -602,14 +607,19 @@ create_component_view (TasksComponent *tasks_component)
|
||||
}
|
||||
|
||||
component_view->tasks = (ETasks *) bonobo_control_get_widget (component_view->view_control);
|
||||
g_signal_connect (component_view->tasks, "source_removed",
|
||||
G_CALLBACK (source_removed_cb), component_view);
|
||||
|
||||
/* Create status bar */
|
||||
statusbar_widget = e_task_bar_new ();
|
||||
component_view->activity_handler = e_activity_handler_new ();
|
||||
e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
|
||||
gtk_widget_show (statusbar_widget);
|
||||
|
||||
component_view->statusbar_control = bonobo_control_new (statusbar_widget);
|
||||
|
||||
e_calendar_table_set_activity_handler (e_tasks_get_calendar_table (component_view->tasks), component_view->activity_handler);
|
||||
|
||||
/* connect after setting the initial selections, or we'll get unwanted calls
|
||||
to calendar_control_sensitize_calendar_commands */
|
||||
g_signal_connect (component_view->source_selector, "selection_changed",
|
||||
@ -891,18 +901,4 @@ tasks_component_peek_source_list (TasksComponent *component)
|
||||
return component->priv->source_list;
|
||||
}
|
||||
|
||||
ESourceSelector *
|
||||
tasks_component_peek_source_selector (TasksComponent *component)
|
||||
{
|
||||
// return component->priv->source_selector;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EActivityHandler *
|
||||
tasks_component_peek_activity_handler (TasksComponent *component)
|
||||
{
|
||||
// return component->priv->activity_handler;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BONOBO_TYPE_FUNC_FULL (TasksComponent, GNOME_Evolution_Component, PARENT_TYPE, tasks_component)
|
||||
|
||||
@ -60,7 +60,5 @@ TasksComponent *tasks_component_peek (void);
|
||||
const char *tasks_component_peek_base_directory (TasksComponent *component);
|
||||
const char *tasks_component_peek_config_directory (TasksComponent *component);
|
||||
ESourceList *tasks_component_peek_source_list (TasksComponent *component);
|
||||
ESourceSelector *tasks_component_peek_source_selector (TasksComponent *component);
|
||||
EActivityHandler *tasks_component_peek_activity_handler (TasksComponent *component);
|
||||
|
||||
#endif /* _TASKS_COMPONENT_H_ */
|
||||
|
||||
Reference in New Issue
Block a user