* Fixed comments with errors
[modest] / src / modest-widget-factory.c
index 1d8128d..92ed3ec 100644 (file)
 
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
-#include "modest-widget-factory.h"
-#include <modest-widget-memory.h>
-#include <modest-protocol-mgr.h>
 #include <tny-gtk-account-list-model.h>
 #include <tny-gtk-folder-store-tree-model.h>
 #include <tny-account-store.h>
 #include <tny-device.h>
 #include <tny-folder-store-query.h>
-
+#include "modest-widget-factory.h"
+#include "modest-widget-memory.h"
+#include "modest-protocol-mgr.h"
 #include "modest-tny-platform-factory.h"
 #include "modest-account-mgr.h"
 #include "modest-mail-operation.h"
-
+#include "widgets/modest-header-view-priv.h"
 
 /* 'private'/'protected' functions */
 static void modest_widget_factory_class_init    (ModestWidgetFactoryClass *klass);
@@ -675,6 +674,7 @@ on_connection_changed (TnyDevice *device, gboolean online,
                       ModestWidgetFactory *self)
 {
        ModestWidgetFactoryPrivate *priv;
+
        priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->online_toggle),
@@ -683,6 +683,15 @@ on_connection_changed (TnyDevice *device, gboolean online,
                              online ? _("Online") : _("Offline"));
 
        statusbar_push (self, 0, online ? _("Modest went online") : _("Modest went offline"));
+
+       /* If Modest has became online and the header view has a
+          header selected then show it */
+       if (online) {
+               GtkTreeSelection *selected;
+
+               selected = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->header_view));
+               _modest_header_view_change_selection (selected, priv->header_view);
+       }
 }
 
 
@@ -710,7 +719,7 @@ on_item_not_found (ModestHeaderView* header_view, ModestItemType type,
                   ModestWidgetFactory *self)
 {
        /* FIXME ==> ask from UI... */
-       GtkWidget *dialog;
+       GtkWidget *dialog, *window;
        gchar *txt;
        gboolean online;
        gchar *item = type == MODEST_ITEM_TYPE_FOLDER ? "folder" : "message";
@@ -723,9 +732,11 @@ on_item_not_found (ModestHeaderView* header_view, ModestItemType type,
        
        gdk_threads_enter ();
        online = tny_device_is_online (device);
+       /* FIXME: get main window */
+       window = NULL;
        if (online) {
                /* already online -- the item is simply not there... */
-               dialog = gtk_message_dialog_new (NULL,
+               dialog = gtk_message_dialog_new (window,
                                                 GTK_DIALOG_MODAL,
                                                 GTK_MESSAGE_WARNING,
                                                 GTK_BUTTONS_OK,
@@ -735,7 +746,7 @@ on_item_not_found (ModestHeaderView* header_view, ModestItemType type,
        } else {
 
                dialog = gtk_dialog_new_with_buttons (_("Connection requested"),
-                                                     NULL,
+                                                     window,
                                                      GTK_DIALOG_MODAL,
                                                      GTK_STOCK_CANCEL,
                                                      GTK_RESPONSE_REJECT,
@@ -766,10 +777,12 @@ on_password_requested (ModestTnyAccountStore *account_store, const gchar* accoun
                       gchar **password, gboolean *cancel, gboolean *remember, ModestWidgetFactory *self)
 {
        gchar *txt;
-       GtkWidget *dialog, *entry, *remember_pass_check;
+       GtkWidget *dialog, *entry, *remember_pass_check, *window;
        
+       /* FIXME: get main window */
+       window = NULL;
        dialog = gtk_dialog_new_with_buttons (_("Password requested"),
-                                             NULL,
+                                             window,
                                              GTK_DIALOG_MODAL,
                                              GTK_STOCK_CANCEL,
                                              GTK_RESPONSE_REJECT,