gboolean
modest_platform_init (void)
{
- osso_hw_state_t hw_state = { 0 };
+ osso_hw_state_t hw_state = { 0 };
+ DBusConnection *con;
osso_context =
osso_initialize(PACKAGE,PACKAGE_VERSION,
FALSE, NULL);
return FALSE;
}
+ if ((con = osso_get_dbus_connection (osso_context)) == NULL) {
+ g_printerr ("Could not get dbus connection\n");
+ return FALSE;
+
+ }
+
+ if (!dbus_connection_add_filter (con,
+ modest_dbus_req_filter,
+ NULL,
+ NULL)) {
+
+ g_printerr ("Could not add dbus filter\n");
+ return FALSE;
+ }
+
/* Register our D-Bus callbacks, via the osso API: */
osso_return_t result = osso_rpc_set_cb_f(osso_context,
MODEST_DBUS_SERVICE,
return octet_stream;
for (i = 0; i != G_N_ELEMENTS(mime_map); ++i) {
- if (g_ascii_strcasecmp (mime_map[i][0], ext + 1)) /* +1: ignore '.'*/
+ if (!g_ascii_strcasecmp (mime_map[i][0], ext + 1)) /* +1: ignore '.'*/
return mime_map[i][1];
}
return octet_stream;
g_return_val_if_fail (name || mime_type, NULL);
- if (!mime_type || g_ascii_strcasecmp (mime_type, "application/octet-stream"))
+ if (!mime_type || !g_ascii_strcasecmp (mime_type, "application/octet-stream"))
mime_str = g_string_new (guess_mime_type_from_name(name));
else {
mime_str = g_string_new (mime_type);
}
gboolean
-modest_platform_activate_file (const gchar *path)
+modest_platform_activate_file (const gchar *path, const gchar *mime_type)
{
gint result;
DBusConnection *con;
gchar *uri_path = NULL;
+ GString *mime_str = NULL;
+
+ if (!mime_type || !g_ascii_strcasecmp (mime_type, "application/octet-stream"))
+ mime_str = g_string_new (guess_mime_type_from_name(path));
+ else {
+ mime_str = g_string_new (mime_type);
+ g_string_ascii_down (mime_str);
+ }
uri_path = g_strconcat ("file://", path, NULL);
con = osso_get_dbus_connection (osso_context);
#ifdef MODEST_HILDON_VERSION_0
- result = osso_mime_open_file (con, uri_path);
+ result = osso_mime_open_file_with_mime_type (con, uri_path, mime_str->str);
+ g_string_free (mime_str, TRUE);
if (result != 1)
hildon_banner_show_information (NULL, NULL, _("mcen_ni_noregistered_viewer"));
return result != 1;
#else
- result = hildon_mime_open_file (con, uri_path);
+ result = hildon_mime_open_file_with_mime_type (con, uri_path, mime_str->str);
+ g_string_free (mime_str, TRUE);
if (result != 1)
hildon_banner_show_information (NULL, NULL, _("mcen_ni_noregistered_viewer"));
g_return_if_fail (osso_context);
/* Show help */
+#ifdef MODEST_HILDON_VERSION_0
result = ossohelp_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG);
+#else
+ result = hildon_help_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG);
+#endif
if (result != OSSO_OK) {
gchar *error_msg;
g_free (error_msg);
}
}
+
+void
+modest_platform_show_search_messages (GtkWindow *parent_window)
+{
+ osso_return_t result = OSSO_ERROR;
+
+ result = osso_rpc_run_with_defaults (osso_context, "osso_global_search", "search_email", NULL, DBUS_TYPE_INVALID);
+
+ if (result != OSSO_OK) {
+ /* TODO: warning about error showing dialog */
+ }
+}