diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-10-19 23:26:43 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-10-19 23:26:43 +0800 |
commit | 92d0b48b3ca0793ea7f3be32c189302ca6ec60f2 (patch) | |
tree | 0f959d7d5baceedbe4d1e04db95a9aa31861b3b2 /calendar/gui | |
parent | 971f97e0518eb19270ead8e500843685e6c5ae71 (diff) | |
download | gsoc2013-evolution-92d0b48b3ca0793ea7f3be32c189302ca6ec60f2.tar.gz gsoc2013-evolution-92d0b48b3ca0793ea7f3be32c189302ca6ec60f2.tar.zst gsoc2013-evolution-92d0b48b3ca0793ea7f3be32c189302ca6ec60f2.zip |
keep a reference to the EvolutionShellClient component
2001-10-19 Rodrigo Moya <rodrigo@ximian.com>
* 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
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/Makefile.am | 47 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 3 | ||||
-rw-r--r-- | calendar/gui/component-factory.c | 3 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 49 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 7 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 49 | ||||
-rw-r--r-- | calendar/gui/e-week-view.h | 6 |
7 files changed, 139 insertions, 25 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index caf867926f..8b70da7f10 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -35,29 +35,30 @@ help_base = $(datadir)/gnome/help/cal bin_PROGRAMS = evolution-calendar -INCLUDES = \ - -DG_LOG_DOMAIN=\"calendar-gui\" \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_srcdir)/calendar/cal-client \ - -I$(top_builddir)/calendar/cal-client \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_srcdir)/addressbook/backend/ebook \ - -I$(top_builddir)/addressbook/backend/ebook \ - -I$(top_srcdir)/widgets \ - -I$(includedir) \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - $(GNOME_VFS_CFLAGS) \ - $(GAL_CFLAGS) \ - $(BONOBO_CONF_CFLAGS) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" +INCLUDES = \ + -DG_LOG_DOMAIN=\"calendar-gui\" \ + -I$(top_builddir)/shell \ + -I$(top_srcdir)/shell \ + -I$(top_srcdir) \ + -I$(top_srcdir)/calendar \ + -I$(top_srcdir)/calendar/cal-client \ + -I$(top_builddir)/calendar/cal-client \ + -I$(top_srcdir)/libical/src/libical \ + -I$(top_builddir)/libical/src/libical \ + -I$(top_srcdir)/addressbook/backend/ebook \ + -I$(top_builddir)/addressbook/backend/ebook \ + -I$(top_srcdir)/widgets \ + -I$(includedir) \ + $(BONOBO_HTML_GNOME_CFLAGS) \ + $(GNOME_VFS_CFLAGS) \ + $(GAL_CFLAGS) \ + $(BONOBO_CONF_CFLAGS) \ + -DEVOLUTION_DATADIR=\""$(datadir)"\" \ + -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ + -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ + -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ + -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ + -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" iconsdir = $(datadir)/images/evolution diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 5aa8913f73..bfa1a258bc 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -56,6 +56,7 @@ #define CREATE_TASK_ID "task" char *evolution_dir; +EvolutionShellClient *global_shell_client = NULL; static const EvolutionShellComponentFolderType folder_types[] = { { FOLDER_CALENDAR, @@ -483,6 +484,8 @@ owner_set_cb (EvolutionShellComponent *shell_component, } shells = g_list_append (shells, shell_component); + + global_shell_client = shell_client; } static void diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index 5aa8913f73..bfa1a258bc 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -56,6 +56,7 @@ #define CREATE_TASK_ID "task" char *evolution_dir; +EvolutionShellClient *global_shell_client = NULL; static const EvolutionShellComponentFolderType folder_types[] = { { FOLDER_CALENDAR, @@ -483,6 +484,8 @@ owner_set_cb (EvolutionShellComponent *shell_component, } shells = g_list_append (shells, shell_component); + + global_shell_client = shell_client; } static void diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index ef3928a029..7aaee07062 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -97,6 +97,9 @@ we get from the server. */ #define E_DAY_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 { @@ -871,6 +874,8 @@ e_day_view_init (EDayView *day_view) GTK_SIGNAL_FUNC (invisible_destroyed), (gpointer) day_view); day_view->clipboard_selection = NULL; + + day_view->activity = NULL; } @@ -956,8 +961,15 @@ e_day_view_destroy (GtkObject *object) if (day_view->invisible) gtk_widget_destroy (day_view->invisible); - if (day_view->clipboard_selection) + if (day_view->clipboard_selection) { g_free (day_view->clipboard_selection); + day_view->clipboard_selection = NULL; + } + + if (day_view->activity) { + gtk_object_unref (GTK_OBJECT (day_view->activity)); + day_view->activity = NULL; + } GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -1575,6 +1587,8 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err /* FIXME */ + e_day_view_set_status_message (day_view, NULL); + if (status != CAL_QUERY_DONE_SUCCESS) fprintf (stderr, "query done: %s\n", error_str); } @@ -1589,6 +1603,8 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) /* FIXME */ + e_day_view_set_status_message (day_view, NULL); + fprintf (stderr, "eval error: %s\n", error_str); } @@ -1655,6 +1671,7 @@ update_query (EDayView *day_view) if (!real_sexp) return; /* No time range is set, so don't start a query */ + e_day_view_set_status_message (day_view, _("Searching")); day_view->query = cal_client_get_query (day_view->client, real_sexp); g_free (real_sexp); @@ -7026,3 +7043,33 @@ e_day_view_get_num_events_selected (EDayView *day_view) return (day_view->editing_event_day != -1) ? 1 : 0; } + +/* Displays messages on the status bar. */ +void +e_day_view_set_status_message (EDayView *day_view, const char *message) +{ + extern EvolutionShellClient *global_shell_client; /* ugly */ + + g_return_if_fail (E_IS_DAY_VIEW (day_view)); + + if (!message || !*message) { + if (day_view->activity) { + gtk_object_unref (GTK_OBJECT (day_view->activity)); + day_view->activity = NULL; + } + } + else if (!day_view->activity) { + int display; + char *client_id = g_strdup_printf ("%p", day_view); + + if (progress_icon[0] == NULL) + progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE); + day_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 (day_view->activity, message, -1.0); +} diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 4b57a2e155..17c83304b6 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -30,6 +30,7 @@ #include <libgnomeui/gnome-canvas.h> #include "gnome-cal.h" +#include "evolution-activity-client.h" #ifdef __cplusplus extern "C" { @@ -493,6 +494,9 @@ struct _EDayView /* The default category for new events */ char *default_category; + + /* The activity client used to show messages on the status bar. */ + EvolutionActivityClient *activity; }; struct _EDayViewClass @@ -657,6 +661,9 @@ gint e_day_view_get_time_string_width (EDayView *day_view); gint e_day_view_event_sort_func (const void *arg1, const void *arg2); +void e_day_view_set_status_message (EDayView *day_view, + const char *message); + #ifdef __cplusplus } #endif /* __cplusplus */ 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); +} diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index 9b4d4c817b..6fc0629a2b 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -29,6 +29,7 @@ #include <libgnomeui/gnome-canvas.h> #include "gnome-cal.h" +#include "evolution-activity-client.h" #ifdef __cplusplus extern "C" { @@ -363,6 +364,9 @@ struct _EWeekView /* The default category for new events */ char *default_category; + + /* The activity client used to show messages on the status bar. */ + EvolutionActivityClient *activity; }; struct _EWeekViewClass @@ -495,6 +499,8 @@ gint e_week_view_get_time_string_width (EWeekView *week_view); gint e_week_view_event_sort_func (const void *arg1, const void *arg2); +void e_week_view_set_status_message (EWeekView *week_view, + const char *message); #ifdef __cplusplus } |