#include <modest-window-priv.h>
#include "modest-text-utils.h"
#include "modest-tny-account.h"
+#include "modest-account-protocol.h"
typedef enum {
EDIT_MODE_COMMAND_MOVE = 1,
static void on_account_changed (TnyAccountStore *account_store,
TnyAccount *account,
gpointer user_data);
+static gboolean on_key_press(GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data);
typedef struct _ModestFolderWindowPrivate ModestFolderWindowPrivate;
struct _ModestFolderWindowPrivate {
G_OBJECT (modest_runtime_get_account_store()),
"account-changed",
G_CALLBACK (on_account_changed), self);
+
+
+ g_signal_connect(G_OBJECT(self), "key-press-event",
+ G_CALLBACK(on_key_press), self);
}
ModestWindow *
G_CALLBACK (edit_mode_changed), (gpointer) self);
action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->folder_view));
- priv->new_message_button = hildon_button_new (0, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
+ priv->new_message_button = hildon_button_new (MODEST_EDITABLE_SIZE, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
hildon_button_set_title (HILDON_BUTTON (priv->new_message_button), _("mcen_ti_new_message"));
new_message_pixbuf = modest_platform_get_icon ("general_add", MODEST_ICON_SIZE_BIG);
priv->top_vbox = gtk_vbox_new (0, FALSE);
top_alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (top_alignment),
- 0, 0,
+ HILDON_MARGIN_HALF, 0,
HILDON_MARGIN_DOUBLE, HILDON_MARGIN_DOUBLE);
gtk_container_add (GTK_CONTAINER (pannable), priv->folder_view);
}
static void
+edit_account (GtkButton *button,
+ ModestFolderWindow *self)
+{
+ const gchar *account_name;
+
+ account_name = modest_window_get_active_account ((ModestWindow *) self);
+ if (modest_ui_actions_check_for_active_account ((ModestWindow *) self, account_name)) {
+ /* Show the account settings dialog */
+ ModestAccountProtocol *proto;
+ ModestProtocolType proto_type;
+
+ /* Get proto */
+ proto_type = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (),
+ account_name);
+ proto = (ModestAccountProtocol *)
+ modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (),
+ proto_type);
+
+ /* Create and show the dialog */
+ if (proto && MODEST_IS_ACCOUNT_PROTOCOL (proto)) {
+ ModestAccountSettingsDialog *dialog =
+ modest_account_protocol_get_account_settings_dialog (proto, account_name);
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ (GtkWindow *) dialog,
+ (GtkWindow *) self);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), FALSE);
+ gtk_widget_show (GTK_WIDGET (dialog));
+ }
+ }
+}
+
+static void
setup_menu (ModestFolderWindow *self)
{
g_return_if_fail (MODEST_IS_FOLDER_WINDOW(self));
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_folder_window_delete));
/* send receive actions should be only one visible always */
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self),
- _("mcen_me_inbox_sendandreceive"),
- NULL,
+ modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
APP_MENU_CALLBACK (modest_ui_actions_on_send_receive),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive));
modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
APP_MENU_CALLBACK (modest_ui_actions_cancel_send),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
+
+ modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self),
+ dngettext(GETTEXT_PACKAGE,
+ "mcen_me_edit_account",
+ "mcen_me_edit_accounts",
+ 1),
+ NULL, APP_MENU_CALLBACK (edit_account),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_edit_accounts));
}
static void
{
TnyAccount *account;
+ if (!account_id)
+ return;
+
account = modest_tny_account_store_get_tny_account_by (modest_runtime_get_account_store(),
MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
account_id);
if (acc_id && visible && !g_utf8_collate (acc_id, visible))
update_window_title (MODEST_FOLDER_WINDOW (user_data), account);
}
+
+
+static gboolean
+on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ ModestFolderWindowPrivate *priv;
+ HildonPannableArea *pannable;
+
+ if (event->type == GDK_KEY_RELEASE)
+ return FALSE;
+
+ priv = MODEST_FOLDER_WINDOW_GET_PRIVATE (user_data);
+
+ pannable = HILDON_PANNABLE_AREA (gtk_widget_get_parent (priv->folder_view));
+
+ 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;
+}