From 8cfbc8ec2dfb219b67608b38f58130dd67310c04 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Fri, 16 Jan 2004 00:46:01 +0000 Subject: new function. (impl_createControls): create a task bar also for the tasks 2004-01-16 Rodrigo Moya * gui/tasks-component.[ch] (tasks_component_peek_activity_handler): new function. (impl_createControls): create a task bar also for the tasks component. We can't rely on the calendar component's one. (tasks_component_init): create the private activity handler. * gui/e-calendar-table.c (e_calendar_table_set_status_message): use the tasks component's activity handler. * gui/e-tasks.c (on_url_cb): new callback to display status bar messages when mousing over links. (setup_widgets): connect to "on_url" signal on the HTML widget. svn path=/trunk/; revision=24262 --- calendar/ChangeLog | 15 +++++++++++++++ calendar/gui/e-calendar-table.c | 2 +- calendar/gui/e-tasks.c | 16 ++++++++++++++++ calendar/gui/tasks-component.c | 29 ++++++++++++++++++----------- calendar/gui/tasks-component.h | 12 +++++++----- 5 files changed, 57 insertions(+), 17 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 61de6ee97e..b3a8607fc5 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,18 @@ +2004-01-16 Rodrigo Moya + + * gui/tasks-component.[ch] + (tasks_component_peek_activity_handler): new function. + (impl_createControls): create a task bar also for the tasks + component. We can't rely on the calendar component's one. + (tasks_component_init): create the private activity handler. + + * gui/e-calendar-table.c (e_calendar_table_set_status_message): + use the tasks component's activity handler. + + * gui/e-tasks.c (on_url_cb): new callback to display status + bar messages when mousing over links. + (setup_widgets): connect to "on_url" signal on the HTML widget. + 2004-01-15 Rodrigo Moya * gui/dialogs/comp-editor.c: reverted my changes made on Jan 8th. diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 786f97504a..455cbbba8b 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -1377,7 +1377,7 @@ 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 ()); + EActivityHandler *activity_handler = tasks_component_peek_activity_handler (tasks_component_peek ()); g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 085751c1da..7b5abba0c9 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -303,6 +303,20 @@ on_link_clicked (GtkHTML *html, const char *url, gpointer data) } } +static void +on_url_cb (GtkHTML *html, const char *url, gpointer data) +{ + char *msg; + ETasks *tasks = data; + + if (url && *url) { + msg = g_strdup_printf (_("Click to open %s"), url); + e_calendar_table_set_status_message (e_tasks_get_calendar_table (tasks), msg); + g_free (msg); + } else + e_calendar_table_set_status_message (e_tasks_get_calendar_table (tasks), NULL); +} + /* Callback used when the cursor changes in the table */ static void table_cursor_change_cb (ETable *etable, int row, gpointer data) @@ -557,6 +571,8 @@ setup_widgets (ETasks *tasks) G_CALLBACK (url_requested_cb), NULL); g_signal_connect (G_OBJECT (priv->html), "link_clicked", G_CALLBACK (on_link_clicked), tasks); + g_signal_connect (G_OBJECT (priv->html), "on_url", + G_CALLBACK (on_url_cb), tasks); gtk_widget_pop_colormap (); scroll = gtk_scrolled_window_new (NULL, NULL); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 9f0470773a..0295b84b16 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -75,6 +75,8 @@ struct _TasksComponentPrivate { ECal *create_ecal; GList *notifications; + + EActivityHandler *activity_handler; }; /* Utility functions. */ @@ -506,8 +508,8 @@ impl_createControls (PortableServer_Servant servant, { TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant)); TasksComponentPrivate *priv; - GtkWidget *selector_scrolled_window; - BonoboControl *sidebar_control; + GtkWidget *selector_scrolled_window, *statusbar_widget; + BonoboControl *sidebar_control, *statusbar_control; guint not; priv = component->priv; @@ -565,15 +567,12 @@ impl_createControls (PortableServer_Servant servant, *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev); *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (priv->view_control), ev); - /* The tasks component doesn't use the status bar so just return an empty label. */ - { - GtkWidget *label = gtk_label_new (""); - BonoboControl *control; - - gtk_widget_show (label); - control = bonobo_control_new (label); - *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); - } + /* Create the task bar */ + statusbar_widget = e_task_bar_new (); + e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget)); + gtk_widget_show (statusbar_widget); + statusbar_control = bonobo_control_new (statusbar_widget); + *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev); } static GNOME_Evolution_CreatableItemTypeList * @@ -777,6 +776,8 @@ tasks_component_init (TasksComponent *component, TasksComponentClass *klass) priv->source_list = e_source_list_new_for_gconf (priv->gconf_client, "/apps/evolution/tasks/sources"); + priv->activity_handler = e_activity_handler_new (); + component->priv = priv; } @@ -819,4 +820,10 @@ tasks_component_peek_source_list (TasksComponent *component) return component->priv->source_list; } +EActivityHandler * +tasks_component_peek_activity_handler (TasksComponent *component) +{ + return component->priv->activity_handler; +} + BONOBO_TYPE_FUNC_FULL (TasksComponent, GNOME_Evolution_Component, PARENT_TYPE, tasks_component) diff --git a/calendar/gui/tasks-component.h b/calendar/gui/tasks-component.h index 1cdb0bdff1..063150a56f 100644 --- a/calendar/gui/tasks-component.h +++ b/calendar/gui/tasks-component.h @@ -25,6 +25,7 @@ #include #include +#include #include "Evolution.h" @@ -52,11 +53,12 @@ struct _TasksComponentClass { }; -GType tasks_component_get_type (void); -TasksComponent *tasks_component_peek (void); +GType tasks_component_get_type (void); +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); +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); +EActivityHandler *tasks_component_peek_activity_handler (TasksComponent *component); #endif /* _TASKS_COMPONENT_H_ */ -- cgit