SF.net SVN: geany: [2722] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Jun 24 12:26:06 UTC 2008


Revision: 2722
          http://geany.svn.sourceforge.net/geany/?rev=2722&view=rev
Author:   ntrel
Date:     2008-06-24 05:25:23 -0700 (Tue, 24 Jun 2008)

Log Message:
-----------
Make keyboard shortcuts dialog non-modal (#1999384).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keybindings.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-06-21 16:22:51 UTC (rev 2721)
+++ trunk/ChangeLog	2008-06-24 12:25:23 UTC (rev 2722)
@@ -1,3 +1,9 @@
+2008-06-24  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/keybindings.c:
+   Make keyboard shortcuts dialog non-modal (#1999384).
+
+
 2008-06-21  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/win32.c:

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2008-06-21 16:22:51 UTC (rev 2721)
+++ trunk/src/keybindings.c	2008-06-24 12:25:23 UTC (rev 2722)
@@ -673,12 +673,12 @@
 }
 
 
-void keybindings_show_shortcuts(void)
+static GtkWidget *create_dialog(void)
 {
 	GtkWidget *dialog, *hbox, *label1, *label2, *label3, *swin, *vbox;
 	GString *text_names;
 	GString *text_keys;
-	gint height, response;
+	gint height;
 
 	dialog = gtk_dialog_new_with_buttons(_("Keyboard Shortcuts"), GTK_WINDOW(main_widgets.window),
 				GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -720,9 +720,15 @@
 
 	gtk_box_pack_start(GTK_BOX(vbox), label3, FALSE, FALSE, 6);
 	gtk_box_pack_start(GTK_BOX(vbox), swin, TRUE, TRUE, 0);
+	return dialog;
+}
 
-	gtk_widget_show_all(dialog);
-	response = gtk_dialog_run(GTK_DIALOG(dialog));
+
+/* non-modal keyboard shortcuts dialog, so user can edit whilst seeing the shortcuts */
+static GtkWidget *key_dialog = NULL;
+
+static void on_dialog_response(GtkWidget *dialog, gint response, gpointer user_data)
+{
 	if (response == GTK_RESPONSE_APPLY)
 	{
 		GtkWidget *wid;
@@ -738,11 +744,22 @@
 				gtk_notebook_set_current_page(nb, gtk_notebook_page_num(nb, wid));
 		}
 	}
-
 	gtk_widget_destroy(dialog);
+	key_dialog = NULL;
 }
 
 
+void keybindings_show_shortcuts(void)
+{
+	if (key_dialog)
+		gtk_widget_destroy(key_dialog);	/* in case the key_dialog is still visible */
+
+	key_dialog = create_dialog();
+	g_signal_connect(key_dialog, "response", G_CALLBACK(on_dialog_response), NULL);
+	gtk_widget_show_all(key_dialog);
+}
+
+
 static gboolean check_fixed_kb(guint keyval, guint state)
 {
 	/* check alt-0 to alt-9 for setting current notebook page */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list