* src/maemo/modest-msg-edit-window.c:
[modest] / src / maemo / modest-platform.c
index b8ff11f..f41dd95 100644 (file)
@@ -76,12 +76,40 @@ on_modest_conf_update_interval_changed (ModestConf* self,
        }
 }
 
+
+
+static gboolean
+check_required_files (void)
+{
+       FILE *mcc_file = modest_maemo_open_mcc_mapping_file ();
+       if (!mcc_file) {
+               g_printerr ("modest: check for mcc file failed\n");
+               return FALSE;
+       } else 
+               fclose (mcc_file);
+
+       if (access (MODEST_PROVIDERS_DATA_PATH, R_OK) != 0) {
+               g_printerr ("modest: cannot find providers data\n");
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+
 gboolean
 modest_platform_init (int argc, char *argv[])
 {
        osso_hw_state_t hw_state = { 0 };
        DBusConnection *con;    
 
+       if (!check_required_files ()) {
+               g_printerr ("modest: missing required files\n");
+               return FALSE;
+       }
+
+       
        osso_context =
                osso_initialize(PACKAGE,PACKAGE_VERSION,
                                FALSE, NULL);   
@@ -95,7 +123,7 @@ modest_platform_init (int argc, char *argv[])
                return FALSE;
 
        }
-       
+
        /* Add a D-Bus handler to be used when the main osso-rpc 
         * D-Bus handler has not handled something.
         * We use this for D-Bus methods that need to use more complex types 
@@ -221,14 +249,12 @@ modest_platform_activate_uri (const gchar *uri)
        HildonURIAction *action;
        gboolean result = FALSE;
        GSList *actions, *iter = NULL;
-       const gchar *scheme;
        
        g_return_val_if_fail (uri, FALSE);
        if (!uri)
                return FALSE;
-
-       scheme = hildon_uri_get_scheme_from_uri (uri, NULL);
-       actions = hildon_uri_get_actions (scheme, NULL);
+       
+       actions = hildon_uri_get_actions_by_uri (uri, -1, NULL);
        
        for (iter = actions; iter; iter = g_slist_next (iter)) {
                action = (HildonURIAction*) iter->data;
@@ -245,7 +271,7 @@ modest_platform_activate_uri (const gchar *uri)
                }
        }
        
-       /* if we could open it with email, try something else */
+       /* if we could not open it with email, try something else */
        if (!result)
                result = hildon_uri_open (uri, NULL, NULL);     
                
@@ -333,14 +359,12 @@ activate_uri_popup_item (GtkMenuItem *menu_item,
 gboolean 
 modest_platform_show_uri_popup (const gchar *uri)
 {
-       gchar *scheme;
        GSList *actions_list;
 
        if (uri == NULL)
                return FALSE;
-       
-       scheme = hildon_uri_get_scheme_from_uri (uri, NULL);
-       actions_list = hildon_uri_get_actions (scheme, NULL);
+
+       actions_list = hildon_uri_get_actions_by_uri (uri, -1, NULL);
        if (actions_list != NULL) {
                GSList *node;
                GtkWidget *menu = gtk_menu_new ();
@@ -386,8 +410,7 @@ modest_platform_show_uri_popup (const gchar *uri)
        } else {
                hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link"));
        }
-       
-       g_free (scheme);
+
        return TRUE;
 }
 
@@ -964,13 +987,9 @@ set_account_to_online (TnyAccount *account)
                 * a) They fundamentally need network access, so they can't really be offline.
                 * b) That might cause a transport connection to happen too early.
                 */
-               GError *error = NULL;
-               tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), TRUE, &error);
-               if (error) {
-                       g_warning ("%s: tny_camel_account_set_online() returned a GError:\n  %s\n", 
-                               __FUNCTION__, error->message);
-                       g_error_free (error);   
-               }
+
+               /* The last argument is user_data, the NULL before that is the callback */
+               tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), TRUE, NULL, NULL);
        }
        #endif
 }
@@ -1252,13 +1271,17 @@ modest_platform_on_new_header_received (TnyHeader *header)
                                            -1);
        g_free (url);
        
-       /* Play sound SR-SND-18 */
-       hildon_notification_set_sound (HILDON_NOTIFICATION(notification),
-                                      "/usr/share/sounds/ui-new_email.wav");
-       notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION(notification),
-                                           "dialog-type", 4);
+       /* Play sound if the user wants */
+       if (modest_conf_get_bool (modest_runtime_get_conf (), 
+                                 MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, 
+                                 NULL)) {
+               hildon_notification_set_sound (HILDON_NOTIFICATION(notification),
+                                              "/usr/share/sounds/ui-new_email.wav");
+       }
        
        /* Set the led pattern */
+       notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION(notification),
+                                           "dialog-type", 4);
        notify_notification_set_hint_string(NOTIFY_NOTIFICATION(notification), 
                                            "led-pattern", 
                                            "PatternCommunicationEmail");
@@ -1563,8 +1586,8 @@ modest_platform_run_alert_dialog (const gchar* prompt,
                
        } else {
                /* Just show the error text and use the default response: */
-               modest_maemo_show_information_note_and_forget(GTK_WINDOW (main_window), 
-                                                             prompt);
+               modest_platform_run_information_dialog (GTK_WINDOW (main_window), 
+                                                       prompt);
        }
        return retval;
 }