* fix the fallout of the configuration changes - builds again now
[modest] / src / maemo / modest-platform.c
index db49d84..1ee57ed 100644 (file)
@@ -202,11 +202,11 @@ 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_HILDON_VERSION_0
+#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_HILDON_VERSION_0*/
+#endif /*MODEST_HAVE_OSSO_MIME*/
        for (cursor = icons; cursor; ++cursor) {
                if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), *cursor)) {
                        icon_name = g_strdup (*cursor);
@@ -226,8 +226,7 @@ modest_platform_get_file_icon_name (const gchar* name, const gchar* mime_type,
 
 
 
-#ifdef MODEST_HILDON_VERSION_0
-
+#ifdef MODEST_HAVE_OSSO_MIME
 gboolean 
 modest_platform_activate_uri (const gchar *uri)
 {
@@ -263,8 +262,7 @@ modest_platform_activate_uri (const gchar *uri)
        return result;
 }
 
-#else /* !MODEST_HILDON_VERSION_0*/
-
+#else /* !MODEST_HAVE_OSSO_MIME*/
 
 gboolean 
 modest_platform_activate_uri (const gchar *uri)
@@ -302,7 +300,7 @@ modest_platform_activate_uri (const gchar *uri)
 }
 
 
-#endif /* MODEST_HILDON_VERSION_0*/
+#endif /* MODEST_HAVE_OSSO_MIME*/
 
 gboolean 
 modest_platform_activate_file (const gchar *path, const gchar *mime_type)
@@ -322,7 +320,7 @@ modest_platform_activate_file (const gchar *path, const gchar *mime_type)
        uri_path = g_strconcat ("file://", path, NULL);
        
        con = osso_get_dbus_connection (osso_context);
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_OSSO_MIME
        result = osso_mime_open_file_with_mime_type (con, uri_path, mime_str->str);
        g_string_free (mime_str, TRUE);
 
@@ -336,7 +334,7 @@ modest_platform_activate_file (const gchar *path, const gchar *mime_type)
        if (result != 1)
                hildon_banner_show_information (NULL, NULL, _("mcen_ni_noregistered_viewer"));
        return result != 1;
-#endif
+#endif /*MODEST_HAVE_OSSO_MIME*/
 
 }
 
@@ -353,11 +351,11 @@ delete_uri_popup (GtkWidget *menu,
        ModestPlatformPopupInfo *popup_info = (ModestPlatformPopupInfo *) userdata;
 
        g_free (popup_info->uri);
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_OSSO_MIME
        osso_uri_free_actions (popup_info->actions);
 #else
        hildon_uri_free_actions (popup_info->actions);
-#endif
+#endif /*MODEST_HAVE_OSSO_MIME*/
        return FALSE;
 }
 
@@ -390,7 +388,7 @@ activate_uri_popup_item (GtkMenuItem *menu_item,
        
        /* now, the real uri-actions... */
        for (node = popup_info->actions; node != NULL; node = g_slist_next (node)) {
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_OSSO_MIME
                OssoURIAction *action = (OssoURIAction *) node->data;
                if (strcmp (action_name, osso_uri_action_get_name (action))==0) {
                        osso_uri_open (popup_info->uri, action, NULL);
@@ -402,7 +400,7 @@ activate_uri_popup_item (GtkMenuItem *menu_item,
                        hildon_uri_open (popup_info->uri, action, NULL);
                        break;
                }
-#endif
+#endif /*MODEST_HAVE_OSSO_MIME*/
        }
 }
 
@@ -415,13 +413,13 @@ modest_platform_show_uri_popup (const gchar *uri)
        if (uri == NULL)
                return FALSE;
        
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_OSSO_MIME
        scheme = osso_uri_get_scheme_from_uri (uri, NULL);
        actions_list = osso_uri_get_actions (scheme, NULL);
 #else
        scheme = hildon_uri_get_scheme_from_uri (uri, NULL);
        actions_list = hildon_uri_get_actions (scheme, NULL);
-#endif
+#endif /* MODEST_HAVE_OSSO_MIME */
        if (actions_list != NULL) {
                GSList *node;
                GtkWidget *menu = gtk_menu_new ();
@@ -434,7 +432,7 @@ modest_platform_show_uri_popup (const gchar *uri)
                        GtkWidget *menu_item;
                        const gchar *action_name;
                        const gchar *translation_domain;
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_OSSO_MIME
                        OssoURIAction *action = (OssoURIAction *) node->data;
                        action_name = osso_uri_action_get_name (action);
                        translation_domain = osso_uri_action_get_translation_domain (action);
@@ -463,7 +461,7 @@ modest_platform_show_uri_popup (const gchar *uri)
                        } else {
                                gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
                        }
-#endif 
+#endif /*MODEST_HAVE_OSSO_MIME*/
                        gtk_widget_show (menu_item);
                }
 
