[epiphany] ephy-overview: Use hand cursor when hovering items



commit 74d8f312cb8f7fd79cf9ddf4f4f8958d3b04e666
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Sep 5 08:58:56 2012 +0300

    ephy-overview: Use hand cursor when hovering items
    
    For improved visual feedback.

 embed/ephy-overview.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-overview.c b/embed/ephy-overview.c
index 49ca2ff..dfba6a2 100644
--- a/embed/ephy-overview.c
+++ b/embed/ephy-overview.c
@@ -74,6 +74,26 @@ main_view_item_activated (GtkWidget *widget,
   g_free (url);
 }
 
+static gboolean
+iconview_motion_notify (GtkWidget *widget,
+                        GdkEvent *event,
+                        EphyOverview *overview)
+{
+  GdkCursor *cursor;
+  GtkIconView *iconview = GTK_ICON_VIEW (widget);
+  GdkEventMotion *ev = (GdkEventMotion *)event;
+
+  if (gtk_icon_view_get_item_at_pos (iconview, ev->x, ev->y, NULL, NULL)) {
+    cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_HAND2);
+    gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
+    g_object_unref (cursor);
+  } else {
+    gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
+  }
+
+  return FALSE;
+}
+
 static void
 ephy_overview_constructed (GObject *object)
 {
@@ -91,6 +111,9 @@ ephy_overview_constructed (GObject *object)
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   iconview = gtk_bin_get_child (GTK_BIN (self->priv->frecent_view));
   gtk_icon_view_set_columns (GTK_ICON_VIEW (iconview), 5);
+  g_signal_connect (iconview, "motion-notify-event",
+                    G_CALLBACK (iconview_motion_notify),
+                    self);
   g_object_set (self->priv->frecent_view,
                 "halign", GTK_ALIGN_FILL,
                 "valign", GTK_ALIGN_FILL, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]