Show the full filename of a document as tooltip on the tab labels.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3248 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-11-18 20:13:29 +00:00
parent 5f6790f38e
commit ac52e42417
4 changed files with 26 additions and 8 deletions

View File

@ -6,6 +6,8 @@
* doc/geany.txt, doc/geany.html: * doc/geany.txt, doc/geany.html:
Fix some typos. Fix some typos.
Add note about the encoding box in the Find in Files dialog. Add note about the encoding box in the Find in Files dialog.
* src/document.c, src/document.h, src/notebook.c:
Show the full filename of a document as tooltip on the tab labels.
2008-11-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2008-11-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -275,6 +275,24 @@ void document_finalize()
} }
void document_update_tab_label(GeanyDocument *doc)
{
gchar *base_name = g_path_get_basename(doc->file_name);
GtkWidget *parent = gtk_widget_get_parent(doc->priv->tab_label);
static GtkTooltips *tooltips = NULL;
if (tooltips == NULL)
tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
gtk_label_set_text(GTK_LABEL(doc->priv->tab_label), base_name);
gtk_label_set_text(GTK_LABEL(doc->priv->tabmenu_label), base_name);
gtk_tooltips_set_tip(tooltips, parent, doc->file_name, NULL);
g_free(base_name);
}
/** /**
* Update the tab labels, the status bar, the window title and some save-sensitive buttons * Update the tab labels, the status bar, the window title and some save-sensitive buttons
* according to the document's save state. * according to the document's save state.
@ -1538,8 +1556,6 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
/* ignore the following things if we are quitting */ /* ignore the following things if we are quitting */
if (! main_status.quitting) if (! main_status.quitting)
{ {
gchar *base_name = g_path_get_basename(doc->file_name);
sci_set_savepoint(doc->editor->sci); sci_set_savepoint(doc->editor->sci);
/* stat the file to get the timestamp, otherwise on Windows the actual /* stat the file to get the timestamp, otherwise on Windows the actual
@ -1551,12 +1567,10 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE); tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
gtk_label_set_text(GTK_LABEL(doc->priv->tab_label), base_name); document_update_tab_label(doc);
gtk_label_set_text(GTK_LABEL(doc->priv->tabmenu_label), base_name);
msgwin_status_add(_("File %s saved."), doc->file_name); msgwin_status_add(_("File %s saved."), doc->file_name);
ui_update_statusbar(doc, -1); ui_update_statusbar(doc, -1);
g_free(base_name);
#ifdef HAVE_VTE #ifdef HAVE_VTE
vte_cwd(doc->file_name, FALSE); vte_cwd(doc->file_name, FALSE);
#endif #endif

View File

@ -224,6 +224,7 @@ void document_redo(GeanyDocument *doc);
void document_undo_add(GeanyDocument *doc, guint type, gpointer data); void document_undo_add(GeanyDocument *doc, guint type, gpointer data);
void document_update_tab_label(GeanyDocument *doc);
GdkColor *document_get_status_color(GeanyDocument *doc); GdkColor *document_get_status_color(GeanyDocument *doc);

View File

@ -450,7 +450,7 @@ gint notebook_new_tab(GeanyDocument *this)
page = GTK_WIDGET(this->editor->sci); page = GTK_WIDGET(this->editor->sci);
title = g_path_get_basename(DOC_FILENAME(this)); title = g_path_get_basename(DOC_FILENAME(this));
this->priv->tab_label = gtk_label_new(title); this->priv->tab_label = gtk_label_new(NULL);
ebox = gtk_event_box_new(); ebox = gtk_event_box_new();
GTK_WIDGET_SET_FLAGS(ebox, GTK_NO_WINDOW); GTK_WIDGET_SET_FLAGS(ebox, GTK_NO_WINDOW);
@ -464,7 +464,6 @@ gint notebook_new_tab(GeanyDocument *this)
{ {
GtkWidget *image, *btn, *align; GtkWidget *image, *btn, *align;
GtkRcStyle *rcstyle; GtkRcStyle *rcstyle;
GtkRequisition size;
btn = gtk_button_new(); btn = gtk_button_new();
gtk_button_set_relief(GTK_BUTTON(btn), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(btn), GTK_RELIEF_NONE);
@ -491,9 +490,11 @@ gint notebook_new_tab(GeanyDocument *this)
gtk_widget_show_all(hbox); gtk_widget_show_all(hbox);
this->priv->tabmenu_label = gtk_label_new(title); this->priv->tabmenu_label = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(this->priv->tabmenu_label), 0.0, 0); gtk_misc_set_alignment(GTK_MISC(this->priv->tabmenu_label), 0.0, 0);
document_update_tab_label(this);
if (file_prefs.tab_order_ltr) if (file_prefs.tab_order_ltr)
tabnum = gtk_notebook_append_page_menu(GTK_NOTEBOOK(main_widgets.notebook), page, tabnum = gtk_notebook_append_page_menu(GTK_NOTEBOOK(main_widgets.notebook), page,
hbox, this->priv->tabmenu_label); hbox, this->priv->tabmenu_label);