From d05937916c33803614acc802ffce9210a0d011dd Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 8 Jun 2007 16:17:28 +0000 Subject: [PATCH] * partial fix for NB#58220, waiting for desktop now pmo-trunk-r2138 --- src/maemo/modest-platform.c | 49 +++++++++++++++++++++++++------------------ src/maemo/modest.desktop.in | 10 ++++----- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index ed0cf64..e662811 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -49,6 +49,8 @@ #include +#define HILDON_OSSO_URI_ACTION "uri-action" + static osso_context_t *osso_context = NULL; static void @@ -295,20 +297,24 @@ activate_uri_popup_item (GtkMenuItem *menu_item, { GSList *node; ModestPlatformPopupInfo *popup_info = (ModestPlatformPopupInfo *) userdata; - GtkWidget *label; - - label = gtk_bin_get_child (GTK_BIN (menu_item)); + const gchar* action_name; + action_name = g_object_get_data (G_OBJECT(menu_item), HILDON_OSSO_URI_ACTION); + if (!action_name) { + g_printerr ("modest: no action name defined\n"); + return; + } + for (node = popup_info->actions; node != NULL; node = g_slist_next (node)) { #ifdef MODEST_HILDON_VERSION_0 OssoURIAction *action = (OssoURIAction *) node->data; - if (strcmp (gtk_label_get_text (GTK_LABEL(label)), osso_uri_action_get_name (action))==0) { + if (strcmp (action_name, osso_uri_action_get_name (action))==0) { osso_uri_open (popup_info->uri, action, NULL); break; } #else HildonURIAction *action = (HildonURIAction *) node->data; - if (strcmp (gtk_label_get_text (GTK_LABEL(label)), hildon_uri_action_get_name (action))==0) { + if (strcmp (action_name, hildon_uri_action_get_name (action))==0) { hildon_uri_open (popup_info->uri, action, NULL); break; } @@ -341,13 +347,15 @@ modest_platform_show_uri_popup (const gchar *uri) for (node = actions_list; node != NULL; node = g_slist_next (node)) { GtkWidget *menu_item; - + const gchar* action_name; #ifdef MODEST_HILDON_VERSION_0 - OssoURIAction *action; - - action = (OssoURIAction *) node->data; - menu_item = gtk_menu_item_new_with_label (osso_uri_action_get_name (action)); - g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_uri_popup_item), popup_info); + OssoURIAction *action = (OssoURIAction *) node->data; + action_name = osso_uri_action_get_name (action); + menu_item = gtk_menu_item_new_with_label (dgettext("osso-uri",action_name)); + g_object_set_data (G_OBJECT(menu_item), HILDON_OSSO_URI_ACTION, (gpointer)action_name); + /* hack, we add it as a gobject property*/ + g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_uri_popup_item), + popup_info); if (osso_uri_is_default_action (action, NULL)) { gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); @@ -355,28 +363,29 @@ modest_platform_show_uri_popup (const gchar *uri) gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); } #else - HildonURIAction *action; - - action = (HildonURIAction *) node->data; - menu_item = gtk_menu_item_new_with_label (hildon_uri_action_get_name (action)); - g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_uri_popup_item), popup_info); - + HildonURIAction *action = (HildonURIAction *) node->data; + action_name = hildon_uri_action_get_name (action); + menu_item = gtk_menu_item_new_with_label (dgettext("osso-uri", action_name)); + g_object_set_data (G_OBJECT(menu_item), HILDON_OSSO_URI_ACTION, (gpointer)action_name); /* hack */ + g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_uri_popup_item), + popup_info); + if (hildon_uri_is_default_action (action, NULL)) { gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); } else { gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); } -#endif - +#endif gtk_widget_show (menu_item); } + g_signal_connect (G_OBJECT (menu), "delete-event", G_CALLBACK (delete_uri_popup), popup_info); gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, 1, gtk_get_current_event_time ()); } else { hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link")); } - + g_free (scheme); return TRUE; } diff --git a/src/maemo/modest.desktop.in b/src/maemo/modest.desktop.in index 2d66573..20f98ed 100644 --- a/src/maemo/modest.desktop.in +++ b/src/maemo/modest.desktop.in @@ -20,8 +20,8 @@ MimeType=application/x-executable; # # below to be activated when dbus/send to functionality works # -#X-Osso-URI-Actions=mailto -#[X-Osso-URI-Action Handler mailto] -#Methods=send_mailto -#Name=uri_link_compose_email -#TranslationDomain=osso-uri +X-Osso-URI-Actions=mailto; +[X-Osso-URI-Action Handler mailto] +Method=MailTo +Name=uri_link_compose_email +TranslationDomain=osso-uri -- 1.7.9.5