X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-hildon2-window.c;h=bb9a376e6f6f387e8e6e2f73da11e8a67da0dab3;hb=2064f741529da69844c75001c8af22684b9108de;hp=7e6f394bc1db2ba799dbb3cea0e88cb93b0839ca;hpb=f02ac5fc983a182ad696716fabb5fd2242256031;p=modest diff --git a/src/hildon2/modest-hildon2-window.c b/src/hildon2/modest-hildon2-window.c index 7e6f394..bb9a376 100644 --- a/src/hildon2/modest-hildon2-window.c +++ b/src/hildon2/modest-hildon2-window.c @@ -30,6 +30,7 @@ #include #include #include +#include "modest-marshal.h" #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include "modest-text-utils.h" #include typedef struct _EditModeRegister { @@ -148,8 +150,8 @@ modest_hildon2_window_class_init (gpointer klass, gpointer class_data) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (ModestHildon2WindowClass, edit_mode_changed), NULL, NULL, - g_cclosure_marshal_VOID__INT, - G_TYPE_NONE, 1, G_TYPE_INT); + modest_marshal_VOID__INT_BOOLEAN, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_BOOLEAN); g_type_class_add_private (gobject_class, sizeof(ModestHildon2WindowPrivate)); @@ -219,9 +221,8 @@ on_zoom_minus_plus_not_implemented (ModestWindow *window) { g_return_val_if_fail (MODEST_IS_HILDON2_WINDOW (window), FALSE); - hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_cannot_zoom_here")); + hildon_banner_show_information (NULL, NULL, _CS("ckct_ib_cannot_zoom_here")); return FALSE; - } static void @@ -255,12 +256,16 @@ modest_hildon2_window_add_button_to_menu (ModestHildon2Window *self, g_return_if_fail (GTK_IS_BUTTON (button)); priv = MODEST_HILDON2_WINDOW_GET_PRIVATE (self); + modest_ui_dimming_manager_set_widget_dimming_mode (GTK_WIDGET (button), + MODEST_UI_DIMMING_MODE_HIDE); + if (dimming_callback) modest_dimming_rules_group_add_widget_rule (priv->app_menu_dimming_group, GTK_WIDGET (button), (GCallback) dimming_callback, MODEST_WINDOW (self)); hildon_app_menu_append (HILDON_APP_MENU (priv->app_menu), GTK_BUTTON (button)); + gtk_widget_show (GTK_WIDGET (button)); } void @@ -392,7 +397,18 @@ modest_hildon2_window_set_edit_mode (ModestHildon2Window *self, selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->current_edit_tree_view)); gtk_tree_selection_set_mode (selection, reg->mode); - gtk_tree_selection_unselect_all (selection); + if (reg->mode == GTK_SELECTION_SINGLE || reg->mode == GTK_SELECTION_BROWSE) { + GtkTreeModel *model; + GtkTreeIter iter; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->current_edit_tree_view)); + if (gtk_tree_model_get_iter_first (model, &iter)) { + gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (priv->current_edit_tree_view), 0, 0); + gtk_tree_selection_select_iter (selection, &iter); + } + } else { + gtk_tree_selection_unselect_all (selection); + } priv->edit_toolbar = hildon_edit_toolbar_new (); hildon_edit_toolbar_set_label (HILDON_EDIT_TOOLBAR (priv->edit_toolbar), @@ -412,8 +428,7 @@ modest_hildon2_window_set_edit_mode (ModestHildon2Window *self, gtk_window_fullscreen (GTK_WINDOW (self)); g_signal_emit (G_OBJECT (self), signals[EDIT_MODE_CHANGED_SIGNAL], 0, - priv->edit_command); - + priv->edit_command, priv->edit_mode); } void @@ -431,7 +446,6 @@ modest_hildon2_window_unset_edit_mode (ModestHildon2Window *self) if (priv->edit_mode) { priv->edit_mode = FALSE; - priv->edit_command = MODEST_HILDON2_WINDOW_EDIT_MODE_NONE; if (priv->current_edit_tree_view) { g_object_set (G_OBJECT (priv->current_edit_tree_view), "hildon-ui-mode", HILDON_UI_MODE_NORMAL, @@ -441,8 +455,8 @@ modest_hildon2_window_unset_edit_mode (ModestHildon2Window *self) } gtk_window_unfullscreen (GTK_WINDOW (self)); g_signal_emit (G_OBJECT (self), signals[EDIT_MODE_CHANGED_SIGNAL], 0, - priv->edit_command); - + priv->edit_command, priv->edit_mode); + priv->edit_command = MODEST_HILDON2_WINDOW_EDIT_MODE_NONE; } } @@ -486,15 +500,16 @@ edit_toolbar_button_clicked (HildonEditToolbar *toolbar, EditModeRegister *reg; g_return_if_fail (MODEST_IS_HILDON2_WINDOW (self)); - + reg = (EditModeRegister *) g_hash_table_lookup (priv->edit_mode_registry, GINT_TO_POINTER (priv->edit_command)); - if (reg == NULL) - modest_hildon2_window_unset_edit_mode (self); - if ((reg->action == NULL) || reg->action (self)) + if (reg) { + if ((reg->action == NULL) || reg->action (self)) + modest_hildon2_window_unset_edit_mode (self); + } else { modest_hildon2_window_unset_edit_mode (self); - + } } static void @@ -502,7 +517,7 @@ edit_toolbar_arrow_clicked (HildonEditToolbar *toolbar, ModestHildon2Window *self) { g_return_if_fail (MODEST_IS_HILDON2_WINDOW (self)); - + modest_hildon2_window_unset_edit_mode (self); }