Remove some deprecated GTK+ symbols
[modest] / src / modest-ui-actions.c
index 53e7d81..4933688 100644 (file)
@@ -60,7 +60,6 @@
 #include "modest-utils.h"
 #include "widgets/modest-connection-specific-smtp-window.h"
 #include "widgets/modest-ui-constants.h"
-#include <widgets/modest-main-window.h>
 #include <widgets/modest-msg-view-window.h>
 #include <widgets/modest-account-view-window.h>
 #include <widgets/modest-details-dialog.h>
@@ -266,7 +265,7 @@ modest_ui_actions_on_about (GtkAction *action, ModestWindow *win)
                NULL
        };
        about = gtk_about_dialog_new ();
-       gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), PACKAGE_NAME);
+       gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG(about), PACKAGE_NAME);
        gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about),PACKAGE_VERSION);
        gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about),
                                        _("Copyright (c) 2006, Nokia Corporation\n"
@@ -382,7 +381,6 @@ modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win)
        gint response;
        ModestWindowMgr *mgr;
        gboolean retval = TRUE;
-       GtkWindow *toplevel;
 
        g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE);
 
@@ -413,8 +411,8 @@ modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win)
                                           tny_list_get_length(header_list)), desc);
 
        /* Confirmation dialog */
-       toplevel = (GtkWindow *) gtk_widget_get_toplevel ((GtkWidget *) win);
-       response = modest_platform_run_confirmation_dialog (toplevel, message);
+       response = modest_platform_run_confirmation_dialog (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (win))),
+                                                           message);
 
        if (response == GTK_RESPONSE_OK) {
                GtkTreeSelection *sel = NULL;
@@ -745,10 +743,11 @@ modest_ui_actions_compose_msg(ModestWindow *win,
                gchar *gray_color_markup = NULL, *color_begin = NULL, *color_end = NULL;
                GdkColor color;
 
-               if (gtk_style_lookup_color (GTK_WIDGET (win)->style, "SecondaryTextColor", &color))
+               if (win && gtk_style_lookup_color (gtk_widget_get_style ((GtkWidget *) win),
+                                                  "SecondaryTextColor", &color))
                        gray_color_markup = modest_text_utils_get_color_string (&color);
                if (!gray_color_markup)
-                       gray_color_markup = g_strdup ("#999999");
+                       gray_color_markup = g_strdup ("#babababababa");
 
                color_begin = g_strdup_printf ("<font color=\"%s\">", gray_color_markup);
                color_end = "</font>";
@@ -1300,6 +1299,12 @@ open_msg_performer(gboolean canceled,
        gboolean can_open;
        gchar *account_name = get_info_from_header (helper->header, &is_draft, &can_open);
 
+       if (!g_strcmp0 (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) ||
+           !g_strcmp0 (account_name, MODEST_MMC_ACCOUNT_ID)) {
+               g_free (account_name);
+               account_name = g_strdup (modest_window_get_active_account (MODEST_WINDOW (parent_window)));
+       }
+
        if (!can_open) {
                modest_window_mgr_unregister_header (modest_runtime_get_window_mgr (), helper->header);
                g_free (account_name);
@@ -3059,7 +3064,7 @@ do_create_folder_cb (ModestMailOperation *mail_op,
                }
 
        } else {
-               /* the 'source_win' is either the ModestMainWindow, or the 'Move to folder'-dialog
+               /* the 'source_win' is either the ModestWindow, or the 'Move to folder'-dialog
                 * FIXME: any other? */
                GtkWidget *folder_view;
 
@@ -3404,8 +3409,19 @@ on_delete_folder_cb (gboolean canceled,
        GtkWidget *folder_view;
        ModestMailOperation *mail_op;
        GtkTreeSelection *sel;
+       ModestWindow *modest_window;
+
+#ifdef MODEST_TOOLKIT_HILDON2
+       modest_window = (ModestWindow*) parent_window;
+#else
+       if (MODEST_IS_SHELL (parent_window)) {
+               modest_window = modest_shell_peek_window (MODEST_SHELL (parent_window));
+       } else {
+               modest_window = NULL;
+       }
+#endif
 
-       if (!MODEST_IS_WINDOW(parent_window) || canceled || (err!=NULL)) {
+       if (!MODEST_IS_WINDOW(modest_window) || canceled || (err!=NULL)) {
                /* Note that the connection process can fail due to
                   memory low conditions as it can not successfully
                   store the summary */
@@ -3418,8 +3434,8 @@ on_delete_folder_cb (gboolean canceled,
                return;
        }
 
-       if (MODEST_IS_FOLDER_WINDOW (parent_window)) {
-               folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (parent_window)));
+       if (MODEST_IS_FOLDER_WINDOW (modest_window)) {
+               folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (modest_window)));
        } else {
                g_object_unref (G_OBJECT (info->folder));
                g_free (info);
@@ -3551,7 +3567,7 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
                                         gchar **password,
                                         gboolean *cancel,
                                         gboolean *remember,
-                                        ModestMainWindow *main_window)
+                                        ModestWindow *window)
 {
        g_return_if_fail(server_account_name);
        gboolean completed = FALSE;
@@ -4508,8 +4524,6 @@ create_move_to_dialog (GtkWindow *win,
 
                modest_folder_view_set_style (MODEST_FOLDER_VIEW (tree_view),
                                              MODEST_FOLDER_VIEW_STYLE_SHOW_ALL);
-               /* modest_folder_view_update_model (MODEST_FOLDER_VIEW (tree_view), */
-               /*                               TNY_ACCOUNT_STORE (modest_runtime_get_account_store ())); */
 
                active_account_name = modest_window_get_active_account (MODEST_WINDOW (win));
                mgr = modest_runtime_get_account_mgr ();
@@ -5143,8 +5157,8 @@ modest_ui_actions_on_edit_mode_move_to (ModestWindow *win)
        }
 
        /* Create and run the dialog */
+       dialog = create_move_to_dialog (win, NULL, list_to_move);
        toplevel = (GtkWindow *) gtk_widget_get_toplevel ((GtkWidget *) win);
-       dialog = create_move_to_dialog (toplevel, NULL, list_to_move);
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
                                     GTK_WINDOW (dialog),
                                     toplevel);
@@ -5911,7 +5925,7 @@ modest_ui_actions_check_for_active_account (ModestWindow *self,
        if (store_conn_status == TNY_CONNECTION_STATUS_CONNECTED || sending) {
                gint response;
 
-               response = modest_platform_run_confirmation_dialog (GTK_WINDOW (gtk_widget_get_toplevel (self)), 
+               response = modest_platform_run_confirmation_dialog (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))), 
                                                                    _("emev_nc_disconnect_account"));
                if (response == GTK_RESPONSE_OK) {
                        retval = TRUE;