SF.net SVN: geany: [411] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Jun 5 15:12:48 UTC 2006


Revision: 411
Author:   eht16
Date:     2006-06-05 08:12:40 -0700 (Mon, 05 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=411&view=rev

Log Message:
-----------
Added dialog to show defined keyboard shortcuts, this replaces the previous link to the documentation.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/dialogs.c
    trunk/src/dialogs.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-05 15:10:40 UTC (rev 410)
+++ trunk/ChangeLog	2006-06-05 15:12:40 UTC (rev 411)
@@ -1,10 +1,19 @@
+2006-06-05  Enrico Troeger  <enrico.troeger at uvena.de>
+
+ * src/dialog.c, src/callbacks.c: Added dialog to show defined keyboard
+                                  shortcuts, this replaces the previous
+                                  link to the documentation.
+ * src/main.c, src/document.c: Fixed wrong setting of filetype when
+                               using "All files" as filetype.
+
+
 2006-06-04  Enrico Troeger  <enrico.troeger at uvena.de>
 
  * README, NEWS: updated for Geany 0.7
- * src/keybindings.c: changed default keybinding for menu_replace to
-                      Ctrl+E
+ * src/keybindings.c: Changed default keybinding for menu_replace to
+                      Ctrl+E.
  * new release: Geany 0.7 "Ravik"
- * configure.in: fixed svn detection code, changed version to 0.8
+ * configure.in: Fixed svn detection code, changed version to 0.8.
 
 
 2006-06-03  Enrico Troeger  <enrico.troeger at uvena.de>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-06-05 15:10:40 UTC (rev 410)
+++ trunk/src/callbacks.c	2006-06-05 15:12:40 UTC (rev 411)
@@ -1933,22 +1933,7 @@
 on_help_shortcuts1_activate            (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-#ifdef GEANY_WIN32
-	gchar *pwd = g_get_current_dir();
-	gchar *uri = g_strconcat("file:///", g_path_skip_root(pwd), "/doc/apa.html", NULL);
-	g_free(pwd);
-#else
-	gchar *uri = g_strconcat("file://", DOCDIR, "apa.html", NULL);
-#endif
-
-	if (! g_file_test(uri + 7, G_FILE_TEST_IS_REGULAR))
-	{
-		g_free(uri);
-		uri = g_strconcat(GEANY_HOMEPAGE, "manual/apa.html", NULL);
-	}
-
-	utils_start_browser(uri);
-	g_free(uri);
+	dialogs_show_keyboard_shortcuts();
 }
 
 

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2006-06-05 15:10:40 UTC (rev 410)
+++ trunk/src/dialogs.c	2006-06-05 15:12:40 UTC (rev 411)
@@ -1834,3 +1834,56 @@
 	return ret;
 }
 
+
+void dialogs_show_keyboard_shortcuts(void)
+{
+	GtkWidget *dialog, *hbox, *label1, *label2, *label3;
+	GString *text_names = g_string_sized_new(600);
+	GString *text_keys = g_string_sized_new(600);
+	gchar *shortcut;
+	guint i;
+
+	dialog = gtk_dialog_new_with_buttons(_("Keyboard shortcuts"), GTK_WINDOW(app->window),
+						GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+
+	gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
+
+	label3 = gtk_label_new(_("The following keyboard shortcuts are defined:"));
+	gtk_misc_set_padding(GTK_MISC(label3), 0, 6);
+	gtk_misc_set_alignment(GTK_MISC(label3), 0, 0);
+
+	hbox = gtk_hbox_new(FALSE, 5);
+
+	label1 = gtk_label_new(NULL);
+	gtk_misc_set_padding(GTK_MISC(label1), 15, 0);
+
+	label2 = gtk_label_new(NULL);
+	gtk_misc_set_padding(GTK_MISC(label2), 15, 0);
+
+	for (i = 0; i < GEANY_MAX_KEYS; i++)
+	{
+		shortcut = gtk_accelerator_get_label(keys[i]->key, keys[i]->mods);
+		g_string_append(text_names, keys[i]->name);
+		g_string_append(text_names, "\n");
+		g_string_append(text_keys, shortcut);
+		g_string_append(text_keys, "\n");
+		g_free(shortcut);
+	}
+
+	gtk_label_set_text(GTK_LABEL(label1), text_names->str);
+	gtk_label_set_text(GTK_LABEL(label2), text_keys->str);
+
+	gtk_container_add(GTK_CONTAINER(hbox), label1);
+	gtk_container_add(GTK_CONTAINER(hbox), label2);
+
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label3);
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
+
+	g_signal_connect((gpointer) dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
+
+	gtk_widget_show_all(dialog);
+
+	g_string_free(text_names, TRUE);
+	g_string_free(text_keys, TRUE);
+}
+

Modified: trunk/src/dialogs.h
===================================================================
--- trunk/src/dialogs.h	2006-06-05 15:10:40 UTC (rev 410)
+++ trunk/src/dialogs.h	2006-06-05 15:12:40 UTC (rev 411)
@@ -79,4 +79,6 @@
 
 gboolean dialogs_show_question(const gchar *text, ...);
 
+void dialogs_show_keyboard_shortcuts(void);
+
 #endif


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