@@ -544,7 +542,7 @@ entry_insert_text (GtkEditable *editable,
        /* Show WID-INF036 */
        if (chars_length == 20) {
                hildon_banner_show_information  (gtk_widget_get_parent (GTK_WIDGET (data)), NULL,
-                                                _("mcen_ib_maxchar_reached"));
+                                                dgettext("hildon-common-strings", "ckdg_ib_maximum_characters_reached"));
        } else {
                if (chars_length == 0) {
                        /* A blank space is not valid as first character */
@@ -720,19 +718,18 @@ launch_sort_headers_dialog (GtkWindow *parent_window,
        g_list_free(cols);      
 }
 
-
-
-gint
-modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
-                                      TnyFolderStore *parent_folder,
-                                      gchar *suggested_name,
-                                      gchar **folder_name)
+static gint
+modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
+                                       const gchar *dialog_title,
+                                       const gchar *label_text,
+                                       const gchar *suggested_name,
+                                       gchar **folder_name)
 {
        GtkWidget *dialog, *entry, *label, *hbox;
        gint result;
 
        /* Ask the user for the folder name */
-       dialog = gtk_dialog_new_with_buttons (_("mcen_ti_new_folder"),
+       dialog = gtk_dialog_new_with_buttons (dialog_title,
                                              parent_window,
                                              GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
                                              GTK_STOCK_OK,
@@ -742,7 +739,7 @@ modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
                                              NULL);
 
        /* Create label and entry */
-       label = gtk_label_new (_("mcen_fi_new_folder_name"));
+       label = gtk_label_new (label_text);
        /* TODO: check that the suggested name does not exist */
        /* We set 21 as maximum because we want to show WID-INF036
           when the user inputs more that 20 */
@@ -784,6 +781,32 @@ modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
 }
 
 gint
+modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
+                                      TnyFolderStore *parent_folder,
+                                      gchar *suggested_name,
+                                      gchar **folder_name)
+{
+       return modest_platform_run_folder_name_dialog (parent_window, 
+                                                      _("mcen_ti_new_folder"),
+                                                      _("mcen_fi_new_folder_name"),
+                                                      suggested_name,
+                                                      folder_name);
+}
+
+gint
+modest_platform_run_rename_folder_dialog (GtkWindow *parent_window,
+                                         TnyFolderStore *parent_folder,
+                                         const gchar *suggested_name,
+                                         gchar **folder_name)
+{
+       return modest_platform_run_folder_name_dialog (parent_window, 
+                                                      _("New folder name"),
+                                                      _("Enter new folder name:"),
+                                                      suggested_name,
+                                                      folder_name);
+}
+
+gint
 modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
                                         const gchar *message)
 {
@@ -938,27 +961,29 @@ modest_platform_get_global_settings_dialog ()
 void 
 modest_platform_on_new_msg (void)
 {
-/*     HildonNotification *not; */
-
-/*     /\* Create a new notification. FIXME put the right values, need */
-/*        some more specs *\/ */
-/*     not = hildon_notification_new ("TODO: (new email) Summary", */
-/*                                    "TODO: (new email) Description", */
-/*                                    "qgn_contact_group_chat_invitation", */
-/*                                    "system.note.dialog"); */
-
-/*     /\* Play sound SR-SND-18. TODO: play the right file *\/ */
-/*     hildon_notification_set_sound (not, "/usr/share/sounds/ui-new_email.wav"); */
-
-/*     /\* Set the led pattern *\/ */
-/*     notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (not), "led-pattern", 3); */
-
-/*     /\* Notify. We need to do this in an idle because this function */
-/*        could be called from a thread *\/ */
-/*     if (!notify_notification_show (NOTIFY_NOTIFICATION (not), NULL)) */
-/*             g_error ("Failed to send notification"); */
+#ifdef MODEST_HAVE_HILDON_NOTIFY
+       HildonNotification *not;
+
+       /* Create a new notification. FIXME put the right values, need
+          some more specs */
+       not = hildon_notification_new ("TODO: (new email) Summary",
+                                      "TODO: (new email) Description",
+                                      "qgn_contact_group_chat_invitation",
+                                      "system.note.dialog");
+
+       /* Play sound SR-SND-18. TODO: play the right file */
+       /* TODO: Where is this declared? hildon_notification_set_sound (not, "/usr/share/sounds/ui-new_email.wav"); */
+
+       /* Set the led pattern */
+       notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (not), "led-pattern", 3);
+
+       /* Notify. We need to do this in an idle because this function
+          could be called from a thread */
+       if (!notify_notification_show (NOTIFY_NOTIFICATION (not), NULL))
+               g_error ("Failed to send notification");
                
-/*     g_object_unref (not); */
+       g_object_unref (not);
+#endif /*MODEST_HAVE_HILDON_NOTIFY*/
 }
 
 
@@ -972,7 +997,7 @@ modest_platform_show_help (GtkWindow *parent_window,
        g_return_if_fail (osso_context);
 
        /* Show help */
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_OSSO_HELP
        result = ossohelp_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG);
 #else
        result = hildon_help_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG);