aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-07 11:14:41 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-07 11:42:46 -0300
commitb43e75b95bbcda5cb854d29b09d8a0997efa4f04 (patch)
tree6f615d57411559e35406a29ccff2dfeca1f3e99e
parent20e0a0798936233e7b82b2dfc68f899a70be41f6 (diff)
callbacks: prevent destroying the preferences widget
The preferences widget's logic is to hide/unride. Intercept the destroy signal, in order to prevent it to be distroyed if one clicks at the (X) button of the widget. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--src/callbacks.c7
-rw-r--r--src/callbacks.h2
-rw-r--r--src/camorama-window.c3
3 files changed, 12 insertions, 0 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 501ea2e..1e81fba 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -340,6 +340,13 @@ void prefs_func(GtkWidget *okbutton, cam_t *cam)
gtk_widget_hide(prefswindow);
}
+gboolean delete_event_prefs_window(GtkWidget *widget, GdkEvent *event,
+ cam_t *cam)
+{
+ prefs_func(widget, cam);
+ return TRUE;
+}
+
void on_quit_activate(GtkMenuItem *menuitem, cam_t *cam)
{
#if GTK_MAJOR_VERSION >= 3
diff --git a/src/callbacks.h b/src/callbacks.h
index a768f7f..1b55606 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -42,6 +42,8 @@ void on_about_activate(GtkMenuItem *menuitem, cam_t *cam);
void on_show_adjustments_activate(GtkToggleButton *button, cam_t *);
void on_show_effects_activate(GtkMenuItem *menuitem, cam_t *);
void prefs_func(GtkWidget *, cam_t *);
+gboolean delete_event_prefs_window(GtkWidget *widget, GdkEvent *event,
+ cam_t *cam);
void capture_func2(GtkWidget *, cam_t *);
void capture_func(GtkWidget *, cam_t *);
gint timeout_capture_func(cam_t *);
diff --git a/src/camorama-window.c b/src/camorama-window.c
index 3108660..862f869 100644
--- a/src/camorama-window.c
+++ b/src/camorama-window.c
@@ -254,6 +254,9 @@ void load_interface(cam_t *cam)
gtk_window_set_icon(GTK_WINDOW(window), logo);
gtk_window_set_icon(GTK_WINDOW(prefswindow), logo);
+ g_signal_connect(G_OBJECT(prefswindow), "delete-event",
+ G_CALLBACK(delete_event_prefs_window), cam);
+
g_signal_connect(gtk_builder_get_object(cam->xml, "show_effects"),
"activate", G_CALLBACK(on_show_effects_activate),
cam);

Privacy Policy