aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2004-01-06 02:58:22 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-01-06 02:58:22 +0800
commit7635b6f4517c48a17882e958b1c0fd04c192dbf4 (patch)
treecbda04352f6ec09cf80dc5fe0342db4171dab155 /calendar
parent4a7e5d43552236559ca9a981f516bd6915899d12 (diff)
downloadgsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.tar
gsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.tar.gz
gsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.tar.bz2
gsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.tar.lz
gsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.tar.xz
gsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.tar.zst
gsoc2013-evolution-7635b6f4517c48a17882e958b1c0fd04c192dbf4.zip
new function to open ECal's, get any error information and display it to
2004-01-05 Rodrigo Moya <rodrigo@ximian.com> * gui/gnome-cal.c (open_ecal): new function to open ECal's, get any error information and display it to the user, all-in-one. (gnome_calendar_construct, gnome_calendar_add_event_source): use the above function, instead of e_cal_open(). (open_error, method_error, permission_error): removed unneeded functions, we just display the error message returned from the backend. svn path=/trunk/; revision=24052
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/gnome-cal.c68
2 files changed, 34 insertions, 44 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a95b6a2b02..26262ec5f9 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,15 @@
2004-01-05 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/gnome-cal.c (open_ecal): new function to open ECal's, get any
+ error information and display it to the user, all-in-one.
+ (gnome_calendar_construct, gnome_calendar_add_event_source): use the
+ above function, instead of e_cal_open().
+ (open_error, method_error, permission_error): removed unneeded
+ functions, we just display the error message returned from the
+ backend.
+
+2004-01-05 Rodrigo Moya <rodrigo@ximian.com>
+
* gui/gnome-cal.c (gnome_calendar_construct): no need to connect to
the "cal_opened" signal on the task client. Also, added code to
add the client to the ECalendarTable's model.
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index afb2c34d79..9d5dc3c43d 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1726,48 +1726,6 @@ gnome_calendar_set_pane_positions (GnomeCalendar *gcal)
}
}
-/* Displays an error to indicate that opening a calendar failed */
-static void
-open_error (GnomeCalendar *gcal, const char *uri)
-{
- char *msg;
- char *urinopwd;
-
- urinopwd = get_uri_without_password (uri);
- msg = g_strdup_printf (_("Could not open the folder in `%s'"), urinopwd);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
- g_free (msg);
- g_free (urinopwd);
-}
-
-/* Displays an error to indicate that the specified URI method is not supported */
-static void
-method_error (GnomeCalendar *gcal, const char *uri)
-{
- char *msg;
- char *urinopwd;
-
- urinopwd = get_uri_without_password (uri);
- msg = g_strdup_printf (_("The method required to open `%s' is not supported"), urinopwd);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
- g_free (msg);
- g_free (urinopwd);
-}
-
-/* Displays an error to indicate permission problems */
-static void
-permission_error (GnomeCalendar *gcal, const char *uri)
-{
- char *msg;
- char *urinopwd;
-
- urinopwd = get_uri_without_password (uri);
- msg = g_strdup_printf (_("You don't have permission to open the folder in `%s'"), urinopwd);
- gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
- g_free (msg);
- g_free (urinopwd);
-}
-
/* Duplicates an array of categories */
static GPtrArray *
copy_categories (GPtrArray *categories)
@@ -1784,6 +1742,28 @@ copy_categories (GPtrArray *categories)
return c;
}
+static gboolean
+open_ecal (ECal *cal, gboolean only_if_exists)
+{
+ gboolean retval;
+ GError *error = NULL;
+
+ retval = e_cal_open (cal, only_if_exists, &error);
+ if (!retval) {
+ GtkWidget *dialog;
+
+ /* display error message */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_NO_SEPARATOR,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Could not open '%s': %s"),
+ e_cal_get_uri (cal),
+ error ? error->message : "");
+ g_error_free (error);
+ }
+
+ return retval;
+}
+
/* Adds the categories from an array to a hash table if they don't exist there
* already.
*/
@@ -1978,7 +1958,7 @@ gnome_calendar_construct (GnomeCalendar *gcal)
g_free (uid);
- if (!e_cal_open (priv->task_pad_client, TRUE, NULL))
+ if (!open_ecal (priv->task_pad_client, TRUE))
return NULL;
e_cal_model_add_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)),
@@ -2117,7 +2097,7 @@ gnome_calendar_add_event_source (GnomeCalendar *gcal, ESource *source)
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal);
/* FIXME Do this async? */
- if (!e_cal_open (client, FALSE, NULL)) {
+ if (!open_ecal (client, FALSE)) {
g_hash_table_remove (priv->clients, str_uri);
priv->clients_list = g_list_remove (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,