[geany/geany] f6be8b: Make the tab switching dialog a bit more useful
Jiří Techet
git-noreply at xxxxx
Thu Jul 26 00:02:22 UTC 2012
Branch: refs/heads/document-messages
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sat, 24 Dec 2011 11:30:01
Commit: f6be8b47d76facd50266d1c59100cfec96c282d2
https://github.com/geany/geany/commit/f6be8b47d76facd50266d1c59100cfec96c282d2
Log Message:
-----------
Make the tab switching dialog a bit more useful
Right now the tab switching dialog shows the full
path of the current file. However this dialog is too
narrow and in my case usually displays one directory
per line. This makes it hard to find the base
filename, which is the thing you are most probably
looking for.
This patch displays only the base name - in bold. In
addition, it displays the following three filenames
in the MRU list, each on a new line (not in bold).
This helps to see what file comes next and how many
times one has to press ctrl+tab.
Modified Paths:
--------------
src/keybindings.c
Modified: src/keybindings.c
33 files changed, 30 insertions(+), 3 deletions(-)
===================================================================
@@ -1803,7 +1803,7 @@ static GtkWidget *create_switch_dialog(void)
dialog = ui_minimal_dialog_new(GTK_WINDOW(main_widgets.window), _("Switch to Document"));
gtk_window_set_decorated(GTK_WINDOW(dialog), FALSE);
- gtk_window_set_default_size(GTK_WINDOW(dialog), 150, -1);
+ gtk_window_set_default_size(GTK_WINDOW(dialog), 200, -1);
vbox = gtk_vbox_new(FALSE, 6);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
@@ -1812,7 +1812,7 @@ static GtkWidget *create_switch_dialog(void)
widget = gtk_image_new_from_stock(GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON);
gtk_container_add(GTK_CONTAINER(vbox), widget);
- widget = geany_wrap_label_new(NULL);
+ widget = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(widget), GTK_JUSTIFY_CENTER);
gtk_container_add(GTK_CONTAINER(vbox), widget);
switch_dialog_label = widget;
@@ -1824,13 +1824,40 @@ static GtkWidget *create_switch_dialog(void)
static void update_filename_label(void)
{
+ guint i;
+ gchar *msg;
+ guint queue_length;
+ GeanyDocument *doc;
+
if (!switch_dialog)
{
switch_dialog = create_switch_dialog();
gtk_widget_show_all(switch_dialog);
}
- gtk_label_set_text(GTK_LABEL(switch_dialog_label), DOC_FILENAME(document_get_current()));
+ queue_length = g_queue_get_length(mru_docs);
+ for (i = mru_pos; (i <= mru_pos + 3) && (doc = g_queue_peek_nth(mru_docs, i % queue_length)); i++)
+ {
+ gchar *basename;
+
+ basename = g_path_get_basename(DOC_FILENAME(doc));
+ if (i == mru_pos)
+ msg = g_markup_printf_escaped ("<b>%s</b>", basename);
+ else if (i % queue_length == mru_pos) /* && i != mru_pos */
+ {
+ /* We have wrapped around and got to the starting document again */
+ g_free(basename);
+ break;
+ }
+ else
+ {
+ setptr(basename, g_markup_printf_escaped ("\n%s", basename));
+ setptr(msg, g_strconcat(msg, basename, NULL));
+ }
+ g_free(basename);
+ }
+ gtk_label_set_markup(GTK_LABEL(switch_dialog_label), msg);
+ g_free(msg);
}
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list