+
+static void
+on_mail_operation_started (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestAccountsWindow *self;
+ ModestMailOperationTypeOperation op_type;
+ GObject *source = NULL;
+
+ self = MODEST_ACCOUNTS_WINDOW (user_data);
+ op_type = modest_mail_operation_get_type_operation (mail_op);
+ source = modest_mail_operation_get_source(mail_op);
+ if (G_OBJECT (self) == source) {
+ update_progress_hint (self);
+ }
+ g_object_unref (source);
+}
+
+static void
+on_mail_operation_finished (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestAccountsWindow *self;
+
+ self = MODEST_ACCOUNTS_WINDOW (user_data);
+
+ /* Don't disable the progress hint if there are more pending
+ operations from this window */
+ update_progress_hint (self);
+
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
+}
+
+static void
+on_queue_changed (ModestMailOperationQueue *queue,
+ ModestMailOperation *mail_op,
+ ModestMailOperationQueueNotification type,
+ ModestAccountsWindow *self)
+{
+ ModestAccountsWindowPrivate *priv;
+
+ priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE (self);
+
+ /* If this operations was created by another window, do nothing */
+ if (!modest_mail_operation_is_mine (mail_op, G_OBJECT(self)))
+ return;
+
+ if (type == MODEST_MAIL_OPERATION_QUEUE_OPERATION_ADDED) {
+ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-started",
+ G_CALLBACK (on_mail_operation_started),
+ self);
+ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-finished",
+ G_CALLBACK (on_mail_operation_finished),
+ self);
+ } else if (type == MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED) {
+ priv->sighandlers = modest_signal_mgr_disconnect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-started");
+ priv->sighandlers = modest_signal_mgr_disconnect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-finished");
+ }
+}
+
+void
+modest_accounts_window_pre_create (void)
+{
+ static gboolean pre_created = FALSE;
+ if (!pre_created) {
+ pre_created = TRUE;
+ pre_created_accounts_window = GTK_WIDGET (modest_accounts_window_new_real ());
+ }
+}
+
+
+static gboolean
+on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ ModestAccountsWindowPrivate *priv;
+ HildonPannableArea *pannable;
+
+ if (event->type == GDK_KEY_RELEASE)
+ return FALSE;
+
+ priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE(user_data);
+
+ pannable = HILDON_PANNABLE_AREA (priv->pannable);
+
+ switch (event->keyval) {
+
+ case GDK_Up:
+ modest_maemo_utils_scroll_pannable(pannable, 0, -1);
+ break;
+
+ case GDK_Down:
+ modest_maemo_utils_scroll_pannable(pannable, 0, 1);
+ break;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+on_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer userdata)
+{
+ ModestAccountsWindowPrivate *priv;
+
+ priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE (widget);
+
+ modest_account_view_set_show_last_update (MODEST_ACCOUNT_VIEW (priv->account_view), FALSE);
+
+ gtk_widget_queue_resize (widget);
+
+ gdk_window_process_updates (priv->account_view->window, TRUE);
+
+ hildon_gtk_window_take_screenshot (GTK_WINDOW (widget), TRUE);
+
+ modest_account_view_set_show_last_update (MODEST_ACCOUNT_VIEW (priv->account_view), TRUE);
+
+ return FALSE;
+
+}