[maemo-commits] [maemo-commits] r13571 - in projects/haf/branches/hildon-control-panel/refactoring: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Sep 4 14:58:31 EEST 2007
- Previous message: [maemo-commits] r13570 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r13572 - in projects/haf/trunk/hildon-desktop: . libhildondesktop libhildonwm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2007-09-04 14:58:29 +0300 (Tue, 04 Sep 2007) New Revision: 13571 Modified: projects/haf/branches/hildon-control-panel/refactoring/ChangeLog projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.c projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.h projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c Log: 2007-09-04 Lucas Rocha <lucas.rocha at nokia.com> * src/hcp-app-view.c (hcp_app_view_selection_changed_cb): scroll to exact grid item instead of considering the whole widget height. Fixes: NB#65971. * src/hcp-grid.[ch] (hcp_grid_get_row_height): add API to get current row height from the grid widget. * src/hcp-window.c (hcp_window_init): correctly set accel group in main menu. Modified: projects/haf/branches/hildon-control-panel/refactoring/ChangeLog =================================================================== --- projects/haf/branches/hildon-control-panel/refactoring/ChangeLog 2007-09-04 11:35:00 UTC (rev 13570) +++ projects/haf/branches/hildon-control-panel/refactoring/ChangeLog 2007-09-04 11:58:29 UTC (rev 13571) @@ -1,3 +1,13 @@ +2007-09-04 Lucas Rocha <lucas.rocha at nokia.com> + + * src/hcp-app-view.c (hcp_app_view_selection_changed_cb): scroll to + exact grid item instead of considering the whole widget height. + Fixes: NB#65971. + * src/hcp-grid.[ch] (hcp_grid_get_row_height): add API to get current + row height from the grid widget. + * src/hcp-window.c (hcp_window_init): correctly set accel group in + main menu. + 2007-08-28 Lucas Rocha <lucas.rocha at nokia.com> * src/hcp-window.c: add accel group to menu in order to make it be Modified: projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c =================================================================== --- projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c 2007-09-04 11:35:00 UTC (rev 13570) +++ projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c 2007-09-04 11:58:29 UTC (rev 13571) @@ -148,13 +148,23 @@ GtkWidget *view = GTK_WIDGET (user_data); GtkWidget *scrolled_window = view->parent->parent; HCPApp *app = hcp_app_view_get_selected_app (widget); + GtkTreePath *path; + GtkAllocation allocation; GtkAdjustment *adj; - gint visible_y; + guint row, row_height, position, visible_y; if (app == NULL) return; - + g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); + path = hcp_grid_get_selected_item (HCP_GRID (widget)); + position = gtk_tree_path_get_indices (path) [0]; + + row = position / HCP_GRID_NUM_COLUMNS; + row_height = hcp_grid_get_row_height (HCP_GRID (widget)); + + gtk_tree_path_free (path); + adj = gtk_scrolled_window_get_vadjustment ( GTK_SCROLLED_WINDOW (scrolled_window)); @@ -163,18 +173,26 @@ visible_y = view->allocation.y + (gint)(view->allocation.height * adj->value / (adj->upper - adj->lower)); - if (widget->allocation.y < visible_y) + allocation.y = widget->allocation.y + (row * row_height); + allocation.height = row_height; + + if (allocation.y < 0) + return; + + if (allocation.y < visible_y) { - adj->value = widget->allocation.y * (adj->upper - adj->lower) - / view->allocation.height; + adj->value = allocation.y * (adj->upper - adj->lower) + / view->allocation.height; + gtk_adjustment_value_changed (adj); } - else if (widget->allocation.y + widget->allocation.height > + else if (allocation.y + allocation.height > visible_y + scrolled_window->allocation.height) { - adj->value = (widget->allocation.y + widget->allocation.height + adj->value = (allocation.y + allocation.height - scrolled_window->allocation.height) * (adj->upper - adj->lower) / view->allocation.height; + gtk_adjustment_value_changed (adj); } @@ -400,6 +418,7 @@ if (view->priv->first_grid) { gtk_widget_grab_focus (priv->first_grid); + g_debug ("LALALAL JOJOJO"); gtk_icon_view_select_path (GTK_ICON_VIEW (priv->first_grid), gtk_tree_path_new_first ()); } Modified: projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.c =================================================================== --- projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.c 2007-09-04 11:35:00 UTC (rev 13570) +++ projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.c 2007-09-04 11:58:29 UTC (rev 13571) @@ -39,7 +39,6 @@ G_DEFINE_TYPE (HCPGrid, hcp_grid, GTK_TYPE_ICON_VIEW); -#define HCP_GRID_NUM_COLUMNS 2 #define HCP_GRID_ITEM_WIDTH 328 #define HCP_GRID_X_PADDING 4 #define HCP_GRID_Y_PADDING 2 @@ -562,6 +561,14 @@ return path; } +guint +hcp_grid_get_row_height (HCPGrid *grid) +{ + g_return_val_if_fail (HCP_IS_GRID (grid), 0); + + return grid->priv->row_height; +} + void hcp_grid_set_icon_size (HCPGrid *grid, HCPIconSize icon_size) { Modified: projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.h =================================================================== --- projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.h 2007-09-04 11:35:00 UTC (rev 13570) +++ projects/haf/branches/hildon-control-panel/refactoring/src/hcp-grid.h 2007-09-04 11:58:29 UTC (rev 13571) @@ -41,6 +41,9 @@ #define HCP_DEFAULT_ICON_BASENAME "qgn_list_gene_unknown_file" +#define HCP_GRID_NUM_COLUMNS 2 + + typedef enum { HCP_ICON_SIZE_SMALL = 27, @@ -72,6 +75,8 @@ GtkTreePath *hcp_grid_get_selected_item (HCPGrid *grid); +guint hcp_grid_get_row_height (HCPGrid *grid); + void hcp_grid_set_icon_size (HCPGrid *grid, HCPIconSize icon_size); Modified: projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c =================================================================== --- projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c 2007-09-04 11:35:00 UTC (rev 13570) +++ projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c 2007-09-04 11:58:29 UTC (rev 13571) @@ -858,7 +858,7 @@ /* Close */ accel_group = gtk_accel_group_new (); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); - gtk_window_add_accel_group (GTK_WINDOW (menu), accel_group); + gtk_menu_set_accel_group (GTK_MENU (menu), accel_group); mi = gtk_menu_item_new_with_label (HCP_MENU_CLOSE);
- Previous message: [maemo-commits] r13570 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r13572 - in projects/haf/trunk/hildon-desktop: . libhildondesktop libhildonwm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]