[gnome-screenshot] screenshot: don't warn when aborting interactive selection with Esc
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screenshot] screenshot: don't warn when aborting interactive selection with Esc
- Date: Tue, 25 Oct 2011 14:02:37 +0000 (UTC)
commit aa78e8ae33133d6d380d53e8f09ff850df6e58ba
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Oct 25 10:00:33 2011 -0400
screenshot: don't warn when aborting interactive selection with Esc
When the user explicitly closes the interactive selection area with Esc,
don't emit a warning or a GtkDialog, but just quit.
src/gnome-screenshot.c | 6 +++++-
src/screenshot-area-selection.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-screenshot.c b/src/gnome-screenshot.c
index 3c24c01..4d69d19 100644
--- a/src/gnome-screenshot.c
+++ b/src/gnome-screenshot.c
@@ -525,7 +525,11 @@ finish_prepare_screenshot (GdkRectangle *rectangle)
static void
rectangle_found_cb (GdkRectangle *rectangle)
{
- finish_prepare_screenshot (rectangle);
+ if (rectangle != NULL)
+ finish_prepare_screenshot (rectangle);
+ else
+ /* just quit here; user dismissed the rectangle with Esc */
+ gtk_main_quit ();
}
static gboolean
diff --git a/src/screenshot-area-selection.c b/src/screenshot-area-selection.c
index c9f5acc..9179815 100644
--- a/src/screenshot-area-selection.c
+++ b/src/screenshot-area-selection.c
@@ -27,6 +27,8 @@ typedef struct {
GdkRectangle rect;
gboolean button_pressed;
GtkWidget *window;
+
+ gboolean aborted;
} select_area_filter_data;
static gboolean
@@ -130,6 +132,8 @@ select_area_key_press (GtkWidget *window,
data->rect.y = 0;
data->rect.width = 0;
data->rect.height = 0;
+ data->aborted = TRUE;
+
gtk_main_quit ();
}
@@ -201,6 +205,7 @@ create_select_window (void)
typedef struct {
GdkRectangle rectangle;
SelectAreaCallback callback;
+ gboolean aborted;
} CallbackData;
static gboolean
@@ -208,7 +213,10 @@ emit_select_callback_in_idle (gpointer user_data)
{
CallbackData *data = user_data;
- data->callback (&data->rectangle);
+ if (!data->aborted)
+ data->callback (&data->rectangle);
+ else
+ data->callback (NULL);
g_slice_free (CallbackData, data);
@@ -230,6 +238,7 @@ screenshot_select_area_async (SelectAreaCallback callback)
data.rect.width = 0;
data.rect.height = 0;
data.button_pressed = FALSE;
+ data.aborted = FALSE;
data.window = create_select_window();
cb_data = g_slice_new0 (CallbackData);
@@ -281,6 +290,7 @@ screenshot_select_area_async (SelectAreaCallback callback)
gdk_flush ();
out:
+ cb_data->aborted = data.aborted;
cb_data->rectangle = data.rect;
/* FIXME: we should actually be emitting the callback When
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]