diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-cal-view.c | 40 | ||||
-rw-r--r-- | calendar/gui/e-cal-view.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 40 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 55 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 6 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 54 | ||||
-rw-r--r-- | calendar/gui/e-week-view.h | 7 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 28 |
9 files changed, 112 insertions, 122 deletions
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index 3c35995a60..6272f0eab9 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-view.c @@ -23,11 +23,19 @@ #include <config.h> #include <gal/util/e-util.h> +#include "evolution-activity-client.h" #include "e-cal-view.h" +/* Used for the status bar messages */ +#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" +static GdkPixbuf *progress_icon[2] = { NULL, NULL }; + struct _ECalViewPrivate { /* The GnomeCalendar we are associated to */ GnomeCalendar *calendar; + + /* The activity client used to show messages on the status bar. */ + EvolutionActivityClient *activity; }; static void e_cal_view_class_init (ECalViewClass *klass); @@ -81,6 +89,11 @@ e_cal_view_destroy (GtkObject *object) g_return_if_fail (E_IS_CAL_VIEW (cal_view)); if (cal_view->priv) { + if (cal_view->priv->activity) { + g_object_unref (cal_view->priv->activity); + cal_view->priv->activity = NULL; + } + g_free (cal_view->priv); cal_view->priv = NULL; } @@ -107,3 +120,30 @@ e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar) cal_view->priv->calendar = calendar; } + +void +e_cal_view_set_status_message (ECalView *cal_view, const gchar *message) +{ + extern EvolutionShellClient *global_shell_client; /* ugly */ + + g_return_if_fail (E_IS_CAL_VIEW (cal_view)); + + if (!message || !*message) { + if (cal_view->priv->activity) { + g_object_unref (cal_view->priv->activity); + cal_view->priv->activity = NULL; + } + } else if (!cal_view->priv->activity) { + int display; + 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); + cal_view->priv->activity = evolution_activity_client_new ( + global_shell_client, client_id, + progress_icon, message, TRUE, &display); + + g_free (client_id); + } else + evolution_activity_client_update (cal_view->priv->activity, message, -1.0); +} diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h index 275798b43a..b43fa0301d 100644 --- a/calendar/gui/e-cal-view.h +++ b/calendar/gui/e-cal-view.h @@ -58,6 +58,8 @@ GType e_cal_view_get_type (void); GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view); void e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar); +void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message); + G_END_DECLS #endif diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 3c35995a60..6272f0eab9 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -23,11 +23,19 @@ #include <config.h> #include <gal/util/e-util.h> +#include "evolution-activity-client.h" #include "e-cal-view.h" +/* Used for the status bar messages */ +#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" +static GdkPixbuf *progress_icon[2] = { NULL, NULL }; + struct _ECalViewPrivate { /* The GnomeCalendar we are associated to */ GnomeCalendar *calendar; + + /* The activity client used to show messages on the status bar. */ + EvolutionActivityClient *activity; }; static void e_cal_view_class_init (ECalViewClass *klass); @@ -81,6 +89,11 @@ e_cal_view_destroy (GtkObject *object) g_return_if_fail (E_IS_CAL_VIEW (cal_view)); if (cal_view->priv) { + if (cal_view->priv->activity) { + g_object_unref (cal_view->priv->activity); + cal_view->priv->activity = NULL; + } + g_free (cal_view->priv); cal_view->priv = NULL; } @@ -107,3 +120,30 @@ e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar) cal_view->priv->calendar = calendar; } + +void +e_cal_view_set_status_message (ECalView *cal_view, const gchar *message) +{ + extern EvolutionShellClient *global_shell_client; /* ugly */ + + g_return_if_fail (E_IS_CAL_VIEW (cal_view)); + + if (!message || !*message) { + if (cal_view->priv->activity) { + g_object_unref (cal_view->priv->activity); + cal_view->priv->activity = NULL; + } + } else if (!cal_view->priv->activity) { + int display; + 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); + cal_view->priv->activity = evolution_activity_client_new ( + global_shell_client, client_id, + progress_icon, message, TRUE, &display); + + g_free (client_id); + } else + evolution_activity_client_update (cal_view->priv->activity, message, -1.0); +} diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index 275798b43a..b43fa0301d 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -58,6 +58,8 @@ GType e_cal_view_get_type (void); GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view); void e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar); +void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message); + G_END_DECLS #endif diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index e731193b4f..55343080ba 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -107,10 +107,6 @@ 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 }; - /* Drag and Drop stuff. */ enum { TARGET_CALENDAR_EVENT, @@ -855,8 +851,6 @@ e_day_view_init (EDayView *day_view) G_CALLBACK (selection_received), (gpointer) day_view); day_view->clipboard_selection = NULL; - - day_view->activity = NULL; } @@ -968,11 +962,6 @@ e_day_view_destroy (GtkObject *object) day_view->clipboard_selection = NULL; } - if (day_view->activity) { - g_object_unref (day_view->activity); - day_view->activity = NULL; - } - GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -1595,7 +1584,7 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err /* FIXME */ - e_day_view_set_status_message (day_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), NULL); if (status != CAL_QUERY_DONE_SUCCESS) fprintf (stderr, "query done: %s\n", error_str); @@ -1611,7 +1600,7 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) /* FIXME */ - e_day_view_set_status_message (day_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), NULL); fprintf (stderr, "eval error: %s\n", error_str); } @@ -1680,7 +1669,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")); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), _("Searching")); day_view->query = cal_client_get_query (day_view->client, real_sexp); g_free (real_sexp); @@ -2835,13 +2824,13 @@ e_day_view_cut_clipboard (EDayView *day_view) if (event == NULL) return; - e_day_view_set_status_message (day_view, _("Deleting selected objects")); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), _("Deleting selected objects")); e_day_view_copy_clipboard (day_view); cal_component_get_uid (event->comp, &uid); delete_error_dialog (cal_client_remove_object (day_view->client, uid), CAL_COMPONENT_EVENT); - e_day_view_set_status_message (day_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), NULL); } void @@ -7991,7 +7980,7 @@ selection_received (GtkWidget *invisible, return; } - e_day_view_set_status_message (day_view, _("Updating objects")); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), _("Updating objects")); e_day_view_get_selected_time_range (day_view, &dtstart, &dtend); if (kind == ICAL_VCALENDAR_COMPONENT) { @@ -8056,7 +8045,7 @@ selection_received (GtkWidget *invisible, g_object_unref (comp); } - e_day_view_set_status_message (day_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (day_view), NULL); } @@ -8141,33 +8130,3 @@ e_day_view_get_selected_event (EDayView *day_view) return event ? event->comp : NULL; } - -/* 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) { - g_object_unref (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, NULL); - 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 07bbf672da..3bbf793ffb 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -511,9 +511,6 @@ struct _EDayViewClass GtkType e_day_view_get_type (void); GtkWidget* e_day_view_new (void); -void e_day_view_set_calendar (EDayView *day_view, - GnomeCalendar *calendar); - void e_day_view_set_cal_client (EDayView *day_view, CalClient *client); @@ -668,9 +665,6 @@ 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 9cdd928f28..8d3ef6a26f 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -86,10 +86,6 @@ 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 }; - static void e_week_view_class_init (EWeekViewClass *class); static void e_week_view_init (EWeekView *week_view); @@ -435,8 +431,6 @@ e_week_view_init (EWeekView *week_view) G_CALLBACK (selection_received), (gpointer) week_view); week_view->clipboard_selection = NULL; - - week_view->activity = NULL; } @@ -522,11 +516,6 @@ e_week_view_destroy (GtkObject *object) week_view->clipboard_selection = NULL; } - if (week_view->activity) { - g_object_unref (week_view->activity); - week_view->activity = NULL; - } - GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -1226,7 +1215,7 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err /* FIXME */ - e_week_view_set_status_message (week_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), NULL); if (status != CAL_QUERY_DONE_SUCCESS) fprintf (stderr, "query done: %s\n", error_str); @@ -1244,7 +1233,7 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) /* FIXME */ - e_week_view_set_status_message (week_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), NULL); fprintf (stderr, "eval error: %s\n", error_str); @@ -1314,7 +1303,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")); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), _("Searching")); week_view->query = cal_client_get_query (week_view->client, real_sexp); g_free (real_sexp); @@ -1991,13 +1980,13 @@ e_week_view_cut_clipboard (EWeekView *week_view) if (event == NULL) return; - e_week_view_set_status_message (week_view, _("Deleting selected objects")); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), _("Deleting selected objects")); e_week_view_copy_clipboard (week_view); cal_component_get_uid (event->comp, &uid); delete_error_dialog (cal_client_remove_object (week_view->client, uid), CAL_COMPONENT_EVENT); - e_week_view_set_status_message (week_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), NULL); } void @@ -4408,7 +4397,7 @@ selection_received (GtkWidget *invisible, return; } - e_week_view_set_status_message (week_view, _("Updating objects")); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), _("Updating objects")); selected_time = week_view->day_starts[week_view->selection_start_day]; if (kind == ICAL_VCALENDAR_COMPONENT) { @@ -4502,7 +4491,7 @@ selection_received (GtkWidget *invisible, g_object_unref (comp); } - e_week_view_set_status_message (week_view, NULL); + e_cal_view_set_status_message (E_CAL_VIEW (week_view), NULL); } @@ -4584,32 +4573,3 @@ e_week_view_get_selected_event (EWeekView *week_view) return event ? event->comp : NULL; } -/* 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) { - g_object_unref (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, NULL); - 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 73e9c1697a..0fdbbf6cdd 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -30,7 +30,6 @@ #include "e-cal-view.h" #include "gnome-cal.h" -#include "evolution-activity-client.h" #ifdef __cplusplus extern "C" { @@ -365,9 +364,6 @@ 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 @@ -504,9 +500,6 @@ 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 } #endif /* __cplusplus */ diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 75dbf8df59..d8bcff310c 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1760,7 +1760,7 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da msg = g_strdup_printf (_("Adding alarms for %s"), uristr); g_free (uristr); if (client == priv->client) { - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), msg); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg); } else if (client == priv->task_pad_client) { calendar_model_set_status_message ( @@ -1794,7 +1794,7 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da } if (client == priv->client) { - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); } else if (client == priv->task_pad_client) { calendar_model_set_status_message ( @@ -1953,10 +1953,10 @@ backend_died_cb (CalClient *client, gpointer data) "You will have to restart Evolution in order " "to use it again"), uristr); - e_day_view_set_status_message (E_DAY_VIEW (priv->day_view), NULL); - e_day_view_set_status_message (E_DAY_VIEW (priv->work_week_view), NULL); - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), NULL); - e_week_view_set_status_message (E_WEEK_VIEW (priv->month_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->day_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->work_week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->month_view), NULL); } else if (client == priv->task_pad_client) { message = g_strdup_printf (_("The task backend for\n%s\n has crashed. " "You will have to restart Evolution in order " @@ -2191,14 +2191,14 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) urinopwd = get_uri_without_password (real_uri); message = g_strdup_printf (_("Opening calendar at %s"), urinopwd); g_free (urinopwd); - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), message); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), message); g_free (message); if (!cal_client_open_calendar (priv->client, real_uri, FALSE)) { g_message ("gnome_calendar_open(): Could not issue the request to open the calendar folder"); g_free (real_uri); e_uri_free (uri); - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); return FALSE; } @@ -3167,12 +3167,12 @@ purging_obj_updated_cb (CalQuery *query, const char *uid, priv->client, priv->zone); if (closure.remove) { - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), msg); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg); delete_error_dialog (cal_client_remove_object (priv->client, uid), CAL_COMPONENT_EVENT); } } else { - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), msg); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg); delete_error_dialog (cal_client_remove_object (priv->client, uid), CAL_COMPONENT_EVENT); } @@ -3188,7 +3188,7 @@ purging_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) priv = gcal->priv; - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); g_signal_handlers_disconnect_matched (priv->exp_query, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal); @@ -3204,7 +3204,7 @@ purging_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *e priv = gcal->priv; - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); g_signal_handlers_disconnect_matched (priv->exp_query, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal); @@ -3234,7 +3234,7 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) " (make-time \"%s\")))", start, end); - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), _("Purging")); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), _("Purging")); priv->exp_query = cal_client_get_query (priv->client, sexp); g_free (sexp); @@ -3242,7 +3242,7 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) g_free (end); if (!priv->exp_query) { - e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), NULL); + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); g_message ("gnome_calendar_purge(): Could not create the query"); return; } |