summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Mikhaylenko <alexm@gnome.org>2020-04-03 06:56:06 +0500
committerAlexander Mikhaylenko <alexm@gnome.org>2020-04-03 09:53:36 +0500
commit7f8512a246d37d420e34e22c6141386ed7c945ab (patch)
tree39f407533d0a5c804dd84ce1eaec256d4cd3f0be /src
parent481c20e2da6f9092a662b82dfb1293b7eda62c4e (diff)
downloadgnome-screenshot-7f8512a246d37d420e34e22c6141386ed7c945ab.tar.gz
interactive-dialog: Use enum for screenshot modes
Diffstat (limited to 'src')
-rw-r--r--src/screenshot-interactive-dialog.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c
index 2276f7a..eca5a85 100644
--- a/src/screenshot-interactive-dialog.c
+++ b/src/screenshot-interactive-dialog.c
@@ -30,9 +30,11 @@
#include "screenshot-interactive-dialog.h"
#include "screenshot-utils.h"
-#define TARGET_TOGGLE_DESKTOP 0
-#define TARGET_TOGGLE_WINDOW 1
-#define TARGET_TOGGLE_AREA 2
+typedef enum {
+ SCREENSHOT_MODE_SCREEN,
+ SCREENSHOT_MODE_WINDOW,
+ SCREENSHOT_MODE_SELECTION,
+} ScreenshotMode;
struct _ScreenshotInteractiveDialog
{
@@ -57,10 +59,10 @@ G_DEFINE_TYPE (ScreenshotInteractiveDialog, screenshot_interactive_dialog, GTK_T
static void
set_mode (ScreenshotInteractiveDialog *self,
- gint mode)
+ ScreenshotMode mode)
{
- gboolean take_window_shot = (mode == TARGET_TOGGLE_WINDOW);
- gboolean take_area_shot = (mode == TARGET_TOGGLE_AREA);
+ gboolean take_window_shot = (mode == SCREENSHOT_MODE_WINDOW);
+ gboolean take_area_shot = (mode == SCREENSHOT_MODE_SELECTION);
gtk_widget_set_sensitive (self->pointer_row, !take_area_shot);
@@ -73,7 +75,7 @@ screen_toggled_cb (GtkToggleButton *button,
ScreenshotInteractiveDialog *self)
{
if (gtk_toggle_button_get_active (button))
- set_mode (self, TARGET_TOGGLE_DESKTOP);
+ set_mode (self, SCREENSHOT_MODE_SCREEN);
}
static void
@@ -81,7 +83,7 @@ window_toggled_cb (GtkToggleButton *button,
ScreenshotInteractiveDialog *self)
{
if (gtk_toggle_button_get_active (button))
- set_mode (self, TARGET_TOGGLE_WINDOW);
+ set_mode (self, SCREENSHOT_MODE_WINDOW);
}
static void
@@ -89,7 +91,7 @@ selection_toggled_cb (GtkToggleButton *button,
ScreenshotInteractiveDialog *self)
{
if (gtk_toggle_button_get_active (button))
- set_mode (self, TARGET_TOGGLE_AREA);
+ set_mode (self, SCREENSHOT_MODE_SELECTION);
}
static void