[Xfce4-commits] <ristretto:ristretto-0.0> cleanup some code

Stephan Arts noreply at xfce.org
Sun Oct 23 19:14:18 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to 64c12a35e6f7465c3b5e4a31c18d8526019c81a7 (commit)
       from 148698070231eb6527c8e08cec68e0de5b432eea (commit)

commit 64c12a35e6f7465c3b5e4a31c18d8526019c81a7
Author: Stephan Arts <stephan at xfce.org>
Date:   Fri Mar 13 21:19:31 2009 +0100

    cleanup some code

 src/picture_viewer.c |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/picture_viewer.c b/src/picture_viewer.c
index ec42a81..8f51294 100644
--- a/src/picture_viewer.c
+++ b/src/picture_viewer.c
@@ -101,6 +101,8 @@ static RsttoPictureViewerState
 rstto_picture_viewer_get_state (RsttoPictureViewer *viewer);
 static void
 rstto_picture_viewer_set_motion_state (RsttoPictureViewer *viewer, RsttoPictureViewerMotionState state);
+static RsttoPictureViewerMotionState
+rstto_picture_viewer_get_motion_state (RsttoPictureViewer *viewer);
 
 static void
 rstto_picture_viewer_set_zoom_mode (RsttoPictureViewer *viewer, RsttoZoomMode mode);
@@ -190,10 +192,8 @@ rstto_picture_viewer_init(RsttoPictureViewer *viewer)
     g_signal_connect(G_OBJECT(viewer), "motion_notify_event", G_CALLBACK(cb_rstto_picture_viewer_motion_notify_event), NULL);
     g_signal_connect(G_OBJECT(viewer), "popup-menu", G_CALLBACK(cb_rstto_picture_viewer_popup_menu), NULL);
 
-    /*
     gtk_drag_dest_set(GTK_WIDGET(viewer), 0, drop_targets, G_N_ELEMENTS(drop_targets),
                       GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE | GDK_ACTION_PRIVATE);
-    */
 }
 
 /**
@@ -360,7 +360,6 @@ rstto_picture_viewer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
      * TODO: Check if we really nead a refresh
      */
     rstto_picture_viewer_queued_repaint (viewer, FALSE);
-    //rstto_picture_viewer_paint (viewer);
 }
 
 /**
@@ -377,7 +376,6 @@ rstto_picture_viewer_expose(GtkWidget *widget, GdkEventExpose *event)
     /** 
      * TODO: Check if we really nead a refresh
      */
-    //rstto_picture_viewer_paint (viewer);
     rstto_picture_viewer_queued_repaint (viewer, TRUE);
     return FALSE;
 }
@@ -1030,6 +1028,7 @@ rstto_picture_viewer_get_state (RsttoPictureViewer *viewer)
     return viewer->priv->state;
 }
 
+
 static void
 rstto_picture_viewer_set_state (RsttoPictureViewer *viewer, RsttoPictureViewerState state)
 {
@@ -1042,6 +1041,12 @@ rstto_picture_viewer_set_motion_state (RsttoPictureViewer *viewer, RsttoPictureV
     viewer->priv->motion.state = state;
 }
 
+static RsttoPictureViewerMotionState
+rstto_picture_viewer_get_motion_state (RsttoPictureViewer *viewer)
+{
+    return viewer->priv->motion.state;
+}
+
 static void
 cb_rstto_picture_viewer_button_press_event (RsttoPictureViewer *viewer, GdkEventButton *event)
 {
@@ -1100,11 +1105,26 @@ static void
 cb_rstto_picture_viewer_button_release_event (RsttoPictureViewer *viewer, GdkEventButton *event)
 {
     GtkWidget *widget = GTK_WIDGET(viewer);
+    switch (event->button)
+    {
+        case 1:
+            switch (rstto_picture_viewer_get_motion_state (viewer))
+            {
+                case RSTTO_PICTURE_VIEWER_MOTION_STATE_BOX_ZOOM:
+                    rstto_picture_viewer_set_zoom_mode (viewer, RSTTO_ZOOM_MODE_CUSTOM);
+                    if(GTK_WIDGET_REALIZED(widget))
+                    {
 
-    gdk_window_set_cursor(widget->window, NULL);
+                    }
+                    break;
+                default:
+                    break;
+            }
+            rstto_picture_viewer_set_motion_state (viewer, RSTTO_PICTURE_VIEWER_MOTION_STATE_NORMAL);
+            rstto_picture_viewer_queued_repaint (viewer, FALSE);
+            break;
+    }
 
-    rstto_picture_viewer_set_motion_state (viewer, RSTTO_PICTURE_VIEWER_MOTION_STATE_NORMAL);
-    rstto_picture_viewer_queued_repaint (viewer, FALSE);
 }
 
 static void


More information about the Xfce4-commits mailing list