gtranslator r3887 - in trunk: . data src src/dialogs src/translation-memory
- From: psanxiao svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3887 - in trunk: . data src src/dialogs src/translation-memory
- Date: Sat, 15 Nov 2008 16:37:16 +0000 (UTC)
Author: psanxiao
Date: Sat Nov 15 16:37:16 2008
New Revision: 3887
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3887&view=rev
Log:
Patch by SeÃn de BÃrca <leftmostcat gmail com>
and modified by me. (Fixes bug #551400)
* configure.ac:
* data/Makefile.am:
* data/gtranslator.schemas.in:
* src/application.c:
* src/dialogs/header-dialog.c:
* src/dialogs/preferences-dialog.c:
* src/dialogs/preferences-dialog.glade:
* src/header.c:
* src/po.c:
* src/prefs-manager-app.c:
* src/prefs-manager.c:
* src/prefs-manager.h:
* src/tab.c:
* src/translation-memory/translation-memory-ui.c:
* src/view.c:
* src/window.c:
Cleaned up and organized preferences.
Now values are stored using gconf schemas.
Added:
trunk/data/gtranslator.schemas.in
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/data/Makefile.am
trunk/src/application.c
trunk/src/dialogs/header-dialog.c
trunk/src/dialogs/preferences-dialog.c
trunk/src/dialogs/preferences-dialog.glade
trunk/src/header.c
trunk/src/po.c
trunk/src/prefs-manager-app.c
trunk/src/prefs-manager.c
trunk/src/prefs-manager.h
trunk/src/tab.c
trunk/src/translation-memory/translation-memory-ui.c
trunk/src/view.c
trunk/src/window.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sat Nov 15 16:37:16 2008
@@ -139,6 +139,17 @@
AC_SUBST(SC_OMFDIR)
AC_SUBST(SC_STATEDIR)
+dnl ------
+dnl GCONF
+dnl ------
+AM_GCONF_SOURCE_2
+
+AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
+
+if test "$GCONFTOOL" = "no"; then
+ AC_MSG_ERROR([gconftool-2 not found])
+fi
+
dnl -------------------------------------------------------------------
dnl Check for gettext >= 0.17.0 - uses it's parser/writer functions
dnl -------------------------------------------------------------------
Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am (original)
+++ trunk/data/Makefile.am Sat Nov 15 16:37:16 2008
@@ -5,11 +5,13 @@
mime \
pixmaps
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gtranslator- GTR_API_VERSION@.pc
+schemasdir = $(GCONF_SCHEMA_FILE_DIR)
+schemas_in_files = gtranslator.schemas.in
+schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+ INTLTOOL_SCHEMAS_RULE@
-gtranslator- GTR_API_VERSION@.pc: gtranslator.pc
- cp gtranslator.pc gtranslator- GTR_API_VERSION@.pc
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gtranslator.pc
uidir = $(pkgdatadir)
ui_DATA = \
@@ -18,9 +20,18 @@
po.lang \
layout.xml
-EXTRA_DIST = \
- $(ui_DATA) \
- gtranslator.pc.in
+install-data-local:
+ if test -z "$(DESTDIR)" ; then \
+ for p in $(schemas_DATA) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p; \
+ done \
+ fi
+
+EXTRA_DIST = \
+ $(schemas_in_files) \
+ $(ui_DATA) \
+ gtranslator.pc.in
-CLEANFILES = \
- $(pkgconfig_DATA)
+CLEANFILES = \
+ $(schemas_DATA) \
+ $(pkgconfig_DATA)
Added: trunk/data/gtranslator.schemas.in
==============================================================================
--- (empty file)
+++ trunk/data/gtranslator.schemas.in Sat Nov 15 16:37:16 2008
@@ -0,0 +1,257 @@
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/files/warn_if_contains_fuzzy</key>
+ <applyto>/apps/gtranslator/preferences/files/warn_if_contains_fuzzy</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Warn if file contains fuzzy translations</short>
+ <long>If true, warn the user when saving a PO translation file containing fuzzy strings.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/files/delete_compiled</key>
+ <applyto>/apps/gtranslator/preferences/files/delete_compiled</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Delete compiled GMO files</short>
+ <long>If true, remove compiled GMO binary files when saving.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/files/autosave</key>
+ <applyto>/apps/gtranslator/preferences/files/autosave</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Autosave files</short>
+ <long>If true, automatically save files at specified intervals.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/files/autosave_interval</key>
+ <applyto>/apps/gtranslator/preferences/files/autosave_interval</applyto>
+ <owner>gtranslator</owner>
+ <type>int</type>
+ <default>4</default>
+ <locale name="C">
+ <short>Autosave interval</short>
+ <long>Interval in minutes at which to automatically save files.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/files/create_backup</key>
+ <applyto>/apps/gtranslator/preferences/files/create_backup</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Create backup before saving</short>
+ <long>If true, create a backup copy of a file before saving it.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/files/use_profile_values</key>
+ <applyto>/apps/gtranslator/preferences/files/use_profile_values</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Use profile values for header</short>
+ <long>If true, overwrite the values in the PO header with those in the active profile.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/editor/highlight_syntax</key>
+ <applyto>/apps/gtranslator/preferences/editor/highlight_syntax</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Highlight syntax in edit fields</short>
+ <long>If true, apply syntax highlighting to strings in edit fields.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/editor/visible_whitespace</key>
+ <applyto>/apps/gtranslator/preferences/editor/visible_whitespace</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Make whitespace visible</short>
+ <long>If true, display whitespace in strings as representative symbols.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/editor/use_custom_font</key>
+ <applyto>/apps/gtranslator/preferences/editor/use_custom_font</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Use custom font</short>
+ <long>If true, use a custom font for edit fields.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/editor/editor_font</key>
+ <applyto>/apps/gtranslator/preferences/editor/editor_font</applyto>
+ <owner>gtranslator</owner>
+ <type>string</type>
+ <default>Sans 10</default>
+ <locale name="C">
+ <short>Editor font</short>
+ <long>Custom font to use for edit fields.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/editor/unmark_fuzzy_when_changed</key>
+ <applyto>/apps/gtranslator/preferences/editor/unmark_fuzzy_when_changed</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Remove fuzzy status when message is changed</short>
+ <long>If true, remove fuzzy status from translations when they are changed.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/editor/spellcheck</key>
+ <applyto>/apps/gtranslator/preferences/editor/spellcheck</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Check spelling</short>
+ <long>If true, check the spelling of translated messages.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/tm/po_directory</key>
+ <applyto>/apps/gtranslator/preferences/tm/po_directory</applyto>
+ <owner>gtranslator</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>PO directory</short>
+ <long>Directory containing PO files to add to the translation memory.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/tm/restrict_to_filename</key>
+ <applyto>/apps/gtranslator/preferences/tm/restrict_to_filename</applyto>
+ <owner>gtranslator</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Restrict search by filename</short>
+ <long>If true, only include files with a specified filename when searching the translation memory.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/tm/filename_restriction</key>
+ <applyto>/apps/gtranslator/preferences/tm/filename_restriction</applyto>
+ <owner>gtranslator</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>Filename to restrict search to</short>
+ <long>Filename to which searching of the translation memory should be restricted.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/tm/max_missing_words</key>
+ <applyto>/apps/gtranslator/preferences/tm/max_missing_words</applyto>
+ <owner>gtranslator</owner>
+ <type>int</type>
+ <default>2</default>
+ <locale name="C">
+ <short>Maximum number of missing words</short>
+ <long>
+ Maximum number of words that can be missing from a message displayed
+ as a match by the translation memory.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/tm/max_length_diff</key>
+ <applyto>/apps/gtranslator/preferences/tm/max_length_diff</applyto>
+ <owner>gtranslator</owner>
+ <type>int</type>
+ <default>2</default>
+ <locale name="C">
+ <short>Maximum difference in message length</short>
+ <long>
+ Maximum difference in length between messages displayed as matches
+ by the translation memory.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/ui/pane_switcher_style</key>
+ <applyto>/apps/gtranslator/preferences/ui/pane_switcher_style</applyto>
+ <owner>gtranslator</owner>
+ <type>string</type>
+ <!-- Keep synced with default in prefs-manager.c -->
+ <default>icons_and_text</default>
+ <locale name="C">
+ <short>Side pane switcher style</short>
+ <long>
+ Style for switchers in the side pane. Possible values are "icons",
+ "text", "icons_and_text", "tabs" and "system".
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/ui/color_scheme</key>
+ <applyto>/apps/gtranslator/preferences/ui/color_scheme</applyto>
+ <owner>gtranslator</owner>
+ <type>string</type>
+ <default>classic</default>
+ <locale name="C">
+ <short>Color scheme</short>
+ <long>Name of a gtksourceview color scheme to use for syntax highlighting.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gtranslator/preferences/ui/sort_order</key>
+ <applyto>/apps/gtranslator/preferences/ui/sort_order</applyto>
+ <owner>gtranslator</owner>
+ <type>string</type>
+ <!-- Keep synced with default in prefs-manager.c -->
+ <default>id</default>
+ <locale name="C">
+ <short>Message list sort order</short>
+ <long>
+ Sort order to use in the message list. Possible values are "status",
+ "id", "original_text" and "translated_text".
+ </long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
Modified: trunk/src/application.c
==============================================================================
--- trunk/src/application.c (original)
+++ trunk/src/application.c Sat Nov 15 16:37:16 2008
@@ -230,9 +230,9 @@
/* Creating translation memory */
application->priv->tm = GTR_TRANSLATION_MEMORY (gtranslator_berkeley_new ());
gtranslator_translation_memory_set_max_omits (application->priv->tm,
- gtranslator_prefs_manager_get_missing_words ());
+ gtranslator_prefs_manager_get_max_missing_words ());
gtranslator_translation_memory_set_max_delta (application->priv->tm,
- gtranslator_prefs_manager_get_sentence_length ());
+ gtranslator_prefs_manager_get_max_length_diff ());
gtranslator_translation_memory_set_max_items (application->priv->tm,
10);
}
Modified: trunk/src/dialogs/header-dialog.c
==============================================================================
--- trunk/src/dialogs/header-dialog.c (original)
+++ trunk/src/dialogs/header-dialog.c Sat Nov 15 16:37:16 2008
@@ -82,7 +82,7 @@
{
g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->take_my_options));
- gtranslator_prefs_manager_set_take_my_options(gtk_toggle_button_get_active(button));
+ gtranslator_prefs_manager_set_use_profile_values(gtk_toggle_button_get_active(button));
gtk_widget_set_sensitive(dlg->priv->translator, !gtk_toggle_button_get_active(button));
gtk_widget_set_sensitive(dlg->priv->tr_email, !gtk_toggle_button_get_active(button));
@@ -299,7 +299,7 @@
gtk_container_set_border_width (GTK_CONTAINER (dlg->priv->notebook), 5);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->take_my_options),
- gtranslator_prefs_manager_get_take_my_options());
+ gtranslator_prefs_manager_get_use_profile_values());
gtk_text_view_set_editable (GTK_TEXT_VIEW (dlg->priv->prj_comment), TRUE);
Modified: trunk/src/dialogs/preferences-dialog.c
==============================================================================
--- trunk/src/dialogs/preferences-dialog.c (original)
+++ trunk/src/dialogs/preferences-dialog.c Sat Nov 15 16:37:16 2008
@@ -57,7 +57,7 @@
GtkWidget *notebook;
/* Files->General */
- GtkWidget *warn_if_fuzzy_checkbutton;
+ GtkWidget *warn_if_contains_fuzzy_checkbutton;
GtkWidget *delete_compiled_checkbutton;
/* Files->Autosave */
@@ -67,14 +67,14 @@
GtkWidget *create_backup_checkbutton;
/* Editor->Text display */
- GtkWidget *highlight_checkbutton;
+ GtkWidget *highlight_syntax_checkbutton;
GtkWidget *visible_whitespace_checkbutton;
GtkWidget *use_custom_font_checkbutton;
GtkWidget *editor_font_fontbutton;
GtkWidget *editor_font_hbox;
/* Editor->Contents */
- GtkWidget *unmark_fuzzy_checkbutton;
+ GtkWidget *unmark_fuzzy_when_changed_checkbutton;
GtkWidget *spellcheck_checkbutton;
/*Profiles*/
@@ -91,7 +91,6 @@
GtkWidget *use_lang_profile_in_tm;
GtkWidget *tm_lang_entry;
- GtkWidget *show_tm_options_checkbutton;
GtkWidget *missing_words_spinbutton;
GtkWidget *sentence_length_spinbutton;
@@ -129,12 +128,12 @@
/***************Files pages****************/
static void
-warn_if_fuzzy_checkbutton_toggled(GtkToggleButton *button,
+warn_if_contains_fuzzy_checkbutton_toggled(GtkToggleButton *button,
GtranslatorPreferencesDialog *dlg)
{
- g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->warn_if_fuzzy_checkbutton));
+ g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->warn_if_contains_fuzzy_checkbutton));
- gtranslator_prefs_manager_set_warn_if_fuzzy(gtk_toggle_button_get_active(button));
+ gtranslator_prefs_manager_set_warn_if_contains_fuzzy(gtk_toggle_button_get_active(button));
}
static void
@@ -150,14 +149,14 @@
setup_files_general_page(GtranslatorPreferencesDialog *dlg)
{
/*Set initial value*/
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->warn_if_fuzzy_checkbutton),
- gtranslator_prefs_manager_get_warn_if_fuzzy());
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->warn_if_contains_fuzzy_checkbutton),
+ gtranslator_prefs_manager_get_warn_if_contains_fuzzy());
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->delete_compiled_checkbutton),
gtranslator_prefs_manager_get_delete_compiled());
/*Connect signals*/
- g_signal_connect(dlg->priv->warn_if_fuzzy_checkbutton, "toggled",
- G_CALLBACK(warn_if_fuzzy_checkbutton_toggled),
+ g_signal_connect(dlg->priv->warn_if_contains_fuzzy_checkbutton, "toggled",
+ G_CALLBACK(warn_if_contains_fuzzy_checkbutton_toggled),
dlg);
g_signal_connect(dlg->priv->delete_compiled_checkbutton, "toggled",
G_CALLBACK(delete_compiled_checkbutton_toggled),
@@ -215,10 +214,7 @@
backup);
autosave_interval = gtranslator_prefs_manager_get_autosave_interval();
-
- if(autosave_interval <= 0)
- autosave_interval = GPM_DEFAULT_AUTOSAVE_INTERVAL;
-
+
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dlg->priv->autosave_interval_spinbutton),
autosave_interval);
@@ -249,12 +245,12 @@
/***************Editor pages****************/
static void
-highlight_checkbutton_toggled(GtkToggleButton *button,
+highlight_syntax_checkbutton_toggled(GtkToggleButton *button,
GtranslatorPreferencesDialog *dlg)
{
- g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->highlight_checkbutton));
+ g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->highlight_syntax_checkbutton));
- gtranslator_prefs_manager_set_highlight(gtk_toggle_button_get_active(button));
+ gtranslator_prefs_manager_set_highlight_syntax (gtk_toggle_button_get_active(button));
}
static void
@@ -303,8 +299,8 @@
const gchar *editor_font;
/*Set initial value*/
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->highlight_checkbutton),
- gtranslator_prefs_manager_get_highlight());
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->highlight_syntax_checkbutton),
+ gtranslator_prefs_manager_get_highlight_syntax ());
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->visible_whitespace_checkbutton),
gtranslator_prefs_manager_get_visible_whitespace());
@@ -325,8 +321,8 @@
gtk_widget_set_sensitive(dlg->priv->editor_font_hbox, use_custom_font);
/*Connect signals*/
- g_signal_connect(dlg->priv->highlight_checkbutton, "toggled",
- G_CALLBACK(highlight_checkbutton_toggled),
+ g_signal_connect(dlg->priv->highlight_syntax_checkbutton, "toggled",
+ G_CALLBACK(highlight_syntax_checkbutton_toggled),
dlg);
g_signal_connect(dlg->priv->visible_whitespace_checkbutton, "toggled",
G_CALLBACK(visible_whitespace_checkbutton_toggled),
@@ -340,12 +336,12 @@
}
static void
-unmark_fuzzy_checkbutton_toggled(GtkToggleButton *button,
+unmark_fuzzy_when_changed_checkbutton_toggled(GtkToggleButton *button,
GtranslatorPreferencesDialog *dlg)
{
- g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->unmark_fuzzy_checkbutton));
+ g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->unmark_fuzzy_when_changed_checkbutton));
- gtranslator_prefs_manager_set_unmark_fuzzy(gtk_toggle_button_get_active(button));
+ gtranslator_prefs_manager_set_unmark_fuzzy_when_changed (gtk_toggle_button_get_active(button));
}
static void
@@ -361,14 +357,14 @@
setup_editor_contents(GtranslatorPreferencesDialog *dlg)
{
/*Set initial values*/
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->unmark_fuzzy_checkbutton),
- gtranslator_prefs_manager_get_unmark_fuzzy());
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->unmark_fuzzy_when_changed_checkbutton),
+ gtranslator_prefs_manager_get_unmark_fuzzy_when_changed());
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->spellcheck_checkbutton),
gtranslator_prefs_manager_get_spellcheck());
/*Connect signals*/
- g_signal_connect(dlg->priv->unmark_fuzzy_checkbutton, "toggled",
- G_CALLBACK(unmark_fuzzy_checkbutton_toggled),
+ g_signal_connect(dlg->priv->unmark_fuzzy_when_changed_checkbutton, "toggled",
+ G_CALLBACK(unmark_fuzzy_when_changed_checkbutton_toggled),
dlg);
g_signal_connect(dlg->priv->spellcheck_checkbutton, "toggled",
G_CALLBACK(spellcheck_checkbutton_toggled),
@@ -544,7 +540,7 @@
{
g_return_if_fail(combobox == GTK_COMBO_BOX(dlg->priv->gdl_combobox));
- gtranslator_prefs_manager_set_gdl_style (gtk_combo_box_get_active (combobox));
+ gtranslator_prefs_manager_set_color_scheme (gtk_combo_box_get_active_text (combobox));
}
static void
@@ -553,34 +549,34 @@
{
g_return_if_fail (combobox == GTK_COMBO_BOX (dlg->priv->scheme_color_combobox));
- gtranslator_prefs_manager_set_scheme_color (gtk_combo_box_get_active_text (combobox));
+ gtranslator_prefs_manager_set_color_scheme (gtk_combo_box_get_active_text (combobox));
}
static void
setup_interface_pages(GtranslatorPreferencesDialog *dlg)
{
- gint gdl_style;
+ gint pane_switcher_style;
GtkSourceStyleSchemeManager *manager;
const gchar * const *scheme_ids;
const gchar * scheme_active;
gint i = 0;
/*Set initial value*/
- gdl_style = gtranslator_prefs_manager_get_gdl_style ();
- gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->priv->gdl_combobox),
- gdl_style);
-
+ pane_switcher_style = gtranslator_prefs_manager_get_pane_switcher_style ();
+ if (pane_switcher_style)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->priv->gdl_combobox),
+ pane_switcher_style);
/*
* Scheme color
*/
manager = gtk_source_style_scheme_manager_get_default ();
scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);
- scheme_active = gtranslator_prefs_manager_get_scheme_color ();
+ scheme_active = gtranslator_prefs_manager_get_color_scheme ();
while (scheme_ids [i] != NULL)
{
gtk_combo_box_append_text (GTK_COMBO_BOX (dlg->priv->scheme_color_combobox),
scheme_ids[i]);
- if (strcmp (scheme_ids[i], scheme_active) == 0)
+ if (g_strcmp0 (scheme_ids[i], scheme_active) == 0)
gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->priv->scheme_color_combobox),
i);
i++;
@@ -609,7 +605,7 @@
if (response_id == GTK_RESPONSE_YES) {
gtk_entry_set_text (GTK_ENTRY (dlg->priv->directory_entry),
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)));
- gtranslator_prefs_manager_set_tm_dir (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)));
+ gtranslator_prefs_manager_set_po_directory (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)));
gtk_widget_destroy (GTK_WIDGET (dialog));
} else {
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -751,12 +747,12 @@
data = g_new0 (IdleData, 1);
data->list = NULL;
- dir_name = gtranslator_prefs_manager_get_tm_dir ();
+ dir_name = gtranslator_prefs_manager_get_po_directory ();
dir = g_file_new_for_path (dir_name);
- if (gtranslator_prefs_manager_get_use_lang_profile ())
- gtranslator_utils_scan_dir (dir, &data->list, gtranslator_prefs_manager_get_tm_lang_entry());
+ if (gtranslator_prefs_manager_get_restrict_to_filename ())
+ gtranslator_utils_scan_dir (dir, &data->list, gtranslator_prefs_manager_get_filename_restriction());
else
gtranslator_utils_scan_dir (dir, &data->list, NULL);
@@ -777,15 +773,7 @@
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)
-{
- gtranslator_prefs_manager_set_show_tm_options (gtk_toggle_button_get_active(button));
+ gtranslator_prefs_manager_set_restrict_to_filename (gtk_toggle_button_get_active(button));
}
static void
@@ -800,7 +788,7 @@
text = gtk_entry_get_text(GTK_ENTRY(gobject));
if(text)
- gtranslator_prefs_manager_set_tm_lang_entry (text);
+ gtranslator_prefs_manager_set_filename_restriction (text);
}
@@ -812,7 +800,7 @@
value = gtk_spin_button_get_value_as_int (spinbutton);
- gtranslator_prefs_manager_set_missing_words (value);
+ gtranslator_prefs_manager_set_max_missing_words (value);
}
static void
@@ -823,7 +811,7 @@
value = gtk_spin_button_get_value_as_int (spinbutton);
- gtranslator_prefs_manager_set_sentence_length (value);
+ gtranslator_prefs_manager_set_max_length_diff (value);
}
static void
@@ -838,7 +826,7 @@
text = gtk_entry_get_text(GTK_ENTRY(gobject));
if(text)
- gtranslator_prefs_manager_set_tm_dir (text);
+ gtranslator_prefs_manager_set_po_directory (text);
}
@@ -849,11 +837,8 @@
const gchar *language_code;
const gchar *filename = 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 ());
+ gtranslator_prefs_manager_get_restrict_to_filename ());
profile = gtranslator_application_get_active_profile (GTR_APP);
@@ -866,13 +851,13 @@
}
if (filename != NULL)
- gtranslator_prefs_manager_set_tm_lang_entry (filename);
+ gtranslator_prefs_manager_set_filename_restriction (filename);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->missing_words_spinbutton),
- (gdouble) gtranslator_prefs_manager_get_missing_words ());
+ (gdouble) gtranslator_prefs_manager_get_max_missing_words ());
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->sentence_length_spinbutton),
- (gdouble) gtranslator_prefs_manager_get_sentence_length ());
+ (gdouble) gtranslator_prefs_manager_get_max_length_diff ());
g_signal_connect (GTK_BUTTON (dlg->priv->search_button), "clicked",
G_CALLBACK (on_search_button_pulsed),
@@ -890,10 +875,6 @@
G_CALLBACK (on_add_database_button_pulsed),
dlg);
- g_signal_connect (GTK_TOGGLE_BUTTON (dlg->priv->show_tm_options_checkbutton), "toggled",
- 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);
@@ -1135,7 +1116,7 @@
"notebook", &dlg->priv->notebook,
- "warn_if_fuzzy_checkbutton", &dlg->priv->warn_if_fuzzy_checkbutton,
+ "warn_if_contains_fuzzy_checkbutton", &dlg->priv->warn_if_contains_fuzzy_checkbutton,
"delete_compiled_checkbutton", &dlg->priv->delete_compiled_checkbutton,
"autosave_checkbutton", &dlg->priv->autosave_checkbutton,
@@ -1143,13 +1124,13 @@
"autosave_hbox", &dlg->priv->autosave_hbox,
"create_backup_checkbutton", &dlg->priv->create_backup_checkbutton,
- "highlight_checkbutton", &dlg->priv->highlight_checkbutton,
+ "highlight_syntax_checkbutton", &dlg->priv->highlight_syntax_checkbutton,
"visible_whitespace_checkbutton", &dlg->priv->visible_whitespace_checkbutton,
"use_custom_font_checkbutton", &dlg->priv->use_custom_font_checkbutton,
"editor_font_fontbutton", &dlg->priv->editor_font_fontbutton,
"editor_font_hbox", &dlg->priv->editor_font_hbox,
- "unmark_fuzzy_checkbutton", &dlg->priv->unmark_fuzzy_checkbutton,
+ "unmark_fuzzy_when_changed_checkbutton", &dlg->priv->unmark_fuzzy_when_changed_checkbutton,
"spellcheck_checkbutton", &dlg->priv->spellcheck_checkbutton,
"profile_treeview", &dlg->priv->profile_treeview,
@@ -1163,8 +1144,7 @@
"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,
+ "tm_lang_entry", &dlg->priv->tm_lang_entry,
"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 Sat Nov 15 16:37:16 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 Wed Nov 12 12:32:00 2008 -->
+<!--Generated with glade3 3.4.5 on Fri Nov 14 11:53:55 2008 -->
<glade-interface>
<widget class="GtkDialog" id="preferences_dialog">
<property name="border_width">5</property>
@@ -55,7 +55,7 @@
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<child>
- <widget class="GtkCheckButton" id="warn_if_fuzzy_checkbutton">
+ <widget class="GtkCheckButton" id="warn_if_contains_fuzzy_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Warn if PO file contains fuzzy translations</property>
@@ -266,7 +266,7 @@
<widget class="GtkVBox" id="vbox18">
<property name="visible">True</property>
<child>
- <widget class="GtkCheckButton" id="highlight_checkbutton">
+ <widget class="GtkCheckButton" id="highlight_syntax_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Highlight message syntax</property>
@@ -389,7 +389,7 @@
<widget class="GtkVBox" id="vbox20">
<property name="visible">True</property>
<child>
- <widget class="GtkCheckButton" id="unmark_fuzzy_checkbutton">
+ <widget class="GtkCheckButton" id="unmark_fuzzy_when_changed_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Remove fuzzy status if message is changed</property>
@@ -831,25 +831,10 @@
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_rows">4</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<child>
- <placeholder/>
- </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>
- <child>
<widget class="GtkSpinButton" id="sentence_length_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -858,16 +843,16 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label23">
+ <widget class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Max. # of missing words:</property>
+ <property name="label" translatable="yes">Max. difference in sentence length:</property>
</widget>
<packing>
<property name="top_attach">2</property>
@@ -884,30 +869,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">1</property>
+ <property name="bottom_attach">2</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>
- <widget class="GtkCheckButton" id="use_lang_profile_in_tm">
+ <widget class="GtkLabel" id="label23">
<property name="visible">True</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>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Max. # of missing words:</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>
@@ -918,10 +893,17 @@
<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="GtkCheckButton" id="use_lang_profile_in_tm">
+ <property name="visible">True</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>
+ </child>
</widget>
<packing>
<property name="position">1</property>
Modified: trunk/src/header.c
==============================================================================
--- trunk/src/header.c (original)
+++ trunk/src/header.c Sat Nov 15 16:37:16 2008
@@ -428,7 +428,7 @@
*/
if (header->priv->plural_forms)
return header->priv->nplurals;
- else if (plural_form = gtranslator_prefs_manager_get_plural_form ())
+ else if (plural_form = (const gchar *)gtranslator_profile_get_plurals ())
{
gtranslator_header_set_plural_forms (header, plural_form);
/*
Modified: trunk/src/po.c
==============================================================================
--- trunk/src/po.c (original)
+++ trunk/src/po.c Sat Nov 15 16:37:16 2008
@@ -593,7 +593,7 @@
gchar **comments_lines;
gchar **comments_translator_values;
- gboolean take_my_options;
+ gboolean use_profile_values;
gint i = 0;
gint j;
@@ -608,7 +608,7 @@
gboolean current_translator_in_comments = FALSE;
- take_my_options = gtranslator_prefs_manager_get_take_my_options ();
+ use_profile_values = gtranslator_prefs_manager_get_use_profile_values ();
/*
* Save the previous translator to update the header's comment
@@ -628,11 +628,11 @@
msgstr = po_message_msgstr(message);
/*
- * If button take_my_options is pulsed, then header's values
+ * If button use_profile_values is pushed, then header's values
* should be taking from default profile
*/
- if (take_my_options) {
+ if (use_profile_values) {
GtranslatorProfile *active_profile;
Modified: trunk/src/prefs-manager-app.c
==============================================================================
--- trunk/src/prefs-manager-app.c (original)
+++ trunk/src/prefs-manager-app.c Sat Nov 15 16:37:16 2008
@@ -421,7 +421,7 @@
NULL);
gconf_client_notify_add (gtranslator_prefs_manager->gconf_client,
- GPM_FONT_DIR,
+ GPM_EDITOR_FONT,
gtranslator_prefs_manager_editor_font_changed,
NULL, NULL, NULL);
@@ -431,7 +431,7 @@
NULL, NULL, NULL);
gconf_client_notify_add (gtranslator_prefs_manager->gconf_client,
- GPM_HIGHLIGHT,
+ GPM_HIGHLIGHT_SYNTAX,
gtranslator_prefs_manager_highlight_changed,
NULL, NULL, NULL);
@@ -441,7 +441,7 @@
NULL, NULL, NULL);
gconf_client_notify_add (gtranslator_prefs_manager->gconf_client,
- GPM_GDL_STYLE,
+ GPM_PANE_SWITCHER_STYLE,
gtranslator_prefs_manager_gdl_style_changed,
NULL, NULL, NULL);
@@ -451,7 +451,7 @@
NULL, NULL, NULL);
gconf_client_notify_add (gtranslator_prefs_manager->gconf_client,
- GPM_SCHEME_COLOR,
+ GPM_COLOR_SCHEME,
gtranslator_prefs_manager_scheme_color_changed,
NULL, NULL, NULL);
}
@@ -485,22 +485,16 @@
if (strcmp (entry->key, GPM_USE_CUSTOM_FONT) == 0)
{
- if (entry->value->type == GCONF_VALUE_BOOL)
- def = gconf_value_get_bool (entry->value);
- else
- def = !GPM_DEFAULT_USE_CUSTOM_FONT;
+ def = gconf_value_get_bool (entry->value);
if (!def)
- font = g_strdup(GPM_DEFAULT_EDITOR_FONT);
+ font = g_strdup("Sans 10"); // Fix to use system font
else
font = g_strdup(gtranslator_prefs_manager_get_editor_font ());
}
else if (strcmp (entry->key, GPM_EDITOR_FONT) == 0)
{
- if (entry->value->type == GCONF_VALUE_STRING)
- font = g_strdup (gconf_value_get_string (entry->value));
- else
- font = g_strdup (GPM_DEFAULT_EDITOR_FONT);
+ font = g_strdup (gconf_value_get_string (entry->value));
def = gtranslator_prefs_manager_get_use_custom_font ();
}
@@ -557,17 +551,14 @@
g_return_if_fail (entry->key != NULL);
g_return_if_fail (entry->value != NULL);
- if (strcmp (entry->key, GPM_HIGHLIGHT) == 0)
+ if (strcmp (entry->key, GPM_HIGHLIGHT_SYNTAX) == 0)
{
gboolean enable;
GList *views;
GList *l;
GtkSourceBuffer *buf;
- if (entry->value->type == GCONF_VALUE_BOOL)
- enable = gconf_value_get_bool (entry->value);
- else
- enable = GPM_DEFAULT_HIGHLIGHT;
+ enable = gconf_value_get_bool (entry->value);
views = gtranslator_application_get_views (GTR_APP, TRUE, TRUE);
l = views;
@@ -601,10 +592,7 @@
GList *views;
GList *l;
- if (entry->value->type == GCONF_VALUE_BOOL)
- enable = gconf_value_get_bool (entry->value);
- else
- enable = GPM_DEFAULT_VISIBLE_WHITESPACE;
+ enable = gconf_value_get_bool (entry->value);
views = gtranslator_application_get_views (GTR_APP, TRUE, TRUE);
l = views;
@@ -632,7 +620,7 @@
window = gtranslator_application_get_active_window (GTR_APP);
- style = gtranslator_prefs_manager_get_gdl_style ();
+ style = gtranslator_prefs_manager_get_pane_switcher_style ();
layout_manager = GDL_DOCK_LAYOUT (_gtranslator_window_get_layout_manager (window));
@@ -659,10 +647,7 @@
{
gboolean autosave;
- if (entry->value->type == GCONF_VALUE_BOOL)
- autosave = gconf_value_get_bool (entry->value);
- else
- autosave = GPM_DEFAULT_AUTOSAVE;
+ autosave = gconf_value_get_bool (entry->value);
tabs = gtranslator_window_get_all_tabs (window);
@@ -679,15 +664,10 @@
{
gint autosave_interval;
- if (entry->value->type == GCONF_VALUE_INT)
- {
- autosave_interval = gconf_value_get_int (entry->value);
+ autosave_interval = gconf_value_get_int (entry->value);
- if (autosave_interval <= 0)
- autosave_interval = GPM_DEFAULT_AUTOSAVE_INTERVAL;
- }
- else
- autosave_interval = GPM_DEFAULT_AUTOSAVE_INTERVAL;
+ if (autosave_interval <= 0)
+ autosave_interval = 1;
tabs = gtranslator_window_get_all_tabs (window);
Modified: trunk/src/prefs-manager.c
==============================================================================
--- trunk/src/prefs-manager.c (original)
+++ trunk/src/prefs-manager.c Sat Nov 15 16:37:16 2008
@@ -43,12 +43,11 @@
#include "prefs-manager.h"
#include "prefs-manager-private.h"
-#define DEFINE_BOOL_PREF(name, key, def) gboolean \
+#define DEFINE_BOOL_PREF(name, key) gboolean \
gtranslator_prefs_manager_get_ ## name (void) \
{ \
\
- return gtranslator_prefs_manager_get_bool (key, \
- (def)); \
+ return gtranslator_prefs_manager_get_bool (key); \
} \
\
void \
@@ -60,12 +59,11 @@
}
-#define DEFINE_INT_PREF(name, key, def) gint \
+#define DEFINE_INT_PREF(name, key) gint \
gtranslator_prefs_manager_get_ ## name (void) \
{ \
\
- return gtranslator_prefs_manager_get_int (key, \
- (def)); \
+ return gtranslator_prefs_manager_get_int (key); \
} \
\
void \
@@ -76,12 +74,11 @@
v); \
}
-#define DEFINE_STRING_PREF(name, key, def) const gchar* \
+#define DEFINE_STRING_PREF(name, key) const gchar* \
gtranslator_prefs_manager_get_ ## name (void) \
{ \
\
- return gtranslator_prefs_manager_get_string (key, \
- def); \
+ return gtranslator_prefs_manager_get_string (key); \
} \
\
void \
@@ -95,35 +92,14 @@
GtranslatorPrefsManager *gtranslator_prefs_manager = NULL;
+static gboolean gtranslator_prefs_manager_get_bool (const gchar* key);
-static GtkWrapMode get_wrap_mode_from_string (const gchar* str);
+static gint gtranslator_prefs_manager_get_int (const gchar* key);
-static gboolean gconf_client_get_bool_with_default (GConfClient* client,
- const gchar* key,
- gboolean def,
- GError** err);
+static gchar *gtranslator_prefs_manager_get_string (const gchar* key);
-static gchar *gconf_client_get_string_with_default (GConfClient* client,
- const gchar* key,
- const gchar* def,
- GError** err);
-static gint gconf_client_get_int_with_default (GConfClient* client,
- const gchar* key,
- gint def,
- GError** err);
-
-static gboolean gtranslator_prefs_manager_get_bool (const gchar* key,
- gboolean def);
-
-static gint gtranslator_prefs_manager_get_int (const gchar* key,
- gint def);
-
-static gchar *gtranslator_prefs_manager_get_string (const gchar* key,
- const gchar* def);
-
-
-gboolean
+void
gtranslator_prefs_manager_init (void)
{
//gtranslator_debug (DEBUG_PREFS);
@@ -134,24 +110,12 @@
gconf_client = gconf_client_get_default ();
if (gconf_client == NULL)
- {
- g_warning (_("Cannot initialize preferences manager."));
- return FALSE;
- }
+ g_error("Failed to initialize preferences manager");
gtranslator_prefs_manager = g_new0 (GtranslatorPrefsManager, 1);
gtranslator_prefs_manager->gconf_client = gconf_client;
- }
-
- if (gtranslator_prefs_manager->gconf_client == NULL)
- {
- g_free (gtranslator_prefs_manager);
- gtranslator_prefs_manager = NULL;
- }
-
- return gtranslator_prefs_manager != NULL;
-
+ }
}
void
@@ -159,54 +123,38 @@
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_if_fail (gtranslator_prefs_manager != NULL);
-
g_object_unref (gtranslator_prefs_manager->gconf_client);
gtranslator_prefs_manager->gconf_client = NULL;
}
static gboolean
-gtranslator_prefs_manager_get_bool (const gchar* key, gboolean def)
+gtranslator_prefs_manager_get_bool (const gchar* key)
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_val_if_fail (gtranslator_prefs_manager != NULL, def);
- g_return_val_if_fail (gtranslator_prefs_manager->gconf_client != NULL, def);
-
- return gconf_client_get_bool_with_default (gtranslator_prefs_manager->gconf_client,
- key,
- def,
- NULL);
+ return gconf_client_get_bool (gtranslator_prefs_manager->gconf_client,
+ key,
+ NULL);
}
static gint
-gtranslator_prefs_manager_get_int (const gchar* key, gint def)
+gtranslator_prefs_manager_get_int (const gchar* key)
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_val_if_fail (gtranslator_prefs_manager != NULL, def);
- g_return_val_if_fail (gtranslator_prefs_manager->gconf_client != NULL, def);
-
- return gconf_client_get_int_with_default (gtranslator_prefs_manager->gconf_client,
- key,
- def,
- NULL);
+ return gconf_client_get_int (gtranslator_prefs_manager->gconf_client,
+ key,
+ NULL);
}
static gchar *
-gtranslator_prefs_manager_get_string (const gchar* key, const gchar* def)
+gtranslator_prefs_manager_get_string (const gchar* key)
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_val_if_fail (gtranslator_prefs_manager != NULL,
- def ? g_strdup (def) : NULL);
- g_return_val_if_fail (gtranslator_prefs_manager->gconf_client != NULL,
- def ? g_strdup (def) : NULL);
-
- return gconf_client_get_string_with_default (gtranslator_prefs_manager->gconf_client,
- key,
- def,
- NULL);
+ return gconf_client_get_string (gtranslator_prefs_manager->gconf_client,
+ key,
+ NULL);
}
static void
@@ -214,8 +162,6 @@
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_if_fail (gtranslator_prefs_manager != NULL);
- g_return_if_fail (gtranslator_prefs_manager->gconf_client != NULL);
g_return_if_fail (gconf_client_key_is_writable (
gtranslator_prefs_manager->gconf_client, key, NULL));
@@ -227,8 +173,6 @@
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_if_fail (gtranslator_prefs_manager != NULL);
- g_return_if_fail (gtranslator_prefs_manager->gconf_client != NULL);
g_return_if_fail (gconf_client_key_is_writable (
gtranslator_prefs_manager->gconf_client, key, NULL));
@@ -242,8 +186,6 @@
g_return_if_fail (value != NULL);
- g_return_if_fail (gtranslator_prefs_manager != NULL);
- g_return_if_fail (gtranslator_prefs_manager->gconf_client != NULL);
g_return_if_fail (gconf_client_key_is_writable (
gtranslator_prefs_manager->gconf_client, key, NULL));
@@ -255,307 +197,168 @@
{
//gtranslator_debug (DEBUG_PREFS);
- g_return_val_if_fail (gtranslator_prefs_manager != NULL, FALSE);
- g_return_val_if_fail (gtranslator_prefs_manager->gconf_client != NULL, FALSE);
-
return gconf_client_key_is_writable (gtranslator_prefs_manager->gconf_client, key, NULL);
}
-/* Edit Header */
-DEFINE_BOOL_PREF(take_my_options,
- GPM_TAKE_MY_OPTIONS,
- GPM_DEFAULT_TAKE_MY_OPTIONS)
-
/* Files */
-DEFINE_BOOL_PREF(warn_if_fuzzy,
- GPM_WARN_IF_FUZZY,
- GPM_DEFAULT_WARN_IF_FUZZY)
+DEFINE_BOOL_PREF(warn_if_contains_fuzzy,
+ GPM_WARN_IF_CONTAINS_FUZZY)
DEFINE_BOOL_PREF(delete_compiled,
- GPM_DELETE_COMPILED,
- GPM_DEFAULT_DELETE_COMPILED)
+ GPM_DELETE_COMPILED)
DEFINE_BOOL_PREF(autosave,
- GPM_AUTOSAVE,
- GPM_DEFAULT_AUTOSAVE)
+ GPM_AUTOSAVE)
DEFINE_INT_PREF(autosave_interval,
- GPM_AUTOSAVE_INTERVAL,
- GPM_DEFAULT_AUTOSAVE_INTERVAL)
+ GPM_AUTOSAVE_INTERVAL)
DEFINE_BOOL_PREF(create_backup,
- GPM_CREATE_BACKUP,
- GPM_DEFAULT_CREATE_BACKUP)
+ GPM_CREATE_BACKUP)
+
+DEFINE_BOOL_PREF(use_profile_values,
+ GPM_USE_PROFILE_VALUES)
/* Editor */
-DEFINE_BOOL_PREF(highlight,
- GPM_HIGHLIGHT,
- GPM_DEFAULT_HIGHLIGHT)
+DEFINE_BOOL_PREF(highlight_syntax,
+ GPM_HIGHLIGHT_SYNTAX)
DEFINE_BOOL_PREF(visible_whitespace,
- GPM_VISIBLE_WHITESPACE,
- GPM_DEFAULT_VISIBLE_WHITESPACE)
+ GPM_VISIBLE_WHITESPACE)
DEFINE_BOOL_PREF(use_custom_font,
- GPM_USE_CUSTOM_FONT,
- GPM_DEFAULT_USE_CUSTOM_FONT)
+ GPM_USE_CUSTOM_FONT)
DEFINE_STRING_PREF(editor_font,
- GPM_EDITOR_FONT,
- GPM_DEFAULT_EDITOR_FONT)
+ GPM_EDITOR_FONT)
-DEFINE_BOOL_PREF(unmark_fuzzy,
- GPM_UNMARK_FUZZY,
- GPM_DEFAULT_UNMARK_FUZZY)
+DEFINE_BOOL_PREF(unmark_fuzzy_when_changed,
+ GPM_UNMARK_FUZZY_WHEN_CHANGED)
DEFINE_BOOL_PREF(spellcheck,
- GPM_SPELLCHECK,
- GPM_DEFAULT_SPELLCHECK)
-
-/* PO header */
-DEFINE_STRING_PREF(name,
- GPM_NAME,
- GPM_DEFAULT_NAME)
-
-DEFINE_STRING_PREF(email,
- GPM_EMAIL,
- GPM_DEFAULT_EMAIL)
-
-DEFINE_STRING_PREF(plural_form,
- GPM_PLURAL_FORM,
- GPM_DEFAULT_PLURAL_FORM)
-
-/* Interface */
-DEFINE_INT_PREF (gdl_style,
- GPM_GDL_STYLE,
- GPM_DEFAULT_GDL_STYLE)
-
-DEFINE_STRING_PREF (scheme_color,
- GPM_SCHEME_COLOR,
- GPM_DEFAULT_SCHEME_COLOR)
+ GPM_SPELLCHECK)
/* Translation Memory */
-DEFINE_STRING_PREF (tm_dir,
- 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)
-
-DEFINE_INT_PREF (missing_words,
- GPM_TM_MISSING_WORDS,
- GPM_DEFAULT_TM_MISSING_WORDS)
-
-DEFINE_INT_PREF (sentence_length,
- GPM_TM_SENTENCE_LENGTH,
- GPM_DEFAULT_TM_SENTENCE_LENGTH)
-
-/* The following functions are taken from gconf-client.c
- * and partially modified.
- * The licensing terms on these is:
- *
- *
- * GConf
- * Copyright (C) 1999, 2000, 2000 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-static const gchar*
-gconf_value_type_to_string(GConfValueType type)
-{
- switch (type)
- {
- case GCONF_VALUE_INT:
- return "int";
- break;
- case GCONF_VALUE_STRING:
- return "string";
- break;
- case GCONF_VALUE_FLOAT:
- return "float";
- break;
- case GCONF_VALUE_BOOL:
- return "bool";
- break;
- case GCONF_VALUE_SCHEMA:
- return "schema";
- break;
- case GCONF_VALUE_LIST:
- return "list";
- break;
- case GCONF_VALUE_PAIR:
- return "pair";
- break;
- case GCONF_VALUE_INVALID:
- return "*invalid*";
- break;
- default:
- g_return_val_if_reached (NULL);
- break;
- }
-}
-
-/* Emit the proper signals for the error, and fill in err */
-static gboolean
-handle_error (GConfClient* client, GError* error, GError** err)
-{
- if (error != NULL)
- {
- gconf_client_error(client, error);
-
- if (err == NULL)
- {
- gconf_client_unreturned_error(client, error);
-
- g_error_free(error);
- }
- else
- *err = error;
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-check_type (const gchar* key, GConfValue* val, GConfValueType t, GError** err)
-{
- if (val->type != t)
- {
- /*
- gconf_set_error(err, GCONF_ERROR_TYPE_MISMATCH,
- _("Expected `%s' got `%s' for key %s"),
- gconf_value_type_to_string(t),
- gconf_value_type_to_string(val->type),
- key);
- */
- g_set_error (err, GCONF_ERROR, GCONF_ERROR_TYPE_MISMATCH,
- _("Expected `%s' got `%s' for key %s"),
- gconf_value_type_to_string(t),
- gconf_value_type_to_string(val->type),
- key);
-
- return FALSE;
- }
- else
- return TRUE;
-}
-
-static gboolean
-gconf_client_get_bool_with_default (GConfClient* client, const gchar* key,
- gboolean def, GError** err)
-{
- GError* error = NULL;
- GConfValue* val;
-
- g_return_val_if_fail (err == NULL || *err == NULL, def);
-
- val = gconf_client_get (client, key, &error);
-
- if (val != NULL)
- {
- gboolean retval = def;
-
- g_return_val_if_fail (error == NULL, retval);
-
- if (check_type (key, val, GCONF_VALUE_BOOL, &error))
- retval = gconf_value_get_bool (val);
- else
- handle_error (client, error, err);
-
- gconf_value_free (val);
-
- return retval;
- }
- else
- {
- if (error != NULL)
- handle_error (client, error, err);
- return def;
- }
-}
-
-static gchar*
-gconf_client_get_string_with_default (GConfClient* client, const gchar* key,
- const gchar* def, GError** err)
-{
- GError* error = NULL;
- gchar* val;
-
- g_return_val_if_fail (err == NULL || *err == NULL, def ? g_strdup (def) : NULL);
-
- val = gconf_client_get_string (client, key, &error);
-
- if (val != NULL)
- {
- g_return_val_if_fail (error == NULL, def ? g_strdup (def) : NULL);
-
- return val;
- }
- else
- {
- if (error != NULL)
- handle_error (client, error, err);
- return def ? g_strdup (def) : NULL;
- }
-}
-
-static gint
-gconf_client_get_int_with_default (GConfClient* client, const gchar* key,
- gint def, GError** err)
-{
- GError* error = NULL;
- GConfValue* val;
-
- g_return_val_if_fail (err == NULL || *err == NULL, def);
-
- val = gconf_client_get (client, key, &error);
-
- if (val != NULL)
- {
- gint retval = def;
-
- g_return_val_if_fail (error == NULL, def);
-
- if (check_type (key, val, GCONF_VALUE_INT, &error))
- retval = gconf_value_get_int(val);
- else
- handle_error (client, error, err);
-
- gconf_value_free (val);
-
- return retval;
- }
- else
- {
- if (error != NULL)
- handle_error (client, error, err);
- return def;
- }
+DEFINE_STRING_PREF (po_directory,
+ GPM_PO_DIRECTORY)
+
+DEFINE_INT_PREF (restrict_to_filename,
+ GPM_RESTRICT_TO_FILENAME)
+
+DEFINE_STRING_PREF (filename_restriction,
+ GPM_FILENAME_RESTRICTION)
+
+DEFINE_INT_PREF (max_missing_words,
+ GPM_MAX_MISSING_WORDS)
+
+DEFINE_INT_PREF (max_length_diff,
+ GPM_MAX_LENGTH_DIFF)
+
+/* UI */
+
+/* pane_switcher_style requires custom functions to deal with conversion from a
+ string to an enum */
+GdlSwitcherStyle
+gtranslator_prefs_manager_get_pane_switcher_style (void)
+{
+ GdlSwitcherStyle pane_switcher_style;
+ const gchar *v;
+
+ v = gtranslator_prefs_manager_get_string (GPM_PANE_SWITCHER_STYLE);
+ if (!g_strcmp0(v, "icons"))
+ pane_switcher_style = GDL_SWITCHER_STYLE_ICON;
+ else if (!g_strcmp0(v, "text"))
+ pane_switcher_style = GDL_SWITCHER_STYLE_TEXT;
+ else if (!g_strcmp0(v, "icons_and_text"))
+ pane_switcher_style = GDL_SWITCHER_STYLE_BOTH;
+ else if (!g_strcmp0(v, "tabs"))
+ pane_switcher_style = GDL_SWITCHER_STYLE_TABS;
+ else if (!g_strcmp0(v, "system"))
+ pane_switcher_style = GDL_SWITCHER_STYLE_TOOLBAR;
+ else
+ pane_switcher_style = GDL_SWITCHER_STYLE_BOTH;
+
+ return pane_switcher_style;
+}
+
+void
+gtranslator_prefs_manager_set_pane_switcher_style (GdlSwitcherStyle pane_switcher_style)
+{
+ const gchar *v;
+
+ switch (pane_switcher_style) {
+ case GDL_SWITCHER_STYLE_ICON:
+ v = "icons";
+ break;
+
+ case GDL_SWITCHER_STYLE_TEXT:
+ v = "text";
+ break;
+
+ case GDL_SWITCHER_STYLE_TABS:
+ v = "tabs";
+ break;
+
+ case GDL_SWITCHER_STYLE_TOOLBAR:
+ v = "system";
+ break;
+
+ case GDL_SWITCHER_STYLE_BOTH:
+ default:
+ v = "icons_and_text";
+ }
+ gtranslator_prefs_manager_set_string (GPM_PANE_SWITCHER_STYLE,
+ v);
}
+DEFINE_STRING_PREF (color_scheme,
+ GPM_COLOR_SCHEME)
+
+/* sort_order requires custom functions to deal with conversion from a string to
+ an enum */
+GtranslatorSortOrder
+gtranslator_prefs_manager_get_sort_order (void)
+{
+ GtranslatorSortOrder sort_order;
+ const gchar *v;
+
+ v = gtranslator_prefs_manager_get_string (GPM_SORT_ORDER);
+ if (!g_strcmp0(v, "status"))
+ sort_order = GTR_SORT_ORDER_STATUS;
+ else if (!g_strcmp0(v, "id"))
+ sort_order = GTR_SORT_ORDER_ID;
+ else if (!g_strcmp0(v, "original_text"))
+ sort_order = GTR_SORT_ORDER_ORIGINAL_TEXT;
+ else if (!g_strcmp0(v, "translated_text"))
+ sort_order = GTR_SORT_ORDER_TRANSLATED_TEXT;
+ else
+ sort_order = GTR_SORT_ORDER_ID;
+
+ return sort_order;
+}
+
+void
+gtranslator_prefs_manager_set_sort_order (GtranslatorSortOrder sort_order)
+{
+ const gchar *v;
+
+ switch (sort_order) {
+ case GTR_SORT_ORDER_STATUS:
+ v = "status";
+ break;
+
+ case GTR_SORT_ORDER_ORIGINAL_TEXT:
+ v = "original_text";
+ break;
+
+ case GTR_SORT_ORDER_TRANSLATED_TEXT:
+ v = "translated_text";
+ break;
+
+ case GTR_SORT_ORDER_ID:
+ default:
+ v = "id";
+ }
+ gtranslator_prefs_manager_set_string (GPM_SORT_ORDER,
+ v);
+}
Modified: trunk/src/prefs-manager.h
==============================================================================
--- trunk/src/prefs-manager.h (original)
+++ trunk/src/prefs-manager.h Sat Nov 15 16:37:16 2008
@@ -33,207 +33,128 @@
#include <glib.h>
-#define GTR_BASE_KEY "/apps/gtranslator"
-
-#define GPM_PREFS_DIR GTR_BASE_KEY "/preferences"
+#include <gdl/gdl-switcher.h>
-#define GPM_HEADER GTR_BASE_KEY "/header"
-
-/* Files */
-#define GPM_GENERAL_DIR GPM_PREFS_DIR "/files/general"
-#define GPM_WARN_IF_FUZZY GPM_GENERAL_DIR "/warn_if_fuzzy"
-#define GPM_DELETE_COMPILED GPM_GENERAL_DIR "/delete_compiled"
-
-#define GPM_AUTOSAVE_DIR GPM_PREFS_DIR "/files/autosave"
-#define GPM_AUTOSAVE GPM_AUTOSAVE_DIR "/autosave"
-#define GPM_AUTOSAVE_INTERVAL GPM_AUTOSAVE_DIR "/autosave_interval"
-#define GPM_CREATE_BACKUP GPM_AUTOSAVE_DIR "/create_backup"
-
-/* Editor */
-#define GPM_TEXT_DISPLAY_DIR GPM_PREFS_DIR "/editor/text_display"
-#define GPM_HIGHLIGHT GPM_TEXT_DISPLAY_DIR "/highlight"
-#define GPM_VISIBLE_WHITESPACE GPM_TEXT_DISPLAY_DIR "/visible_whitespace"
-#define GPM_FONT_DIR GPM_TEXT_DISPLAY_DIR "/fonts"
-#define GPM_USE_CUSTOM_FONT GPM_FONT_DIR "/use_custom_font"
-#define GPM_EDITOR_FONT GPM_FONT_DIR "/editor_font"
-
-#define GPM_CONTENTS_DIR GPM_PREFS_DIR "/editor/contents"
-#define GPM_UNMARK_FUZZY GPM_CONTENTS_DIR "/unmark_fuzzy"
-#define GPM_KEEP_OBSOLETE GPM_CONTENTS_DIR "/keep_obsolete"
-#define GPM_SPELLCHECK GPM_CONTENTS_DIR "/spellcheck"
-
-/* Edit Header */
-#define GPM_TAKE_MY_OPTIONS GPM_HEADER "/take_my_options"
-
-/* PO header */
-#define GPM_PERSONAL_INFORMATION_DIR GPM_PREFS_DIR "/po_header/personal_information"
-#define GPM_NAME GPM_PERSONAL_INFORMATION_DIR "/name"
-#define GPM_EMAIL GPM_PERSONAL_INFORMATION_DIR "/email"
-
-#define GPM_LANGUAGE_SETTINGS_DIR GPM_PREFS_DIR "/po_header/language_settings"
-#define GPM_LANGUAGE GPM_LANGUAGE_SETTINGS_DIR "/language"
-#define GPM_LANGCODE GPM_LANGUAGE_SETTINGS_DIR "/langcode"
-#define GPM_CHARSET GPM_LANGUAGE_SETTINGS_DIR "/charset"
-#define GPM_TRANSFER_ENCODING GPM_LANGUAGE_SETTINGS_DIR "/transfer_encoding"
-#define GPM_TEAM_EMAIL GPM_LANGUAGE_SETTINGS_DIR "/team_email"
-
-/* 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"
-
-/*FIXME: With profiles i think that this has to change*/
-#define GPM_PLURAL_FORM GPM_LANGUAGE_SETTINGS_DIR "/plural_form"
-
-/* Interface */
-#define GPM_INTERFACE_DIR GPM_PREFS_DIR "/interface"
-#define GPM_GDL_STYLE GPM_INTERFACE_DIR "/gdl_style"
-#define GPM_SCHEME_COLOR GPM_INTERFACE_DIR "/scheme_color"
+/* Useful enum for sort order pref */
+typedef enum
+{
+ GTR_SORT_ORDER_STATUS,
+ GTR_SORT_ORDER_ID,
+ GTR_SORT_ORDER_ORIGINAL_TEXT,
+ GTR_SORT_ORDER_TRANSLATED_TEXT
+} GtranslatorSortOrder;
-/* Fallback default values. Keep in sync with gtranslator.schemas */
+#define GTR_BASE_KEY "/apps/gtranslator"
+#define GPM_PREFS_DIR GTR_BASE_KEY "/preferences"
/* Files */
-#define GPM_DEFAULT_WARN_IF_FUZZY 0 /* FALSE */
-#define GPM_DEFAULT_DELETE_COMPILED 0 /* FALSE */
+#define GPM_FILES_DIR GPM_PREFS_DIR "/files"
-#define GPM_DEFAULT_AUTOSAVE 0 /* FALSE */
-#define GPM_DEFAULT_AUTOSAVE_INTERVAL 4
-#define GPM_DEFAULT_CREATE_BACKUP 0 /* FALSE */
+#define GPM_WARN_IF_CONTAINS_FUZZY GPM_FILES_DIR "/warn_if_contains_fuzzy"
+#define GPM_DELETE_COMPILED GPM_FILES_DIR "/delete_compiled"
+#define GPM_AUTOSAVE GPM_FILES_DIR "/autosave"
+#define GPM_AUTOSAVE_INTERVAL GPM_FILES_DIR "/autosave_interval"
+#define GPM_CREATE_BACKUP GPM_FILES_DIR "/create_backup"
+#define GPM_USE_PROFILE_VALUES GPM_FILES_DIR "/use_profile_values"
/* Editor */
-#define GPM_DEFAULT_HIGHLIGHT 1 /* TRUE */
-#define GPM_DEFAULT_VISIBLE_WHITESPACE 1 /* TRUE */
-#define GPM_DEFAULT_USE_CUSTOM_FONT 0 /* FALSE */
-#define GPM_DEFAULT_EDITOR_FONT (const gchar*) "Sans 10"
-
-#define GPM_DEFAULT_UNMARK_FUZZY 1 /* TRUE */
-#define GPM_DEFAULT_KEEP_OBSOLETE 0 /* FALSE */
-#define GPM_DEFAULT_SPELLCHECK 1 /* TRUE */
-
-/* Edit Header */
-#define GPM_DEFAULT_TAKE_MY_OPTIONS 0 /*FALSE */
-
-/* PO header */
-#define GPM_DEFAULT_NAME (const gchar*) ""
-#define GPM_DEFAULT_EMAIL (const gchar*) ""
-
-/*#define GPM_AUTHORS_LANGUAGE GPM_LANGUAGE_SETTINGS_DIR "/authors_language"
-#define GPM_LCODE GPM_LANGUAGE_SETTINGS_DIR "/lcode"
-#define GPM_MIME_TYPE GPM_LANGUAGE_SETTINGS_DIR "/mime_type"
-#define GPM_ENCODING GPM_LANGUAGE_SETTINGS_DIR "/encoding"
-#define GPM_LG_EMAIL GPM_LANGUAGE_SETTINGS_DIR "/lg_email"*/
-#define GPM_DEFAULT_PLURAL_FORM (const gchar*) ""
-
-/* Interface */
-#define GPM_DEFAULT_GDL_STYLE 2 //Both icons and text
-#define GPM_DEFAULT_SCHEME_COLOR "classic"
+#define GPM_EDITOR_DIR GPM_PREFS_DIR "/editor"
+
+#define GPM_HIGHLIGHT_SYNTAX GPM_EDITOR_DIR "/highlight_syntax"
+#define GPM_VISIBLE_WHITESPACE GPM_EDITOR_DIR "/visible_whitespace"
+#define GPM_USE_CUSTOM_FONT GPM_EDITOR_DIR "/use_custom_font"
+#define GPM_EDITOR_FONT GPM_EDITOR_DIR "/editor_font"
+#define GPM_UNMARK_FUZZY_WHEN_CHANGED GPM_EDITOR_DIR "/unmark_fuzzy_when_changed"
+#define GPM_SPELLCHECK GPM_EDITOR_DIR "/spellcheck"
/* 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
+#define GPM_TM_DIR GPM_PREFS_DIR "/tm"
+
+#define GPM_PO_DIRECTORY GPM_TM_DIR "/po_directory"
+#define GPM_RESTRICT_TO_FILENAME GPM_TM_DIR "/restrict_to_filename"
+#define GPM_FILENAME_RESTRICTION GPM_TM_DIR "/filename_restriction"
+#define GPM_MAX_MISSING_WORDS GPM_TM_DIR "/max_missing_words"
+#define GPM_MAX_LENGTH_DIFF GPM_TM_DIR "/max_length_diff"
+
+/* User Interface */
+#define GPM_UI_DIR GPM_PREFS_DIR "/ui"
+
+#define GPM_PANE_SWITCHER_STYLE GPM_UI_DIR "/pane_switcher_style"
+#define GPM_COLOR_SCHEME GPM_UI_DIR "/color_scheme"
+#define GPM_SORT_ORDER GPM_UI_DIR "/sort_order"
/** LIFE CYCLE MANAGEMENT FUNCTIONS **/
-gboolean gtranslator_prefs_manager_init (void);
+void gtranslator_prefs_manager_init (void);
/* This function must be called before exiting gtranslator */
-void gtranslator_prefs_manager_shutdown (void);
+void gtranslator_prefs_manager_shutdown (void);
/** PREFS MANAGEMENT FUNCTIONS **/
-/* Use preferences for header */
-void gtranslator_prefs_manager_set_take_my_options (gboolean take_options);
-gboolean gtranslator_prefs_manager_get_take_my_options (void);
-
-/* Warn if fuzzy*/
-void gtranslator_prefs_manager_set_warn_if_fuzzy (gboolean wif);
-gboolean gtranslator_prefs_manager_get_warn_if_fuzzy (void);
-
-/*Delete compiled*/
-void gtranslator_prefs_manager_set_delete_compiled (gboolean scf);
-gboolean gtranslator_prefs_manager_get_delete_compiled (void);
-
-/*Autosave*/
-void gtranslator_prefs_manager_set_autosave (gboolean autosave);
-gboolean gtranslator_prefs_manager_get_autosave (void);
+/* Files */
+void gtranslator_prefs_manager_set_warn_if_contains_fuzzy (gboolean warn_if_contains_fuzzy);
+gboolean gtranslator_prefs_manager_get_warn_if_contains_fuzzy (void);
-/*Autosave interval*/
-void gtranslator_prefs_manager_set_autosave_interval (gint timeout);
-gint gtranslator_prefs_manager_get_autosave_interval (void);
+void gtranslator_prefs_manager_set_delete_compiled (gboolean delete_compiled);
+gboolean gtranslator_prefs_manager_get_delete_compiled (void);
-/*Create backup*/
-void gtranslator_prefs_manager_set_create_backup (gboolean backup);
-gboolean gtranslator_prefs_manager_get_create_backup (void);
+void gtranslator_prefs_manager_set_autosave (gboolean autosave);
+gboolean gtranslator_prefs_manager_get_autosave (void);
-/*Highlight*/
-void gtranslator_prefs_manager_set_highlight (gboolean highlight);
-gboolean gtranslator_prefs_manager_get_highlight (void);
+void gtranslator_prefs_manager_set_autosave_interval (gint autosave_interval);
+gint gtranslator_prefs_manager_get_autosave_interval (void);
-/*Visible whitespace*/
-void gtranslator_prefs_manager_set_visible_whitespace (gboolean udc);
-gboolean gtranslator_prefs_manager_get_visible_whitespace (void);
+void gtranslator_prefs_manager_set_create_backup (gboolean create_backup);
+gboolean gtranslator_prefs_manager_get_create_backup (void);
-/*Use custom font*/
-void gtranslator_prefs_manager_set_use_custom_font (gboolean use_custom_font);
-gboolean gtranslator_prefs_manager_get_use_custom_font (void);
+void gtranslator_prefs_manager_set_use_profile_values (gboolean use_profile_values);
+gboolean gtranslator_prefs_manager_get_use_profile_values (void);
-/*Editor font*/
-void gtranslator_prefs_manager_set_editor_font (const gchar *font);
-const gchar * gtranslator_prefs_manager_get_editor_font (void);
+/* Editor */
+void gtranslator_prefs_manager_set_highlight_syntax (gboolean highlight_syntax);
+gboolean gtranslator_prefs_manager_get_highlight_syntax (void);
-/*Unmark fuzzy*/
-void gtranslator_prefs_manager_set_unmark_fuzzy (gboolean unmark);
-gboolean gtranslator_prefs_manager_get_unmark_fuzzy (void);
+void gtranslator_prefs_manager_set_visible_whitespace (gboolean visible_whitespace);
+gboolean gtranslator_prefs_manager_get_visible_whitespace (void);
-/*Spellcheck*/
-void gtranslator_prefs_manager_set_spellcheck (gboolean spell_checking);
-gboolean gtranslator_prefs_manager_get_spellcheck (void);
+void gtranslator_prefs_manager_set_use_custom_font (gboolean use_custom_font);
+gboolean gtranslator_prefs_manager_get_use_custom_font (void);
-/*Name*/
-void gtranslator_prefs_manager_set_name (const gchar *name);
-const gchar * gtranslator_prefs_manager_get_name (void);
+void gtranslator_prefs_manager_set_editor_font (const gchar *editor_font);
+const gchar * gtranslator_prefs_manager_get_editor_font (void);
-/*Email*/
-void gtranslator_prefs_manager_set_email (const gchar *email);
-const gchar * gtranslator_prefs_manager_get_email (void);
+void gtranslator_prefs_manager_set_unmark_fuzzy_when_changed (gboolean unmark_fuzzy_when_changed);
+gboolean gtranslator_prefs_manager_get_unmark_fuzzy_when_changed (void);
-/*Plural form*/
-void gtranslator_prefs_manager_set_plural_form (const gchar *plural_form);
-const gchar * gtranslator_prefs_manager_get_plural_form (void);
+void gtranslator_prefs_manager_set_spellcheck (gboolean spellcheck);
+gboolean gtranslator_prefs_manager_get_spellcheck (void);
-/*Gdl style*/
-void gtranslator_prefs_manager_set_gdl_style (gint style);
-gint gtranslator_prefs_manager_get_gdl_style (void);
+/* Translation memory */
+void gtranslator_prefs_manager_set_po_directory (const gchar *po_directory);
+const gchar * gtranslator_prefs_manager_get_po_directory (void);
-/*Scheme color*/
-void gtranslator_prefs_manager_set_scheme_color (const gchar *scheme);
-const gchar * gtranslator_prefs_manager_get_scheme_color (void);
+void gtranslator_prefs_manager_set_restrict_to_filename (gboolean restrict_to_filename);
+gboolean gtranslator_prefs_manager_get_restrict_to_filename (void);
-/*Translation Memory*/
-void gtranslator_prefs_manager_set_tm_dir (const gchar *dir);
-const gchar * gtranslator_prefs_manager_get_tm_dir (void);
+void gtranslator_prefs_manager_set_filename_restriction (const gchar *filename_restriction);
+const gchar * gtranslator_prefs_manager_get_filename_restriction (void);
-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_max_missing_words (gint max_missing_words);
+gint gtranslator_prefs_manager_get_max_missing_words (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_max_length_diff (gint max_length_diff);
+gint gtranslator_prefs_manager_get_max_length_diff (void);
-void gtranslator_prefs_manager_set_use_lang_profile (gboolean use_lang_profile);
-gboolean gtranslator_prefs_manager_get_use_lang_profile (void);
+/* UI */
+void gtranslator_prefs_manager_set_pane_switcher_style (GdlSwitcherStyle pane_switcher_style);
+GdlSwitcherStyle gtranslator_prefs_manager_get_pane_switcher_style (void);
-void gtranslator_prefs_manager_set_missing_words (gint timeout);
-gint gtranslator_prefs_manager_get_missing_words (void);
+void gtranslator_prefs_manager_set_color_scheme (const gchar *color_scheme);
+const gchar * gtranslator_prefs_manager_get_color_scheme (void);
-void gtranslator_prefs_manager_set_sentence_length (gint timeout);
-gint gtranslator_prefs_manager_get_sentence_length (void);
+void gtranslator_prefs_manager_set_sort_order (GtranslatorSortOrder sort_order);
+GtranslatorSortOrder gtranslator_prefs_manager_get_sort_order (void);
-#endif /* __GTR_PREFS_MANAGER_H__ */
+#endif /* __GTR_PREFS_MANAGER_H__ */
Modified: trunk/src/tab.c
==============================================================================
--- trunk/src/tab.c (original)
+++ trunk/src/tab.c Sat Nov 15 16:37:16 2008
@@ -258,7 +258,7 @@
msg = msg_aux->data;
buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tab->priv->trans_msgstr[0]));
- if(gtranslator_msg_is_fuzzy(msg) && gtranslator_prefs_manager_get_unmark_fuzzy())
+ if(gtranslator_msg_is_fuzzy(msg) && gtranslator_prefs_manager_get_unmark_fuzzy_when_changed())
gtranslator_msg_set_fuzzy(msg, FALSE);
if(textbuffer == buf)
@@ -787,7 +787,7 @@
tab->priv->autosave_interval = gtranslator_prefs_manager_get_autosave_interval ();
if (tab->priv->autosave_interval <= 0)
- tab->priv->autosave_interval = GPM_DEFAULT_AUTOSAVE_INTERVAL;
+ tab->priv->autosave_interval = 1;
}
static void
Modified: trunk/src/translation-memory/translation-memory-ui.c
==============================================================================
--- trunk/src/translation-memory/translation-memory-ui.c (original)
+++ trunk/src/translation-memory/translation-memory-ui.c Sat Nov 15 16:37:16 2008
@@ -141,88 +141,82 @@
window = gtranslator_application_get_active_window (GTR_APP);
tm_menu = gtranslator_window_get_tm_menu (window);
- if (!gtranslator_prefs_manager_get_show_tm_options () && gtranslator_msg_is_translated (msg)
- && !gtranslator_msg_is_fuzzy (msg)) {
- gtk_widget_set_sensitive (tm_menu, FALSE);
- gtk_list_store_clear (model);
- return;
- }else {
- g_signal_connect (tm_ui->priv->tree_view,
+ g_signal_connect (tm_ui->priv->tree_view,
"size_allocate",
G_CALLBACK (tree_view_size_cb),
tm_ui->priv->tree_view);
+
+ msgid = gtranslator_msg_get_msgid (msg);
+
+ tm = GTR_TRANSLATION_MEMORY (gtranslator_application_get_translation_memory (GTR_APP));
+
+ tm_list = gtranslator_translation_memory_lookup (tm, msgid);
+
+ if (tm_list == NULL) {
+ gtk_widget_set_sensitive (tm_menu, FALSE);
+ } else {
+ gtk_widget_set_sensitive (tm_menu, TRUE);
+ }
- msgid = gtranslator_msg_get_msgid (msg);
-
- tm = GTR_TRANSLATION_MEMORY (gtranslator_application_get_translation_memory (GTR_APP));
-
- tm_list = gtranslator_translation_memory_lookup (tm, msgid);
-
- if (tm_list == NULL) {
- gtk_widget_set_sensitive (tm_menu, FALSE);
- } else {
- gtk_widget_set_sensitive (tm_menu, TRUE);
- }
-
- gtk_list_store_clear (model);
+ gtk_list_store_clear (model);
- g_strfreev (tm_ui->priv->tm_list);
- tm_ui->priv->tm_list = g_new (gchar *, MAX_ELEMENTS + 1);
-
- for (l = tm_list; l; l = l->next) {
- GtranslatorTranslationMemoryMatch *match;
- match = (GtranslatorTranslationMemoryMatch *)l->data;
- tm_ui->priv->tm_list[i-1] = g_strdup (match->match);
- level_column = gtk_tree_view_get_column (GTK_TREE_VIEW (tm_ui->priv->tree_view), 0);
- renderers_list = gtk_tree_view_column_get_cell_renderers (level_column);
-
- g_object_set (renderers_list->data,
- "accel-mods", GDK_CONTROL_MASK,
- NULL);
- g_list_free (renderers_list);
-
- gtk_list_store_append (model, &iter);
- gtk_list_store_set (model,
- &iter,
- SHORTCUT_COLUMN,
+ g_strfreev (tm_ui->priv->tm_list);
+ tm_ui->priv->tm_list = g_new (gchar *, MAX_ELEMENTS + 1);
+
+ for (l = tm_list; l; l = l->next) {
+ GtranslatorTranslationMemoryMatch *match;
+ match = (GtranslatorTranslationMemoryMatch *)l->data;
+ tm_ui->priv->tm_list[i-1] = g_strdup (match->match);
+ level_column = gtk_tree_view_get_column (GTK_TREE_VIEW (tm_ui->priv->tree_view), 0);
+ renderers_list = gtk_tree_view_column_get_cell_renderers (level_column);
+
+ g_object_set (renderers_list->data,
+ "accel-mods", GDK_CONTROL_MASK,
+ NULL);
+ g_list_free (renderers_list);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model,
+ &iter,
+ SHORTCUT_COLUMN,
GDK_0+k,
- STRING_COLUMN,
- match->match,
- LEVEL_COLUMN,
- match->level,
- -1);
- i++;
- k++;
- if (k == MAX_ELEMENTS)
- break;
- }
-
- /* Ensure last element is NULL */
- tm_ui->priv->tm_list[i-1] = NULL;
-
- /* MenuBar stuff */
-
- items_menu = gtk_menu_new();
+ STRING_COLUMN,
+ match->match,
+ LEVEL_COLUMN,
+ match->level,
+ -1);
+ i++;
+ k++;
+ if (k == MAX_ELEMENTS)
+ break;
+ }
+
+ /* Ensure last element is NULL */
+ tm_ui->priv->tm_list[i-1] = NULL;
+
+ /* MenuBar stuff */
+
+ items_menu = gtk_menu_new();
+
+ manager = gtranslator_window_get_ui_manager (window);
+
+ gtk_menu_set_accel_group (GTK_MENU (items_menu),
+ gtk_ui_manager_get_accel_group(manager));
+
+ do{
+ gchar *accel_path;
+
+ item_name = g_strdup_printf (_("Insert Option n %d"), j);
+
+ tm_item = gtk_menu_item_new_with_label (item_name);
+ g_object_set_data (G_OBJECT (tm_item), "option", GINT_TO_POINTER (j));
+ gtk_widget_show (tm_item);
- manager = gtranslator_window_get_ui_manager (window);
+ accel_path = g_strdup_printf ("<Gtranslator-sheet>/Edit/_Translation Memory/%s", item_name);
- gtk_menu_set_accel_group (GTK_MENU (items_menu),
- gtk_ui_manager_get_accel_group(manager));
+ gtk_menu_item_set_accel_path (GTK_MENU_ITEM (tm_item), accel_path);
+ gtk_accel_map_add_entry (accel_path, GDK_0+(j-1), GDK_CONTROL_MASK);
- do{
- gchar *accel_path;
-
- item_name = g_strdup_printf (_("Insert Option n %d"), j);
-
- tm_item = gtk_menu_item_new_with_label (item_name);
- g_object_set_data (G_OBJECT (tm_item), "option", GINT_TO_POINTER (j));
- gtk_widget_show (tm_item);
-
- accel_path = g_strdup_printf ("<Gtranslator-sheet>/Edit/_Translation Memory/%s", item_name);
-
- gtk_menu_item_set_accel_path (GTK_MENU_ITEM (tm_item), accel_path);
- gtk_accel_map_add_entry (accel_path, GDK_0+(j-1), GDK_CONTROL_MASK);
-
g_free (accel_path);
g_free (item_name);
@@ -231,19 +225,18 @@
tm_ui);
gtk_menu_shell_append (GTK_MENU_SHELL (items_menu), tm_item);
-
+
j++;
if (j > MAX_ELEMENTS)
break;
-
- }while ((tm_list = g_list_next (tm_list)));
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (tm_menu), items_menu);
-
- /* Freeing the list */
- g_list_foreach (tm_list, (GFunc)free_list, NULL);
- g_list_free (tm_list);
- }
+
+ }while ((tm_list = g_list_next (tm_list)));
+
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (tm_menu), items_menu);
+
+ /* Freeing the list */
+ g_list_foreach (tm_list, (GFunc)free_list, NULL);
+ g_list_free (tm_list);
}
static void
Modified: trunk/src/view.c
==============================================================================
--- trunk/src/view.c (original)
+++ trunk/src/view.c Sat Nov 15 16:37:16 2008
@@ -127,7 +127,7 @@
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD);
//Set syntax highlight according to preferences
- gtk_source_buffer_set_highlight_syntax(priv->buffer, gtranslator_prefs_manager_get_highlight());
+ gtk_source_buffer_set_highlight_syntax(priv->buffer, gtranslator_prefs_manager_get_highlight_syntax());
//Set dot char according to preferences
@@ -396,7 +396,7 @@
g_return_if_fail (GTR_IS_VIEW (view));
if (def)
- font_name = g_strdup(GPM_DEFAULT_EDITOR_FONT);
+ font_name = g_strdup("Sans 10");
g_return_if_fail (font_name != NULL);
@@ -827,7 +827,7 @@
buf = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
manager = gtk_source_style_scheme_manager_get_default ();
- scheme_id = gtranslator_prefs_manager_get_scheme_color ();
+ scheme_id = gtranslator_prefs_manager_get_color_scheme ();
scheme = gtk_source_style_scheme_manager_get_scheme (manager, scheme_id);
gtk_source_buffer_set_style_scheme (buf, scheme);
Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c (original)
+++ trunk/src/window.c Sat Nov 15 16:37:16 2008
@@ -1420,7 +1420,7 @@
priv->layout_manager = gdl_dock_layout_new (GDL_DOCK (priv->dock));
g_object_set (priv->layout_manager->master,
"switcher-style",
- gtranslator_prefs_manager_get_gdl_style (),
+ gtranslator_prefs_manager_get_pane_switcher_style (),
NULL);
g_signal_connect (priv->layout_manager,
"notify::dirty",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]