Kaydet (Commit) be5a3fe1 authored tarafından Enrico Tröger's avatar Enrico Tröger

Added dialog to show defined keyboard shortcuts, this replaces the previous link…

Added dialog to show defined keyboard shortcuts, this replaces the previous link to the documentation.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@411 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 94460208
2006-06-05 Enrico Troeger <enrico.troeger@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@uvena.de> 2006-06-04 Enrico Troeger <enrico.troeger@uvena.de>
* README, NEWS: updated for Geany 0.7 * README, NEWS: updated for Geany 0.7
* src/keybindings.c: changed default keybinding for menu_replace to * src/keybindings.c: Changed default keybinding for menu_replace to
Ctrl+E Ctrl+E.
* new release: Geany 0.7 "Ravik" * 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@uvena.de> 2006-06-03 Enrico Troeger <enrico.troeger@uvena.de>
......
...@@ -1933,22 +1933,7 @@ void ...@@ -1933,22 +1933,7 @@ void
on_help_shortcuts1_activate (GtkMenuItem *menuitem, on_help_shortcuts1_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
#ifdef GEANY_WIN32 dialogs_show_keyboard_shortcuts();
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);
} }
......
...@@ -1834,3 +1834,56 @@ gboolean dialogs_show_question(const gchar *text, ...) ...@@ -1834,3 +1834,56 @@ gboolean dialogs_show_question(const gchar *text, ...)
return ret; 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);
}
...@@ -79,4 +79,6 @@ void dialogs_show_prefs_dialog(void); ...@@ -79,4 +79,6 @@ void dialogs_show_prefs_dialog(void);
gboolean dialogs_show_question(const gchar *text, ...); gboolean dialogs_show_question(const gchar *text, ...);
void dialogs_show_keyboard_shortcuts(void);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment