* src/modest-tny-msg.c:
[modest] / src / maemo / modest-platform.c
index 4482a9a..4146bf6 100644 (file)
@@ -54,6 +54,8 @@
 #define URI_ACTION_COPY "copy:"
 
 static osso_context_t *osso_context = NULL;
+
+static void  folder_name_insensitive_press (GtkWidget *widget, ModestWindow *window);
        
 static void    
 on_modest_conf_update_interval_changed (ModestConf* self, const gchar *key, 
@@ -212,13 +214,18 @@ modest_platform_get_file_icon_name (const gchar* name, const gchar* mime_type,
                mime_str = g_string_new (mime_type);
                g_string_ascii_down (mime_str);
        }
+
 #ifdef MODEST_HAVE_OSSO_MIME
        icons = osso_mime_get_icon_names (mime_str->str, NULL);
 #else
        icons = hildon_mime_get_icon_names (mime_str->str, NULL);
 #endif /*MODEST_HAVE_OSSO_MIME*/
        for (cursor = icons; cursor; ++cursor) {
-               if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), *cursor)) {
+               if (!g_ascii_strcasecmp (*cursor, "gnome-mime-message") ||
+                   !g_ascii_strcasecmp (*cursor, "gnome-mime-message-rfc822")) {
+                       icon_name = g_strdup ("qgn_list_messagin");
+                       break;
+               } else if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), *cursor)) {
                        icon_name = g_strdup (*cursor);
                        break;
                }
@@ -266,6 +273,11 @@ modest_platform_activate_uri (const gchar *uri)
                        break;
                }
        }
+
+       /* if we could open it with email, try something else */
+       if (!result)
+               result = osso_uri_open (uri, NULL, NULL);       
+       
                        
        if (!result)
                hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link"));
@@ -286,7 +298,6 @@ modest_platform_activate_uri (const gchar *uri)
        if (!uri)
                return FALSE;
 
-       /* the default action should be email */
        scheme = hildon_uri_get_scheme_from_uri (uri, NULL);
        actions = hildon_uri_get_actions (scheme, NULL);
        
@@ -303,9 +314,14 @@ modest_platform_activate_uri (const gchar *uri)
                        break;
                }
        }
-                       
+       
+       /* if we could open it with email, try something else */
+       if (!result)
+               result = hildon_uri_open (uri, NULL, NULL);     
+               
        if (!result)
                hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link"));
+       
        return result;
 }
 
@@ -588,8 +604,8 @@ entry_changed (GtkEditable *editable,
        chars = gtk_editable_get_chars (editable, 0, -1);
        g_return_if_fail (chars != NULL);
 
-       /* Dimm OK button */
-       if (strlen (chars) == 0) {
+       /* Dimm OK button. Do not allow also the "/" */
+       if (strlen (chars) == 0 || strchr (chars, '/')) {
                GtkWidget *ok_button;
                GList *buttons;
 
@@ -742,7 +758,9 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
                                        const gchar *suggested_name,
                                        gchar **folder_name)
 {
+       GtkWidget *accept_btn = NULL; 
        GtkWidget *dialog, *entry, *label, *hbox;
+       GList *buttons = NULL;
        gint result;
 
        /* Ask the user for the folder name */
@@ -755,6 +773,11 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
                                              GTK_RESPONSE_REJECT,
                                              NULL);
 
+       /* Add accept button (with unsensitive handler) */
+       buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
+       accept_btn = GTK_WIDGET (buttons->next->data);
+       g_signal_connect (G_OBJECT (accept_btn), "insensitive-press", G_CALLBACK (folder_name_insensitive_press), parent_window);
+
        /* Create label and entry */
        label = gtk_label_new (label_text);
        /* TODO: check that the suggested name does not exist */
@@ -798,6 +821,12 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
        return result;
 }
 
+static void  
+folder_name_insensitive_press (GtkWidget *widget, ModestWindow *window)
+{
+       hildon_banner_show_information (NULL, NULL, _("(empty)"));
+}
+
 gint
 modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
                                       TnyFolderStore *parent_folder,
@@ -921,26 +950,28 @@ gboolean modest_platform_set_update_interval (guint minutes)
        st_time->tm_min += minutes;
        
        /* Set the time in alarm_event_t structure: */
-       alarm_event_t event;
-       memset (&event, 0, sizeof (alarm_event_t));
-       event.alarm_time = mktime (st_time);
+       alarm_event_t *event = g_new0(alarm_event_t, 1);
+       event->alarm_time = mktime (st_time);
 
        /* Specify what should happen when the alarm happens:
         * It should call this D-Bus method: */
         
        /* Note: I am surpised that alarmd can't just use the modest.service file
         * for this. murrayc. */
-       event.dbus_path = g_strdup(PREFIX "/bin/modest");
+       event->dbus_path = g_strdup(PREFIX "/bin/modest");
        
-       event.dbus_interface = g_strdup (MODEST_DBUS_IFACE);
-       event.dbus_service = g_strdup (MODEST_DBUS_SERVICE);
-       event.dbus_name = g_strdup (MODEST_DBUS_METHOD_SEND_RECEIVE);
+       event->dbus_interface = g_strdup (MODEST_DBUS_IFACE);
+       event->dbus_service = g_strdup (MODEST_DBUS_SERVICE);
+       event->dbus_name = g_strdup (MODEST_DBUS_METHOD_SEND_RECEIVE);
 
        /* Otherwise, a dialog will be shown if exect_name or dbus_path is NULL,
        even though we have specified no dialog text: */
-       event.flags = ALARM_EVENT_NO_DIALOG;
+       event->flags = ALARM_EVENT_NO_DIALOG;
        
-       alarm_cookie = alarm_event_add (&event);
+       alarm_cookie = alarm_event_add (event);
+
+       /* now, free it */
+       alarm_event_free (event);
        
        /* Store the alarm ID in GConf, so we can remove it later:
         * This is apparently valid between application instances. */