diff options
author | David Robillard <d@drobilla.net> | 2011-08-22 17:06:11 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-08-22 17:06:11 +0000 |
commit | 4ec145604cee4e2a3d445564d2204f8243283eab (patch) | |
tree | 4d6194492607c95950d392f1991bf588d1d98aaf /src | |
parent | 941d72fb5ed6aa0a8e3843e306b537b9ccbcc6a4 (diff) | |
download | jalv-4ec145604cee4e2a3d445564d2204f8243283eab.tar.gz jalv-4ec145604cee4e2a3d445564d2204f8243283eab.tar.bz2 jalv-4ec145604cee4e2a3d445564d2204f8243283eab.zip |
Shut down cleanly both on window destroy and File->Quit.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3446 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv_gtk2.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/jalv_gtk2.c b/src/jalv_gtk2.c index 9ddc705..6e4e9cd 100644 --- a/src/jalv_gtk2.c +++ b/src/jalv_gtk2.c @@ -18,8 +18,9 @@ #include "jalv_internal.h" -static void destroy(GtkWidget* widget, - gpointer data) +static void +on_window_destroy(GtkWidget* widget, + gpointer data) { gtk_main_quit(); } @@ -54,7 +55,7 @@ jalv_native_ui_type(Jalv* jalv) } static void -on_save(GtkWidget* widget, void* ptr) +on_save_activate(GtkWidget* widget, void* ptr) { Jalv* jalv = (Jalv*)ptr; GtkWidget* dialog = gtk_file_chooser_dialog_new( @@ -77,6 +78,15 @@ on_save(GtkWidget* widget, void* ptr) gtk_widget_destroy(dialog); } +static void +on_quit_activate(GtkWidget* widget, + gpointer data) +{ + GtkWidget* window = (GtkWidget*)data; + gtk_widget_destroy(window); +} + + int jalv_open_ui(Jalv* jalv, SuilInstance* instance) @@ -84,7 +94,7 @@ jalv_open_ui(Jalv* jalv, GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", - G_CALLBACK(destroy), NULL); + G_CALLBACK(on_window_destroy), NULL); gtk_window_set_title(GTK_WINDOW(window), lilv_node_as_string(lilv_plugin_get_name(jalv->plugin))); @@ -106,10 +116,10 @@ jalv_open_ui(Jalv* jalv, gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(quit), "activate", - G_CALLBACK(gtk_main_quit), NULL); + G_CALLBACK(on_quit_activate), window); g_signal_connect(G_OBJECT(save), "activate", - G_CALLBACK(on_save), jalv); + G_CALLBACK(on_save_activate), jalv); GtkWidget* alignment = gtk_alignment_new(0.5, 0.5, 1.0, 1.0); gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0); |