gtranslator r3734 - trunk/src
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3734 - trunk/src
- Date: Mon, 22 Sep 2008 09:45:40 +0000 (UTC)
Author: icq
Date: Mon Sep 22 09:45:39 2008
New Revision: 3734
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3734&view=rev
Log:
2008-08-26 Ignacio Casal Quinteiro <nacho resa gmail com>
* window.c (set_window_title), (notebook_switch_page),
(notebook_page_removed), (notebook_tab_added),
(gtranslator_window_draw):
If there is only one tab add the path to the window title.
(Fixes #549369)
Modified:
trunk/src/ChangeLog
trunk/src/window.c
Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c (original)
+++ trunk/src/window.c Mon Sep 22 09:45:39 2008
@@ -810,6 +810,33 @@
}
static void
+set_window_title (GtranslatorWindow *window,
+ GtranslatorTab *tab,
+ gboolean with_path)
+{
+ GtranslatorPo *po;
+ GFile *file;
+ gchar *title;
+
+ if (with_path)
+ {
+ po = gtranslator_tab_get_po (GTR_TAB (tab));
+ file = gtranslator_po_get_location (po);
+
+ /*
+ * Translators: The title of the window when there is only one tab
+ */
+ title = g_strdup_printf (_("gtranslator - %s"), g_file_get_path (file));
+ g_object_unref (file);
+ }
+ else
+ title = g_strdup (_("gtranslator"));
+
+ gtk_window_set_title (GTK_WINDOW (window), title);
+ g_free (title);
+}
+
+static void
notebook_switch_page(GtkNotebook *nb,
GtkNotebookPage *page,
gint page_num,
@@ -819,11 +846,21 @@
GList *msg;
GtranslatorView *view;
GtranslatorPo *po;
+ gint n_pages;
tab = GTR_TAB (gtk_notebook_get_nth_page (nb, page_num));
if (tab == window->priv->active_tab)
return;
+ /*
+ * Set the window title
+ */
+ n_pages = gtk_notebook_get_n_pages (nb);
+ if (n_pages == 1)
+ set_window_title (window, tab, TRUE);
+ else
+ set_window_title (window, tab, FALSE);
+
window->priv->active_tab = tab;
view = gtranslator_tab_get_active_view (tab);
@@ -843,6 +880,24 @@
}
static void
+notebook_page_removed (GtkNotebook *notebook,
+ GtkWidget *child,
+ guint page_num,
+ GtranslatorWindow *window)
+{
+ gint n_pages;
+
+ /*
+ * Set the window title
+ */
+ n_pages = gtk_notebook_get_n_pages (notebook);
+ if (n_pages == 1)
+ set_window_title (window, GTR_TAB (child), TRUE);
+ else
+ set_window_title (window, GTR_TAB (child), FALSE);
+}
+
+static void
notebook_tab_close_request (GtranslatorNotebook *notebook,
GtranslatorTab *tab,
GtranslatorWindow *window)
@@ -931,9 +986,19 @@
GList *views;
GtranslatorTab *tab = GTR_TAB(child);
GtkTextBuffer *buffer;
+ gint n_pages;
g_return_if_fail(GTR_IS_TAB(tab));
+ /*
+ * Set the window title
+ */
+ n_pages = gtk_notebook_get_n_pages (notebook);
+ if (n_pages == 1)
+ set_window_title (window, tab, TRUE);
+ else
+ set_window_title (window, tab, FALSE);
+
views = gtranslator_tab_get_all_views(tab, FALSE, TRUE);
while(views)
@@ -1353,6 +1418,8 @@
G_CALLBACK(notebook_switch_page), window);
g_signal_connect(priv->notebook, "page-added",
G_CALLBACK(notebook_tab_added), window);
+ g_signal_connect (priv->notebook, "page-removed",
+ G_CALLBACK (notebook_page_removed), window);
g_signal_connect (priv->notebook,
"tab_close_request",
G_CALLBACK (notebook_tab_close_request),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]