gtranslator r3650 - in trunk/src: . dialogs
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3650 - in trunk/src: . dialogs
- Date: Mon, 22 Sep 2008 09:41:02 +0000 (UTC)
Author: icq
Date: Mon Sep 22 09:41:02 2008
New Revision: 3650
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3650&view=rev
Log:
* prefs-manager.{ch}:
* dialogs/preferences-dialog.glade:
* dialogs/preferences-dialog.c:
Added checkbutton and text entry in order to choose files
to create the translation memory.
Modified:
trunk/src/ChangeLog
trunk/src/dialogs/preferences-dialog.c
trunk/src/dialogs/preferences-dialog.glade
trunk/src/prefs-manager.c
trunk/src/prefs-manager.h
Modified: trunk/src/dialogs/preferences-dialog.c
==============================================================================
--- trunk/src/dialogs/preferences-dialog.c (original)
+++ trunk/src/dialogs/preferences-dialog.c Mon Sep 22 09:41:02 2008
@@ -84,6 +84,8 @@
GtkWidget *add_database_button;
GtkWidget *add_database_progressbar;
+ GtkWidget *use_lang_profile_in_tm;
+ GtkWidget *tm_lang_entry;
GtkWidget *show_tm_options_checkbutton;
GtkWidget *missing_words_spinbutton;
GtkWidget *sentence_length_spinbutton;
@@ -768,8 +770,11 @@
dir = g_file_new_for_path (dir_name);
- gtranslator_project_utils_scan_dir (dir, &data->list, NULL);
-
+ if (gtranslator_prefs_manager_get_use_lang_profile ()) {
+ gtranslator_project_utils_scan_dir (dir, &data->list, gtranslator_prefs_manager_get_tm_lang_entry());
+ } else {
+ gtranslator_project_utils_scan_dir (dir, &data->list, NULL);
+ }
data->tm = GTR_TRANSLATION_MEMORY (gtranslator_application_get_translation_memory (GTR_APP));
data->progress = GTK_PROGRESS_BAR (dlg->priv->add_database_progressbar);
data->parent = GTK_WINDOW (dlg);
@@ -784,6 +789,14 @@
}
static void
+on_use_lang_profile_checkbutton_changed (GtkToggleButton *button,
+ gpointer user_data)
+{
+ gtranslator_prefs_manager_set_use_lang_profile (gtk_toggle_button_get_active(button));
+}
+
+
+static void
on_show_tm_options_checkbutton_changed (GtkToggleButton *button,
gpointer user_data)
{
@@ -791,6 +804,22 @@
}
static void
+tm_lang_entry_changed (GObject *gobject,
+ GParamSpec *arg1,
+ GtranslatorPreferencesDialog *dlg)
+{
+ const gchar *text;
+
+ g_return_if_fail(GTK_ENTRY(gobject) == GTK_ENTRY(dlg->priv->tm_lang_entry));
+
+ text = gtk_entry_get_text(GTK_ENTRY(gobject));
+
+ if(text)
+ gtranslator_prefs_manager_set_tm_lang_entry (text);
+}
+
+
+static void
on_missing_words_spinbutton_changed (GtkSpinButton *spinbutton,
gpointer data)
{
@@ -830,9 +859,26 @@
static void
setup_tm_pages(GtranslatorPreferencesDialog *dlg)
-{
+{
+ GtranslatorProfile *profile;
+ gchar *language_code;
+ const gchar *filename;
+
+ profile = gtranslator_application_get_active_profile (GTR_APP);
+ language_code = gtranslator_profile_get_language_code (profile);
+ filename = (const gchar*)g_strconcat (language_code, ".po", NULL);
+
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->show_tm_options_checkbutton),
gtranslator_prefs_manager_get_show_tm_options ());
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->use_lang_profile_in_tm),
+ gtranslator_prefs_manager_get_use_lang_profile ());
+
+ gtk_entry_set_text (GTK_ENTRY (dlg->priv->tm_lang_entry),
+ filename);
+
+ gtranslator_prefs_manager_set_tm_lang_entry (filename);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->missing_words_spinbutton),
(gdouble) gtranslator_prefs_manager_get_missing_words ());
@@ -848,6 +894,10 @@
G_CALLBACK(directory_entry_changed),
dlg);
+ g_signal_connect(dlg->priv->tm_lang_entry, "notify::text",
+ G_CALLBACK(tm_lang_entry_changed),
+ dlg);
+
g_signal_connect (GTK_BUTTON (dlg->priv->add_database_button), "clicked",
G_CALLBACK (on_add_database_button_pulsed),
dlg);
@@ -856,6 +906,10 @@
G_CALLBACK (on_show_tm_options_checkbutton_changed),
dlg);
+ g_signal_connect (GTK_TOGGLE_BUTTON (dlg->priv->use_lang_profile_in_tm), "toggled",
+ G_CALLBACK (on_use_lang_profile_checkbutton_changed),
+ dlg);
+
g_signal_connect (GTK_SPIN_BUTTON (dlg->priv->missing_words_spinbutton), "value-changed",
G_CALLBACK (on_missing_words_spinbutton_changed),
dlg);
@@ -863,6 +917,8 @@
g_signal_connect (GTK_SPIN_BUTTON (dlg->priv->sentence_length_spinbutton), "value-changed",
G_CALLBACK (on_sentence_length_spinbutton_changed),
dlg);
+
+ g_free (filename);
}
/***************Plugins pages****************/
@@ -1110,7 +1166,9 @@
"search_button", &dlg->priv->search_button,
"add_database_button", &dlg->priv->add_database_button,
"add_database_progressbar", &dlg->priv->add_database_progressbar,
-
+
+ "use_lang_profile_in_tm", &dlg->priv->use_lang_profile_in_tm,
+ "tm_lang_entry", &dlg->priv->tm_lang_entry,
"show_tm_options_checkbutton", &dlg->priv->show_tm_options_checkbutton,
"missing_words_spinbutton", &dlg->priv->missing_words_spinbutton,
"sentence_length_spinbutton", &dlg->priv->sentence_length_spinbutton,
Modified: trunk/src/dialogs/preferences-dialog.glade
==============================================================================
--- trunk/src/dialogs/preferences-dialog.glade (original)
+++ trunk/src/dialogs/preferences-dialog.glade Mon Sep 22 09:41:02 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Fri Aug 1 11:35:50 2008 -->
+<!--Generated with glade3 3.4.5 on Mon Aug 4 09:30:40 2008 -->
<glade-interface>
<widget class="GtkDialog" id="preferences_dialog">
<property name="border_width">5</property>
@@ -783,34 +783,47 @@
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<child>
- <placeholder/>
- </child>
- <child>
- <widget class="GtkCheckButton" id="show_tm_options_checkbutton">
+ <widget class="GtkEntry" id="tm_lang_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Show options in translated messages</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
</widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
</child>
<child>
- <widget class="GtkLabel" id="label23">
+ <widget class="GtkCheckButton" id="use_lang_profile_in_tm">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Max. # of missing words:</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use only files with this name:</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
+ <widget class="GtkCheckButton" id="show_tm_options_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show options in translated messages</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkSpinButton" id="missing_words_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -819,15 +832,15 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label24">
+ <widget class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Max. difference in sentence length:</property>
+ <property name="label" translatable="yes">Max. # of missing words:</property>
</widget>
<packing>
<property name="top_attach">2</property>
@@ -844,8 +857,20 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label24">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Max. difference in sentence length:</property>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
Modified: trunk/src/prefs-manager.c
==============================================================================
--- trunk/src/prefs-manager.c (original)
+++ trunk/src/prefs-manager.c Mon Sep 22 09:41:02 2008
@@ -330,6 +330,14 @@
GPM_TM_DIR,
GPM_DEFAULT_TM_DIR)
+DEFINE_INT_PREF (use_lang_profile,
+ GPM_TM_USE_LANG_PROFILE,
+ GPM_DEFAULT_TM_USE_LANG_PROFILE)
+
+DEFINE_STRING_PREF (tm_lang_entry,
+ GPM_TM_LANG_ENTRY,
+ GPM_DEFAULT_TM_LANG_ENTRY)
+
DEFINE_INT_PREF (show_tm_options,
GPM_TM_SHOW_TM_OPTIONS,
GPM_DEFAULT_TM_SHOW_TM_OPTIONS)
Modified: trunk/src/prefs-manager.h
==============================================================================
--- trunk/src/prefs-manager.h (original)
+++ trunk/src/prefs-manager.h Mon Sep 22 09:41:02 2008
@@ -73,6 +73,8 @@
/* Translation Memory */
#define GPM_TM_DIR GPM_PREFS_DIR "/tm/dir_entry"
+#define GPM_TM_USE_LANG_PROFILE GPM_PREFS_DIR "/tm/use_lang_profile"
+#define GPM_TM_LANG_ENTRY GPM_PREFS_DIR "/tm/tm_lang_profile"
#define GPM_TM_SHOW_TM_OPTIONS GPM_PREFS_DIR "/tm/show_tm_options"
#define GPM_TM_MISSING_WORDS GPM_PREFS_DIR "/tm/missing_words"
#define GPM_TM_SENTENCE_LENGTH GPM_PREFS_DIR "/tm/sentence_lenght"
@@ -123,6 +125,8 @@
/* Translation Memory */
#define GPM_DEFAULT_TM_DIR (const gchar*) ""
+#define GPM_DEFAULT_TM_USE_LANG_PROFILE 0 /*FALSE*/
+#define GPM_DEFAULT_TM_LANG_ENTRY (const gchar*) ""
#define GPM_DEFAULT_TM_SHOW_TM_OPTIONS 0 /*FALSE*/
#define GPM_DEFAULT_TM_MISSING_WORDS 2
#define GPM_DEFAULT_TM_SENTENCE_LENGTH 2
@@ -208,6 +212,12 @@
void gtranslator_prefs_manager_set_show_tm_options (gboolean show_tm_options);
gboolean gtranslator_prefs_manager_get_show_tm_options (void);
+void gtranslator_prefs_manager_set_tm_lang_entry (const gchar *dir);
+const gchar * gtranslator_prefs_manager_get_tm_lang_entry (void);
+
+void gtranslator_prefs_manager_set_use_lang_profile (gboolean use_lang_profile);
+gboolean gtranslator_prefs_manager_get_use_lang_profile (void);
+
void gtranslator_prefs_manager_set_missing_words (gint timeout);
gint gtranslator_prefs_manager_get_missing_words (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]