[Xfce4-commits] <ristretto:master> Merge branch 'uri-base'

Stephan Arts noreply at xfce.org
Tue Aug 9 20:38:04 CEST 2011


Updating branch refs/heads/master
         to fe81869de83d6e88046328cd7069b09b8c3a6674 (commit)
       from c070a4151dbdb4165d6ad51caad6531268812edb (commit)

commit fe81869de83d6e88046328cd7069b09b8c3a6674
Merge: c070a41 610a068
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Aug 9 20:36:19 2011 +0200

    Merge branch 'uri-base'

commit 610a0686255b44abf4894ee3aca2e90650a10454
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Aug 9 20:35:33 2011 +0200

    Add navigate-images with scroll-button.

commit f0b4198dbf8bbe89ae8e9c03c1ea0f51bd9d394b
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Aug 9 19:44:29 2011 +0200

    Add tooltip with delete button

 src/image_viewer.c |   15 ++++++++-------
 src/main_window.c  |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/src/image_viewer.c b/src/image_viewer.c
index f6b288b..e83169e 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -159,7 +159,7 @@ cb_rstto_image_viewer_update_pixbuf (RsttoImageViewer *viewer);
 static gboolean 
 cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer);
 
-static void
+static gboolean
 cb_rstto_image_viewer_scroll_event (RsttoImageViewer *viewer, GdkEventScroll *event);
 static gboolean 
 cb_rstto_image_viewer_motion_notify_event (RsttoImageViewer *viewer,
@@ -238,10 +238,10 @@ rstto_image_viewer_init(RsttoImageViewer *viewer)
                            GDK_ENTER_NOTIFY_MASK |
                            GDK_POINTER_MOTION_MASK);
 
