[maemo-commits] [maemo-commits] r13873 - projects/haf/trunk/hildon-fm/hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Sep 17 21:14:11 EEST 2007
Author: marivoll
Date: 2007-09-17 21:14:09 +0300 (Mon, 17 Sep 2007)
New Revision: 13873

Modified:
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c
Log:
	* hildon-fm/hildon-file-selection.c
	(hildon_file_selection_create_list_view,
	hildon_file_selection_create_thumbnail_view): Enable the 'rules
	hint' for the GtkTreeView (N69593).
	(hildon_file_selection_row_inserted): check for empty selection
	instead of NULL cursor, as this condition will not happen
	ever. This way we ensure that the goal URI is selected as soon as
	the row is added if the user hasn't selected anything
	meanwhile. (N68619)


Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c	2007-09-17 18:11:10 UTC (rev 13872)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c	2007-09-17 18:14:09 UTC (rev 13873)
@@ -2237,6 +2237,7 @@
     tree = GTK_TREE_VIEW(self->priv->view[1]);
 
     gtk_tree_view_set_fixed_height_mode(tree, TRUE);
+    gtk_tree_view_set_rules_hint(tree, TRUE);
 
     col = gtk_tree_view_column_new();
     renderer = gtk_cell_renderer_pixbuf_new();
@@ -2301,6 +2302,8 @@
     self->priv->view[0] = gtk_tree_view_new();
     tree = GTK_TREE_VIEW(self->priv->view[0]);
     gtk_tree_view_set_headers_visible(tree, FALSE);
+    gtk_tree_view_set_rules_hint(tree, TRUE);
+
     /* Fixed height seems to require setting fixed widths for every
        column. This is not a good thing in our case. We would _absolutely_
        need GTK_TREE_VIEW_COLUMN_GROW_ONLY to be supported as well in
@@ -4442,8 +4445,8 @@
 {
   HildonFileSelection *self = (HildonFileSelection *)data;
   HildonFileSelectionPrivate *priv = self->priv;
+  GtkTreeSelection *selection;
   GtkTreeView *view;
-  GtkTreePath *cursor;
   char *uri;
 
   if (priv->cursor_goal_uri == NULL)
@@ -4453,24 +4456,20 @@
   if (view == NULL)
     return;
 
+  selection = gtk_tree_view_get_selection (view);
   gtk_tree_model_get (model, iter,
                       HILDON_FILE_SYSTEM_MODEL_COLUMN_URI, &uri,
                       -1);
-  if (g_strcasecmp (uri, priv->cursor_goal_uri) != 0)
-    {
-      g_free (uri);
-      return;
-    }
 
-  gtk_tree_view_get_cursor (view, &cursor, NULL);
-  if (cursor == NULL)
+  if (g_strcasecmp (uri, priv->cursor_goal_uri) == 0 &&
+      !gtk_tree_selection_get_selected (selection, NULL, NULL))
     {
       set_cursor_when_idle (view, path, FALSE);
       g_free (priv->cursor_goal_uri);
       priv->cursor_goal_uri = NULL;
     }
-  else
-    gtk_tree_path_free (cursor);
+
+  g_free (uri);
 }
 
 /* Setup things so that the view that shows MODEL (at any time) will


More information about the maemo-commits mailing list