X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-mailboxes-window.c;h=89df6843f8ac238ed1bc557e2568dc96618278af;hp=18c7fd736143a15c64a51761e7588d478f895ebb;hb=b8a28ec2cedd74525ff802fb341a96e64c5481b1;hpb=45e33863f943f10d01ba7fffbf35a9f1f8fa814d diff --git a/src/widgets/modest-mailboxes-window.c b/src/widgets/modest-mailboxes-window.c index 18c7fd7..89df684 100644 --- a/src/widgets/modest-mailboxes-window.c +++ b/src/widgets/modest-mailboxes-window.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -41,9 +40,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -52,6 +48,13 @@ #include "modest-text-utils.h" #include "modest-tny-account.h" #include +#ifdef MODEST_TOOLKIT_HILDON2 +#include +#endif +#ifdef MODEST_PLATFORM_MAEMO +#include +#endif +#include /* 'private'/'protected' functions */ static void modest_mailboxes_window_class_init (ModestMailboxesWindowClass *klass); @@ -77,9 +80,11 @@ static void on_queue_changed (ModestMailOperationQueue *queue, static void on_activity_changed (ModestFolderView *view, gboolean activity, ModestMailboxesWindow *folder_window); +#ifdef MODEST_TOOLKIT_HILDON2 static gboolean on_key_press(GtkWidget *widget, - GdkEventKey *event, - gpointer user_data); + GdkEventKey *event, + gpointer user_data); +#endif typedef struct _ModestMailboxesWindowPrivate ModestMailboxesWindowPrivate; struct _ModestMailboxesWindowPrivate { @@ -121,7 +126,12 @@ modest_mailboxes_window_get_type (void) (GInstanceInitFunc) modest_mailboxes_window_init, NULL }; - my_type = g_type_register_static (MODEST_TYPE_HILDON2_WINDOW, + my_type = g_type_register_static ( +#ifdef MODEST_TOOLKIT_HILDON2 + MODEST_TYPE_HILDON2_WINDOW, +#else + MODEST_TYPE_SHELL_WINDOW, +#endif "ModestMailboxesWindow", &my_info, 0); } @@ -258,9 +268,11 @@ connect_signals (ModestMailboxesWindow *self) "clicked", G_CALLBACK (modest_ui_actions_on_new_msg), self); +#ifdef MODEST_TOOLKIT_HILDON2 /* connect window keys -> priv->folder_view scroll here? */ g_signal_connect(G_OBJECT(self), "key-press-event", G_CALLBACK(on_key_press), self); +#endif } ModestWindow * @@ -268,15 +280,12 @@ modest_mailboxes_window_new (const gchar *account) { ModestMailboxesWindow *self = NULL; ModestMailboxesWindowPrivate *priv = NULL; - HildonProgram *app; GdkPixbuf *window_icon; GtkWidget *scrollable; - GtkWidget *action_area_box; - GdkPixbuf *new_message_pixbuf; - guint accel_key; - GdkModifierType accel_mods; - GtkAccelGroup *accel_group; GtkWidget *top_alignment; +#ifdef MODEST_TOOLKIT_HILDON2 + GtkWidget *live_search; +#endif self = MODEST_MAILBOXES_WINDOW(g_object_new(MODEST_TYPE_MAILBOXES_WINDOW, NULL)); priv = MODEST_MAILBOXES_WINDOW_GET_PRIVATE(self); @@ -289,11 +298,18 @@ modest_mailboxes_window_new (const gchar *account) self); priv->folder_view = modest_platform_create_folder_view (NULL); +#ifdef MODEST_TOOLKIT_HILDON2 + live_search = modest_folder_view_setup_live_search (MODEST_FOLDER_VIEW (priv->folder_view)); + hildon_live_search_widget_hook (HILDON_LIVE_SEARCH (live_search), GTK_WIDGET (self), priv->folder_view); +#endif modest_folder_view_set_cell_style (MODEST_FOLDER_VIEW (priv->folder_view), MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT); modest_folder_view_set_filter (MODEST_FOLDER_VIEW (priv->folder_view), MODEST_FOLDER_VIEW_FILTER_HIDE_ACCOUNTS); +#ifdef MODEST_TOOLKIT_HILDON2 + GtkWidget *action_area_box; + GdkPixbuf *new_message_pixbuf; 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); @@ -305,6 +321,7 @@ modest_mailboxes_window_new (const gchar *account) gtk_box_pack_start (GTK_BOX (action_area_box), priv->new_message_button, TRUE, TRUE, 0); gtk_widget_show_all (priv->new_message_button); hildon_tree_view_set_action_area_visible (GTK_TREE_VIEW (priv->folder_view), TRUE); +#endif /* Set account store */ tny_account_store_view_set_account_store (TNY_ACCOUNT_STORE_VIEW (priv->folder_view), @@ -318,6 +335,9 @@ modest_mailboxes_window_new (const gchar *account) gtk_container_add (GTK_CONTAINER (scrollable), priv->folder_view); gtk_box_pack_end (GTK_BOX (priv->top_vbox), scrollable, TRUE, TRUE, 0); +#ifdef MODEST_TOOLKIT_HILDON2 + gtk_box_pack_end (GTK_BOX (priv->top_vbox), live_search, FALSE, FALSE, 0); +#endif gtk_container_add (GTK_CONTAINER (top_alignment), priv->top_vbox); gtk_container_add (GTK_CONTAINER (self), top_alignment); @@ -329,10 +349,16 @@ modest_mailboxes_window_new (const gchar *account) connect_signals (MODEST_MAILBOXES_WINDOW (self)); /* Get device name */ +#ifdef MODEST_PLATFORM_MAEMO modest_maemo_utils_get_device_name (); +#endif + +#ifdef MODEST_TOOLKIT_HILDON2 + HildonProgram *app; app = hildon_program_get_instance (); hildon_program_add_window (app, HILDON_WINDOW (self)); +#endif /* Set window icon */ window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG); @@ -352,11 +378,17 @@ modest_mailboxes_window_new (const gchar *account) G_OBJECT (self)); update_progress_hint (self); +#ifdef MODEST_TOOLKIT_HILDON2 + guint accel_key; + GdkModifierType accel_mods; + GtkAccelGroup *accel_group; + accel_group = gtk_accel_group_new (); gtk_accelerator_parse ("n", &accel_key, &accel_mods); gtk_widget_add_accelerator (priv->new_message_button, "clicked", accel_group, accel_key, accel_mods, 0); gtk_window_add_accel_group (GTK_WINDOW (self), accel_group); +#endif modest_folder_view_set_filter (MODEST_FOLDER_VIEW (priv->folder_view), MODEST_FOLDER_VIEW_FILTER_SHOW_ONLY_MAILBOXES); @@ -443,6 +475,8 @@ on_mailbox_activated (ModestFolderView *mailboxes_view, return; new_window = GTK_WIDGET (modest_folder_window_new (NULL)); + active_account = modest_window_get_active_account (MODEST_WINDOW (self)); + modest_window_set_active_account (MODEST_WINDOW (self), active_account); registered = modest_window_mgr_register_window (modest_runtime_get_window_mgr (), MODEST_WINDOW (new_window), MODEST_WINDOW (self)); @@ -472,7 +506,7 @@ on_map_event (GtkWidget *widget, ModestMailboxesWindowPrivate *priv = MODEST_MAILBOXES_WINDOW_GET_PRIVATE (self); if (priv->progress_hint) { - hildon_gtk_window_set_progress_indicator (GTK_WINDOW (self), TRUE); + modest_window_show_progress (MODEST_WINDOW (self), TRUE); } return FALSE; @@ -526,7 +560,7 @@ update_progress_hint (ModestMailboxesWindow *self) modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self)); if (GTK_WIDGET_VISIBLE (self)) { - hildon_gtk_window_set_progress_indicator (GTK_WINDOW (self), priv->progress_hint ? 1:0); + modest_window_show_progress (MODEST_WINDOW (self), priv->progress_hint ? 1:0); } } @@ -614,7 +648,7 @@ on_activity_changed (ModestFolderView *view, update_progress_hint (self); } - +#ifdef MODEST_TOOLKIT_HILDON2 static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { @@ -641,3 +675,4 @@ on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data) return FALSE; } +#endif