* Added gdk_threads_enter/leave stuff to the idle that shows the password dialog
authorSergio Villar Senin <svillar@igalia.com>
Tue, 10 Jul 2007 10:19:01 +0000 (10:19 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 10 Jul 2007 10:19:01 +0000 (10:19 +0000)
* Replaced the tny_folder_sync by the async version
* The toggle button of the toolbar and the View->Folders menu share now the same GtkAction. Fixes the problem of the toolbar button not pressed when starting

pmo-trunk-r2667

src/maemo/modest-main-window-ui.h
src/maemo/modest-main-window.c
src/maemo/ui/modest-main-window-ui.xml
src/modest-tny-account-store.c
src/modest-ui-actions.c
src/widgets/modest-folder-view.c

index 4826ba1..dd95025 100644 (file)
@@ -117,7 +117,6 @@ static const GtkActionEntry modest_action_entries [] = {
        { "ToolbarMessageReplyAll",   MODEST_STOCK_REPLY_ALL,     N_("mcen_me_inbox_replytoall"),         NULL, NULL,  G_CALLBACK (modest_ui_actions_on_reply_all) },
        { "ToolbarMessageForward",    MODEST_STOCK_FORWARD,     N_("mcen_me_inbox_forward"),      NULL, NULL,  G_CALLBACK (modest_ui_actions_on_forward) },
        { "ToolbarSendReceive",       MODEST_STOCK_REFRESH,   N_("qgn_toolb_gene_refresh"),      NULL, NULL,  G_CALLBACK (modest_ui_actions_on_send_receive) },
-/*     { "ToolbarToggleView",        MODEST_STOCK_SPLIT_VIEW,      N_("gqn_toolb_rss_fldonoff"),                "<CTRL>t", NULL,  G_CALLBACK (modest_ui_actions_toggle_folders_view) }, */
        { "ToolbarDeleteMessage",     MODEST_STOCK_DELETE,     N_("qgn_toolb_gene_deletebutton"),             NULL, NULL,  G_CALLBACK (modest_ui_actions_on_delete_message_or_folder) },
        { "ToolbarSort",     MODEST_STOCK_SORT,     N_("qgn_list_sort"),             NULL, NULL,  G_CALLBACK (modest_ui_actions_on_sort) },
        { "ToolbarFindInMessage",     MODEST_TOOLBAR_ICON_FIND,       N_("qgn_toolb_gene_find"),         NULL, NULL, NULL },
@@ -128,7 +127,6 @@ static const GtkActionEntry modest_action_entries [] = {
 };
 
 static const GtkToggleActionEntry modest_toggle_action_entries [] = {
-       { "ViewToggleFolders",     NULL, N_("mcen_me_inbox_hidefolders"), NULL, NULL, G_CALLBACK (modest_ui_actions_toggle_folders_view), TRUE },
        { "ViewToggleFullscreen",     GTK_STOCK_FULLSCREEN, N_("mcen_me_inbox_fullscreen"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_fullscreen), FALSE },
        { "ViewShowToolbarNormalScreen", NULL, N_("mcen_me_inbox_normalview"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_toolbar), TRUE },
        { "ViewShowToolbarFullScreen", NULL, N_("mcen_me_inbox_optimizedview"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_toolbar), TRUE },
index 1dd000b..7380646 100644 (file)
@@ -254,7 +254,7 @@ static const GtkActionEntry modest_header_view_action_entries [] = {
 };
 
 static const GtkToggleActionEntry modest_main_window_toggle_action_entries [] = {
-       { "ToolbarToggleView", MODEST_STOCK_SPLIT_VIEW, N_("gqn_toolb_rss_fldonoff"), "<CTRL>t", NULL, G_CALLBACK (modest_ui_actions_toggle_folders_view), FALSE },
+       { "ToggleFolders",     MODEST_STOCK_SPLIT_VIEW, N_("mcen_me_inbox_hidefolders"), "<CTRL>t", NULL, G_CALLBACK (modest_ui_actions_toggle_folders_view), TRUE },
 };
 
 /************************************************************************/
@@ -990,6 +990,7 @@ modest_main_window_set_style (ModestMainWindow *self,
        ModestMainWindowPrivate *priv;
        ModestWindowPrivate *parent_priv;
        GtkAction *action;
+       gboolean active;
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
 
@@ -1000,8 +1001,17 @@ modest_main_window_set_style (ModestMainWindow *self,
        if (priv->style == style)
                return;
 
-       /* Get toggle button */
-       action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToolbarToggleView");
+       /* Get toggle button and update the state if needed. This will
+         happen only when the set_style is not invoked from the UI,
+         for example when it's called from widget memory */
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToggleFolders");
+       active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+       if ((active && style == MODEST_MAIN_WINDOW_STYLE_SIMPLE) ||
+          (!active && style == MODEST_MAIN_WINDOW_STYLE_SPLIT)) {
+              g_signal_handlers_block_by_func (action, modest_ui_actions_toggle_folders_view, self);
+              gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !active);
+              g_signal_handlers_unblock_by_func (action, modest_ui_actions_toggle_folders_view, self);
+       }
 
        priv->style = style;
        switch (style) {
@@ -1013,10 +1023,6 @@ modest_main_window_set_style (ModestMainWindow *self,
                /* Reparent the contents widget to the main vbox */
                gtk_widget_reparent (priv->contents_widget, priv->main_vbox);
 
-               g_signal_handlers_block_by_func (action, modest_ui_actions_toggle_folders_view, self);
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-               g_signal_handlers_unblock_by_func (action, modest_ui_actions_toggle_folders_view, self);
-
                if (modest_header_view_has_selected_headers (MODEST_HEADER_VIEW (priv->header_view))) {
                        TnyList *selection = modest_header_view_get_selected_headers (MODEST_HEADER_VIEW (priv->header_view));
                        TnyIterator *iterator = tny_list_create_iterator (selection);
@@ -1042,10 +1048,6 @@ modest_main_window_set_style (ModestMainWindow *self,
                gtk_paned_add2 (GTK_PANED (priv->main_paned), priv->contents_widget);
                gtk_container_add (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
 
-               g_signal_handlers_block_by_func (action, modest_ui_actions_toggle_folders_view, self);
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
-               g_signal_handlers_unblock_by_func (action, modest_ui_actions_toggle_folders_view, self);
-
                break;
        default:
                g_return_if_reached ();
index 47ade2c..3140026 100644 (file)
@@ -68,7 +68,7 @@
     <menu name="ViewMenu" action="View">
       <menuitem name="ViewSortMenu" action="ViewSort"/>
       <separator/>
-      <menuitem name="ViewToggleFoldersMenu" action="ViewToggleFolders"/>
+      <menuitem name="ViewToggleFoldersMenu" action="ToggleFolders"/>
       <menuitem name="ViewToggleFullscreenMenu" action="ViewToggleFullscreen"/>
       <separator/>
       <menu name="ViewShowToolbarMainMenu" action="ViewShowToolbar">
     <toolitem action="ToolbarMessageNew"/> 
     <toolitem action="ToolbarMessageReply"/> 
     <toolitem action="ToolbarDeleteMessage"/>
-    <toolitem action="ToolbarToggleView"/>
+    <toolitem action="ToggleFolders"/>
     <toolitem action="ToolbarSort"/>
     <toolitem action="ToolbarSendReceive"/>
     <placeholder name="ProgressBarView" />
index 70e3d5f..001bdd8 100644 (file)
@@ -453,7 +453,8 @@ gboolean on_idle_wrong_password (gpointer user_data)
                                        
        ModestWindow *main_window = 
                                modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
-                                             
+
+       gdk_threads_enter ();
        gboolean created_dialog = FALSE;
        if (!found || !dialog) {
                dialog = modest_account_settings_dialog_new ();
@@ -480,10 +481,11 @@ gboolean on_idle_wrong_password (gpointer user_data)
        else {
                /* Just show it instead of showing it and deleting it when it closes,
                 * though it is probably open already: */
-               gtk_widget_show (GTK_WIDGET (dialog));
+               gtk_window_present (GTK_WINDOW (dialog));
        }
        
        g_object_unref (account);
+       gdk_threads_leave ();
        
        return FALSE; /* Dont' call this again. */
 }
index 9700853..f440f7c 100644 (file)
@@ -3048,16 +3048,12 @@ void
 modest_ui_actions_toggle_folders_view (GtkAction *action, 
                                       ModestMainWindow *main_window)
 {
-       ModestConf *conf;
-       
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
-       conf = modest_runtime_get_conf ();
-       
-       if (modest_main_window_get_style (main_window) == MODEST_MAIN_WINDOW_STYLE_SPLIT)
-               modest_main_window_set_style (main_window, MODEST_MAIN_WINDOW_STYLE_SIMPLE);
-       else
+       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
                modest_main_window_set_style (main_window, MODEST_MAIN_WINDOW_STYLE_SPLIT);
+       else
+               modest_main_window_set_style (main_window, MODEST_MAIN_WINDOW_STYLE_SIMPLE);
 }
 
 void 
index 893c068..d70736e 100644 (file)
@@ -1102,7 +1102,7 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
        /* Current folder was unselected */
        if (priv->cur_folder_store) {
                if (TNY_IS_FOLDER(priv->cur_folder_store))
-                       tny_folder_sync (TNY_FOLDER(priv->cur_folder_store), FALSE, NULL);
+                       tny_folder_sync_async (TNY_FOLDER(priv->cur_folder_store), FALSE, NULL, NULL, NULL);
                /* FALSE --> don't expunge the messages */
 
                g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,