#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);
static void on_online_toggle_toggled (GtkToggleButton *toggle, ModestWidgetFactory *factory);
static void on_password_requested (ModestTnyAccountStore *account_store, const gchar* account_name,
- gchar **password, gboolean *cancel, ModestWidgetFactory *self);
+ gchar **password, gboolean *cancel, gboolean *remember, ModestWidgetFactory *self);
static void on_item_not_found (ModestHeaderView* header_view, ModestItemType type,
ModestWidgetFactory *self);
ModestWidgetFactory *self)
{
ModestWidgetFactoryPrivate *priv;
+
priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->online_toggle),
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);
+ }
}
ModestWidgetFactory *self)
{
/* FIXME ==> ask from UI... */
- GtkWidget *dialog;
+ GtkWidget *dialog, *window;
gchar *txt;
gboolean online;
gchar *item = type == MODEST_ITEM_TYPE_FOLDER ? "folder" : "message";
priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
device = tny_account_store_get_device (priv->account_store);
+ 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,
} else {
dialog = gtk_dialog_new_with_buttons (_("Connection requested"),
- NULL,
+ window,
GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
g_free (txt);
gtk_window_set_default_size (GTK_WINDOW(dialog), 300, 300);
- if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
tny_device_force_online (device);
+ }
}
gtk_widget_destroy (dialog);
+ gdk_threads_leave ();
}
static void
on_password_requested (ModestTnyAccountStore *account_store, const gchar* account_name,
- gchar **password, gboolean *cancel, ModestWidgetFactory *self)
+ 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,
*password = NULL;
*cancel = TRUE;
}
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (remember_pass_check)))
+ *remember = TRUE;
+ else
+ *remember = FALSE;
+
gtk_widget_destroy (dialog);
}