[gnome-subtitles] Allow to reset the preferences to defaults
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Allow to reset the preferences to defaults
- Date: Sun, 7 Feb 2010 22:48:29 +0000 (UTC)
commit ef83f6b3f23a324fc8d02130916632b05c30d348
Author: Pedro Castro <mail>
Date: Sat Feb 6 18:07:52 2010 +0000
Allow to reset the preferences to defaults
data/gnome-subtitles.schemas | 2 +-
src/Glade/PreferencesDialog.glade | 40 ++++++++++++++------
src/GnomeSubtitles/Core/Config.cs | 2 +-
src/GnomeSubtitles/Dialog/PreferencesDialog.cs | 22 +++++++++++
.../Ui/Component/NewlineTypeComboBox.cs | 6 +++
5 files changed, 58 insertions(+), 14 deletions(-)
---
diff --git a/data/gnome-subtitles.schemas b/data/gnome-subtitles.schemas
index 79fe96d..2dd49fc 100644
--- a/data/gnome-subtitles.schemas
+++ b/data/gnome-subtitles.schemas
@@ -106,7 +106,7 @@
<applyto>/apps/gnome-subtitles/preferences/defaults/file_open_fallback</applyto>
<owner>gnome-subtitles</owner>
<type>string</type>
- <default>ISO-8859-15</default>
+ <default>CurrentLocale</default>
<locale name="C">
<short>Auto detection fallback encoding</short>
<long>Encoding to use when auto detection fails.</long>
diff --git a/src/Glade/PreferencesDialog.glade b/src/Glade/PreferencesDialog.glade
index c70097d..9070be2 100644
--- a/src/Glade/PreferencesDialog.glade
+++ b/src/Glade/PreferencesDialog.glade
@@ -35,7 +35,7 @@
<property name="spacing">5</property>
<child>
<widget class="GtkCheckButton" id="translationSaveCheckButton">
- <property name="label" translatable="yes">When saving subtitles, also save their translation</property>
+ <property name="label" translatable="yes">When saving subtitles, also save their _translation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -91,7 +91,7 @@
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Character coding to use:</property>
+ <property name="label" translatable="yes">Character c_oding to use:</property>
<property name="use_underline">True</property>
</widget>
<packing>
@@ -111,7 +111,7 @@
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">If character coding auto detection fails, use:</property>
+ <property name="label" translatable="yes">If auto detection _fails, use:</property>
<property name="use_underline">True</property>
</widget>
<packing>
@@ -138,7 +138,7 @@
</child>
<child>
<widget class="GtkCheckButton" id="videoAutoChooseFileCheckButton">
- <property name="label" translatable="yes">Automatically choose _video file to open</property>
+ <property name="label" translatable="yes">Automatically choose the _video file to open</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -157,7 +157,7 @@
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="label" translatable="yes"><b>File _Open</b></property>
+ <property name="label" translatable="yes"><b>File Open</b></property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
</widget>
@@ -203,7 +203,7 @@
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Subtitle _format to use:</property>
+ <property name="label" translatable="yes">_Subtitle format to use:</property>
<property name="use_underline">True</property>
</widget>
<packing>
@@ -234,7 +234,7 @@
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Newline type to use:</property>
+ <property name="label" translatable="yes">_Newline type to use:</property>
<property name="use_underline">True</property>
</widget>
<packing>
@@ -261,7 +261,7 @@
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="label" translatable="yes"><b>File _Save As</b></property>
+ <property name="label" translatable="yes"><b>File Save As</b></property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
</widget>
@@ -285,24 +285,40 @@
<widget class="GtkHButtonBox" id="dialogActionArea">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
- <property name="layout_style">end</property>
+ <property name="layout_style">edge</property>
+ <child>
+ <widget class="GtkButton" id="buttonReset">
+ <property name="label" translatable="yes">_Reset to defaults</property>
+ <property name="response_id">-6</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<widget class="GtkButton" id="buttonClose">
<property name="label">gtk-close</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="receives_default">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
diff --git a/src/GnomeSubtitles/Core/Config.cs b/src/GnomeSubtitles/Core/Config.cs
index 4b0a6fd..2460ab1 100644
--- a/src/GnomeSubtitles/Core/Config.cs
+++ b/src/GnomeSubtitles/Core/Config.cs
@@ -124,7 +124,7 @@ public class Config {
}
public ConfigFileOpenFallbackEncoding PrefsDefaultsFileOpenFallbackEncoding {
- get { return (ConfigFileOpenFallbackEncoding)GetEnumValueFromSuperset(keyPrefsDefaultsFileOpenFallbackEncoding, ConfigFileOpenFallbackEncoding.Fixed); }
+ get { return (ConfigFileOpenFallbackEncoding)GetEnumValueFromSuperset(keyPrefsDefaultsFileOpenFallbackEncoding, ConfigFileOpenFallbackEncoding.CurrentLocale); }
set { Set(keyPrefsDefaultsFileOpenFallbackEncoding, value.ToString()); }
}
diff --git a/src/GnomeSubtitles/Dialog/PreferencesDialog.cs b/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
index 3bb93ae..aefb71e 100644
--- a/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
+++ b/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
@@ -40,6 +40,7 @@ public class PreferencesDialog : GladeDialog {
private NewlineTypeComboBox fileSaveNewline = null;
/* Widgets */
+ [WidgetAttribute] private CheckButton translationSaveCheckButton = null;
[WidgetAttribute] private CheckButton videoAutoChooseFileCheckButton = null;
[WidgetAttribute] private ComboBox fileOpenEncodingComboBox = null;
[WidgetAttribute] private ComboBox fileOpenFallbackEncodingComboBox = null;
@@ -146,6 +147,18 @@ public class PreferencesDialog : GladeDialog {
fileSaveNewline.SelectionChanged += OnDefaultsFileSaveNewlineChanged;
}
+ private void ResetDialogToDefaults () {
+ translationSaveCheckButton.Active = true;
+
+ fileOpenEncoding.ActiveSelection = 0; //Auto detect
+ fileOpenFallbackEncoding.ActiveSelection = 0; //Current Locale
+ videoAutoChooseFileCheckButton.Active = true;
+
+ fileSaveEncoding.ActiveSelection = 0; //Keep Existing
+ fileSaveFormat.ActiveSelection = 0; //Keep Existing
+ fileSaveNewline.ChosenNewlineType = Core.Util.GetSystemNewlineType();
+ }
+
/* Event members */
@@ -254,6 +267,15 @@ public class PreferencesDialog : GladeDialog {
Base.Config.PrefsVideoAutoChooseFile = videoAutoChooseFileCheckButton.Active;
}
+ protected override bool ProcessResponse (ResponseType response) {
+ if (response == ResponseType.Cancel) {
+ ResetDialogToDefaults();
+ return true;
+ }
+ else
+ return false;
+ }
+
}
}
diff --git a/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs b/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
index 0242a81..7528d77 100644
--- a/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
+++ b/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
@@ -66,6 +66,11 @@ public class NewlineTypeComboBox {
return (NewlineType)Enum.ToObject(typeof(NewlineType), newlineTypePosition);
}
}
+ set {
+ int actionCount = GetActionCount();
+ int position = (int)value - 1 + (actionCount > 0 ? actionCount + 1 : 0);
+ this.ActiveSelection = position;
+ }
}
public int ActiveSelection {
@@ -148,6 +153,7 @@ public class NewlineTypeComboBox {
}
}
+
/* Event members */
#pragma warning disable 169 //Disables warning about handlers not being used
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]