From 0e25f2b3d4b2ce21a587703a08043d2b98a31d4d Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Fri, 27 Jun 2014 20:46:56 +0200 Subject: shellexecui: disallow multiple shellexecui dialogs --- plugins/shellexecui/callbacks.c | 1 - plugins/shellexecui/callbacks.h | 4 ++++ plugins/shellexecui/interface.c | 4 ++++ plugins/shellexecui/shellexec.glade | 3 ++- plugins/shellexecui/shellexecui.c | 11 +++++++++++ 5 files changed, 21 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/shellexecui/callbacks.c b/plugins/shellexecui/callbacks.c index b8fb56d3..019fde92 100644 --- a/plugins/shellexecui/callbacks.c +++ b/plugins/shellexecui/callbacks.c @@ -8,4 +8,3 @@ #include "interface.h" #include "support.h" - diff --git a/plugins/shellexecui/callbacks.h b/plugins/shellexecui/callbacks.h index c4b57687..4b1f2037 100644 --- a/plugins/shellexecui/callbacks.h +++ b/plugins/shellexecui/callbacks.h @@ -28,3 +28,7 @@ on_edit_cancel_button_clicked (GtkButton *button, void on_edit_ok_button_clicked (GtkButton *button, gpointer user_data); + +void +on_shellexec_conf_dialog_destroy (GObject *object, + gpointer user_data); diff --git a/plugins/shellexecui/interface.c b/plugins/shellexecui/interface.c index d00c0fc7..6296617b 100644 --- a/plugins/shellexecui/interface.c +++ b/plugins/shellexecui/interface.c @@ -44,6 +44,7 @@ create_shellexec_conf_dialog (void) shellexec_conf_dialog = gtk_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (shellexec_conf_dialog), 12); gtk_window_set_title (GTK_WINDOW (shellexec_conf_dialog), _("Custom Shell Commands")); + gtk_window_set_destroy_with_parent (GTK_WINDOW (shellexec_conf_dialog), TRUE); gtk_window_set_type_hint (GTK_WINDOW (shellexec_conf_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (shellexec_conf_dialog), FALSE); @@ -89,6 +90,9 @@ create_shellexec_conf_dialog (void) gtk_dialog_add_action_widget (GTK_DIALOG (shellexec_conf_dialog), save_button, 0); gtk_widget_set_can_default(save_button, TRUE); + g_signal_connect ((gpointer) shellexec_conf_dialog, "destroy", + G_CALLBACK (on_shellexec_conf_dialog_destroy), + NULL); g_signal_connect ((gpointer) add_button, "clicked", G_CALLBACK (on_add_button_clicked), NULL); diff --git a/plugins/shellexecui/shellexec.glade b/plugins/shellexecui/shellexec.glade index aea894ae..aa872167 100644 --- a/plugins/shellexecui/shellexec.glade +++ b/plugins/shellexecui/shellexec.glade @@ -11,7 +11,7 @@ GTK_WIN_POS_NONE False True - False + True True False False @@ -20,6 +20,7 @@ True False False + diff --git a/plugins/shellexecui/shellexecui.c b/plugins/shellexecui/shellexecui.c index 482cec2b..6b6744dd 100644 --- a/plugins/shellexecui/shellexecui.c +++ b/plugins/shellexecui/shellexecui.c @@ -345,9 +345,20 @@ init_treeview() { g_object_unref(liststore); } +void +on_shellexec_conf_dialog_destroy (GObject *object, + gpointer user_data) +{ + conf_dlg = NULL; +} + + static gboolean shellexecui_action_gtk (void *data) { + if (conf_dlg) { + return FALSE; + } conf_dlg = create_shellexec_conf_dialog(); gtk_widget_set_size_request (conf_dlg, 400, 400); gtk_window_set_transient_for(GTK_WINDOW(conf_dlg), -- cgit v1.2.3