[libgda] Improved browser window's title



commit c22becce240702ba1c8dc1df4feb57197ee3c828
Author: Vivien Malerba <malerba gnome-db org>
Date:   Thu May 26 20:36:51 2011 +0200

    Improved browser window's title

 tools/browser/browser-window.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index 2314001..d60f943 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -374,7 +374,8 @@ browser_window_new (BrowserConnection *bcnc, BrowserPerspectiveFactory *factory)
 {
 	BrowserWindow *bwin;
 	const gchar *cncname;
-	gchar *str;
+	const GdaDsnInfo *dsn;
+	GString *title;
 
 	g_return_val_if_fail (BROWSER_IS_CONNECTION (bcnc), NULL);
 
@@ -383,12 +384,19 @@ browser_window_new (BrowserConnection *bcnc, BrowserPerspectiveFactory *factory)
 	g_signal_connect (bcnc, "transaction-status-changed",
 			  G_CALLBACK (transaction_status_changed_cb), bwin);
 
+	dsn = browser_connection_get_information (bcnc);
 	cncname = browser_connection_get_name (bcnc);
-	if (!cncname)
-		cncname = _("unnamed");
-	str = g_strdup_printf (_("Connection: %s"), cncname);
-	gtk_window_set_title (GTK_WINDOW (bwin), str);
-	g_free (str);
+	title = g_string_new (_("Connection"));
+	g_string_append (title, " ");
+	g_string_append_printf (title, "'%s'", cncname ? cncname : _("unnamed"));
+	if (dsn) {
+		if (dsn->name)
+			g_string_append_printf (title, ", %s '%s'", _("data source"), dsn->name);
+		if (dsn->provider)
+			g_string_append_printf (title, " (%s)", dsn->provider);
+	}
+	gtk_window_set_title (GTK_WINDOW (bwin), title->str);
+	g_string_free (title, TRUE);
 	gtk_window_set_default_size ((GtkWindow*) bwin, 900, 650);
 	g_signal_connect (G_OBJECT (bwin), "delete-event",
                           G_CALLBACK (delete_event), bwin);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]