aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-11-18 21:06:33 +0800
committerMilan Crha <mcrha@redhat.com>2009-11-18 21:06:33 +0800
commitff6be368c53aa208774242e507828bddce99b6cc (patch)
tree90a3ef8285fd4f85a4893061c34066467edd43aa
parent327c54dbbc1645acda50b8c60019ec5fe5722711 (diff)
downloadgsoc2013-evolution-ff6be368c53aa208774242e507828bddce99b6cc.tar.gz
gsoc2013-evolution-ff6be368c53aa208774242e507828bddce99b6cc.tar.zst
gsoc2013-evolution-ff6be368c53aa208774242e507828bddce99b6cc.zip
Bug #602098 - No progress notification from GnomeCalendar
-rw-r--r--calendar/gui/e-cal-model.c27
-rw-r--r--calendar/gui/e-cal-model.h7
-rw-r--r--calendar/gui/e-calendar-table.c6
-rw-r--r--calendar/gui/e-memo-table.c6
-rw-r--r--calendar/gui/gnome-cal.c48
-rw-r--r--modules/calendar/e-cal-shell-view-private.c7
6 files changed, 75 insertions, 26 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index b04e7b7245..e53dd1d77d 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -139,6 +139,7 @@ enum {
COMPS_DELETED,
CAL_VIEW_PROGRESS,
CAL_VIEW_DONE,
+ STATUS_MESSAGE,
LAST_SIGNAL
};
@@ -440,6 +441,15 @@ e_cal_model_class_init (ECalModelClass *class)
e_marshal_VOID__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalModelClass, status_message),
+ NULL, NULL,
+ e_marshal_VOID__STRING_DOUBLE,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING, G_TYPE_DOUBLE);
}
static void
@@ -2075,6 +2085,14 @@ try_again:
e_cal_view_start (client_data->query);
}
+void
+e_cal_model_update_status_message (ECalModel *model, const gchar *message, gdouble percent)
+{
+ g_return_if_fail (model != NULL);
+
+ g_signal_emit (model, signals[STATUS_MESSAGE], 0, message, percent);
+}
+
static void
backend_died_cb (ECal *client, gpointer user_data)
{
@@ -2098,9 +2116,12 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data)
if (status != E_CALENDAR_STATUS_OK) {
e_cal_model_remove_client (model, client);
+ e_cal_model_update_status_message (model, NULL, -1.0);
return;
}
+ e_cal_model_update_status_message (model, NULL, -1.0);
+
/* Stop listening for this calendar to be opened */
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, cal_opened_cb, model);
@@ -2153,6 +2174,12 @@ add_new_client (ECalModel *model, ECal *client, gboolean do_query)
if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) {
update_e_cal_view_for_client (model, client_data);
} else {
+ gchar *msg;
+
+ msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (client));
+ e_cal_model_update_status_message (model, msg, -1.0);
+ g_free (msg);
+
g_signal_connect (client, "cal_opened", G_CALLBACK (cal_opened_cb), model);
e_cal_open_async (client, TRUE);
}
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index a59d5e02a5..a5228eb9da 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -164,6 +164,9 @@ struct _ECalModelClass {
void (*cal_view_done) (ECalModel *model,
ECalendarStatus status,
ECalSourceType type);
+ void (*status_message) (ECalModel *model,
+ const gchar *message,
+ gdouble percent);
};
typedef time_t (*ECalModelDefaultTimeFunc) (ECalModel *model, gpointer user_data);
@@ -262,6 +265,10 @@ void e_cal_model_update_comp_time (ECalModel *model,
void (*set_func)(icalproperty *prop, struct icaltimetype v),
icalproperty * (*new_func)(struct icaltimetype v));
+void e_cal_model_update_status_message (ECalModel *model,
+ const gchar *message,
+ gdouble percent);
+
G_END_DECLS
#endif /* E_CAL_MODEL_H */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 4ea57c2abb..2b11da0582 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -917,9 +917,9 @@ calendar_table_class_init (ECalendarTableClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (ECalendarTableClass, status_message),
NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ e_marshal_VOID__STRING_DOUBLE,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING, G_TYPE_DOUBLE);
signals[USER_CREATED] = g_signal_new (
"user-created",
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index fc4b2c82ce..c60784912f 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -700,9 +700,9 @@ memo_table_class_init (EMemoTableClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (EMemoTableClass, status_message),
NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ e_marshal_VOID__STRING_DOUBLE,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING, G_TYPE_DOUBLE);
signals[USER_CREATED] = g_signal_new (
"user-created",
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 3a1e3edd7f..09f77fa492 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -204,6 +204,19 @@ message_push (Message *msg)
G_DEFINE_TYPE (GnomeCalendar, gnome_calendar, GTK_TYPE_VBOX)
static void
+gcal_update_status_message (GnomeCalendar *gcal, const gchar *message, gdouble percent)
+{
+ ECalModel *model;
+
+ g_return_if_fail (gcal != NULL);
+
+ model = gnome_calendar_get_model (gcal);
+ g_return_if_fail (model != NULL);
+
+ e_cal_model_update_status_message (model, message, percent);
+}
+
+static void
update_adjustment (GnomeCalendar *gcal,
GtkAdjustment *adjustment,
EWeekView *week_view)
@@ -280,12 +293,7 @@ view_progress_cb (ECalModel *model,
ECalSourceType type,
GnomeCalendar *gcal)
{
-#if 0 /* KILL-BONOBO */
- ECalendarView *view;
-
- view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
- e_calendar_view_set_status_message (view, message, percent);
-#endif
+ gcal_update_status_message (gcal, message, percent);
}
static void
@@ -294,12 +302,7 @@ view_done_cb (ECalModel *model,
ECalSourceType type,
GnomeCalendar *gcal)
{
-#if 0 /* KILL-BONOBO */
- ECalendarView *view;
-
- view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
- e_calendar_view_set_status_message (view, NULL, -1);
-#endif
+ gcal_update_status_message (gcal, NULL, -1);
}
static void
@@ -1884,6 +1887,8 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
case E_CALENDAR_STATUS_BUSY:
if (state == E_CAL_LOAD_NOT_LOADED)
e_cal_open_async (ecal, FALSE);
+ else
+ gcal_update_status_message (gcal, NULL, -1);
return;
case E_CALENDAR_STATUS_INVALID_SERVER_VERSION:
id = g_strdup ("calendar:server-version");
@@ -1891,6 +1896,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
if (g_hash_table_lookup(non_intrusive_error_table, id)) {
/* We already have it */
g_message("Error occurred while existing dialog active:\n");
+ gcal_update_status_message (gcal, NULL, -1);
return;
}
@@ -1912,6 +1918,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
if (g_hash_table_lookup(non_intrusive_error_table, id)) {
/* We already have it */
g_message("Error occurred while existing dialog active:\n");
+ gcal_update_status_message (gcal, NULL, -1);
return;
}
@@ -1929,6 +1936,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
g_object_unref (source);
g_warning ("Unable to load the calendar %s \n", e_cal_get_error_message (status));
+ gcal_update_status_message (gcal, NULL, -1);
return;
}
@@ -1936,7 +1944,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, client_cal_opened_cb, NULL);
msg = g_strdup_printf (_("Loading appointments at %s"), e_cal_get_uri (ecal));
- /*e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg, -1); KILL-BONOBO */
+ gcal_update_status_message (gcal, msg, -1);
g_free (msg);
/* add client to the views */
@@ -1946,7 +1954,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
/* update date navigator query */
gnome_calendar_update_query (gcal);
- /*e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); KILL-BONOBO */
+ gcal_update_status_message (gcal, NULL, -1);
}
static void
@@ -1971,6 +1979,8 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
case E_CALENDAR_STATUS_BUSY:
if (state == E_CAL_LOAD_NOT_LOADED)
e_cal_open_async (ecal, FALSE);
+ else
+ gcal_update_status_message (gcal, NULL, -1.0);
return;
case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
/* try to reopen calendar - it'll ask for a password once again */
@@ -1996,6 +2006,7 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
g_object_unref (source);
g_warning ("Unable to load the calendar %s \n", e_cal_get_error_message (status));
+ gcal_update_status_message (gcal, NULL, -1.0);
return;
}
@@ -2004,6 +2015,7 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
model = gnome_calendar_get_model (gcal);
e_cal_model_set_default_client (model, ecal);
+ gcal_update_status_message (gcal, NULL, -1.0);
}
typedef void (*open_func) (ECal *, ECalendarStatus, GnomeCalendar *);
@@ -2021,7 +2033,7 @@ open_ecal (GnomeCalendar *gcal, ECal *cal, gboolean only_if_exists, open_func of
e_cal_set_default_timezone (cal, zone, NULL);
msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
- /*e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg, -1); KILL-BONOBO */
+ gcal_update_status_message (gcal, msg, -1.0);
g_free (msg);
@@ -2090,7 +2102,7 @@ backend_died_cb (ECal *ecal, gpointer data)
id = g_strdup ("calendar:calendar-crashed");
- /* e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); KILL-BONOBO */
+ gcal_update_status_message (gcal, NULL, -1);
g_signal_emit (gcal, signals[SOURCE_REMOVED], 0, source);
@@ -2552,7 +2564,7 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
" (make-time \"%s\"))",
start, end);
- /*e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), _("Purging"), -1); KILL-BONOBO */
+ gcal_update_status_message (gcal, _("Purging"), -1);
/* FIXME Confirm expunge */
clients = e_cal_model_get_client_list (gnome_calendar_get_model (gcal));
@@ -2621,7 +2633,7 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
g_list_free (clients);
- /* e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); KILL-BONOBO */
+ gcal_update_status_message (gcal, NULL, -1);
g_free (sexp);
g_free (start);
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index a2fa491cc3..ddee1d9544 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -507,6 +507,11 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
cal_shell_view);
g_signal_connect_swapped (
+ model, "status-message",
+ G_CALLBACK (e_cal_shell_view_set_status_message),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
model, "notify::timezone",
G_CALLBACK (e_cal_shell_view_update_timezone),
cal_shell_view);
@@ -707,12 +712,10 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view,
g_object_unref (activity);
activity = NULL;
}
-
} else if (activity == NULL) {
activity = e_activity_new (status_message);
e_activity_set_percent (activity, percent);
e_shell_backend_add_activity (shell_backend, activity);
-
} else {
e_activity_set_percent (activity, percent);
e_activity_set_primary_text (activity, status_message);