-    g_signal_connect(G_OBJECT(viewer), "scroll_event", G_CALLBACK(cb_rstto_image_viewer_scroll_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "button_press_event", G_CALLBACK(cb_rstto_image_viewer_button_press_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "button_release_event", G_CALLBACK(cb_rstto_image_viewer_button_release_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "motion_notify_event", G_CALLBACK(cb_rstto_image_viewer_motion_notify_event), NULL);
+    g_signal_connect(G_OBJECT(viewer), "scroll-event", G_CALLBACK(cb_rstto_image_viewer_scroll_event), NULL);
+    g_signal_connect(G_OBJECT(viewer), "button-press-event", G_CALLBACK(cb_rstto_image_viewer_button_press_event), NULL);
+    g_signal_connect(G_OBJECT(viewer), "button-release-event", G_CALLBACK(cb_rstto_image_viewer_button_release_event), NULL);
+    g_signal_connect(G_OBJECT(viewer), "motion-notify-event", G_CALLBACK(cb_rstto_image_viewer_motion_notify_event), NULL);
 
     /*
     gtk_drag_dest_set(GTK_WIDGET(viewer), 0, drop_targets, G_N_ELEMENTS(drop_targets),
@@ -1640,14 +1640,14 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
     rstto_image_viewer_paint (GTK_WIDGET (viewer));
 }
 
-static void
+static gboolean
 cb_rstto_image_viewer_scroll_event (RsttoImageViewer *viewer, GdkEventScroll *event)
 {
     gdouble tmp_x, tmp_y;
     gdouble scale;
     GtkWidget *widget = GTK_WIDGET(viewer);
 
-    if ((event->state & (GDK_CONTROL_MASK)))
+    if (event->state & (GDK_CONTROL_MASK))
     {
             viewer->priv->auto_scale = FALSE;
             tmp_x = (gtk_adjustment_get_value(viewer->hadjustment) + event->x) / viewer->priv->scale;
@@ -1750,6 +1750,7 @@ cb_rstto_image_viewer_scroll_event (RsttoImageViewer *viewer, GdkEventScroll *ev
 
             rstto_image_viewer_queued_repaint (viewer, TRUE);
     }
+    return FALSE;
 }
 
 static gboolean 
diff --git a/src/main_window.c b/src/main_window.c
index c8e552d..fd33502 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -247,6 +247,10 @@ static gboolean
 cb_rstto_main_window_image_viewer_enter_notify_event (GtkWidget *widget,
                                                         GdkEventCrossing *event,
                                                         gpointer user_data);
+static gboolean
+cb_rstto_main_window_image_viewer_scroll_event (GtkWidget *widget,
+                                                GdkEventScroll *event,
+                                                gpointer user_data);
 
 static void
 rstto_main_window_update_buttons (RsttoMainWindow *window);
@@ -278,7 +282,7 @@ static GtkActionEntry action_entries[] =
   { "edit-menu", NULL, N_ ("_Edit"), NULL, },
   { "open-with-menu", NULL, N_ ("_Open with..."), NULL, },
   { "sorting-menu", NULL, N_ ("_Sorting"), NULL, },
-  { "delete", GTK_STOCK_DELETE, N_ ("_Delete"), "Delete", NULL, G_CALLBACK (cb_rstto_main_window_delete), },
+  { "delete", GTK_STOCK_DELETE, N_ ("_Delete"), "Delete", N_ ("Delete this image from disk"), G_CALLBACK (cb_rstto_main_window_delete), },
   { "clear-private-data", GTK_STOCK_PREFERENCES, N_ ("_Clear private data"), "<control><shift>Delete", NULL, G_CALLBACK(cb_rstto_main_window_clear_private_data), },
   { "preferences", GTK_STOCK_PREFERENCES, N_ ("_Preferences"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_preferences), },
 /* View Menu */
@@ -438,6 +442,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     gtk_accel_group_connect_by_path (accel_group, "<Window>/next-image", next_image_closure);
     gtk_accel_group_connect_by_path (accel_group, "<Window>/previous-image", previous_image_closure);
     gtk_accel_group_connect_by_path (accel_group, "<Window>/quit", quit_closure);
+
     /* Set default accelerators */
     gtk_accel_map_change_entry ("<Window>/unfullscreen", GDK_Escape, 0, FALSE);
     gtk_accel_map_change_entry ("<Window>/next-image", GDK_Page_Down, 0, FALSE);
@@ -660,6 +665,8 @@ rstto_main_window_init (RsttoMainWindow *window)
 
     g_signal_connect(G_OBJECT(window), "motion-notify-event", G_CALLBACK(cb_rstto_main_window_motion_notify_event), window);
     g_signal_connect(G_OBJECT(window->priv->image_viewer), "enter-notify-event", G_CALLBACK(cb_rstto_main_window_image_viewer_enter_notify_event), window);
+    g_signal_connect(G_OBJECT(window->priv->image_viewer), "scroll-event", G_CALLBACK(cb_rstto_main_window_image_viewer_scroll_event), window);
+
     g_signal_connect(G_OBJECT(window), "configure-event", G_CALLBACK(cb_rstto_main_window_configure_event), NULL);
     g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(cb_rstto_main_window_state_event), NULL);
     g_signal_connect(G_OBJECT(window->priv->image_list_toolbar), "button-press-event", G_CALLBACK(cb_rstto_main_window_navigationtoolbar_button_press_event), window);
@@ -1442,6 +1449,30 @@ cb_rstto_main_window_motion_notify_event (RsttoMainWindow *window,
 }
 
 static gboolean
+cb_rstto_main_window_image_viewer_scroll_event (GtkWidget *widget,
+                                                GdkEventScroll *event,
+                                                gpointer user_data)
+{
+    g_debug("%s", __FUNCTION__);
+    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
+    if (!(event->state & (GDK_CONTROL_MASK)))
+    {
+        switch(event->direction)
+        {
+            case GDK_SCROLL_UP:
+            case GDK_SCROLL_LEFT:
+                rstto_image_list_iter_previous (window->priv->iter);
+                break;
+            case GDK_SCROLL_DOWN:
+            case GDK_SCROLL_RIGHT:
+                rstto_image_list_iter_next (window->priv->iter);
+                break;
+        }
+    }
+    return FALSE;
+}
+
+static gboolean
 cb_rstto_main_window_image_viewer_enter_notify_event (GtkWidget *widget,
                                                       GdkEventCrossing *event,
                                                       gpointer user_data)


More information about the Xfce4-commits mailing list