[gthumb/ext] added other keybindings



commit 10312f631a13355b4032d72d1e8abd45e5dc8988
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Sep 5 19:15:33 2009 +0200

    added other keybindings
    
    allow to exit from fullscreen using the 'f' key
    allow to rotate images with '[' and ']'

 extensions/image_rotation/callbacks.c           |   35 +++++++++++++++++++++++
 extensions/image_viewer/gth-image-viewer-page.c |    4 ++
 gthumb/gth-browser.c                            |   25 ----------------
 3 files changed, 39 insertions(+), 25 deletions(-)
---
diff --git a/extensions/image_rotation/callbacks.c b/extensions/image_rotation/callbacks.c
index b45e441..3c71a0a 100644
--- a/extensions/image_rotation/callbacks.c
+++ b/extensions/image_rotation/callbacks.c
@@ -24,6 +24,7 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include <glib-object.h>
+#include <gdk/gdkkeysyms.h>
 #include <gthumb.h>
 #include "actions.h"
 
@@ -66,6 +67,35 @@ browser_data_free (BrowserData *data)
 }
 
 
+static gboolean
+gth_file_list_key_press_cb (GtkWidget   *widget,
+			    GdkEventKey *event,
+			    gpointer     user_data)
+{
+	GthBrowser *browser = user_data;
+	gboolean    result = FALSE;
+
+	if (! (event->state & GDK_CONTROL_MASK) && ! (event->state & GDK_MOD1_MASK)) {
+		switch (gdk_keyval_to_lower (event->keyval)) {
+		case GDK_bracketright:
+			gth_browser_activate_action_tool_rotate_right (NULL, browser);
+			result = TRUE;
+			break;
+
+		case GDK_bracketleft:
+			gth_browser_activate_action_tool_rotate_left (NULL, browser);
+			result = TRUE;
+			break;
+
+		default:
+			break;
+		}
+        }
+
+	return result;
+}
+
+
 void
 ir__gth_browser_construct_cb (GthBrowser *browser)
 {
@@ -88,6 +118,11 @@ ir__gth_browser_construct_cb (GthBrowser *browser)
 		g_clear_error (&error);
 	}
 
+	g_signal_connect (gth_browser_get_file_list (browser),
+			  "key_press_event",
+			  G_CALLBACK (gth_file_list_key_press_cb),
+			  browser);
+
 	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
 }
 
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 550037f..412399e 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -262,6 +262,10 @@ viewer_key_press_cb (GtkWidget          *widget,
 	case GDK_End:
 		gth_browser_show_last_image (self->priv->browser, TRUE, FALSE);
 		return TRUE;
+
+	case GDK_f:
+		gth_browser_fullscreen (self->priv->browser);
+		break;
 	}
 
 	return gth_hook_invoke_get ("gth-browser-file-list-key-press", self->priv->browser, event) != NULL;
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index e55d670..4edade3 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2763,31 +2763,6 @@ gth_file_list_key_press_cb (GtkWidget   *widget,
 			result = TRUE;
 			break;
 
-		/* FIXME: add these to the image viewer
-		case GDK_b:
-		case GDK_BackSpace:
-			gth_browser_show_prev_image (browser, FALSE, FALSE);
-			result = TRUE;
-			break;
-
-		case GDK_n:
-			gth_browser_show_next_image (browser, FALSE, FALSE);
-			result = TRUE;
-			break;
-		*/
-
-		/* FIXME: add these to the rotate extension
-		case GDK_bracketright:
-			gth_window_activate_action_tools_jpeg_rotate_right (NULL, window);
-			result = TRUE;
-			break;
-
-		case GDK_bracketleft:
-			gth_window_activate_action_tools_jpeg_rotate_left (NULL, window);
-			result = TRUE;
-			break;
-		*/
-
 		default:
 			break;
 		}



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