From e0610b2e0cea191f631dc825cdc8023cdcd9433d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 11 Jan 2009 14:20:50 +0000 Subject: Continue chipping away at EMFolderView and EMFolderBrowser. Migrate from gnome_url_show() to e_show_uri(). svn path=/branches/kill-bonobo/; revision=37038 --- calendar/gui/dialogs/comp-editor.c | 13 ++-- calendar/gui/e-cal-component-preview.c | 15 +--- calendar/modules/e-cal-shell-view-memopad.c | 15 ++-- calendar/modules/e-cal-shell-view-taskpad.c | 15 ++-- calendar/modules/e-memo-shell-view-actions.c | 15 ++-- calendar/modules/e-task-shell-module.c | 110 +++++++++++++-------------- calendar/modules/e-task-shell-view-actions.c | 15 ++-- 7 files changed, 89 insertions(+), 109 deletions(-) (limited to 'calendar') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index f3d9eb7b34..3b7f2c5385 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1945,7 +1945,6 @@ open_attachment (EAttachmentBar *bar, CompEditor *editor) GList *p; int num; char *attach_file_url; - GError *error = NULL; if (E_IS_ATTACHMENT_BAR (bar)) { icon_list = GNOME_ICON_LIST (bar); @@ -1970,11 +1969,7 @@ open_attachment (EAttachmentBar *bar, CompEditor *editor) attach_file_url = g_build_path ("/", local_store, filename, NULL); /* launch the url now */ - /* TODO should send GError and handle error conditions - * here */ - gnome_url_show (attach_file_url, &error); - if (error) - g_message ("DEBUG: gnome_url_show(%s) failed\n", attach_file_url); + e_show_uri (GTK_WINDOW (editor), attach_file_url); g_free (filename); g_free (attach_file_url); } @@ -2587,11 +2582,15 @@ comp_editor_get_managed_widget (CompEditor *editor, CompEditor * comp_editor_find_instance (const gchar *uid) { + GList *link; + g_return_val_if_fail (uid != NULL, NULL); - return g_list_find_custom ( + link = g_list_find_custom ( active_editors, uid, (GCompareFunc) comp_editor_compare); + + return (link != NULL) ? link->data : NULL; } /** diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c index 8d3a903119..d75f06c41e 100644 --- a/calendar/gui/e-cal-component-preview.c +++ b/calendar/gui/e-cal-component-preview.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "calendar-config.h" #include @@ -47,18 +48,10 @@ static gpointer parent_class; static void cal_component_preview_link_clicked (GtkHTML *html, - const gchar *url) + const gchar *uri) { - GdkScreen *screen; - GError *error = NULL; - - screen = gtk_widget_get_screen (GTK_WIDGET (html)); - gtk_show_uri (screen, url, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + /* FIXME Pass a parent window. */ + e_show_uri (NULL, uri); } static void diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c index 7c306fd8eb..b78bdd1c50 100644 --- a/calendar/modules/e-cal-shell-view-memopad.c +++ b/calendar/modules/e-cal-shell-view-memopad.c @@ -164,14 +164,17 @@ static void action_calendar_memopad_open_url_cb (GtkAction *action, ECalShellView *cal_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; ECalShellContent *cal_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); @@ -186,14 +189,8 @@ action_calendar_memopad_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (cal_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c index 082572b4c8..651cf1e878 100644 --- a/calendar/modules/e-cal-shell-view-taskpad.c +++ b/calendar/modules/e-cal-shell-view-taskpad.c @@ -233,14 +233,17 @@ static void action_calendar_taskpad_open_url_cb (GtkAction *action, ECalShellView *cal_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; ECalShellContent *cal_shell_content; ECalendarTable *task_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; task_table = e_cal_shell_content_get_task_table (cal_shell_content); @@ -254,14 +257,8 @@ action_calendar_taskpad_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (cal_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c index 8975edf71a..23c456c066 100644 --- a/calendar/modules/e-memo-shell-view-actions.c +++ b/calendar/modules/e-memo-shell-view-actions.c @@ -387,14 +387,17 @@ static void action_memo_open_url_cb (GtkAction *action, EMemoShellView *memo_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; EMemoShellContent *memo_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (memo_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); memo_shell_content = memo_shell_view->priv->memo_shell_content; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); @@ -409,14 +412,8 @@ action_memo_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (memo_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/calendar/modules/e-task-shell-module.c b/calendar/modules/e-task-shell-module.c index dbcb58104b..80cfc0a61a 100644 --- a/calendar/modules/e-task-shell-module.c +++ b/calendar/modules/e-task-shell-module.c @@ -337,38 +337,38 @@ task_module_handle_uri (EShellModule *shell_module, goto exit; while (*cp != '\0') { - gchar *header; - gchar *content; - gsize header_len; - gsize content_len; - - header_len = strcspn (cp, "=&"); - - /* If it's malformed, give up. */ - if (cp[header_len] != '=') - break; - - header = (gchar *) cp; - header[header_len] = '\0'; - cp += header_len + 1; - - content_len = strcspn (cp, "&"); - - content = g_strndup (cp, content_len); - if (g_ascii_strcasecmp (header, "source-uid") == 0) - source_uid = g_strdup (content); - else if (g_ascii_strcasecmp (header, "comp-uid") == 0) - comp_uid = g_strdup (content); - else if (g_ascii_strcasecmp (header, "comp-rid") == 0) - comp_rid = g_strdup (content); - g_free (content); - - cp += content_len; - if (*cp == '&') { - cp++; - if (strcmp (cp, "amp;") == 0) - cp += 4; - } + gchar *header; + gchar *content; + gsize header_len; + gsize content_len; + + header_len = strcspn (cp, "=&"); + + /* If it's malformed, give up. */ + if (cp[header_len] != '=') + break; + + header = (gchar *) cp; + header[header_len] = '\0'; + cp += header_len + 1; + + content_len = strcspn (cp, "&"); + + content = g_strndup (cp, content_len); + if (g_ascii_strcasecmp (header, "source-uid") == 0) + source_uid = g_strdup (content); + else if (g_ascii_strcasecmp (header, "comp-uid") == 0) + comp_uid = g_strdup (content); + else if (g_ascii_strcasecmp (header, "comp-rid") == 0) + comp_rid = g_strdup (content); + g_free (content); + + cp += content_len; + if (*cp == '&') { + cp++; + if (strcmp (cp, "amp;") == 0) + cp += 4; + } } if (source_uid != NULL || comp_uid != NULL) @@ -452,25 +452,25 @@ static void task_module_window_created (EShellModule *shell_module, EShellWindow *shell_window) { - const gchar *module_name; + const gchar *module_name; - module_name = G_TYPE_MODULE (shell_module)->name; + module_name = G_TYPE_MODULE (shell_module)->name; - e_shell_window_register_new_item_actions ( - shell_window, module_name, - item_entries, G_N_ELEMENTS (item_entries)); + e_shell_window_register_new_item_actions ( + shell_window, module_name, + item_entries, G_N_ELEMENTS (item_entries)); - e_shell_window_register_new_source_actions ( - shell_window, module_name, - source_entries, G_N_ELEMENTS (source_entries)); + e_shell_window_register_new_source_actions ( + shell_window, module_name, + source_entries, G_N_ELEMENTS (source_entries)); } static EShellModuleInfo module_info = { - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SORT_ORDER, + MODULE_NAME, + MODULE_ALIASES, + MODULE_SCHEMES, + MODULE_SORT_ORDER, /* is_busy */ NULL, /* shutdown */ NULL, @@ -480,23 +480,23 @@ static EShellModuleInfo module_info = { void e_shell_module_init (GTypeModule *type_module) { - EShell *shell; - EShellModule *shell_module; + EShell *shell; + EShellModule *shell_module; - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); + shell_module = E_SHELL_MODULE (type_module); + shell = e_shell_module_get_shell (shell_module); - e_shell_module_set_info ( + e_shell_module_set_info ( shell_module, &module_info, e_task_shell_view_get_type (type_module)); task_module_ensure_sources (shell_module); - g_signal_connect_swapped ( - shell, "handle-uri", - G_CALLBACK (task_module_handle_uri), shell_module); + g_signal_connect_swapped ( + shell, "handle-uri", + G_CALLBACK (task_module_handle_uri), shell_module); - g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (task_module_window_created), shell_module); + g_signal_connect_swapped ( + shell, "window-created", + G_CALLBACK (task_module_window_created), shell_module); } diff --git a/calendar/modules/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c index c1273633c9..21e9d89767 100644 --- a/calendar/modules/e-task-shell-view-actions.c +++ b/calendar/modules/e-task-shell-view-actions.c @@ -480,14 +480,17 @@ static void action_task_open_url_cb (GtkAction *action, ETaskShellView *task_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; ETaskShellContent *task_shell_content; ECalendarTable *task_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (task_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); task_shell_content = task_shell_view->priv->task_shell_content; task_table = e_task_shell_content_get_task_table (task_shell_content); @@ -501,14 +504,8 @@ action_task_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (task_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void -- cgit v1.2.3