From 92d0b48b3ca0793ea7f3be32c189302ca6ec60f2 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Fri, 19 Oct 2001 15:26:43 +0000 Subject: keep a reference to the EvolutionShellClient component 2001-10-19 Rodrigo Moya * gui/component-factory.c (owner_set_cb): keep a reference to the EvolutionShellClient component * gui/e-week-view.c (e_week_view_set_status_message): new function (update_query): call e_week_view_set_status_message (query_query_done_cb): (query_eval_error_cb): clean up status bar messages * gui/e-day-view.c (e_day_view_set_status_message): new function (update_query): call e_day_view_set_status_message (query_query_done_cb): (query_eval_error_cb): clean up status bar messages * gui/Makefile.am: added EVOLUTION_IMAGESDIR to CFLAGS svn path=/trunk/; revision=13793 --- calendar/gui/e-week-view.c | 49 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'calendar/gui/e-week-view.c') diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 22f776b557..3fb334905a 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -80,6 +80,9 @@ we get from the server. */ #define E_WEEK_VIEW_LAYOUT_TIMEOUT 100 +/* Used for the status bar messages */ +#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" +static GdkPixbuf *progress_icon[2] = { NULL, NULL }; /* Signal IDs */ enum { @@ -453,6 +456,8 @@ e_week_view_init (EWeekView *week_view) GTK_SIGNAL_FUNC (invisible_destroyed), (gpointer) week_view); week_view->clipboard_selection = NULL; + + week_view->activity = NULL; } @@ -519,8 +524,15 @@ e_week_view_destroy (GtkObject *object) if (week_view->invisible) gtk_widget_destroy (week_view->invisible); - if (week_view->clipboard_selection) + if (week_view->clipboard_selection) { g_free (week_view->clipboard_selection); + week_view->clipboard_selection = NULL; + } + + if (week_view->activity) { + gtk_object_unref (GTK_OBJECT (week_view->activity)); + week_view->activity = NULL; + } GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -1079,6 +1091,8 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err /* FIXME */ + e_week_view_set_status_message (week_view, NULL); + if (status != CAL_QUERY_DONE_SUCCESS) fprintf (stderr, "query done: %s\n", error_str); @@ -1095,6 +1109,8 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) /* FIXME */ + e_week_view_set_status_message (week_view, NULL); + fprintf (stderr, "eval error: %s\n", error_str); gtk_widget_queue_draw (week_view->main_canvas); @@ -1162,6 +1178,7 @@ update_query (EWeekView *week_view) return; /* No time range is set, so don't start a query */ } + e_week_view_set_status_message (week_view, _("Searching")); week_view->query = cal_client_get_query (week_view->client, real_sexp); g_free (real_sexp); @@ -3921,3 +3938,33 @@ e_week_view_get_num_events_selected (EWeekView *week_view) return (week_view->editing_event_num != -1) ? 1 : 0; } + +/* Displays a message on the activity client. */ +void +e_week_view_set_status_message (EWeekView *week_view, const char *message) +{ + extern EvolutionShellClient *global_shell_client; /* ugly */ + + g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + + if (!message || !*message) { + if (week_view->activity) { + gtk_object_unref (GTK_OBJECT (week_view->activity)); + week_view->activity = NULL; + } + } + else if (!week_view->activity) { + int display; + char *client_id = g_strdup_printf ("%p", week_view); + + if (progress_icon[0] == NULL) + progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE); + week_view->activity = evolution_activity_client_new ( + global_shell_client, client_id, + progress_icon, message, TRUE, &display); + + g_free (client_id); + } + else + evolution_activity_client_update (week_view->activity, message, -1.0); +} -- cgit