From ac0442e31c68ce073e4156bbe47d63da8f7d2523 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 2 Dec 2003 02:17:34 +0000 Subject: Pass a label for the status bar control for now. * gui/component/addressbook-component.c (impl_createControls): Pass a label for the status bar control for now. * gui/calendar-component.c (impl_createControls): Pass a label for the status bar control for now. * gui/tasks-component.c (impl_createControls): Pass a label for the status bar control for now. * mail-component.c (impl_createControls): Pass a label for the status bar control for now. * e-shell.c (struct _EShellPrivate): Remove member activity_handler. (setup_activity_interface): Remove. (e_shell_init): Don't call. (create_window): Don't attach the task bar to the activity handler. * e-shell-window.c (struct _ComponentView): New member statusbar_widget. (struct _EShellWindowPrivate): Remove member task_bar. (init_view): Get the status bar control from createControls and put it in the ComponentView struct. (setup_task_bar): New. (setup_statusbar_notebook): New. (switch_view): Switch the statusbar notebook too. (impl_dispose): Add missing GTK_OBJECT() cast. (e_shell_window_peek_task_bar): Remove. * Evolution-Component.idl (Component::createControls): New out arg "statusbar_control"; this way components can provide their own status bar. * e-activity-handler.c, e-activity-handler.h: Turn into a plain GObject; translate all the CORBA methods into plain C methods. * Makefile.am: Move e-activity-handler to libeshell instead of it being in the shell. svn path=/trunk/; revision=23555 --- addressbook/ChangeLog | 5 + addressbook/gui/component/addressbook-component.c | 12 + calendar/ChangeLog | 8 + calendar/gui/calendar-component.c | 11 + calendar/gui/tasks-component.c | 11 + mail/ChangeLog | 5 + mail/mail-component.c | 11 + shell/ChangeLog | 30 ++ shell/Evolution-Component.idl | 3 +- shell/Makefile.am | 4 +- shell/e-activity-handler.c | 388 ++++++---------------- shell/e-activity-handler.h | 35 +- shell/e-shell-window.c | 44 +-- shell/e-shell-window.h | 1 - shell/e-shell.c | 23 -- 15 files changed, 242 insertions(+), 349 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 9bb07f7968..81713aab1b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,8 @@ +2003-12-01 Ettore Perazzoli + + * gui/component/addressbook-component.c (impl_createControls): + Pass a label for the status bar control for now. + 2003-12-01 Larry Ewing * gui/component/Makefile.am (INCLUDES): remove diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 046b1f5a00..306a1f6e2b 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -39,6 +39,7 @@ #include #include #include +#include /* FIXME */ #include #include #include @@ -149,6 +150,7 @@ static void impl_createControls (PortableServer_Servant servant, Bonobo_Control *corba_sidebar_control, Bonobo_Control *corba_view_control, + Bonobo_Control *corba_statusbar_control, CORBA_Environment *ev) { AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant)); @@ -183,6 +185,16 @@ impl_createControls (PortableServer_Servant servant, *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 addressbook"); + BonoboControl *control; + + gtk_widget_show (label); + control = bonobo_control_new (label); + *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); + } } static GNOME_Evolution_CreatableItemTypeList * diff --git a/calendar/ChangeLog b/calendar/ChangeLog index f6f5f58841..cc6dc2e756 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2003-12-01 Ettore Perazzoli + + * gui/calendar-component.c (impl_createControls): Pass a label for + the status bar control for now. + + * gui/tasks-component.c (impl_createControls): Pass a label for + the status bar control for now. + 2003-12-01 Rodney Dawes * gui/GNOME_Evolution_Calendar.server.in.in: diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 0968b9372f..53acafe853 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -509,6 +509,7 @@ static void impl_createControls (PortableServer_Servant servant, Bonobo_Control *corba_sidebar_control, Bonobo_Control *corba_view_control, + Bonobo_Control *corba_statusbar_control, CORBA_Environment *ev) { CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant)); @@ -576,6 +577,16 @@ 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); + } } diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 0045c66848..9b29767396 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -473,6 +473,7 @@ static void impl_createControls (PortableServer_Servant servant, Bonobo_Control *corba_sidebar_control, Bonobo_Control *corba_view_control, + Bonobo_Control *corba_statusbar_control, CORBA_Environment *ev) { TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant)); @@ -536,6 +537,16 @@ 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. */ + { + GtkLabel *label = gtk_label_new ("Hey hey this is the tasks component"); + BonoboControl *control; + + gtk_widget_show (label); + control = bonobo_control_new (label); + *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); + } } static GNOME_Evolution_CreatableItemTypeList * diff --git a/mail/ChangeLog b/mail/ChangeLog index b1a592ce5f..da58519f1b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2003-12-01 Ettore Perazzoli + + * mail-component.c (impl_createControls): Pass a label for the + status bar control for now. + 2003-12-01 Jeffrey Stedfast * mail-config.c (mail_config_signature_run_script): Use fcntl() to diff --git a/mail/mail-component.c b/mail/mail-component.c index 6f06889e81..e43f0610d3 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -318,6 +318,7 @@ static void impl_createControls (PortableServer_Servant servant, Bonobo_Control *corba_tree_control, Bonobo_Control *corba_view_control, + Bonobo_Control *corba_statusbar_control, CORBA_Environment *ev) { MailComponent *mail_component = MAIL_COMPONENT (bonobo_object_from_servant (servant)); @@ -343,6 +344,16 @@ impl_createControls (PortableServer_Servant servant, g_signal_connect (view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget); g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget); + + /* FIXME temporary for testing. */ + { + GtkWidget *label = gtk_label_new ("Hey hey this is the mailer"); + BonoboControl *control; + + gtk_widget_show (label); + control = bonobo_control_new (label); + *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); + } } diff --git a/shell/ChangeLog b/shell/ChangeLog index b71cc589b7..eb3ed5cd68 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,33 @@ +2003-12-01 Ettore Perazzoli + + * e-shell.c (struct _EShellPrivate): Remove member + activity_handler. + (setup_activity_interface): Remove. + (e_shell_init): Don't call. + (create_window): Don't attach the task bar to the activity + handler. + + * e-shell-window.c (struct _ComponentView): New member + statusbar_widget. + (struct _EShellWindowPrivate): Remove member task_bar. + (init_view): Get the status bar control from createControls and + put it in the ComponentView struct. + (setup_task_bar): New. + (setup_statusbar_notebook): New. + (switch_view): Switch the statusbar notebook too. + (impl_dispose): Add missing GTK_OBJECT() cast. + (e_shell_window_peek_task_bar): Remove. + + * Evolution-Component.idl (Component::createControls): New out arg + "statusbar_control"; this way components can provide their own + status bar. + + * e-activity-handler.c, e-activity-handler.h: Turn into a plain + GObject; translate all the CORBA methods into plain C methods. + + * Makefile.am: Move e-activity-handler to libeshell instead of it + being in the shell. + 2003-12-01 Rodney Dawes * GNOME_Evolution_Shell.server.in.in: diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl index 0d1af94e75..97c3e6ad3a 100644 --- a/shell/Evolution-Component.idl +++ b/shell/Evolution-Component.idl @@ -39,7 +39,8 @@ module Evolution { /* Create the controls for embedding in the shell. */ void createControls (out Bonobo::Control sidebar_control, - out Bonobo::Control view_control) + out Bonobo::Control view_control, + out Bonobo::Control statusbar_control) raises (Failed); /* Request the component to quit. The component will reply diff --git a/shell/Makefile.am b/shell/Makefile.am index 7dc9e7e896..8ac0866d88 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -109,6 +109,7 @@ eshellincludedir = $(privincludedir)/shell eshellinclude_HEADERS = \ Evolution.h \ + e-activity-handler.h \ e-folder-list.h \ e-folder-tree.h \ e-folder.h \ @@ -129,6 +130,7 @@ eshellinclude_HEADERS = \ libeshell_la_SOURCES = \ $(IDL_GENERATED) \ $(MARSHAL_GENERATED) \ + e-activity-handler.c \ e-folder-list.c \ e-folder-tree.c \ e-folder.c \ @@ -155,8 +157,6 @@ libeshell_la_LIBADD = \ evolution_SOURCES = \ $(SELECT_NAMES_IDL_GENERATED) \ $(DATASERVER_IDL_GENERATED) \ - e-activity-handler.c \ - e-activity-handler.h \ e-component-registry.c \ e-component-registry.h \ e-config-upgrade.c \ diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c index 023ff59cd5..695b7f6606 100644 --- a/shell/e-activity-handler.c +++ b/shell/e-activity-handler.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-activity-handler.c * - * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 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 @@ -37,35 +37,32 @@ #include #include -#include - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; +#define PARENT_TYPE G_TYPE_OBJECT +static GObjectClass *parent_class = NULL; + - #define ICON_SIZE 16 - + struct _ActivityInfo { char *component_id; GdkPixbuf *icon_pixbuf; - GNOME_Evolution_Activity_ActivityId id; - CORBA_char *information; - CORBA_boolean cancellable; - Bonobo_Listener event_listener; - CORBA_float progress; + guint id; + char *information; + gboolean cancellable; + double progress; GtkWidget *menu; }; typedef struct _ActivityInfo ActivityInfo; struct _EActivityHandlerPrivate { - GNOME_Evolution_Activity_ActivityId next_activity_id; + uint next_activity_id; GList *activity_infos; GSList *task_bars; }; - + /* Utility functions. */ static unsigned int @@ -80,7 +77,7 @@ get_new_activity_id (EActivityHandler *activity_handler) static GList * lookup_activity (GList *list, - GNOME_Evolution_Activity_ActivityId activity_id, + guint activity_id, int *order_number_return) { GList *p; @@ -100,176 +97,63 @@ lookup_activity (GList *list, return NULL; } -#if 0 -static const CORBA_any * -get_corba_null_value (void) -{ - static CORBA_any *null_value = NULL; - - if (null_value == NULL) { - null_value = CORBA_any__alloc (); - null_value->_type = TC_null; - } - - return null_value; -} - -static void -report_task_event (ActivityInfo *activity_info, - const char *event_name) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - Bonobo_Listener_event (activity_info->event_listener, event_name, get_corba_null_value (), &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("EActivityHandler: Cannot event `%s' -- %s", event_name, ev._repo_id); - - CORBA_exception_free (&ev); -} -#endif - - /* ETaskWidget actions. */ -#if 0 -static void -task_widget_cancel_callback (GtkWidget *widget, - void *data) -{ - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) data; - report_task_event (activity_info, "Cancel"); -} - -static void -task_widget_show_details_callback (GtkWidget *widget, - void *data) -{ - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) data; - report_task_event (activity_info, "ShowDetails"); -} - -static void -show_cancellation_popup (ActivityInfo *activity_info, - GtkWidget *task_widget, - GdkEventButton *button_event) -{ - GtkMenu *popup; - EPopupMenu items[] = { - E_POPUP_MENU (N_("Show Details"), task_widget_show_details_callback, 0), - E_POPUP_SEPARATOR, - E_POPUP_MENU (N_("Cancel Operation"), task_widget_cancel_callback, 0), - E_POPUP_TERMINATOR - }; - - /* FIXME: We should gray out things properly here. */ - popup = e_popup_menu_create (items, 0, 0, activity_info); - - g_assert (activity_info->menu == NULL); - activity_info->menu = GTK_WIDGET (popup); - - gnome_popup_menu_do_popup_modal (GTK_WIDGET (popup), NULL, NULL, button_event, activity_info); - - activity_info->menu = NULL; -} -#endif - static int task_widget_button_press_event_callback (GtkWidget *widget, GdkEventButton *button_event, void *data) { - CORBA_Environment ev; ActivityInfo *activity_info; - CORBA_any *null_value; activity_info = (ActivityInfo *) data; - if (button_event->button == 3) { - if (! activity_info->cancellable) { - return FALSE; - } else { - /* show_cancellation_popup (activity_info, widget, button_event); */ - /* return TRUE; */ - return TRUE; - } - } + if (button_event->button == 3) + return activity_info->cancellable; if (button_event->button != 1) return FALSE; - CORBA_exception_init (&ev); - - null_value = CORBA_any__alloc (); - null_value->_type = TC_null; - - Bonobo_Listener_event (activity_info->event_listener, "Clicked", null_value, &ev); - if (BONOBO_EX (&ev) != CORBA_NO_EXCEPTION) - g_warning ("EActivityHandler: Cannot report `Clicked' event -- %s", - BONOBO_EX_REPOID (&ev)); - - CORBA_free (null_value); - - CORBA_exception_free (&ev); - return TRUE; } - + /* Creating and destroying ActivityInfos. */ static ActivityInfo * activity_info_new (const char *component_id, - GNOME_Evolution_Activity_ActivityId id, + guint id, GdkPixbuf *icon, - const CORBA_char *information, - CORBA_boolean cancellable, - const Bonobo_Listener event_listener) + const char *information, + gboolean cancellable) { ActivityInfo *info; - CORBA_Environment ev; - - CORBA_exception_init (&ev); info = g_new (ActivityInfo, 1); info->component_id = g_strdup (component_id); info->id = id; info->icon_pixbuf = g_object_ref (icon); - info->information = CORBA_string_dup (information); + info->information = g_strdup (information); info->cancellable = cancellable; - info->event_listener = CORBA_Object_duplicate (event_listener, &ev); info->progress = -1.0; /* (Unknown) */ info->menu = NULL; - CORBA_exception_free (&ev); - return info; } static void activity_info_free (ActivityInfo *info) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - g_free (info->component_id); g_object_unref (info->icon_pixbuf); - CORBA_free (info->information); - CORBA_Object_release (info->event_listener, &ev); + g_free (info->information); if (info->menu != NULL) gtk_widget_destroy (info->menu); g_free (info); - - CORBA_exception_free (&ev); } static ETaskWidget * @@ -289,7 +173,7 @@ task_widget_new_from_activity_info (ActivityInfo *activity_info) return E_TASK_WIDGET (widget); } - + /* Task Bar handling. */ static void @@ -320,7 +204,7 @@ task_bar_destroy_notify (void *data, priv->task_bars = g_slist_remove (priv->task_bars, task_bar_instance); } - + /* GObject methods. */ static void @@ -365,89 +249,113 @@ impl_finalize (GObject *object) (* G_OBJECT_CLASS (parent_class)->finalize) (object); } - -/* CORBA methods. */ + +/* GTK+ type stuff. */ static void -impl_operationStarted (PortableServer_Servant servant, - const CORBA_char *component_id, - const GNOME_Evolution_AnimatedIcon *icon, - const CORBA_char *information, - const CORBA_boolean cancellable, - const Bonobo_Listener event_listener, - GNOME_Evolution_Activity_ActivityId *activity_id_return, - CORBA_boolean *suggest_display_return, - CORBA_Environment *ev) +class_init (GObjectClass *object_class) +{ + parent_class = g_type_class_ref(PARENT_TYPE); + + object_class->dispose = impl_dispose; + object_class->finalize = impl_finalize; +} + +static void +init (EActivityHandler *activity_handler) { - EActivityHandler *activity_handler; EActivityHandlerPrivate *priv; - ActivityInfo *activity_info; - GdkPixbuf *icon_pixbuf; - unsigned int activity_id; - GSList *p; - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); + priv = g_new (EActivityHandlerPrivate, 1); + priv->next_activity_id = 0; + priv->activity_infos = NULL; + priv->task_bars = NULL; + + activity_handler->priv = priv; +} + + +EActivityHandler * +e_activity_handler_new (void) +{ + return g_object_new (e_activity_handler_get_type (), 0); +} + + +void +e_activity_handler_attach_task_bar (EActivityHandler *activity_handler, + ETaskBar *task_bar) +{ + EActivityHandlerPrivate *priv; + + g_return_if_fail (activity_handler != NULL); + g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler)); + g_return_if_fail (task_bar != NULL); + g_return_if_fail (E_IS_TASK_BAR (task_bar)); priv = activity_handler->priv; - if (icon->_length == 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Activity_InvalidIcon, NULL); - return; - } + g_object_weak_ref (G_OBJECT (task_bar), task_bar_destroy_notify, activity_handler); + + priv->task_bars = g_slist_prepend (priv->task_bars, task_bar); + + setup_task_bar (activity_handler, task_bar); +} - if (icon->_length > 1) - g_warning ("Animated icons are not supported for activities (yet)."); +/* CORBA methods. */ + +guint +e_activity_handler_operation_started (EActivityHandler *activity_handler, + const char *component_id, + GdkPixbuf *icon_pixbuf, + const char *information, + gboolean cancellable) +{ + EActivityHandlerPrivate *priv; + ActivityInfo *activity_info; + unsigned int activity_id; + GSList *p; - icon_pixbuf = e_new_gdk_pixbuf_from_corba_icon (icon->_buffer, ICON_SIZE, ICON_SIZE); + priv = activity_handler->priv; activity_id = get_new_activity_id (activity_handler); - activity_info = activity_info_new (component_id, activity_id, icon_pixbuf, information, - cancellable, event_listener); + activity_info = activity_info_new (component_id, activity_id, icon_pixbuf, information, cancellable); - for (p = priv->task_bars; p != NULL; p = p->next) + for (p = priv->task_bars; p != NULL; p = p->next) { e_task_bar_prepend_task (E_TASK_BAR (p->data), task_widget_new_from_activity_info (activity_info)); + } g_object_unref (icon_pixbuf); priv->activity_infos = g_list_prepend (priv->activity_infos, activity_info); - *activity_id_return = activity_id; + return activity_id; } -static void -impl_operationProgressing (PortableServer_Servant servant, - const GNOME_Evolution_Activity_ActivityId activity_id, - const CORBA_char *information, - const CORBA_float progress, - CORBA_Environment *ev) +void +e_activity_handler_operation_progressing (EActivityHandler *activity_handler, + guint activity_id, + const char *information, + double progress) { - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; + EActivityHandlerPrivate *priv = activity_handler->priv; ActivityInfo *activity_info; GList *p; GSList *sp; int order_number; - /* FIXME? The complexity in this function sucks. */ - - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - priv = activity_handler->priv; - p = lookup_activity (priv->activity_infos, activity_id, &order_number); if (p == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Activity_IdNotFound, NULL); + g_warning ("EActivityHandler: uknown operation %d", activity_id); return; } activity_info = (ActivityInfo *) p->data; - CORBA_free (activity_info->information); - activity_info->information = CORBA_string_dup (information); + g_free (activity_info->information); + activity_info->information = g_strdup (information); activity_info->progress = progress; @@ -462,21 +370,15 @@ impl_operationProgressing (PortableServer_Servant servant, } } -static void -impl_operationFinished (PortableServer_Servant servant, - const GNOME_Evolution_Activity_ActivityId activity_id, - CORBA_Environment *ev) +void +e_activity_client_operation_finished (EActivityHandler *activity_handler, + guint activity_id) { - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; + EActivityHandlerPrivate *priv = activity_handler->priv; GList *p; GSList *sp; int order_number; - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - priv = activity_handler->priv; - p = lookup_activity (priv->activity_infos, activity_id, &order_number); activity_info_free ((ActivityInfo *) p->data); @@ -490,99 +392,5 @@ impl_operationFinished (PortableServer_Servant servant, } } -static GNOME_Evolution_Activity_DialogAction -impl_requestDialog (PortableServer_Servant servant, - const GNOME_Evolution_Activity_ActivityId activity_id, - const GNOME_Evolution_Activity_DialogType dialog_type, - CORBA_Environment *ev) -{ - EActivityHandler *activity_handler; - - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - /* FIXME implement. */ - g_warning ("Evolution::Activity::requestDialog not implemented"); - - return GNOME_Evolution_Activity_DIALOG_ACTION_DISPLAY; -} - - -/* GTK+ type stuff. */ - -static void -e_activity_handler_class_init (GObjectClass *object_class) -{ - EActivityHandlerClass *handler_class; - - parent_class = g_type_class_ref(PARENT_TYPE); - - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; - - handler_class = E_ACTIVITY_HANDLER_CLASS (object_class); - handler_class->epv.operationStarted = impl_operationStarted; - handler_class->epv.operationProgressing = impl_operationProgressing; - handler_class->epv.operationFinished = impl_operationFinished; - handler_class->epv.requestDialog = impl_requestDialog; -} - -static void -e_activity_handler_init (EActivityHandler *activity_handler) -{ - EActivityHandlerPrivate *priv; - - priv = g_new (EActivityHandlerPrivate, 1); - priv->next_activity_id = 0; - priv->activity_infos = NULL; - priv->task_bars = NULL; - - activity_handler->priv = priv; -} - - -void -e_activity_handler_construct (EActivityHandler *activity_handler) -{ - g_return_if_fail (activity_handler != NULL); - g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler)); - - /* Nothing to do here. */ -} - -EActivityHandler * -e_activity_handler_new (void) -{ - EActivityHandler *activity_handler; - - activity_handler = g_object_new (e_activity_handler_get_type (), 0); - e_activity_handler_construct (activity_handler); - - return activity_handler; -} - - -void -e_activity_handler_attach_task_bar (EActivityHandler *activity_handler, - ETaskBar *task_bar) -{ - EActivityHandlerPrivate *priv; - - g_return_if_fail (activity_handler != NULL); - g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler)); - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - - priv = activity_handler->priv; - - g_object_weak_ref (G_OBJECT (task_bar), task_bar_destroy_notify, activity_handler); - - priv->task_bars = g_slist_prepend (priv->task_bars, task_bar); - - setup_task_bar (activity_handler, task_bar); -} - -BONOBO_TYPE_FUNC_FULL (EActivityHandler, - GNOME_Evolution_Activity, - PARENT_TYPE, - e_activity_handler) +E_MAKE_TYPE (e_activity_handler, "EActivityHandler", EActivityHandler, class_init, init, PARENT_TYPE) diff --git a/shell/e-activity-handler.h b/shell/e-activity-handler.h index b69c360765..6a315fae21 100644 --- a/shell/e-activity-handler.h +++ b/shell/e-activity-handler.h @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-activity-handler.h * - * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 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 @@ -27,7 +27,7 @@ #include "e-task-bar.h" -#include +#include #ifdef __cplusplus extern "C" { @@ -40,31 +40,44 @@ extern "C" { #define E_IS_ACTIVITY_HANDLER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER)) #define E_IS_ACTIVITY_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER)) - + typedef struct _EActivityHandler EActivityHandler; typedef struct _EActivityHandlerPrivate EActivityHandlerPrivate; typedef struct _EActivityHandlerClass EActivityHandlerClass; struct _EActivityHandler { - BonoboObject parent; + GObject parent; EActivityHandlerPrivate *priv; }; struct _EActivityHandlerClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Activity__epv epv; + GObjectClass parent_class; }; - -GtkType e_activity_handler_get_type (void); -void e_activity_handler_construct (EActivityHandler *activity_hanlder); -EActivityHandler *e_activity_handler_new (void); + +GtkType e_activity_handler_get_type (void); + +EActivityHandler *e_activity_handler_new (void); void e_activity_handler_attach_task_bar (EActivityHandler *activity_hanlder, ETaskBar *task_bar); +guint e_activity_handler_operation_started (EActivityHandler *activity_handler, + const char *component_id, + GdkPixbuf *icon_pixbuf, + const char *information, + gboolean cancellable); + +void e_activity_handler_operation_progressing (EActivityHandler *activity_handler, + guint activity_id, + const char *information, + double progress); + +void e_activity_client_operation_finished (EActivityHandler *activity_handler, + guint activity_id); + + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index cde68a42e6..e11908902f 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -30,7 +30,6 @@ #include "e-shell-window-commands.h" #include "e-shell-marshal.h" #include "e-sidebar.h" -#include "e-task-bar.h" #include "e-util/e-lang-utils.h" @@ -72,6 +71,7 @@ struct _ComponentView { GtkWidget *sidebar_widget; GtkWidget *view_widget; + GtkWidget *statusbar_widget; int notebook_page_num; }; @@ -90,6 +90,7 @@ struct _EShellWindowPrivate { /* Notebooks used to switch between components. */ GtkWidget *sidebar_notebook; GtkWidget *view_notebook; + GtkWidget *statusbar_notebook; /* Bonobo foo. */ BonoboUIComponent *ui_component; @@ -105,7 +106,6 @@ struct _EShellWindowPrivate { GtkWidget *offline_toggle; GtkWidget *offline_toggle_image; GtkWidget *menu_hint_label; - GtkWidget *task_bar; }; @@ -191,9 +191,11 @@ init_view (EShellWindow *window, Bonobo_UIContainer container; Bonobo_Control sidebar_control; Bonobo_Control view_control; + Bonobo_Control statusbar_control; CORBA_Environment ev; int sidebar_notebook_page_num; int view_notebook_page_num; + int statusbar_notebook_page_num; g_assert (view->view_widget == NULL); g_assert (view->sidebar_widget == NULL); @@ -214,7 +216,7 @@ init_view (EShellWindow *window, /* 2. Set up view. */ - GNOME_Evolution_Component_createControls (component_iface, &sidebar_control, &view_control, &ev); + GNOME_Evolution_Component_createControls (component_iface, &sidebar_control, &view_control, &statusbar_control, &ev); if (BONOBO_EX (&ev)) { g_warning ("Cannot create view for %s", view->component_id); @@ -239,11 +241,17 @@ init_view (EShellWindow *window, gtk_widget_show (view->view_widget); bonobo_object_release_unref (view_control, NULL); + view->statusbar_widget = bonobo_widget_new_control_from_objref (statusbar_control, container); + gtk_widget_show (view->statusbar_widget); + bonobo_object_release_unref (statusbar_control, NULL); + gtk_notebook_append_page (GTK_NOTEBOOK (priv->sidebar_notebook), view->sidebar_widget, NULL); gtk_notebook_append_page (GTK_NOTEBOOK (priv->view_notebook), view->view_widget, NULL); + gtk_notebook_append_page (GTK_NOTEBOOK (priv->statusbar_notebook), view->statusbar_widget, NULL); sidebar_notebook_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->sidebar_notebook), view->sidebar_widget); view_notebook_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->view_notebook), view->view_widget); + statusbar_notebook_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->view_notebook), view->statusbar_widget); /* Since we always add a view page and a sidebar page at the same time... */ g_assert (sidebar_notebook_page_num == view_notebook_page_num); @@ -254,6 +262,7 @@ init_view (EShellWindow *window, gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->view_notebook), view_notebook_page_num); gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->sidebar_notebook), view_notebook_page_num); + gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->statusbar_notebook), view_notebook_page_num); if (priv->current_view != NULL) component_view_deactivate (priv->current_view); @@ -279,6 +288,7 @@ switch_view (EShellWindow *window, ComponentView *component_view) gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->view_notebook), component_view->notebook_page_num); gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->sidebar_notebook), component_view->notebook_page_num); + gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->statusbar_notebook), component_view->notebook_page_num); } gconf_client_set_string (gconf_client, "/apps/evolution/shell/view_defaults/component_id", @@ -411,7 +421,7 @@ ui_engine_add_hint_callback (BonoboUIEngine *engine, { gtk_label_set_text (GTK_LABEL (window->priv->menu_hint_label), hint); gtk_widget_show (window->priv->menu_hint_label); - gtk_widget_hide (window->priv->task_bar); + gtk_widget_hide (window->priv->statusbar_notebook); } static void @@ -419,7 +429,7 @@ ui_engine_remove_hint_callback (BonoboUIEngine *engine, EShellWindow *window) { gtk_widget_hide (window->priv->menu_hint_label); - gtk_widget_show (window->priv->task_bar); + gtk_widget_show (window->priv->statusbar_notebook); } @@ -494,18 +504,18 @@ setup_menu_hint_label (EShellWindow *window) } static void -setup_task_bar (EShellWindow *window) +setup_statusbar_notebook (EShellWindow *window) { EShellWindowPrivate *priv; priv = window->priv; - priv->task_bar = e_task_bar_new (); - - g_assert (priv->status_bar != NULL); + priv->statusbar_notebook = gtk_notebook_new (); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->statusbar_notebook), FALSE); + gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->statusbar_notebook), FALSE); - gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->task_bar, TRUE, TRUE, 0); - gtk_widget_show (priv->task_bar); + gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->statusbar_notebook, TRUE, TRUE, 0); + gtk_widget_show (priv->statusbar_notebook); } static void @@ -521,7 +531,7 @@ setup_status_bar (EShellWindow *window) setup_offline_toggle (window); setup_menu_hint_label (window); - setup_task_bar (window); + setup_statusbar_notebook (window); ui_engine = bonobo_window_get_ui_engine (BONOBO_WINDOW (window)); @@ -598,7 +608,7 @@ impl_dispose (GObject *object) } if (priv->tooltips != NULL) { - gtk_object_destroy (priv->tooltips); + gtk_object_destroy (GTK_OBJECT (priv->tooltips)); priv->tooltips = NULL; } @@ -782,14 +792,6 @@ e_shell_window_peek_bonobo_ui_component (EShellWindow *window) return window->priv->ui_component; } -GtkWidget * -e_shell_window_peek_task_bar (EShellWindow *window) -{ - g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL); - - return window->priv->task_bar; -} - void e_shell_window_save_defaults (EShellWindow *window) { diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h index f7431d5a68..01c231c329 100644 --- a/shell/e-shell-window.h +++ b/shell/e-shell-window.h @@ -64,7 +64,6 @@ const char *e_shell_window_peek_current_component_id (EShellWindow *shell); EShell *e_shell_window_peek_shell (EShellWindow *window); BonoboUIComponent *e_shell_window_peek_bonobo_ui_component (EShellWindow *window); -GtkWidget *e_shell_window_peek_task_bar (EShellWindow *window); void e_shell_window_save_defaults (EShellWindow *window); void e_shell_window_show_settings (EShellWindow *window); diff --git a/shell/e-shell.c b/shell/e-shell.c index 3406dec228..a29461ef00 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -28,7 +28,6 @@ #include "e-util/e-dialog-utils.h" -#include "e-activity-handler.h" #include "e-setup.h" #include "e-shell-constants.h" #include "e-shell-offline-handler.h" @@ -96,9 +95,6 @@ struct _EShellPrivate { /* Settings Dialog */ GtkWidget *settings_dialog; - /* The handler for the ::Activity interface. */ - EActivityHandler *activity_handler; /* */ - /* Whether the shell is succesfully initialized. This is needed during the start-up sequence, to avoid CORBA calls to do make wrong things to happen while the shell is initializing. */ @@ -144,18 +140,6 @@ get_config_start_offline (void) return value; } -/* Set up the ::Activity interface. */ -static void -setup_activity_interface (EShell *shell) -{ - EActivityHandler *activity_handler; - - activity_handler = e_activity_handler_new (); - - bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (activity_handler)); - shell->priv->activity_handler = activity_handler; -} - /* Interactivity handling. */ @@ -328,8 +312,6 @@ create_window (EShell *shell, g_signal_connect (window, "delete_event", G_CALLBACK (window_delete_event_cb), shell); g_object_weak_ref (G_OBJECT (window), window_weak_notify, shell); - e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (e_shell_window_peek_task_bar (window))); - shell->priv->windows = g_list_prepend (shell->priv->windows, window); g_signal_emit (shell, signals[NEW_WINDOW_CREATED], 0, window); @@ -391,9 +373,6 @@ impl_dispose (GObject *object) priv->settings_dialog = NULL; } - /* No unreffing for this as it is aggregate. */ - /* bonobo_object_unref (BONOBO_OBJECT (priv->activity_handler)); */ - (* G_OBJECT_CLASS (parent_class)->dispose) (object); } @@ -478,8 +457,6 @@ e_shell_init (EShell *shell) priv->user_creatable_items_handler = e_user_creatable_items_handler_new (priv->component_registry); shell->priv = priv; - - setup_activity_interface (shell); } -- cgit