[gtranslator] Factor out the tab label.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Factor out the tab label.
- Date: Sat, 17 Apr 2010 11:25:29 +0000 (UTC)
commit 0a3d6ee8570d0363d6ae62e6be74f264a3ef75c3
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Apr 17 00:05:52 2010 +0200
Factor out the tab label.
Borrowed the close-button and tab-label widgets from gedit
and factor it out from gtr-notebook.
po/POTFILES.in | 1 +
po/gl.po | 12 +-
src/Makefile.am | 4 +
src/gtr-close-button.c | 80 +++++++++++
src/gtr-close-button.h | 56 ++++++++
src/gtr-notebook.c | 204 ++++++++--------------------
src/gtr-po.c | 117 ++++++++++-----
src/gtr-tab-label.c | 348 ++++++++++++++++++++++++++++++++++++++++++++++
src/gtr-tab-label.h | 66 +++++++++
src/gtr-tab.c | 155 ++++++++++++---------
src/gtr-tab.h | 113 ++++++----------
src/gtr-window.c | 2 +-
src/update-from-gedit.sh | 6 +-
13 files changed, 832 insertions(+), 332 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 01314fe..e3abf1d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -52,6 +52,7 @@ src/plugin-system/gtr-plugin-manager.c
src/gtr-prefs-manager.c
src/gtr-statusbar.c
src/gtr-tab.c
+src/gtr-tab-label.c
src/toolbareditor/egg-editable-toolbar.c
src/toolbareditor/egg-toolbar-editor.c
src/translation-memory/berkeley/gtr-db-base.c
diff --git a/po/gl.po b/po/gl.po
index 7ae24a4..c240195 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -12,23 +12,21 @@
# First Version: 2000-09-13 20:39+0200
#
# Jesús Bravo �lvarez <jba pobox com>, 2000.
-# Ignacio Casal Quinteiro <nacho resa gmail com>, 2005, 2006.
-# Ignacio Casal Quinteiro <icq cvs gnome org>, 2007.
-# Ignacio Casal Quinteiro <icq svn gnome org>, 2008.
-# Ignacio Casal Quinteiro <nacho resa gmail com>, 2008.
# Fran Diéguez <frandieguez ubuntu com>, 2010.
# Francisco Diéguez <frandieguez ubuntu com>, 2009, 2010.
+# Ignacio Casal Quinteiro <icq gnome org>, 2005, 2006, 2007, 2008, 2010.
+#
msgid ""
msgstr ""
"Project-Id-Version: gl\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-04-09 19:08+0200\n"
-"PO-Revision-Date: 2010-03-06 23:32+0100\n"
-"Last-Translator: Francisco Diéguez <frandieguez ubuntu com>\n"
+"PO-Revision-Date: 2010-04-17 13:22+0200\n"
+"Last-Translator: Ignacio Casal Quinteiro <icq gnome org>\n"
"Language-Team: Galician <proxecto trasno net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
+"Content-Transfer-Encoding: 8bits\n"
"X-Generator: Lokalize 0.3\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
diff --git a/src/Makefile.am b/src/Makefile.am
index b37166f..a0e1aeb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -97,6 +97,10 @@ libgtranslator_la_SOURCES = \
gtr-message-table-model.h \
gtr-notebook.c \
gtr-tab.c \
+ gtr-tab-label.h \
+ gtr-tab-label.c \
+ gtr-close-button.h \
+ gtr-close-button.c \
gtr-view.c \
gtr-window.c \
gtr-po.c \
diff --git a/src/gtr-close-button.c b/src/gtr-close-button.c
new file mode 100644
index 0000000..88966ac
--- /dev/null
+++ b/src/gtr-close-button.c
@@ -0,0 +1,80 @@
+/*
+ * gtr-close-button.c
+ * This file is part of gtr
+ *
+ * Copyright (C) 2010 - Paolo Borelli
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gtr-close-button.h"
+
+G_DEFINE_TYPE (GtrCloseButton, gtr_close_button, GTK_TYPE_BUTTON)
+
+static void
+gtr_close_button_style_set (GtkWidget *button,
+ GtkStyle *previous_style)
+{
+ gint h, w;
+
+ gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
+ GTK_ICON_SIZE_MENU, &w, &h);
+
+ gtk_widget_set_size_request (button, w + 2, h + 2);
+
+ GTK_WIDGET_CLASS (gtr_close_button_parent_class)->style_set (button, previous_style);
+}
+
+static void
+gtr_close_button_class_init (GtrCloseButtonClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->style_set = gtr_close_button_style_set;
+}
+
+static void
+gtr_close_button_init (GtrCloseButton *button)
+{
+ GtkRcStyle *rcstyle;
+ GtkWidget *image;
+
+ /* make it as small as possible */
+ rcstyle = gtk_rc_style_new ();
+ rcstyle->xthickness = rcstyle->ythickness = 0;
+ gtk_widget_modify_style (GTK_WIDGET (button), rcstyle);
+ g_object_unref (rcstyle);
+
+ image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
+ GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image);
+
+ gtk_container_add (GTK_CONTAINER (button), image);
+}
+
+GtkWidget *
+gtr_close_button_new ()
+{
+ GtrCloseButton *button;
+
+ button = g_object_new (GTR_TYPE_CLOSE_BUTTON,
+ "relief", GTK_RELIEF_NONE,
+ "focus-on-click", FALSE,
+ NULL);
+
+ return GTK_WIDGET (button);
+}
+
diff --git a/src/gtr-close-button.h b/src/gtr-close-button.h
new file mode 100644
index 0000000..088ca66
--- /dev/null
+++ b/src/gtr-close-button.h
@@ -0,0 +1,56 @@
+/*
+ * gtr-close-button.h
+ * This file is part of gtr
+ *
+ * Copyright (C) 2010 - Paolo Borelli
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTR_CLOSE_BUTTON_H__
+#define __GTR_CLOSE_BUTTON_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTR_TYPE_CLOSE_BUTTON (gtr_close_button_get_type ())
+#define GTR_CLOSE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTR_TYPE_CLOSE_BUTTON, GtrCloseButton))
+#define GTR_CLOSE_BUTTON_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTR_TYPE_CLOSE_BUTTON, GtrCloseButton const))
+#define GTR_CLOSE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTR_TYPE_CLOSE_BUTTON, GtrCloseButtonClass))
+#define GTR_IS_CLOSE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTR_TYPE_CLOSE_BUTTON))
+#define GTR_IS_CLOSE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTR_TYPE_CLOSE_BUTTON))
+#define GTR_CLOSE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTR_TYPE_CLOSE_BUTTON, GtrCloseButtonClass))
+
+typedef struct _GtrCloseButton GtrCloseButton;
+typedef struct _GtrCloseButtonClass GtrCloseButtonClass;
+typedef struct _GtrCloseButtonPrivate GtrCloseButtonPrivate;
+
+struct _GtrCloseButton {
+ GtkButton parent;
+};
+
+struct _GtrCloseButtonClass {
+ GtkButtonClass parent_class;
+};
+
+GType gtr_close_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gtr_close_button_new (void);
+
+G_END_DECLS
+
+#endif /* __GTR_CLOSE_BUTTON_H__ */
diff --git a/src/gtr-notebook.c b/src/gtr-notebook.c
index 81646b2..f07272d 100644
--- a/src/gtr-notebook.c
+++ b/src/gtr-notebook.c
@@ -22,179 +22,97 @@
#include "gtr-notebook.h"
#include "gtr-tab.h"
+#include "gtr-tab-label.h"
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#define GTR_NOTEBOOK_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ( \
- (object), \
- GTR_TYPE_NOTEBOOK, \
- GtrNotebookPrivate))
+#define GTR_NOTEBOOK_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ( \
+ (object), \
+ GTR_TYPE_NOTEBOOK, \
+ GtrNotebookPrivate))
G_DEFINE_TYPE (GtrNotebook, gtr_notebook, GTK_TYPE_NOTEBOOK)
- struct _GtrNotebookPrivate
- {
- GList *pages;
- };
+struct _GtrNotebookPrivate
+{
+};
/* Signals */
- enum
- {
- TAB_CLOSE_REQUEST,
- LAST_SIGNAL
- };
+enum
+{
+ TAB_CLOSE_REQUEST,
+ LAST_SIGNAL
+};
- static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL] = { 0 };
static void
-tab_label_style_set_cb (GtkWidget * hbox,
- GtkStyle * previous_style, gpointer user_data)
+close_button_clicked_cb (GtrTabLabel *tab_label, GtrNotebook *notebook)
{
- GtkWidget *button;
- gint h, w;
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox),
- GTK_ICON_SIZE_MENU, &w, &h);
+ GtrTab *tab;
- button = g_object_get_data (G_OBJECT (hbox), "close-button");
- gtk_widget_set_size_request (button, w + 2, h + 2);
+ tab = gtr_tab_label_get_tab (tab_label);
+ g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
}
-static void
-sync_name (GtrPo * po, GParamSpec * pspec, GtkWidget * hbox)
+static GtkWidget *
+create_tab_label (GtrNotebook *nb,
+ GtrTab *tab)
{
- gchar *str;
- GtkWidget *label;
- GtkWidget *ebox;
- gchar *tooltip;
- GtrTab *tab;
- GFile *location;
- gchar *path;
+ GtkWidget *tab_label;
- label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
- ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label-ebox"));
- tab = gtr_tab_get_from_document (po);
+ tab_label = gtr_tab_label_new (tab);
- str = gtr_tab_get_name (tab);
- g_return_if_fail (str != NULL);
+ g_signal_connect (tab_label,
+ "close-clicked",
+ G_CALLBACK (close_button_clicked_cb),
+ nb);
- gtk_label_set_text (GTK_LABEL (label), str);
+ g_object_set_data (G_OBJECT (tab), "tab-label", tab_label);
- location = gtr_po_get_location (po);
- path = g_file_get_path (location);
- g_object_unref (location);
+ return tab_label;
+}
+
+static void
+remove_tab_label (GtrNotebook *nb,
+ GtrTab *tab)
+{
+ GtkWidget *tab_label;
- tooltip = g_strdup_printf (_("<b>Path:</b> %s"), path);
+ tab_label = gtr_tab_label_new (tab);
- gtk_widget_set_tooltip_markup (ebox, tooltip);
+ g_signal_handlers_disconnect_by_func (tab_label,
+ G_CALLBACK (close_button_clicked_cb),
+ nb);
- g_free (path);
- g_free (tooltip);
- g_free (str);
+ g_object_set_data (G_OBJECT (tab), "tab-label", NULL);
}
static void
-close_button_clicked_cb (GtkWidget * widget, GtkWidget * tab)
+update_tabs_visibility (GtrNotebook *nb)
{
- GtrNotebook *notebook;
+ gboolean show_tabs;
+ guint num;
- notebook = GTR_NOTEBOOK (gtk_widget_get_parent (tab));
- g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
-}
+ num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
-static GtkWidget *
-build_tab_label (GtrNotebook * nb, GtrTab * tab)
-{
- GtkWidget *hbox, *label_hbox, *label_ebox;
- GtkWidget *label, *dummy_label;
- GtkWidget *close_button;
- GtkRcStyle *rcstyle;
- GtkWidget *image;
- GtkWidget *icon;
-
- hbox = gtk_hbox_new (FALSE, 4);
-
- label_ebox = gtk_event_box_new ();
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
-
- label_hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
-
- /* setup close button */
- close_button = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
- /* don't allow focus on the close button */
- gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
-
- /* make it as small as possible */
- rcstyle = gtk_rc_style_new ();
- rcstyle->xthickness = rcstyle->ythickness = 0;
- gtk_widget_modify_style (close_button, rcstyle);
- g_object_unref (G_OBJECT (rcstyle)),
- image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (close_button), image);
- gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
-
- gtk_widget_set_tooltip_text (close_button, _("Close document"));
-
- g_signal_connect (close_button,
- "clicked", G_CALLBACK (close_button_clicked_cb), tab);
-
- /* setup site icon, empty by default */
- icon = gtk_image_new ();
- gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0);
-
- /* setup label */
- label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
-
- dummy_label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
-
- /* Set minimal size */
- g_signal_connect (hbox, "style-set",
- G_CALLBACK (tab_label_style_set_cb), NULL);
-
- gtk_widget_show (hbox);
- gtk_widget_show (label_ebox);
- gtk_widget_show (label_hbox);
- gtk_widget_show (label);
- gtk_widget_show (dummy_label);
- gtk_widget_show (image);
- gtk_widget_show (close_button);
- gtk_widget_show (icon);
-
- g_object_set_data (G_OBJECT (hbox), "label", label);
- g_object_set_data (G_OBJECT (hbox), "label-ebox", label_ebox);
- g_object_set_data (G_OBJECT (hbox), "close-button", close_button);
- g_object_set_data (G_OBJECT (tab), "close-button", close_button);
-
- return hbox;
+ show_tabs = (num > 1);
+
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
}
static void
gtr_notebook_init (GtrNotebook * notebook)
{
notebook->priv = GTR_NOTEBOOK_GET_PRIVATE (notebook);
- GtrNotebookPrivate *priv = notebook->priv;
-
- priv->pages = NULL;
}
static void
gtr_notebook_finalize (GObject * object)
{
- GtrNotebook *notebook = GTR_NOTEBOOK (object);
-
- if (notebook->priv->pages)
- g_list_free (notebook->priv->pages);
-
G_OBJECT_CLASS (gtr_notebook_parent_class)->finalize (object);
}
@@ -203,7 +121,7 @@ gtr_notebook_class_init (GtrNotebookClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GtrNotebookPrivate));
+ //g_type_class_add_private (klass, sizeof (GtrNotebookPrivate));
object_class->finalize = gtr_notebook_finalize;
@@ -242,7 +160,6 @@ gtr_notebook_new ()
void
gtr_notebook_add_page (GtrNotebook * notebook, GtrTab * tab)
{
- GtrNotebookPrivate *priv = notebook->priv;
GtrPo *po;
GtkWidget *label;
@@ -251,20 +168,11 @@ gtr_notebook_add_page (GtrNotebook * notebook, GtrTab * tab)
po = gtr_tab_get_po (tab);
- label = build_tab_label (notebook, tab);
-
- sync_name (po, NULL, label);
-
- g_signal_connect_object (po,
- "notify::state", G_CALLBACK (sync_name), label, 0);
+ label = create_tab_label (notebook, tab);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), GTK_WIDGET (tab), label);
- priv->pages = g_list_append (priv->pages, tab);
- if (g_list_length (notebook->priv->pages) == 1)
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
- else
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
+ update_tabs_visibility (notebook);
}
/**
@@ -284,12 +192,12 @@ gtr_notebook_remove_page (GtrNotebook * notebook, gint page_num)
tab = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num);
if (page_num != -1)
- gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), page_num);
-
- notebook->priv->pages = g_list_remove (notebook->priv->pages, tab);
+ {
+ remove_tab_label (notebook, GTR_TAB (tab));
+ gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), page_num);
+ }
- if (g_list_length (notebook->priv->pages) == 1)
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
+ update_tabs_visibility (notebook);
}
/**
diff --git a/src/gtr-po.c b/src/gtr-po.c
index 1e0c230..f387e69 100644
--- a/src/gtr-po.c
+++ b/src/gtr-po.c
@@ -58,65 +58,89 @@
G_DEFINE_TYPE (GtrPo, gtr_po, G_TYPE_OBJECT)
- struct _GtrPoPrivate
- {
- GFile *location;
- /* Gettext's file handle */
- po_file_t gettext_po_file;
+struct _GtrPoPrivate
+{
+ GFile *location;
+
+ /* Gettext's file handle */
+ po_file_t gettext_po_file;
- /* Message iter */
- po_message_iterator_t iter;
+ /* Message iter */
+ po_message_iterator_t iter;
- /* The message domains in this file */
- GList *domains;
+ /* The message domains in this file */
+ GList *domains;
- /* Parsed list of GtrMsgs for the current domains' messagelist */
- GList *messages;
+ /* Parsed list of GtrMsgs for the current domains' messagelist */
+ GList *messages;
- /* A pointer to the currently displayed message */
- GList *current;
+ /* A pointer to the currently displayed message */
+ GList *current;
- /* The obsolete messages are stored within this gchar. */
- gchar *obsolete;
+ /* The obsolete messages are stored within this gchar. */
+ gchar *obsolete;
- /* Is the file write-permitted? (read-only) */
- gboolean no_write_perms;
+ /* Is the file write-permitted? (read-only) */
+ gboolean no_write_perms;
- /* Translated entries count */
- guint translated;
+ /* Translated entries count */
+ guint translated;
- /* Fuzzy entries count */
- guint fuzzy;
+ /* Fuzzy entries count */
+ guint fuzzy;
- /* Autosave timeout timer */
- guint autosave_timeout;
+ /* Autosave timeout timer */
+ guint autosave_timeout;
- /* Header object */
- GtrHeader *header;
+ /* Header object */
+ GtrHeader *header;
- GtrPoState state;
+ GtrPoState state;
- /* Marks if the file was changed; */
- guint file_changed:1;
- };
+ /* Marks if the file was changed; */
+ guint file_changed : 1;
+};
- enum
- {
- PROP_0,
- PROP_STATE
- };
+enum
+{
+ PROP_0,
+ PROP_LOCATION,
+ PROP_STATE
+};
- static gchar *message_error = NULL;
+static gchar *message_error = NULL;
- static void
- gtr_po_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
+static void
+gtr_po_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GtrPo *po = GTR_PO (object);
switch (prop_id)
{
+ case PROP_LOCATION:
+ gtr_po_set_location (po, G_FILE (g_value_get_object (value)));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtr_po_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec)
+{
+ GtrPo *po = GTR_PO (object);
+
+ switch (prop_id)
+ {
+ case PROP_LOCATION:
+ g_value_take_object (value, gtr_po_get_location (po));
+ break;
case PROP_STATE:
g_value_set_enum (value, gtr_po_get_state (po));
break;
@@ -208,6 +232,15 @@ gtr_po_class_init (GtrPoClass * klass)
object_class->finalize = gtr_po_finalize;
object_class->dispose = gtr_po_dispose;
object_class->get_property = gtr_po_get_property;
+ object_class->set_property = gtr_po_set_property;
+
+ g_object_class_install_property (object_class,
+ PROP_LOCATION,
+ g_param_spec_object ("location",
+ "Location",
+ "The po's location",
+ G_TYPE_FILE,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_STATE,
@@ -623,9 +656,15 @@ gtr_po_set_location (GtrPo * po, GFile * location)
g_return_if_fail (GTR_IS_PO (po));
if (po->priv->location)
- g_object_unref (po->priv->location);
+ {
+ if (g_file_equal (po->priv->location, location))
+ return;
+ g_object_unref (po->priv->location);
+ }
po->priv->location = g_file_dup (location);
+
+ g_object_notify (G_OBJECT (po), "location");
}
/**
diff --git a/src/gtr-tab-label.c b/src/gtr-tab-label.c
new file mode 100644
index 0000000..6fb0377
--- /dev/null
+++ b/src/gtr-tab-label.c
@@ -0,0 +1,348 @@
+/*
+ * gtr-tab-label.c
+ * This file is part of gtranslator
+ *
+ * Copyright (C) 2010 - Paolo Borelli
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include "gtr-tab-label.h"
+#include "gtr-close-button.h"
+
+#define GTR_TAB_LABEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GTR_TYPE_TAB_LABEL, GtrTabLabelPrivate))
+
+/* Signals */
+enum
+{
+ CLOSE_CLICKED,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_TAB
+};
+
+struct _GtrTabLabelPrivate
+{
+ GtrTab *tab;
+
+ GtkWidget *ebox;
+ GtkWidget *close_button;
+ GtkWidget *spinner;
+ GtkWidget *icon;
+ GtkWidget *label;
+
+ gboolean close_button_sensitive;
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (GtrTabLabel, gtr_tab_label, GTK_TYPE_HBOX)
+
+static void
+gtr_tab_label_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gtr_tab_label_parent_class)->finalize (object);
+}
+
+static void
+gtr_tab_label_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtrTabLabel *tab_label = GTR_TAB_LABEL (object);
+
+ switch (prop_id)
+ {
+ case PROP_TAB:
+ tab_label->priv->tab = GTR_TAB (g_value_get_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtr_tab_label_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtrTabLabel *tab_label = GTR_TAB_LABEL (object);
+
+ switch (prop_id)
+ {
+ case PROP_TAB:
+ g_value_set_object (value, tab_label->priv->tab);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+close_button_clicked_cb (GtkWidget *widget,
+ GtrTabLabel *tab_label)
+{
+ g_signal_emit (tab_label, signals[CLOSE_CLICKED], 0, NULL);
+}
+
+static void
+sync_tip (GtrTab *tab, GtrTabLabel *tab_label)
+{
+ gchar *str;
+
+ str = _gtr_tab_get_tooltips (tab);
+ g_return_if_fail (str != NULL);
+
+ gtk_widget_set_tooltip_markup (tab_label->priv->ebox, str);
+ g_free (str);
+}
+
+static void
+sync_name (GtrTab *tab, GParamSpec *pspec, GtrTabLabel *tab_label)
+{
+ gchar *str;
+
+ g_return_if_fail (tab == tab_label->priv->tab);
+
+ str = _gtr_tab_get_name (tab);
+ g_return_if_fail (str != NULL);
+
+ gtk_label_set_text (GTK_LABEL (tab_label->priv->label), str);
+ g_free (str);
+
+ sync_tip (tab, tab_label);
+}
+
+#if 0
+static void
+sync_state (GtrTab *tab, GParamSpec *pspec, GtrTabLabel *tab_label)
+{
+ GtrTabState state;
+
+ g_return_if_fail (tab == tab_label->priv->tab);
+
+ state = gtr_tab_get_state (tab);
+
+ gtk_widget_set_sensitive (tab_label->priv->close_button,
+ tab_label->priv->close_button_sensitive &&
+ (state != GTR_TAB_STATE_CLOSING) &&
+ (state != GTR_TAB_STATE_SAVING) &&
+ (state != GTR_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
+ (state != GTR_TAB_STATE_SAVING_ERROR));
+
+ if ((state == GTR_TAB_STATE_LOADING) ||
+ (state == GTR_TAB_STATE_SAVING) ||
+ (state == GTR_TAB_STATE_REVERTING))
+ {
+ gtk_widget_hide (tab_label->priv->icon);
+
+ gtk_widget_show (tab_label->priv->spinner);
+ gtk_spinner_start (GTK_SPINNER (tab_label->priv->spinner));
+ }
+ else
+ {
+ GdkPixbuf *pixbuf;
+
+ pixbuf = _gtr_tab_get_icon (tab);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (tab_label->priv->icon), pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
+
+ gtk_widget_show (tab_label->priv->icon);
+
+ gtk_widget_hide (tab_label->priv->spinner);
+
+ gtk_spinner_stop (GTK_SPINNER (tab_label->priv->spinner));
+ }
+
+ /* sync tip since encoding is known only after load/save end */
+ sync_tip (tab, tab_label);
+}
+#endif
+
+static void
+gtr_tab_label_constructed (GObject *object)
+{
+ GtrTabLabel *tab_label = GTR_TAB_LABEL (object);
+
+ if (!tab_label->priv->tab)
+ {
+ g_critical ("The tab label was not properly constructed");
+ return;
+ }
+
+ sync_name (tab_label->priv->tab, NULL, tab_label);
+ /*sync_state (tab_label->priv->tab, NULL, tab_label); */
+
+ g_signal_connect_object (tab_label->priv->tab,
+ "notify::name",
+ G_CALLBACK (sync_name),
+ tab_label,
+ 0);
+
+/*
+ g_signal_connect_object (tab_label->priv->tab,
+ "notify::state",
+ G_CALLBACK (sync_state),
+ tab_label,
+ 0);*/
+}
+
+static void
+gtr_tab_label_class_init (GtrTabLabelClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gtr_tab_label_finalize;
+ object_class->set_property = gtr_tab_label_set_property;
+ object_class->get_property = gtr_tab_label_get_property;
+ object_class->constructed = gtr_tab_label_constructed;
+
+ signals[CLOSE_CLICKED] =
+ g_signal_new ("close-clicked",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtrTabLabelClass, close_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_object_class_install_property (object_class,
+ PROP_TAB,
+ g_param_spec_object ("tab",
+ "Tab",
+ "The GtrTab",
+ GTR_TYPE_TAB,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_type_class_add_private (object_class, sizeof(GtrTabLabelPrivate));
+}
+
+static void
+gtr_tab_label_init (GtrTabLabel *tab_label)
+{
+ GtkWidget *ebox;
+ GtkWidget *hbox;
+ GtkWidget *close_button;
+ GtkWidget *spinner;
+ GtkWidget *icon;
+ GtkWidget *label;
+ GtkWidget *dummy_label;
+
+ tab_label->priv = GTR_TAB_LABEL_GET_PRIVATE (tab_label);
+
+ tab_label->priv->close_button_sensitive = TRUE;
+
+ ebox = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
+ gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0);
+ tab_label->priv->ebox = ebox;
+
+ hbox = gtk_hbox_new (FALSE, 4);
+ gtk_container_add (GTK_CONTAINER (ebox), hbox);
+
+ close_button = gtr_close_button_new ();
+ gtk_widget_set_tooltip_text (close_button, _("Close document"));
+ gtk_box_pack_start (GTK_BOX (tab_label), close_button, FALSE, FALSE, 0);
+ tab_label->priv->close_button = close_button;
+
+ g_signal_connect (close_button,
+ "clicked",
+ G_CALLBACK (close_button_clicked_cb),
+ tab_label);
+
+ spinner = gtk_spinner_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
+ tab_label->priv->spinner = spinner;
+
+ /* setup icon, empty by default */
+ icon = gtk_image_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
+ tab_label->priv->icon = icon;
+
+ label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_misc_set_padding (GTK_MISC (label), 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ tab_label->priv->label = label;
+
+ dummy_label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (hbox), dummy_label, TRUE, TRUE, 0);
+
+ gtk_widget_show (ebox);
+ gtk_widget_show (hbox);
+ gtk_widget_show (close_button);
+ gtk_widget_show (icon);
+ gtk_widget_show (label);
+ gtk_widget_show (dummy_label);
+}
+
+void
+gtr_tab_label_set_close_button_sensitive (GtrTabLabel *tab_label,
+ gboolean sensitive)
+{
+ g_return_if_fail (GTR_IS_TAB_LABEL (tab_label));
+
+ sensitive = (sensitive != FALSE);
+
+ if (sensitive == tab_label->priv->close_button_sensitive)
+ return;
+
+ tab_label->priv->close_button_sensitive = sensitive;
+
+ gtk_widget_set_sensitive (tab_label->priv->close_button,
+ tab_label->priv->close_button_sensitive);
+}
+
+GtrTab *
+gtr_tab_label_get_tab (GtrTabLabel *tab_label)
+{
+ g_return_val_if_fail (GTR_IS_TAB_LABEL (tab_label), NULL);
+
+ return tab_label->priv->tab;
+}
+
+GtkWidget *
+gtr_tab_label_new (GtrTab *tab)
+{
+ GtrTabLabel *tab_label;
+
+ tab_label = g_object_new (GTR_TYPE_TAB_LABEL,
+ "homogeneous", FALSE,
+ "tab", tab,
+ NULL);
+
+ return GTK_WIDGET (tab_label);
+}
diff --git a/src/gtr-tab-label.h b/src/gtr-tab-label.h
new file mode 100644
index 0000000..7c76d79
--- /dev/null
+++ b/src/gtr-tab-label.h
@@ -0,0 +1,66 @@
+/*
+ * gtr-tab-label.h
+ * This file is part of gtr
+ *
+ * Copyright (C) 2010 - Paolo Borelli
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTR_TAB_LABEL_H__
+#define __GTR_TAB_LABEL_H__
+
+#include <gtk/gtk.h>
+#include "gtr-tab.h"
+
+G_BEGIN_DECLS
+
+#define GTR_TYPE_TAB_LABEL (gtr_tab_label_get_type ())
+#define GTR_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTR_TYPE_TAB_LABEL, GtrTabLabel))
+#define GTR_TAB_LABEL_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTR_TYPE_TAB_LABEL, GtrTabLabel const))
+#define GTR_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTR_TYPE_TAB_LABEL, GtrTabLabelClass))
+#define GTR_IS_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTR_TYPE_TAB_LABEL))
+#define GTR_IS_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTR_TYPE_TAB_LABEL))
+#define GTR_TAB_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTR_TYPE_TAB_LABEL, GtrTabLabelClass))
+
+typedef struct _GtrTabLabel GtrTabLabel;
+typedef struct _GtrTabLabelClass GtrTabLabelClass;
+typedef struct _GtrTabLabelPrivate GtrTabLabelPrivate;
+
+struct _GtrTabLabel {
+ GtkHBox parent;
+
+ GtrTabLabelPrivate *priv;
+};
+
+struct _GtrTabLabelClass {
+ GtkHBoxClass parent_class;
+
+ void (* close_clicked) (GtrTabLabel *tab_label);
+};
+
+GType gtr_tab_label_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gtr_tab_label_new (GtrTab *tab);
+
+GtrTab *gtr_tab_label_get_tab (GtrTabLabel *tab_label);
+
+void gtr_tab_label_set_close_button_sensitive (GtrTabLabel *tab_label,
+ gboolean sensitive);
+
+G_END_DECLS
+
+#endif /* __GTR_TAB_LABEL_H__ */
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index f4d7a01..1226255 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -118,6 +118,7 @@ enum
enum
{
PROP_0,
+ PROP_NAME,
PROP_AUTOSAVE,
PROP_AUTOSAVE_INTERVAL
};
@@ -544,6 +545,22 @@ gtr_tab_add_msgstr_tabs (GtrTab * tab)
}
static void
+on_location_notify (GtrPo *po,
+ GParamSpec *pspec,
+ GtrTab *tab)
+{
+ g_object_notify (G_OBJECT (tab), "name");
+}
+
+static void
+on_state_notify (GtrPo *po,
+ GParamSpec *pspec,
+ GtrTab *tab)
+{
+ g_object_notify (G_OBJECT (tab), "name");
+}
+
+static void
gtr_tab_draw (GtrTab * tab)
{
GtkWidget *vertical_box;
@@ -552,16 +569,12 @@ gtr_tab_draw (GtrTab * tab)
GtkWidget *scroll;
GtrTabPrivate *priv = tab->priv;
- /*
- * Panel
- */
+ /* Panel */
priv->panel = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->panel), GTK_POS_BOTTOM);
gtk_widget_show (priv->panel);
- /*
- * Message table
- */
+ /* Message table */
priv->message_table = gtr_message_table_new (GTK_WIDGET (tab));
gtk_widget_show (priv->message_table);
@@ -572,9 +585,7 @@ gtr_tab_draw (GtrTab * tab)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->panel), FALSE);
- /*
- * Comment pane
- */
+ /* Comment pane */
priv->comment_pane = gtk_hpaned_new ();
gtk_paned_set_position (GTK_PANED (priv->comment_pane),
gtr_prefs_manager_get_comment_pane_pos ());
@@ -582,33 +593,25 @@ gtr_tab_draw (GtrTab * tab)
G_CALLBACK (comment_pane_position_changed), tab);
gtk_widget_show (priv->comment_pane);
- /*
- * Lateral panel
- */
+ /* Lateral panel */
tab->priv->lateral_panel = gtk_notebook_new ();
gtk_widget_show (tab->priv->lateral_panel);
gtk_paned_pack2 (GTK_PANED (priv->comment_pane), tab->priv->lateral_panel,
TRUE, TRUE);
- /*
- * Context
- */
+ /* Context */
priv->context = gtr_context_panel_new (GTK_WIDGET (tab));
gtk_widget_show (priv->context);
gtr_tab_add_widget_to_lateral_panel (tab, priv->context, _("Context"));
- /*
- * TM
- */
+ /* TM */
priv->translation_memory = gtr_translation_memory_ui_new (GTK_WIDGET (tab));
gtk_widget_show (priv->translation_memory);
gtr_tab_add_widget_to_lateral_panel (tab, priv->translation_memory,
_("Translation Memory"));
- /*
- * Content pane; this is where the message table and message area go
- */
+ /* Content pane; this is where the message table and message area go */
priv->content_pane = gtk_vpaned_new ();
gtk_paned_set_position (GTK_PANED (priv->content_pane),
gtr_prefs_manager_get_content_pane_pos ());
@@ -617,9 +620,7 @@ gtr_tab_draw (GtrTab * tab)
G_CALLBACK (content_pane_position_changed), tab);
gtk_widget_show (priv->content_pane);
- /*
- * Pack the comments pane and the main content
- */
+ /* Pack the comments pane and the main content */
vertical_box = gtk_vbox_new (FALSE, 0);
gtk_paned_pack1 (GTK_PANED (priv->content_pane), GTK_WIDGET (priv->panel),
TRUE, FALSE);
@@ -627,9 +628,7 @@ gtr_tab_draw (GtrTab * tab)
TRUE);
gtk_widget_show (vertical_box);
- /*
- * Orignal text widgets
- */
+ /* Orignal text widgets */
priv->msgid_hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (priv->msgid_hbox);
@@ -687,9 +686,7 @@ gtr_tab_draw (GtrTab * tab)
gtk_box_pack_start (GTK_BOX (vertical_box), priv->text_vbox, TRUE, TRUE, 0);
- /*
- * Translation widgets
- */
+ /* Translation widgets */
priv->msgstr_label = gtk_label_new (NULL);
gtk_label_set_markup_with_mnemonic (GTK_LABEL (priv->msgstr_label),
_("<b>Translate_d Text:</b>"));
@@ -829,6 +826,15 @@ gtr_tab_class_init (GtrTabClass * klass)
/* Properties */
g_object_class_install_property (object_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "The tab's name",
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (object_class,
PROP_AUTOSAVE,
g_param_spec_boolean ("autosave",
"Autosave",
@@ -868,17 +874,22 @@ gtr_tab_new (GtrPo * po)
tab = g_object_new (GTR_TYPE_TAB, NULL);
+ /* FIXME: make the po a property */
tab->priv->po = po;
g_object_set_data (G_OBJECT (po), GTR_TAB_KEY, tab);
+
+ g_signal_connect (po, "notify::location",
+ G_CALLBACK (on_location_notify), tab);
+
+ g_signal_connect (po, "notify::state",
+ G_CALLBACK (on_state_notify), tab);
+
install_autosave_timeout_if_needed (tab);
- /*
- * Now we have to initialize the number of msgstr tabs
- */
+ /* Now we have to initialize the number of msgstr tabs */
gtr_tab_add_msgstr_tabs (tab);
- gtr_message_table_populate (GTR_MESSAGE_TABLE
- (tab->priv->message_table),
+ gtr_message_table_populate (GTR_MESSAGE_TABLE (tab->priv->message_table),
gtr_po_get_messages (tab->priv->po));
gtk_widget_show (GTK_WIDGET (tab));
@@ -1006,34 +1017,6 @@ gtr_tab_get_all_views (GtrTab * tab, gboolean original, gboolean translated)
}
/**
- * gtr_tab_get_name:
- * @tab: a #GtrTab
- *
- * Return value: a new allocated string with the name of the @tab.
- */
-gchar *
-gtr_tab_get_name (GtrTab * tab)
-{
- GtrHeader *header;
- GtrPoState state;
- const gchar *str;
- gchar *tab_name;
-
- header = gtr_po_get_header (tab->priv->po);
- state = gtr_po_get_state (tab->priv->po);
-
- str = gtr_header_get_prj_id_version (header);
-
- if (state == GTR_PO_STATE_MODIFIED)
- {
- tab_name = g_strdup_printf ("*%s", str);
- return tab_name;
- }
-
- return g_strdup (str);
-}
-
-/**
* gtr_tab_message_go_to:
* @tab: a #GtrTab
* @to_go: the #GtrMsg you want to jump
@@ -1132,6 +1115,52 @@ gtr_tab_message_go_to (GtrTab * tab,
}
/**
+ * _gtr_tab_get_name:
+ * @tab: a #GtrTab
+ *
+ * Return value: a new allocated string with the name of the @tab.
+ */
+gchar *
+_gtr_tab_get_name (GtrTab *tab)
+{
+ GtrHeader *header;
+ GtrPoState state;
+ const gchar *str;
+ gchar *tab_name;
+
+ header = gtr_po_get_header (tab->priv->po);
+ state = gtr_po_get_state (tab->priv->po);
+
+ str = gtr_header_get_prj_id_version (header);
+
+ if (state == GTR_PO_STATE_MODIFIED)
+ {
+ tab_name = g_strdup_printf ("*%s", str);
+ return tab_name;
+ }
+
+ return g_strdup (str);
+}
+
+gchar *
+_gtr_tab_get_tooltips (GtrTab *tab)
+{
+ GFile *location;
+ gchar *tooltips;
+ gchar *path;
+
+ location = gtr_po_get_location (tab->priv->po);
+ path = g_file_get_path (location);
+ g_object_unref (location);
+
+ /* Translators: Path to the document opened */
+ tooltips = g_strdup_printf ("<b>%s</b> %s", _("Path:"), path);
+ g_free (path);
+
+ return tooltips;
+}
+
+/**
* _gtr_tab_can_close:
* @tab: a #GtrTab
*
diff --git a/src/gtr-tab.h b/src/gtr-tab.h
index 1dd35f2..0937c2d 100644
--- a/src/gtr-tab.h
+++ b/src/gtr-tab.h
@@ -82,117 +82,88 @@ typedef enum
/*
* Public methods
*/
-GType
-gtr_tab_get_type (void)
- G_GNUC_CONST;
+GType gtr_tab_get_type (void) G_GNUC_CONST;
- GType gtr_tab_register_type (GTypeModule * module);
+GtrTab *gtr_tab_new (GtrPo * po);
- GtrTab *gtr_tab_new (GtrPo * po);
+GtrPo *gtr_tab_get_po (GtrTab * tab);
- GtrPo *gtr_tab_get_po (GtrTab * tab);
+GtkWidget *gtr_tab_get_panel (GtrTab * tab);
- GtkWidget *gtr_tab_get_panel (GtrTab * tab);
+gint gtr_tab_get_active_trans_tab (GtrTab * tab);
- gint gtr_tab_get_active_trans_tab (GtrTab * tab);
+GtrContextPanel *gtr_tab_get_context_panel (GtrTab * tab);
-GtrContextPanel * gtr_tab_get_context_panel (GtrTab * tab);
+GtkWidget *gtr_tab_get_translation_memory_ui (GtrTab * tab);
- GtkWidget *
- gtr_tab_get_translation_memory_ui (GtrTab * tab);
+GtrView *gtr_tab_get_active_view (GtrTab * tab);
- GtrView *
- gtr_tab_get_active_view (GtrTab * tab);
-
- GList *
- gtr_tab_get_all_views (GtrTab * tab,
+GList *gtr_tab_get_all_views (GtrTab * tab,
gboolean original, gboolean translated);
- gchar *
- gtr_tab_get_name (GtrTab * tab);
-
- void
- gtr_tab_message_go_to (GtrTab * tab,
+void gtr_tab_message_go_to (GtrTab * tab,
GList * to_go,
gboolean searching, GtrTabMove move);
- GtrTab *
- gtr_tab_get_from_document (GtrPo * po);
+GtrTab *gtr_tab_get_from_document (GtrPo * po);
- gboolean
- gtr_tab_get_autosave_enabled (GtrTab * tab);
+gboolean gtr_tab_get_autosave_enabled (GtrTab * tab);
- void
- gtr_tab_set_autosave_enabled (GtrTab * tab, gboolean enable);
+void gtr_tab_set_autosave_enabled (GtrTab * tab, gboolean enable);
- gint
- gtr_tab_get_autosave_interval (GtrTab * tab);
+gint gtr_tab_get_autosave_interval (GtrTab * tab);
- void
- gtr_tab_set_autosave_interval (GtrTab * tab, gint interval);
+void gtr_tab_set_autosave_interval (GtrTab * tab, gint interval);
- void
- gtr_tab_add_widget_to_lateral_panel (GtrTab * tab,
+void gtr_tab_add_widget_to_lateral_panel (GtrTab * tab,
GtkWidget * widget,
const gchar * tab_name);
- void
- gtr_tab_remove_widget_from_lateral_panel (GtrTab *
+void gtr_tab_remove_widget_from_lateral_panel (GtrTab *
tab, GtkWidget * widget);
- void
- gtr_tab_show_lateral_panel_widget (GtrTab * tab, GtkWidget * widget);
+void gtr_tab_show_lateral_panel_widget (GtrTab * tab, GtkWidget * widget);
+
+void gtr_tab_clear_msgstr_views (GtrTab * tab);
- void
- gtr_tab_clear_msgstr_views (GtrTab * tab);
+void gtr_tab_copy_to_translation (GtrTab * tab);
- void
- gtr_tab_copy_to_translation (GtrTab * tab);
+void gtr_tab_block_movement (GtrTab * tab);
- void
- gtr_tab_block_movement (GtrTab * tab);
+void gtr_tab_unblock_movement (GtrTab * tab);
- void
- gtr_tab_unblock_movement (GtrTab * tab);
+void gtr_tab_go_to_next (GtrTab * tab);
- void
- gtr_tab_go_to_next (GtrTab * tab);
+void gtr_tab_go_to_prev (GtrTab * tab);
- void
- gtr_tab_go_to_prev (GtrTab * tab);
+void gtr_tab_go_to_first (GtrTab * tab);
- void
- gtr_tab_go_to_first (GtrTab * tab);
+void gtr_tab_go_to_last (GtrTab * tab);
- void
- gtr_tab_go_to_last (GtrTab * tab);
+gboolean gtr_tab_go_to_next_fuzzy (GtrTab * tab);
- gboolean
- gtr_tab_go_to_next_fuzzy (GtrTab * tab);
+gboolean gtr_tab_go_to_prev_fuzzy (GtrTab * tab);
- gboolean
- gtr_tab_go_to_prev_fuzzy (GtrTab * tab);
+gboolean gtr_tab_go_to_next_untrans (GtrTab * tab);
- gboolean
- gtr_tab_go_to_next_untrans (GtrTab * tab);
+gboolean gtr_tab_go_to_prev_untrans (GtrTab * tab);
- gboolean
- gtr_tab_go_to_prev_untrans (GtrTab * tab);
+gboolean gtr_tab_go_to_next_fuzzy_or_untrans (GtrTab * tab);
- gboolean
- gtr_tab_go_to_next_fuzzy_or_untrans (GtrTab * tab);
+gboolean gtr_tab_go_to_prev_fuzzy_or_untrans (GtrTab * tab);
- gboolean
- gtr_tab_go_to_prev_fuzzy_or_untrans (GtrTab * tab);
+void gtr_tab_go_to_number (GtrTab * tab, gint number);
- void
- gtr_tab_go_to_number (GtrTab * tab, gint number);
+void gtr_tab_set_info_bar (GtrTab * tab, GtkWidget * infobar);
- void
- gtr_tab_set_info_bar (GtrTab * tab, GtkWidget * infobar);
+/* Semi-public methods */
- gboolean
- _gtr_tab_can_close (GtrTab * tab);
+gchar *_gtr_tab_get_name (GtrTab * tab);
+
+gchar *_gtr_tab_get_tooltips (GtrTab *tab);
+
+gboolean _gtr_tab_can_close (GtrTab * tab);
G_END_DECLS
+
#endif /* __TAB_H__ */
diff --git a/src/gtr-window.c b/src/gtr-window.c
index accee7d..2d8c48c 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -835,7 +835,7 @@ update_documents_list_menu (GtrWindow * window)
* get the same accel.
*/
action_name = g_strdup_printf ("Tab_%d", i);
- tab_name = gtr_tab_get_name (GTR_TAB (tab));
+ tab_name = _gtr_tab_get_name (GTR_TAB (tab));
name = gtr_utils_escape_underscores (tab_name, -1);
tip = get_menu_tip_for_tab (GTR_TAB (tab));
diff --git a/src/update-from-gedit.sh b/src/update-from-gedit.sh
index 072ac63..4f85405 100755
--- a/src/update-from-gedit.sh
+++ b/src/update-from-gedit.sh
@@ -3,12 +3,12 @@
FILES="gedit-history-entry.h \
gedit-history-entry.c \
gedit-status-combo-box.h \
- gedit-status-combo-box.c"
+ gedit-status-combo-box.c \
+ gedit-close-button.h \
+ gedit-close-button.c"
sed_it () {
sed \
- -e 's/gedit-history-entry/gtr-history-entry/g' \
- -e 's/gedit-window.h/gtr-window.h/g' \
-e 's/#include "gedit-debug.h"/\/\/#include "gedit-debug.h"/g' \
-e 's/gedit/gtr/g' \
-e 's/Gedit/Gtr/g' \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]