From 480298cb7c35991ef6cd6c0ec4edae81568a7061 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 7 Jun 2007 19:54:25 +0000 Subject: [PATCH] Added support for opening the addressbook from the main window through menu (fixes bug NB#57590): * src/modest-platform.h: * Added method to show the addressbook UI. * src/modest-ui-actions.[ch]: * Add action handler to open the addressbook UI. * src/maemo/modest-main-window-ui.h: * Add callback handler to show addressbook from main window menu. * src/maemo/modest-platform.c: * Added implementation to show the addressbook from modest using osso rpc. pmo-trunk-r2113 --- src/maemo/modest-main-window-ui.h | 2 +- src/maemo/modest-platform.c | 12 ++++++++++++ src/modest-platform.h | 8 ++++++++ src/modest-ui-actions.c | 8 ++++++++ src/modest-ui-actions.h | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/maemo/modest-main-window-ui.h b/src/maemo/modest-main-window-ui.h index d18b37c..00fc7a2 100644 --- a/src/maemo/modest-main-window-ui.h +++ b/src/maemo/modest-main-window-ui.h @@ -96,7 +96,7 @@ static const GtkActionEntry modest_action_entries [] = { { "ToolsSendReceive", NULL, N_("mcen_me_inbox_sendandreceive") }, /* submenu */ { "ToolsSendReceiveAll", NULL, N_("mcen_me_inbox_sendandreceive_all"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_send_receive) }, { "ToolsSendReceiveCancelSending", NULL, N_("mcen_me_outbox_cancelsend"), NULL, NULL, NULL }, - { "ToolsContacts", NULL, N_("mcen_me_inbox_open_addressbook"), NULL, NULL, NULL }, + { "ToolsContacts", NULL, N_("mcen_me_inbox_open_addressbook"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_open_addressbook) }, { "ToolsAddToContacts", NULL, N_("mcen_me_viewer_addtocontacts"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_add_to_contacts) }, { "ToolsSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_search_messages) }, { "ToolsHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) }, diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index cc30e48..ed0cf64 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -840,3 +840,15 @@ modest_platform_show_search_messages (GtkWindow *parent_window) /* TODO: warning about error showing dialog */ } } + +void +modest_platform_show_addressbook (GtkWindow *parent_window) +{ + osso_return_t result = OSSO_ERROR; + + result = osso_rpc_run_with_defaults (osso_context, "osso_addressbook", "top_application", NULL, DBUS_TYPE_INVALID); + + if (result != OSSO_OK) { + /* TODO: warning about error showing dialog */ + } +} diff --git a/src/modest-platform.h b/src/modest-platform.h index 2511e9d..d51dea4 100644 --- a/src/modest-platform.h +++ b/src/modest-platform.h @@ -233,6 +233,14 @@ void modest_platform_show_help (GtkWindow *parent_window, **/ void modest_platform_show_search_messages (GtkWindow *parent_window); +/** + * modest_platform_show_addressbook: + * @parent_window: window the dialog will be child of + * + * shows the addressbook + **/ +void modest_platform_show_addressbook (GtkWindow *parent_window); + G_END_DECLS #endif /* __MODEST_PLATFORM_UTILS_H__ */ diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 8be6b6b..159a307 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -3039,6 +3039,14 @@ modest_ui_actions_on_search_messages (GtkAction *action, ModestWindow *window) modest_platform_show_search_messages (GTK_WINDOW (window)); } +void +modest_ui_actions_on_open_addressbook (GtkAction *action, ModestWindow *win) +{ + g_return_if_fail (MODEST_IS_WINDOW (win)); + modest_platform_show_addressbook (GTK_WINDOW (win)); +} + + void modest_ui_actions_on_toggle_find_in_page (GtkToggleAction *action, ModestWindow *window) diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index 5261a1e..69b4784 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -56,6 +56,8 @@ void modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow void modest_ui_actions_on_select_contacts (GtkAction *action, ModestMsgEditWindow *win); +void modest_ui_actions_on_open_addressbook (GtkAction *action, ModestWindow *win); + void modest_ui_actions_on_check_names (GtkAction *action, ModestMsgEditWindow *win); void modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win); -- 1.7.9.5