summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-10-27 13:16:20 +0200
committerJasmine Hassan <[email protected]>2012-11-16 09:45:50 +0200
commitf30de91c1ccc7f3cbaeb3c00c0f89e4443b01238 (patch)
tree4c329a8871480b5d251c37fdaafec044ea51accf /src
parent5680dbcc4995bd860e0e7659481e3d2079b09382 (diff)
downloadcaja-f30de91c1ccc7f3cbaeb3c00c0f89e4443b01238.tar.bz2
caja-f30de91c1ccc7f3cbaeb3c00c0f89e4443b01238.tar.xz
[places-sidebar] fix eject button highlighting
http://git.gnome.org/browse/nautilus/commit/?id=2d9d47254908533d1eb20e16e091f91310052e93
Diffstat (limited to 'src')
-rw-r--r--src/caja-places-sidebar.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index e161a3e6..b836de94 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -2654,34 +2654,36 @@ update_eject_buttons (CajaPlacesSidebar *sidebar,
GtkTreePath *path)
{
GtkTreeIter iter;
- gboolean icon_visible;
+ gboolean icon_visible, path_same;
icon_visible = TRUE;
- if (!path && !sidebar->eject_highlight_path) {
+ if (path == NULL && sidebar->eject_highlight_path == NULL) {
/* Both are null - highlight up to date */
return;
}
- if (path &&
- sidebar->eject_highlight_path &&
- gtk_tree_path_compare (sidebar->eject_highlight_path, path) == 0) {
+ path_same = (path != NULL) &&
+ (sidebar->eject_highlight_path != NULL) &&
+ (gtk_tree_path_compare (sidebar->eject_highlight_path, path) == 0);
+
+ if (path_same) {
/* Same path - highlight up to date */
return;
}
if (path) {
- gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->filter_model),
&iter,
path);
- gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
+ gtk_tree_model_get (GTK_TREE_MODEL (sidebar->filter_model),
&iter,
PLACES_SIDEBAR_COLUMN_EJECT, &icon_visible,
-1);
}
- if (!icon_visible || !path) {
+ if (!icon_visible || path == NULL || !path_same) {
/* remove highlighting and reset the saved path, as we are leaving
* an eject button area.
*/
@@ -2694,26 +2696,32 @@ update_eject_buttons (CajaPlacesSidebar *sidebar,
&iter,
PLACES_SIDEBAR_COLUMN_EJECT_ICON, get_eject_icon (FALSE),
-1);
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (sidebar->filter_model));
gtk_tree_path_free (sidebar->eject_highlight_path);
sidebar->eject_highlight_path = NULL;
}
- return;
+ if (!icon_visible) {
+ return;
+ }
}
- /* add highlighting to the selected path, as the icon is visible and
- * we're hovering it.
- */
- gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
- &iter,
- path);
+ if (path != NULL) {
+ /* add highlighting to the selected path, as the icon is visible and
+ * we're hovering it.
+ */
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
+ &iter,
+ path);
+ gtk_list_store_set (sidebar->store,
+ &iter,
+ PLACES_SIDEBAR_COLUMN_EJECT_ICON, get_eject_icon (TRUE),
+ -1);
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (sidebar->filter_model));
- gtk_list_store_set (sidebar->store,
- &iter,
- PLACES_SIDEBAR_COLUMN_EJECT_ICON, get_eject_icon (TRUE),
- -1);
- sidebar->eject_highlight_path = gtk_tree_path_copy (path);
+ sidebar->eject_highlight_path = gtk_tree_path_copy (path);
+ }
}
static gboolean
@@ -2730,11 +2738,13 @@ bookmarks_motion_event_cb (GtkWidget *widget,
if (over_eject_button (sidebar, event->x, event->y, &path)) {
update_eject_buttons (sidebar, path);
gtk_tree_path_free (path);
- } else {
- update_eject_buttons (sidebar, NULL);
+
+ return TRUE;
}
- return TRUE;
+ update_eject_buttons (sidebar, NULL);
+
+ return FALSE;
}
/* Callback used when a button is pressed on the shortcuts list.