SF.net SVN: geany:[3248] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Nov 18 20:13:29 UTC 2008


Revision: 3248
          http://geany.svn.sourceforge.net/geany/?rev=3248&view=rev
Author:   eht16
Date:     2008-11-18 20:13:29 +0000 (Tue, 18 Nov 2008)

Log Message:
-----------
Show the full filename of a document as tooltip on the tab labels.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/notebook.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-18 17:46:24 UTC (rev 3247)
+++ trunk/ChangeLog	2008-11-18 20:13:29 UTC (rev 3248)
@@ -6,6 +6,8 @@
  * doc/geany.txt, doc/geany.html:
    Fix some typos.
    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>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2008-11-18 17:46:24 UTC (rev 3247)
+++ trunk/src/document.c	2008-11-18 20:13:29 UTC (rev 3248)
@@ -275,6 +275,24 @@
 }
 
 
+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
  *  according to the document's save state.
@@ -1538,8 +1556,6 @@
 	/* ignore the following things if we are quitting */
 	if (! main_status.quitting)
 	{
-		gchar *base_name = g_path_get_basename(doc->file_name);
-
 		sci_set_savepoint(doc->editor->sci);
 
 		/* stat the file to get the timestamp, otherwise on Windows the actual
@@ -1551,12 +1567,10 @@
 
 		tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
 
-		gtk_label_set_text(GTK_LABEL(doc->priv->tab_label), base_name);
-		gtk_label_set_text(GTK_LABEL(doc->priv->tabmenu_label), base_name);
+		document_update_tab_label(doc);
 
 		msgwin_status_add(_("File %s saved."), doc->file_name);
 		ui_update_statusbar(doc, -1);
-		g_free(base_name);
 #ifdef HAVE_VTE
 		vte_cwd(doc->file_name, FALSE);
 #endif

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2008-11-18 17:46:24 UTC (rev 3247)
+++ trunk/src/document.h	2008-11-18 20:13:29 UTC (rev 3248)
@@ -224,6 +224,7 @@
 
 void document_undo_add(GeanyDocument *doc, guint type, gpointer data);
 
+void document_update_tab_label(GeanyDocument *doc);
 
 GdkColor *document_get_status_color(GeanyDocument *doc);
 

Modified: trunk/src/notebook.c
===================================================================
--- trunk/src/notebook.c	2008-11-18 17:46:24 UTC (rev 3247)
+++ trunk/src/notebook.c	2008-11-18 20:13:29 UTC (rev 3248)
@@ -450,7 +450,7 @@
 	page = GTK_WIDGET(this->editor->sci);
 	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();
 	GTK_WIDGET_SET_FLAGS(ebox, GTK_NO_WINDOW);
@@ -464,7 +464,6 @@
 	{
 		GtkWidget *image, *btn, *align;
 		GtkRcStyle *rcstyle;
-		GtkRequisition size;
 
 		btn = gtk_button_new();
 		gtk_button_set_relief(GTK_BUTTON(btn), GTK_RELIEF_NONE);
@@ -491,9 +490,11 @@
 
 	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);
 
+	document_update_tab_label(this);
+
 	if (file_prefs.tab_order_ltr)
 		tabnum = gtk_notebook_append_page_menu(GTK_NOTEBOOK(main_widgets.notebook), page,
 			hbox, this->priv->tabmenu_label);


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