diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-12-02 13:24:02 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-12-02 13:24:02 +0800 |
commit | 49e7dd311ec4652cbd87fe6f7627c54ab20f4782 (patch) | |
tree | de7f360836c95134d1c57a52391a7fb4ee58388e /calendar/gui | |
parent | 89dc17247f41b4d82f4a973fa6f4a8358cd0f42c (diff) | |
download | gsoc2013-evolution-49e7dd311ec4652cbd87fe6f7627c54ab20f4782.tar.gz gsoc2013-evolution-49e7dd311ec4652cbd87fe6f7627c54ab20f4782.tar.zst gsoc2013-evolution-49e7dd311ec4652cbd87fe6f7627c54ab20f4782.zip |
Replace member "activity" with an "activity_id".
* gui/e-calendar-table.h (struct _ECalendarTable): Replace member
"activity" with an "activity_id".
* gui/e-cal-view.c (struct _ECalendarViewPrivate): Replace member
"activity" with "activity_id".
(e_calendar_view_destroy): Don't unref activity here anymore.
(e_calendar_view_set_status_message): Report progress using the
EActivityHandler off the CalendarComponent.
* gui/calendar-component.c
(struct _CalendarComponentPrivate): New member activity_handler.
(calendar_component_init): Init.
(calendar_component_peek_activity_handler): New.
(impl_dispose): Unref.
(impl_createControls): Return an ETaskBar for the statusbar
control.
svn path=/trunk/; revision=23565
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar-component.c | 36 | ||||
-rw-r--r-- | calendar/gui/calendar-component.h | 8 | ||||
-rw-r--r-- | calendar/gui/e-cal-view.c | 42 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 48 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.h | 5 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 42 |
6 files changed, 89 insertions, 92 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 53acafe853..93c5a0be42 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -62,7 +62,9 @@ struct _CalendarComponentPrivate { GnomeCalendar *calendar; GtkWidget *source_selector; - guint selected_not; + guint selected_not; + + EActivityHandler *activity_handler; }; /* FIXME This should be gnome cal likely */ @@ -474,6 +476,11 @@ impl_dispose (GObject *object) priv->selected_not = 0; } + if (priv->activity_handler != NULL) { + g_object_unref (priv->activity_handler); + priv->activity_handler = NULL; + } + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } @@ -515,8 +522,10 @@ impl_createControls (PortableServer_Servant servant, CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant)); CalendarComponentPrivate *priv; GtkWidget *selector_scrolled_window; + GtkWidget *statusbar_widget; BonoboControl *sidebar_control; BonoboControl *view_control; + BonoboControl *statusbar_control; priv = calendar_component->priv; @@ -566,6 +575,11 @@ impl_createControls (PortableServer_Servant servant, G_CALLBACK (fill_popup_menu_cb), G_OBJECT (calendar_component), 0); + statusbar_widget = e_task_bar_new (); + gtk_widget_show (statusbar_widget); + e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget)); + statusbar_control = bonobo_control_new (statusbar_widget); + /* Load the selection from the last run */ update_selection (calendar_component); update_primary_selection (calendar_component); @@ -577,16 +591,7 @@ impl_createControls (PortableServer_Servant servant, /* Return the controls */ *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev); *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev); - - /* FIXME temporary for testing. */ - { - GtkWidget *label = gtk_label_new ("Hey hey this is the calendar"); - BonoboControl *control; - - gtk_widget_show (label); - control = bonobo_control_new (label); - *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); - } + *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev); } @@ -707,6 +712,8 @@ calendar_component_init (CalendarComponent *component) priv->source_list = e_source_list_new_for_gconf (priv->gconf_client, "/apps/evolution/calendar/sources"); + priv->activity_handler = e_activity_handler_new (); + /* create default calendars if there are no groups */ groups = e_source_list_peek_groups (priv->source_list); if (!groups) { @@ -779,4 +786,11 @@ calendar_component_peek_config_directory (CalendarComponent *component) } +EActivityHandler * +calendar_component_peek_activity_handler (CalendarComponent *component) +{ + return component->priv->activity_handler; +} + + BONOBO_TYPE_FUNC_FULL (CalendarComponent, GNOME_Evolution_Component, PARENT_TYPE, calendar_component) diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h index 8b51720446..77d2fe9879 100644 --- a/calendar/gui/calendar-component.h +++ b/calendar/gui/calendar-component.h @@ -26,6 +26,8 @@ #include <bonobo/bonobo-object.h> #include <libedataserver/e-source-list.h> + +#include "e-activity-handler.h" #include "Evolution.h" @@ -57,9 +59,9 @@ GType calendar_component_get_type (void); CalendarComponent *calendar_component_peek (void); -const char *calendar_component_peek_config_directory (CalendarComponent *component); - -ESourceList *calendar_component_peek_source_list (CalendarComponent *component); +const char *calendar_component_peek_config_directory (CalendarComponent *component); +ESourceList *calendar_component_peek_source_list (CalendarComponent *component); +EActivityHandler *calendar_component_peek_activity_handler (CalendarComponent *component); #endif /* _CALENDAR_COMPONENT_H_ */ diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index 8b8d29bdaf..4d2db99905 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-view.c @@ -30,8 +30,9 @@ #include "e-util/e-dialog-utils.h" #include "e-calendar-marshal.h" #include <libecal/e-cal-time-util.h> -#include "evolution-activity-client.h" + #include "calendar-commands.h" +#include "calendar-component.h" #include "calendar-config.h" #include "comp-util.h" #include "e-cal-model-calendar.h" @@ -50,7 +51,7 @@ /* Used for the status bar messages */ #define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" -static GdkPixbuf *progress_icon[2] = { NULL, NULL }; +static GdkPixbuf *progress_icon = NULL; struct _ECalendarViewPrivate { /* The GnomeCalendar we are associated to */ @@ -59,8 +60,8 @@ struct _ECalendarViewPrivate { /* The calendar model we are monitoring */ ECalModel *model; - /* The activity client used to show messages on the status bar. */ - EvolutionActivityClient *activity; + /* Current activity (for the EActivityHandler, i.e. the status bar). */ + guint activity_id; /* clipboard selections */ gchar *clipboard_selection; @@ -360,11 +361,6 @@ e_calendar_view_destroy (GtkObject *object) cal_view->priv->model = NULL; } - if (cal_view->priv->activity) { - g_object_unref (cal_view->priv->activity); - cal_view->priv->activity = NULL; - } - if (cal_view->priv->clipboard_selection) { g_free (cal_view->priv->clipboard_selection); cal_view->priv->clipboard_selection = NULL; @@ -516,31 +512,27 @@ 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) { + EActivityHandler *activity_handler = calendar_component_peek_activity_handler (calendar_component_peek ()); + g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); if (!message || !*message) { - if (cal_view->priv->activity) { - g_object_unref (cal_view->priv->activity); - cal_view->priv->activity = NULL; + 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; } - } else if (!cal_view->priv->activity) { -#if 0 - int display; -#endif + } else if (cal_view->priv->activity_id == 0) { char *client_id = g_strdup_printf ("%p", cal_view); - if (progress_icon[0] == NULL) - progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE, NULL); + if (progress_icon == NULL) + progress_icon = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE, NULL); -#if 0 - cal_view->priv->activity = evolution_activity_client_new ( - global_shell_client, client_id, - progress_icon, message, TRUE, &display); -#endif + cal_view->priv->activity_id = e_activity_handler_operation_started (activity_handler, client_id, progress_icon, message, TRUE); g_free (client_id); - } else - evolution_activity_client_update (cal_view->priv->activity, message, -1.0); + } else { + e_activity_handler_operation_progressing (activity_handler, cal_view->priv->activity_id, message, -1.0); + } } GList * diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index fc14a50800..74be935d5c 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -5,8 +5,7 @@ * Damon Chaplin <damon@ximian.com> * Rodrigo Moya <rodrigo@ximian.com> * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. + * Copyright 2000, 2001, 2002, 2003 Novell, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -42,15 +41,17 @@ #include <e-util/e-dialog-utils.h> #include <widgets/misc/e-cell-date-edit.h> #include <widgets/misc/e-cell-percent.h> -#include "e-comp-editor-registry.h" -#include "e-calendar-table.h" -#include "e-cell-date-edit-text.h" + +#include "calendar-component.h" #include "calendar-config.h" -#include "e-cal-model-tasks.h" -#include "print.h" #include "dialogs/delete-comp.h" #include "dialogs/delete-error.h" #include "dialogs/task-editor.h" +#include "e-cal-model-tasks.h" +#include "e-calendar-table.h" +#include "e-cell-date-edit-text.h" +#include "e-comp-editor-registry.h" +#include "print.h" /* Pixmaps. */ #include "art/task.xpm" @@ -316,8 +317,6 @@ e_calendar_table_init (ECalendarTable *cal_table) GdkPixbuf *pixbuf; GList *strings; - cal_table->activity = NULL; - /* Create the model */ cal_table->model = (ECalModel *) e_cal_model_tasks_new (); @@ -1435,32 +1434,31 @@ static char *test[] = { /* Displays messages on the status bar */ #define EVOLUTION_TASKS_PROGRESS_IMAGE "evolution-tasks-mini.png" -static GdkPixbuf *progress_icon[2] = { NULL, NULL }; +static GdkPixbuf *progress_icon = NULL; void e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *message) { + EActivityHandler *activity_handler = calendar_component_peek_activity_handler (calendar_component_peek ()); + g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); if (!message || !*message) { - if (cal_table->activity) { - g_object_unref (cal_table->activity); - cal_table->activity = NULL; - } - } else if (!cal_table->activity) { - int display; + if (cal_table->activity_id != 0) { + e_activity_handler_operation_finished (activity_handler, cal_table->activity_id); + cal_table->activity_id = 0; + } + } else if (cal_table->activity_id == 0) { char *client_id = g_strdup_printf ("%p", cal_table); - if (progress_icon[0] == NULL) - progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_TASKS_PROGRESS_IMAGE, NULL); + if (progress_icon == NULL) + progress_icon = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_TASKS_PROGRESS_IMAGE, NULL); -#if 0 /* EPFIXME */ - cal_table->activity = evolution_activity_client_new ( - global_shell_client, client_id, - progress_icon, message, TRUE, &display); -#endif + cal_table->activity_id = e_activity_handler_operation_started (activity_handler, client_id, + progress_icon, message, TRUE); g_free (client_id); - } else - evolution_activity_client_update (cal_table->activity, message, -1.0); + } else { + evolution_activity_client_update (activity_handler, cal_table->activity_id, message, -1.0); + } } diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h index 70dd031174..810c78254b 100644 --- a/calendar/gui/e-calendar-table.h +++ b/calendar/gui/e-calendar-table.h @@ -26,7 +26,6 @@ #include <gtk/gtktable.h> #include <gal/e-table/e-table-scrolled.h> -#include <shell/evolution-activity-client.h> #include <widgets/misc/e-cell-date-edit.h> #include "e-cal-model.h" @@ -63,8 +62,8 @@ struct _ECalendarTable { gchar *clipboard_selection; icalcomponent *tmp_vcal; - /* The activity client used to show messages on the status bar. */ - EvolutionActivityClient *activity; + /* Activity ID for the EActivityHandler (i.e. the status bar). */ + guint activity_id; }; struct _ECalendarTableClass { diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 8b8d29bdaf..4d2db99905 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -30,8 +30,9 @@ #include "e-util/e-dialog-utils.h" #include "e-calendar-marshal.h" #include <libecal/e-cal-time-util.h> -#include "evolution-activity-client.h" + #include "calendar-commands.h" +#include "calendar-component.h" #include "calendar-config.h" #include "comp-util.h" #include "e-cal-model-calendar.h" @@ -50,7 +51,7 @@ /* Used for the status bar messages */ #define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" -static GdkPixbuf *progress_icon[2] = { NULL, NULL }; +static GdkPixbuf *progress_icon = NULL; struct _ECalendarViewPrivate { /* The GnomeCalendar we are associated to */ @@ -59,8 +60,8 @@ struct _ECalendarViewPrivate { /* The calendar model we are monitoring */ ECalModel *model; - /* The activity client used to show messages on the status bar. */ - EvolutionActivityClient *activity; + /* Current activity (for the EActivityHandler, i.e. the status bar). */ + guint activity_id; /* clipboard selections */ gchar *clipboard_selection; @@ -360,11 +361,6 @@ e_calendar_view_destroy (GtkObject *object) cal_view->priv->model = NULL; } - if (cal_view->priv->activity) { - g_object_unref (cal_view->priv->activity); - cal_view->priv->activity = NULL; - } - if (cal_view->priv->clipboard_selection) { g_free (cal_view->priv->clipboard_selection); cal_view->priv->clipboard_selection = NULL; @@ -516,31 +512,27 @@ 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) { + EActivityHandler *activity_handler = calendar_component_peek_activity_handler (calendar_component_peek ()); + g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); if (!message || !*message) { - if (cal_view->priv->activity) { - g_object_unref (cal_view->priv->activity); - cal_view->priv->activity = NULL; + 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; } - } else if (!cal_view->priv->activity) { -#if 0 - int display; -#endif + } else if (cal_view->priv->activity_id == 0) { char *client_id = g_strdup_printf ("%p", cal_view); - if (progress_icon[0] == NULL) - progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE, NULL); + if (progress_icon == NULL) + progress_icon = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE, NULL); -#if 0 - cal_view->priv->activity = evolution_activity_client_new ( - global_shell_client, client_id, - progress_icon, message, TRUE, &display); -#endif + cal_view->priv->activity_id = e_activity_handler_operation_started (activity_handler, client_id, progress_icon, message, TRUE); g_free (client_id); - } else - evolution_activity_client_update (cal_view->priv->activity, message, -1.0); + } else { + e_activity_handler_operation_progressing (activity_handler, cal_view->priv->activity_id, message, -1.0); + } } GList * |