[gnome-subtitles/gtk3] Save dialog refactoring and migration to gtk3
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles/gtk3] Save dialog refactoring and migration to gtk3
- Date: Sat, 2 Dec 2017 23:17:21 +0000 (UTC)
commit d8ffd2e596a73b6f539364acada083384999d3bf
Author: Pedro Castro <pedro gnomesubtitles org>
Date: Sat Dec 2 23:16:22 2017 +0000
Save dialog refactoring and migration to gtk3
Also improved the Open dialog to show fields on a single line.
gnome-subtitles.csproj | 8 +-
src/Glade/{ => old.glade}/FileSaveAsDialog.glade | 0
.../FileSaveAsDialog.ui} | 88 +++++------
src/GnomeSubtitles/Dialog/FileOpenDialog.cs | 120 +++++++-------
src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs | 31 ----
...btitleFileSaveAsDialog.cs => FileSaveDialog.cs} | 172 +++++++++++---------
.../Dialog/FileTranslationOpenDialog.cs | 6 +-
.../Dialog/FileTranslationSaveDialog.cs | 49 ++++++
src/GnomeSubtitles/Dialog/PreferencesDialog.cs | 15 ++-
.../Dialog/TranslationSaveAsDialog.cs | 31 ----
src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs | 8 -
.../Ui/Component/EncodingComboBox.cs | 17 +--
.../Ui/Component/NewlineTypeComboBox.cs | 19 +--
.../Ui/Component/SubtitleFormatComboBox.cs | 38 +++--
src/GnomeSubtitles/Ui/MainUi.cs | 6 +-
src/SubLib/Core/Domain/SubtitleTypeInfo.cs | 24 +---
16 files changed, 299 insertions(+), 333 deletions(-)
---
diff --git a/gnome-subtitles.csproj b/gnome-subtitles.csproj
index 1a2a669..6ce1224 100644
--- a/gnome-subtitles.csproj
+++ b/gnome-subtitles.csproj
@@ -63,9 +63,6 @@
<EmbeddedResource Include="src\Glade\FilePropertiesDialog.glade">
<LogicalName>FilePropertiesDialog.glade</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="src\Glade\FileSaveAsDialog.glade">
- <LogicalName>FileSaveAsDialog.glade</LogicalName>
- </EmbeddedResource>
<EmbeddedResource Include="src\Glade\PreferencesDialog.glade">
<LogicalName>PreferencesDialog.glade</LogicalName>
</EmbeddedResource>
@@ -183,7 +180,6 @@
<Compile Include="src\GnomeSubtitles\Dialog\Dialogs.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\EncodingsDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\FilePropertiesDialog.cs" />
- <Compile Include="src\GnomeSubtitles\Dialog\FileSaveAsDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\FileTranslationOpenDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\HeadersDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\MessageDialog.cs" />
@@ -192,11 +188,9 @@
<Compile Include="src\GnomeSubtitles\Dialog\SetLanguageDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\SetTextLanguageDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\SetTranslationLanguageDialog.cs" />
- <Compile Include="src\GnomeSubtitles\Dialog\SubtitleFileSaveAsDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\TimingsAdjustDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\TimingsShiftDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\TimingsSynchronizeDialog.cs" />
- <Compile Include="src\GnomeSubtitles\Dialog\TranslationSaveAsDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\VideoSeekToDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\Unmanaged\BasicErrorDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\Unmanaged\ErrorDialog.cs" />
@@ -313,6 +307,8 @@
<Compile Include="src\GnomeSubtitles\Dialog\BuilderDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\FileOpenDialog.cs" />
<Compile Include="src\GnomeSubtitles\Dialog\VideoOpenDialog.cs" />
+ <Compile Include="src\GnomeSubtitles\Dialog\FileSaveDialog.cs" />
+ <Compile Include="src\GnomeSubtitles\Dialog\FileTranslationSaveDialog.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/src/Glade/FileSaveAsDialog.glade b/src/Glade/old.glade/FileSaveAsDialog.glade
similarity index 100%
copy from src/Glade/FileSaveAsDialog.glade
copy to src/Glade/old.glade/FileSaveAsDialog.glade
diff --git a/src/Glade/FileSaveAsDialog.glade b/src/Glade/old.glade/FileSaveAsDialog.ui
similarity index 77%
rename from src/Glade/FileSaveAsDialog.glade
rename to src/Glade/old.glade/FileSaveAsDialog.ui
index b4d751f..67fd0f1 100644
--- a/src/Glade/FileSaveAsDialog.glade
+++ b/src/Glade/old.glade/FileSaveAsDialog.ui
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<glade-interface>
+<interface>
<!-- interface-requires gtk+ 2.16 -->
<!-- interface-naming-policy toplevel-contextual -->
- <widget class="GtkFileChooserDialog" id="dialog">
+ <object class="GtkFileChooserDialog" id="dialog">
<property name="title" translatable="yes">Save As</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
@@ -14,51 +14,50 @@
<property name="action">save</property>
<property name="do_overwrite_confirmation">True</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="dialogVBox">
+ <object class="GtkVBox" id="dialogVBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<child>
- <widget class="GtkVBox" id="optionsVBox">
+ <object class="GtkVBox" id="optionsVBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
- <widget class="GtkTable" id="table">
+ <object class="GtkTable" id="table">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<property name="row_spacing">10</property>
<child>
- <widget class="GtkLabel" id="subtitleFormatLabel">
+ <object class="GtkLabel" id="subtitleFormatLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Subtitle Format:</property>
- </widget>
+ </object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="encodingLabel">
+ <object class="GtkLabel" id="encodingLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Character Coding:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="subtitleFormatComboBox">
+ <object class="GtkComboBox" id="subtitleFormatComboBox">
<property name="visible">True</property>
- <property name="items" translatable="yes"></property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -66,10 +65,9 @@
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="fileEncodingComboBox">
+ <object class="GtkComboBox" id="fileEncodingComboBox">
<property name="visible">True</property>
- <property name="items" translatable="yes"></property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -78,7 +76,7 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -86,20 +84,19 @@
</packing>
</child>
<child>
- <widget class="GtkExpander" id="expander">
+ <object class="GtkExpander" id="expander">
<property name="visible">True</property>
<property name="spacing">10</property>
<child>
- <widget class="GtkTable" id="expanderTable">
+ <object class="GtkTable" id="expanderTable">
<property name="visible">True</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<property name="row_spacing">10</property>
<child>
- <widget class="GtkComboBox" id="newlineTypeComboBox">
+ <object class="GtkComboBox" id="newlineTypeComboBox">
<property name="visible">True</property>
- <property name="items"></property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -107,35 +104,32 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="newlineTypeLabel">
+ <object class="GtkLabel" id="newlineTypeLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Newline Type:</property>
- </widget>
+ </object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
- </widget>
+ </object>
</child>
- <child>
- <widget class="GtkLabel" id="expanderLabel">
+ <child type="label">
+ <object class="GtkLabel" id="expanderLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Select advanced options</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -143,19 +137,18 @@
</packing>
</child>
<child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialogHBox">
+ <object class="GtkHButtonBox" id="dialogHBox">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <widget class="GtkButton" id="buttonCancel">
+ <object class="GtkButton" id="buttonCancel">
<property name="label">gtk-cancel</property>
- <property name="response_id">-6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -163,30 +156,33 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="buttonSave">
+ <object class="GtkButton" id="buttonSave">
<property name="label">gtk-save</property>
- <property name="response_id">-5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
-</glade-interface>
+ <action-widgets>
+ <action-widget response="-6">buttonCancel</action-widget>
+ <action-widget response="-5">buttonSave</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/GnomeSubtitles/Dialog/FileOpenDialog.cs b/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
index 6aaf7a0..d1b864e 100644
--- a/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
+++ b/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
@@ -32,7 +32,7 @@ using System.Text.RegularExpressions;
namespace GnomeSubtitles.Dialog {
public class FileOpenDialog : BaseDialog {
- protected FileChooserDialog dialog = null;
+ protected FileChooserDialog dialog;
private string chosenFilename = String.Empty;
private EncodingDescription chosenEncoding = EncodingDescription.Empty;
@@ -45,7 +45,6 @@ public class FileOpenDialog : BaseDialog {
private EncodingComboBox encodingComboBox = null;
/* Widgets */
- private ComboBoxText fileEncodingComboBox = null;
private ComboBoxText videoComboBox = null;
private Label videoLabel = null;
@@ -63,63 +62,6 @@ public class FileOpenDialog : BaseDialog {
base.Init(dialog);
}
- private void BuildDialog(string title) {
- dialog = new FileChooserDialog(title, Base.Ui.Window, FileChooserAction.Open,
- Util.GetStockLabel("gtk-cancel"), ResponseType.Cancel,
Util.GetStockLabel("gtk-open"), ResponseType.Ok);
-
- dialog.DefaultResponse = ResponseType.Ok;
-
- /* Build content area */
-
- Grid grid = new Grid();
- grid.RowSpacing = 6;
- grid.ColumnSpacing = 6;
- grid.BorderWidth = 6;
-
- Label encodingLabel = new Label(Catalog.GetString("Character Encoding:"));
- encodingLabel.Xalign = 0;
- grid.Attach(encodingLabel, 0, 0, 1, 1);
-
- this.videoLabel = new Label(Catalog.GetString("Video To Open:"));
- this.videoLabel.Xalign = 0;
- grid.Attach(this.videoLabel, 0, 1, 1, 1);
-
- this.fileEncodingComboBox = new ComboBoxText();
- this.fileEncodingComboBox.Hexpand = true;
- grid.Attach(this.fileEncodingComboBox, 1, 0, 1, 1);
- this.encodingComboBox = BuildEncodingComboBox();
-
- this.videoComboBox = new ComboBoxText();
- this.videoComboBox.Hexpand = true;
- grid.Attach(this.videoComboBox, 1, 1, 1, 1);
-
- dialog.ContentArea.Add(grid);
- dialog.ContentArea.ShowAll();
-
- /* Other stuff */
- SetFilters();
- dialog.SetCurrentFolder(GetStartFolder());
- }
-
- private EncodingComboBox BuildEncodingComboBox () {
- int fixedEncoding = -1;
- ConfigFileOpenEncoding encodingConfig = Base.Config.FileOpenEncoding;
- if (encodingConfig == ConfigFileOpenEncoding.Fixed) {
- string encodingName = Base.Config.FileOpenEncodingFixed;
- EncodingDescription encodingDescription = EncodingDescription.Empty;
- Encodings.Find(encodingName, ref encodingDescription);
- fixedEncoding = encodingDescription.CodePage;
- }
-
- EncodingComboBox comboBox = new EncodingComboBox(this.fileEncodingComboBox, true, null,
fixedEncoding);
-
- /* Only need to handle the case of currentLocale, as Fixed is handled before and AutoDetect
is the default behaviour */
- if (encodingConfig == ConfigFileOpenEncoding.CurrentLocale) {
- comboBox.ActiveSelection = (int)encodingConfig;
- }
-
- return comboBox;
- }
/* Overriden members */
@@ -127,6 +69,7 @@ public class FileOpenDialog : BaseDialog {
get { return DialogScope.Singleton; }
}
+
/* Public properties */
public EncodingDescription Encoding {
@@ -159,10 +102,64 @@ public class FileOpenDialog : BaseDialog {
/* Private members */
+ private void BuildDialog(string title) {
+ dialog = new FileChooserDialog(title, Base.Ui.Window, FileChooserAction.Open,
+ Util.GetStockLabel("gtk-cancel"), ResponseType.Cancel,
Util.GetStockLabel("gtk-open"), ResponseType.Ok);
+
+ dialog.DefaultResponse = ResponseType.Ok;
+
+ //Build content area
+
+ Box box = new Box(Orientation.Horizontal, 6);
+ box.BorderWidth = 6;
+
+ videoLabel = new Label(Catalog.GetString("Video To Open:"));
+ box.Add(videoLabel);
+ videoComboBox = new ComboBoxText();
+ videoComboBox.Hexpand = true;
+ CellRendererText videoComboBoxRenderer = (videoComboBox.Cells[0] as CellRendererText);
+ videoComboBoxRenderer.WidthChars = 20;
+ videoComboBoxRenderer.Ellipsize = Pango.EllipsizeMode.End;
+ box.Add(videoComboBox);
+
+ box.Add(new Label(Catalog.GetString("Character Encoding:")));
+
+ encodingComboBox = BuildEncodingComboBox();
+ box.Add(encodingComboBox.Widget);
+
+ dialog.ContentArea.Add(box);
+ dialog.ContentArea.ShowAll();
+
+ //Other stuff
+
+ SetFilters();
+ dialog.SetCurrentFolder(GetStartFolder());
+ }
+
+ private EncodingComboBox BuildEncodingComboBox () {
+ int fixedEncoding = -1;
+ ConfigFileOpenEncoding encodingConfig = Base.Config.FileOpenEncoding;
+ if (encodingConfig == ConfigFileOpenEncoding.Fixed) {
+ string encodingName = Base.Config.FileOpenEncodingFixed;
+ EncodingDescription encodingDescription = EncodingDescription.Empty;
+ Encodings.Find(encodingName, ref encodingDescription);
+ fixedEncoding = encodingDescription.CodePage;
+ }
+
+ EncodingComboBox comboBox = new EncodingComboBox(true, null, fixedEncoding);
+
+ /* Only need to handle the case of currentLocale, as Fixed is handled before and AutoDetect
is the default behaviour */
+ if (encodingConfig == ConfigFileOpenEncoding.CurrentLocale) {
+ comboBox.ActiveSelection = (int)encodingConfig;
+ }
+
+ return comboBox;
+ }
+
private void FillVideoComboBoxBasedOnCurrentFolder () {
videoFiles = null;
videoFilenames = null;
- (videoComboBox.Model as ListStore).Clear();
+ videoComboBox.RemoveAll();
string folder = String.Empty;
try {
@@ -270,6 +267,9 @@ public class FileOpenDialog : BaseDialog {
dialog.SelectionChanged += OnSelectionChanged;
}
+ /* Note: It would be nice show a separator after "All Subtitle Files" but filters
+ * don't allow to set a separator function like we do in a normal combo box.
+ */
private void SetFilters () {
SubtitleTypeInfo[] types = Subtitles.AvailableTypesSorted;
FileFilter[] filters = new FileFilter[types.Length + 2];
diff --git a/src/GnomeSubtitles/Dialog/SubtitleFileSaveAsDialog.cs
b/src/GnomeSubtitles/Dialog/FileSaveDialog.cs
similarity index 67%
rename from src/GnomeSubtitles/Dialog/SubtitleFileSaveAsDialog.cs
rename to src/GnomeSubtitles/Dialog/FileSaveDialog.cs
index f4a71cb..941e1d8 100644
--- a/src/GnomeSubtitles/Dialog/SubtitleFileSaveAsDialog.cs
+++ b/src/GnomeSubtitles/Dialog/FileSaveDialog.cs
@@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//using Glade;
using GnomeSubtitles.Core;
using GnomeSubtitles.Ui.Component;
using Gtk;
@@ -29,41 +28,26 @@ using System.Text;
namespace GnomeSubtitles.Dialog {
-public abstract class SubtitleFileSaveAsDialog : BuilderDialog {
- protected FileChooserDialog dialog = null;
+public class FileSaveDialog : BaseDialog {
+ protected FileChooserDialog dialog;
private string chosenFilename = String.Empty;
private EncodingDescription chosenEncoding = EncodingDescription.Empty;
- private SubtitleTextType textType;
private SubtitleType chosenSubtitleType;
private NewlineType chosenNewlineType;
- /* Constant strings */
- private const string gladeFilename = "FileSaveAsDialog.glade";
-
/* Components */
- private EncodingComboBox encodingComboBoxComponent = null;
- private SubtitleFormatComboBox formatComboBoxComponent = null;
- private NewlineTypeComboBox newlineComboBoxComponent = null;
-
- /* Widgets */
- [Builder.Object] private ComboBoxText fileEncodingComboBox = null;
- [Builder.Object] private ComboBoxText subtitleFormatComboBox = null;
- [Builder.Object] private ComboBoxText newlineTypeComboBox = null;
-
-
- protected SubtitleFileSaveAsDialog (SubtitleTextType textType) : base(gladeFilename) {
- dialog = GetDialog() as FileChooserDialog;
+ private SubtitleFormatComboBox formatComboBox = null;
+ private EncodingComboBox encodingComboBox = null;
+ private NewlineTypeComboBox newlineComboBox = null;
- this.textType = textType;
- SetTitle();
+ public FileSaveDialog () : this(Catalog.GetString("Save As")) {
+ }
- InitEncodingComboBox();
- InitFormatComboBox();
- InitNewlineComboBox();
+ protected FileSaveDialog (string title) : base() {
+ BuildDialog(title);
- SetDialogFromFileProperties();
- ConnectHandlers();
+ base.Init(dialog);
}
@@ -85,54 +69,108 @@ public abstract class SubtitleFileSaveAsDialog : BuilderDialog {
get { return chosenNewlineType; }
}
+ /* Protected members */
- /* Private members */
+ protected virtual string GetStartFolder () {
+ if (Base.Document.HasTextFileProperties && Base.Document.TextFile.IsPathRooted)
+ return Base.Document.TextFile.Directory;
+ else
+ return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
+ }
- private void InitEncodingComboBox () {
- int fixedEncoding = GetFixedEncoding();
- ConfigFileSaveEncoding encodingConfig = Base.Config.FileSaveEncoding;
- if (encodingConfig == ConfigFileSaveEncoding.Fixed) {
- string encodingName = Base.Config.FileSaveEncodingFixed;
- EncodingDescription encodingDescription = EncodingDescription.Empty;
- Encodings.Find(encodingName, ref encodingDescription);
- fixedEncoding = encodingDescription.CodePage;
+ protected virtual string GetStartFilename () {
+ if (Base.Document.HasTextFileProperties &&
!String.IsNullOrEmpty(Base.Document.TextFile.Filename)) {
+ return Base.Document.TextFile.Filename;
}
- this.encodingComboBoxComponent = new EncodingComboBox(fileEncodingComboBox, false, null,
fixedEncoding);
+ return Base.Document.UnsavedTextFilename;
+ }
- /* Only need to handle the case of currentLocale, as Fixed and Keep Existent is handled
before */
- if (encodingConfig == ConfigFileSaveEncoding.CurrentLocale)
- encodingComboBoxComponent.ActiveSelection = (int)encodingConfig;
+ /* Private members */
+
+ private void BuildDialog (string title) {
+ dialog = new FileChooserDialog(title, Base.Ui.Window, FileChooserAction.Save,
+ Util.GetStockLabel("gtk-cancel"), ResponseType.Cancel,
Util.GetStockLabel("gtk-save"), ResponseType.Ok);
+
+ dialog.DefaultResponse = ResponseType.Ok;
+
+ //Build content area
+
+ Grid grid = new Grid();
+ grid.RowSpacing = 6;
+ grid.ColumnSpacing = 6;
+ grid.BorderWidth = 6;
+
+ Label formatLabel = new Label(Catalog.GetString("Subtitle Format:"));
+ formatLabel.Xalign = 0;
+ grid.Attach(formatLabel, 0, 0, 1, 1);
+ BuildFormatComboBox();
+ formatComboBox.Widget.Hexpand = true;
+ grid.Attach(formatComboBox.Widget, 1, 0, 3, 1);
+
+ Label encodingLabel = new Label(Catalog.GetString("Character Encoding:"));
+ encodingLabel.Xalign = 0;
+ grid.Attach(encodingLabel, 0, 1, 1, 1);
+ BuildEncodingComboBox();
+ encodingComboBox.Widget.Hexpand = true;
+ grid.Attach(encodingComboBox.Widget, 1, 1, 1, 1);
+
+ Label newlineLabel = new Label(Catalog.GetString("Line Ending:"));
+ newlineLabel.Xalign = 0;
+ grid.Attach(newlineLabel, 2, 1, 1, 1);
+ BuildNewlineComboBox();
+ newlineComboBox.Widget.Hexpand = true;
+ grid.Attach(newlineComboBox.Widget, 3, 1, 1, 1);
+
+ dialog.ContentArea.Add(grid);
+ dialog.ContentArea.ShowAll();
+
+ // Other stuff
+
+ dialog.SetCurrentFolder(GetStartFolder());
+ dialog.CurrentName = GetStartFilename();
}
- private void InitFormatComboBox () {
+ private void BuildFormatComboBox () {
SubtitleType fixedSubtitleType = GetFixedSubtitleType();
ConfigFileSaveFormat formatConfig = Base.Config.FileSaveFormat;
if (formatConfig == ConfigFileSaveFormat.Fixed) {
fixedSubtitleType = Base.Config.FileSaveFormatFixed;
}
+
/* Check if fixed subtitle type has been correctly identified */
if (fixedSubtitleType == SubtitleType.Unknown) {
fixedSubtitleType = SubtitleType.SubRip;
}
- this.formatComboBoxComponent = new SubtitleFormatComboBox(subtitleFormatComboBox,
fixedSubtitleType, null);
+ formatComboBox = new SubtitleFormatComboBox(fixedSubtitleType, null);
+ formatComboBox.SelectionChanged += OnFormatChanged;
+ }
+
+ private void BuildEncodingComboBox () {
+ int fixedEncoding = GetFixedEncoding();
+ ConfigFileSaveEncoding encodingConfig = Base.Config.FileSaveEncoding;
+ if (encodingConfig == ConfigFileSaveEncoding.Fixed) {
+ string encodingName = Base.Config.FileSaveEncodingFixed;
+ EncodingDescription encodingDescription = EncodingDescription.Empty;
+ Encodings.Find(encodingName, ref encodingDescription);
+ fixedEncoding = encodingDescription.CodePage;
+ }
+
+ encodingComboBox = new EncodingComboBox(false, null, fixedEncoding);
+
+ /* Only need to handle the case of currentLocale, as Fixed and Keep Existent is handled
before */
+ if (encodingConfig == ConfigFileSaveEncoding.CurrentLocale)
+ encodingComboBox.ActiveSelection = (int)encodingConfig;
}
- private void InitNewlineComboBox () {
+ private void BuildNewlineComboBox () {
NewlineType newlineTypeToSelect = Base.Config.FileSaveNewline;
/* If no newline type set, or system default unknown, use Unix */
if (newlineTypeToSelect == NewlineType.Unknown)
newlineTypeToSelect = NewlineType.Unix;
- this.newlineComboBoxComponent = new NewlineTypeComboBox(newlineTypeComboBox,
newlineTypeToSelect, null);
- }
-
- private void SetTitle () {
- if (textType == SubtitleTextType.Text)
- dialog.Title = Catalog.GetString("Save As");
- else
- dialog.Title = Catalog.GetString("Save Translation As");
+ newlineComboBox = new NewlineTypeComboBox(newlineTypeToSelect, null);
}
private int GetFixedEncoding () {
@@ -153,24 +191,6 @@ public abstract class SubtitleFileSaveAsDialog : BuilderDialog {
}
}
- private void SetDialogFromFileProperties () {
- /* Set folder */
- if ((textType == SubtitleTextType.Translation) && Base.Document.HasTranslationFileProperties
&& Base.Document.TranslationFile.IsPathRooted)
- dialog.SetCurrentFolder(Base.Document.TranslationFile.Directory);
- else if (Base.Document.HasTextFileProperties && Base.Document.TextFile.IsPathRooted)
- dialog.SetCurrentFolder(Base.Document.TextFile.Directory);
- else
-
dialog.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
-
- /* Set filename */
- FileProperties fileProperties = (textType == SubtitleTextType.Text ? Base.Document.TextFile :
Base.Document.TranslationFile);
- if ((fileProperties != null) && (fileProperties.Filename != String.Empty))
- dialog.CurrentName = fileProperties.Filename;
- else
- dialog.CurrentName = (textType == SubtitleTextType.Text ?
Base.Document.UnsavedTextFilename : Base.Document.UnsavedTranslationFilename);
- }
-
-
private string UpdateFilenameExtension (string filename, SubtitleType type) {
SubtitleTypeInfo typeInfo = Subtitles.GetAvailableType(type);
string newExtensionDotted = "." + typeInfo.PreferredExtension;
@@ -218,19 +238,13 @@ public abstract class SubtitleFileSaveAsDialog : BuilderDialog {
/* Event members */
- #pragma warning disable 169 //Disables warning about handlers not being used
-
- private void ConnectHandlers () {
- this.formatComboBoxComponent.SelectionChanged += OnFormatChanged;
- }
-
protected override bool ProcessResponse (ResponseType response) {
if (response == ResponseType.Ok) {
/* Check chosen encoding */
- chosenEncoding = encodingComboBoxComponent.ChosenEncoding;
+ chosenEncoding = encodingComboBox.ChosenEncoding;
if (Base.Config.FileSaveEncodingOption ==
ConfigFileSaveEncodingOption.RememberLastUsed) {
- int activeAction = encodingComboBoxComponent.ActiveSelection;
+ int activeAction = encodingComboBox.ActiveSelection;
ConfigFileSaveEncoding activeOption =
(ConfigFileSaveEncoding)Enum.ToObject(typeof(ConfigFileSaveEncoding), activeAction);
if (((int)activeOption) >= ((int)ConfigFileSaveEncoding.Fixed)) {
Base.Config.FileSaveEncodingFixed = chosenEncoding.Name;
@@ -241,13 +255,13 @@ public abstract class SubtitleFileSaveAsDialog : BuilderDialog {
}
/* Check chosen subtitle format */
- chosenSubtitleType = formatComboBoxComponent.ChosenSubtitleType;
+ chosenSubtitleType = formatComboBox.ChosenSubtitleType;
if (Base.Config.FileSaveFormatOption == ConfigFileSaveFormatOption.RememberLastUsed) {
Base.Config.FileSaveFormatFixed = chosenSubtitleType;
}
/* Check chosen newline type */
- chosenNewlineType = newlineComboBoxComponent.ChosenNewlineType;
+ chosenNewlineType = newlineComboBox.ChosenNewlineType;
if (Base.Config.FileSaveNewlineOption ==
ConfigFileSaveNewlineOption.RememberLastUsed) {
Base.Config.FileSaveNewline = chosenNewlineType;
}
@@ -270,7 +284,7 @@ public abstract class SubtitleFileSaveAsDialog : BuilderDialog {
filename = filename.Substring(folder.Length + 1);
}
- SubtitleType subtitleType = formatComboBoxComponent.ChosenSubtitleType;
+ SubtitleType subtitleType = formatComboBox.ChosenSubtitleType;
filename = UpdateFilenameExtension(filename, subtitleType);
dialog.CurrentName = filename;
}
diff --git a/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs
b/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs
index 10c8eb6..f316def 100644
--- a/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs
+++ b/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs
@@ -27,14 +27,12 @@ public class FileTranslationOpenDialog : FileOpenDialog {
public FileTranslationOpenDialog () : base(false, Catalog.GetString("Open Translation File")) {
}
- /* Public members */
-
protected override string GetStartFolder () {
if (Base.IsDocumentLoaded && Base.Document.IsTranslationLoaded &&
Base.Document.HasTranslationFileProperties && Base.Document.TranslationFile.IsPathRooted) {
return Base.Document.TranslationFile.Directory;
- } else {
- return base.GetStartFolder();
}
+
+ return base.GetStartFolder();
}
}
diff --git a/src/GnomeSubtitles/Dialog/FileTranslationSaveDialog.cs
b/src/GnomeSubtitles/Dialog/FileTranslationSaveDialog.cs
new file mode 100644
index 0000000..264fb8c
--- /dev/null
+++ b/src/GnomeSubtitles/Dialog/FileTranslationSaveDialog.cs
@@ -0,0 +1,49 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2009-2017 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+using GnomeSubtitles.Core;
+using Mono.Unix;
+using SubLib.Core.Domain;
+
+namespace GnomeSubtitles.Dialog {
+
+public class FileTranslationSaveDialog : FileSaveDialog {
+
+ public FileTranslationSaveDialog () : base(Catalog.GetString("Save Translation As")) {
+ }
+
+ protected override string GetStartFolder () {
+ if (Base.Document.HasTranslationFileProperties && Base.Document.TranslationFile.IsPathRooted)
{
+ return Base.Document.TranslationFile.Directory;
+ }
+
+ return base.GetStartFolder();
+ }
+
+ protected override string GetStartFilename () {
+ if (Base.Document.HasTranslationFileProperties &&
!string.IsNullOrEmpty(Base.Document.TranslationFile.Filename)) {
+ return Base.Document.TranslationFile.Filename;
+ }
+
+ return Base.Document.UnsavedTranslationFilename;
+ }
+
+}
+
+}
diff --git a/src/GnomeSubtitles/Dialog/PreferencesDialog.cs b/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
index 01dd70d..7c7d632 100644
--- a/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
+++ b/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
@@ -109,7 +109,8 @@ public class PreferencesDialog : BuilderDialog {
fixedEncoding = encodingDescription.CodePage;
}
- fileOpenEncoding = new EncodingComboBox(fileOpenEncodingComboBox, true, additionalActions,
fixedEncoding);
+ fileOpenEncoding = new EncodingComboBox(true, additionalActions, fixedEncoding);
+ fileOpenEncodingComboBox = fileOpenEncoding.Widget; //FIXME REMOVE
if (fileOpenEncodingOption != ConfigFileOpenEncodingOption.Specific) {
fileOpenEncoding.ActiveSelection = (int)fileOpenEncodingOption;
}
@@ -126,7 +127,8 @@ public class PreferencesDialog : BuilderDialog {
fixedEncoding = encodingDescription.CodePage;
}
- fileOpenFallbackEncoding = new EncodingComboBox(fileOpenFallbackEncodingComboBox, false,
null, fixedEncoding);
+ fileOpenFallbackEncoding = new EncodingComboBox(false, null, fixedEncoding);
+ fileOpenFallbackEncodingComboBox = fileOpenFallbackEncoding.Widget; //FIXME REMOVE
fileOpenFallbackEncoding.SelectionChanged += OnDefaultsFileOpenFallbackEncodingChanged;
}
@@ -141,7 +143,8 @@ public class PreferencesDialog : BuilderDialog {
fixedEncoding = encodingDescription.CodePage;
}
- fileSaveEncoding = new EncodingComboBox(fileSaveEncodingComboBox, false, additionalActions,
fixedEncoding);
+ fileSaveEncoding = new EncodingComboBox(false, additionalActions, fixedEncoding);
+ fileSaveEncodingComboBox = fileSaveEncoding.Widget; //FIXME REMOVE
if (fileSaveEncodingOption != ConfigFileSaveEncodingOption.Specific) {
fileSaveEncoding.ActiveSelection = (int)fileSaveEncodingOption;
}
@@ -156,7 +159,8 @@ public class PreferencesDialog : BuilderDialog {
fixedFormat = Base.Config.FileSaveFormatFixed;
}
- fileSaveFormat = new SubtitleFormatComboBox(fileSaveFormatComboBox, fixedFormat,
additionalActions);
+ fileSaveFormat = new SubtitleFormatComboBox(fixedFormat, additionalActions);
+ fileSaveFormatComboBox = fileSaveFormat.Widget; //FIXME REMOVE
if (fileSaveFormatOption != ConfigFileSaveFormatOption.Specific) {
fileSaveFormat.ActiveSelection = (int)fileSaveFormatOption;
}
@@ -171,7 +175,8 @@ public class PreferencesDialog : BuilderDialog {
newlineTypeToSelect = Base.Config.FileSaveNewline;
}
- fileSaveNewline = new NewlineTypeComboBox(fileSaveNewlineComboBox, newlineTypeToSelect,
additionalActions);
+ fileSaveNewline = new NewlineTypeComboBox(newlineTypeToSelect, additionalActions);
+ fileSaveNewlineComboBox = fileSaveNewline.Widget; //FIXME REMOVE
if (fileSaveNewlineOption != ConfigFileSaveNewlineOption.Specific) {
fileSaveNewline.ActiveSelection = (int)fileSaveNewlineOption;
}
diff --git a/src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs b/src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs
index 7e104d6..854a0f9 100644
--- a/src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs
+++ b/src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs
@@ -28,14 +28,6 @@ public class ComboBoxUtil {
return ((text != null) && (text.CompareTo("-") == 0));
}
- public static void InitComboBox (ComboBox comboBox) {
- comboBox.Clear();
- CellRendererText cell = new CellRendererText();
- comboBox.PackStart(cell, false);
- comboBox.AddAttribute(cell, "text", 0);
- comboBox.Model = new ListStore(typeof(string));
- }
-
}
}
diff --git a/src/GnomeSubtitles/Ui/Component/EncodingComboBox.cs
b/src/GnomeSubtitles/Ui/Component/EncodingComboBox.cs
index 14f0a6f..eaab232 100644
--- a/src/GnomeSubtitles/Ui/Component/EncodingComboBox.cs
+++ b/src/GnomeSubtitles/Ui/Component/EncodingComboBox.cs
@@ -38,19 +38,18 @@ public class EncodingComboBox {
private int fixedEncoding = -1; //Codepage of an encoding that must be present (-1 if not)
private ArrayList configShownEncodings = null; //Encodings shown in menu from config
- public EncodingComboBox (ComboBoxText comboBox, bool hasAutoDetect, string[] additionalActions, int
fixedEncoding) {
- this.comboBox = comboBox;
+ public EncodingComboBox (bool hasAutoDetect, string[] additionalActions, int fixedEncoding) {
+ this.comboBox = new ComboBoxText();
this.additionalActions = additionalActions;
this.hasAutoDetect = hasAutoDetect;
this.fixedEncoding = fixedEncoding;
- InitComboBoxModel();
SetActionCount();
SetComboBox(Base.Config.FileEncodingsShownInMenu);
ConnectHandlers();
}
- public EncodingComboBox (ComboBoxText comboBox, bool hasAutoDetect) : this(comboBox, hasAutoDetect,
null, -1) {
+ public EncodingComboBox (bool hasAutoDetect) : this(hasAutoDetect, null, -1) {
}
@@ -61,6 +60,10 @@ public class EncodingComboBox {
/* Public properties */
+ public ComboBoxText Widget {
+ get { return comboBox; }
+ }
+
public bool HasChosenAction {
get { return comboBox.Active < actionCount; }
}
@@ -96,10 +99,6 @@ public class EncodingComboBox {
/* Private members */
- private void InitComboBoxModel () {
- ComboBoxUtil.InitComboBox(comboBox);
- }
-
private void SetActionCount () {
this.actionCount = (hasAutoDetect ? 1 : 0) + (additionalActions != null ?
additionalActions.Length : 0);
}
@@ -201,8 +200,6 @@ public class EncodingComboBox {
/* Event members */
- #pragma warning disable 169 //Disables warning about handlers not being used
-
private void ConnectHandlers () {
comboBox.RowSeparatorFunc = ComboBoxUtil.SeparatorFunc;
}
diff --git a/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
b/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
index 4e128b1..6e5d8d8 100644
--- a/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
+++ b/src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs
@@ -30,12 +30,11 @@ public class NewlineTypeComboBox {
private NewlineType newlineTypeToSelect = NewlineType.Unknown;
private string[] additionalActions = null;
- public NewlineTypeComboBox (ComboBoxText comboBox, NewlineType newlineTypeToSelect, string[]
additionalActions) {
- this.comboBox = comboBox;
+ public NewlineTypeComboBox (NewlineType newlineTypeToSelect, string[] additionalActions) {
+ this.comboBox = new ComboBoxText();
this.newlineTypeToSelect = newlineTypeToSelect;
this.additionalActions = additionalActions;
- InitComboBoxModel();
FillComboBox();
ConnectHandlers();
}
@@ -47,6 +46,10 @@ public class NewlineTypeComboBox {
/* Public properties */
+ public ComboBoxText Widget {
+ get { return comboBox; }
+ }
+
public bool HasChosenAction {
get { return comboBox.Active < GetActionCount(); }
}
@@ -81,10 +84,6 @@ public class NewlineTypeComboBox {
/* Private members */
- private void InitComboBoxModel () {
- ComboBoxUtil.InitComboBox(comboBox);
- }
-
private void FillComboBox () {
DisconnectComboBoxChangedSignal();
@@ -101,8 +100,8 @@ public class NewlineTypeComboBox {
}
/* Prepare newline types to add */
- string mac = "Macintosh";
- string unix = "Unix";
+ string mac = "Mac OS Classic";
+ string unix = "Unix/Linux";
string windows = "Windows";
string systemDefault = " (" + Catalog.GetString("System Default") + ")";
NewlineType systemNewline = Core.Util.GetSystemNewlineType();
@@ -156,8 +155,6 @@ public class NewlineTypeComboBox {
/* Event members */
- #pragma warning disable 169 //Disables warning about handlers not being used
-
private void ConnectHandlers () {
comboBox.RowSeparatorFunc = ComboBoxUtil.SeparatorFunc;
}
diff --git a/src/GnomeSubtitles/Ui/Component/SubtitleFormatComboBox.cs
b/src/GnomeSubtitles/Ui/Component/SubtitleFormatComboBox.cs
index 27e6243..480799d 100644
--- a/src/GnomeSubtitles/Ui/Component/SubtitleFormatComboBox.cs
+++ b/src/GnomeSubtitles/Ui/Component/SubtitleFormatComboBox.cs
@@ -30,13 +30,13 @@ public class SubtitleFormatComboBox {
private string[] additionalActions = null; //
private SubtitleType fixedSubtitleType = SubtitleType.Unknown; //A subtitle type that must be selected
- public SubtitleFormatComboBox (ComboBoxText comboBox, SubtitleType fixedSubtitleType, string[]
additionalActions) {
- this.comboBox = comboBox;
+ public SubtitleFormatComboBox (SubtitleType fixedSubtitleType, string[] additionalActions) {
+ this.comboBox = new ComboBoxText();
this.fixedSubtitleType = fixedSubtitleType;
this.additionalActions = additionalActions;
- InitComboBoxModel();
- SetComboBox();
+ this.subtitleTypes = Subtitles.AvailableTypesSorted;
+ FillComboBox();
ConnectHandlers();
}
@@ -47,6 +47,10 @@ public class SubtitleFormatComboBox {
/* Public properties */
+ public ComboBoxText Widget {
+ get { return comboBox; }
+ }
+
public bool HasChosenAction {
get { return comboBox.Active < GetActionCount(); }
}
@@ -74,15 +78,6 @@ public class SubtitleFormatComboBox {
/* Private members */
- private void InitComboBoxModel () {
- ComboBoxUtil.InitComboBox(comboBox);
- }
-
- private void SetComboBox () {
- subtitleTypes = Subtitles.AvailableTypesSorted;
- FillComboBox();
- }
-
private void FillComboBox () {
DisconnectComboBoxChangedSignal();
@@ -104,7 +99,7 @@ public class SubtitleFormatComboBox {
/* Add subtitle formats */
foreach (SubtitleTypeInfo typeInfo in subtitleTypes) {
- comboBox.AppendText(typeInfo.Name + " (" + typeInfo.ExtensionsAsText + ")");
+ comboBox.AppendText(typeInfo.Name + " (" + ConcatenateExtensions(typeInfo.Extensions)
+ ")");
if (typeInfo.Type == fixedSubtitleType) {
activeItem = currentItem;
}
@@ -134,10 +129,21 @@ public class SubtitleFormatComboBox {
return (additionalActions != null ? additionalActions.Length : 0);
}
+ private string ConcatenateExtensions (string[] extensions) {
+ string result = "";
+ if (extensions == null) {
+ return result;
+ }
- /* Event members */
+ foreach (string extension in extensions) {
+ result += (String.IsNullOrEmpty(result) ? "" : ", ") + "." + extension;
+ }
- #pragma warning disable 169 //Disables warning about handlers not being used
+ return result;
+ }
+
+
+ /* Event members */
private void ConnectHandlers () {
comboBox.RowSeparatorFunc = ComboBoxUtil.SeparatorFunc;
diff --git a/src/GnomeSubtitles/Ui/MainUi.cs b/src/GnomeSubtitles/Ui/MainUi.cs
index b22275c..81d6241 100644
--- a/src/GnomeSubtitles/Ui/MainUi.cs
+++ b/src/GnomeSubtitles/Ui/MainUi.cs
@@ -190,7 +190,7 @@ public class MainUi {
/// <remarks>After saving, the timing mode is set to the timing mode of the subtitle format using when
saving.</remarks>
/// <returns>Whether the file was saved.</returns>
public bool SaveAs () {
- FileSaveAsDialog dialog = Base.Dialogs.Get(typeof(FileSaveAsDialog)) as FileSaveAsDialog;
+ FileSaveDialog dialog = Base.Dialogs.Get(typeof(FileSaveDialog)) as FileSaveDialog;
FileProperties properties = ShowSaveAsDialog(dialog);
if (properties != null) {
Save(properties);
@@ -247,7 +247,7 @@ public class MainUi {
/// <summary>Executes a translation SaveAs operation.</summary>
/// <returns>Whether the translation file was saved or not.</returns>
public bool TranslationSaveAs () {
- TranslationSaveAsDialog dialog = Base.Dialogs.Get(typeof(TranslationSaveAsDialog)) as
TranslationSaveAsDialog;
+ FileTranslationSaveDialog dialog = Base.Dialogs.Get(typeof(FileTranslationSaveDialog)) as
FileTranslationSaveDialog;
FileProperties properties = ShowSaveAsDialog(dialog);
if (properties != null) {
SaveTranslation(properties);
@@ -354,7 +354,7 @@ public class MainUi {
/// <summary>Displays a SaveAs dialog and gets the chosen options as <cref="FileProperties"
/>.</summary>
/// <param name="dialog">The dialog to display.</param>
/// <returns>The chosen file properties, or null in case SaveAs was canceled.</returns>
- private FileProperties ShowSaveAsDialog (SubtitleFileSaveAsDialog dialog) {
+ private FileProperties ShowSaveAsDialog (FileSaveDialog dialog) {
dialog.Show();
bool toSaveAs = dialog.WaitForResponse();
if (!toSaveAs)
diff --git a/src/SubLib/Core/Domain/SubtitleTypeInfo.cs b/src/SubLib/Core/Domain/SubtitleTypeInfo.cs
index 8abbee4..dcb8db2 100644
--- a/src/SubLib/Core/Domain/SubtitleTypeInfo.cs
+++ b/src/SubLib/Core/Domain/SubtitleTypeInfo.cs
@@ -1,6 +1,6 @@
/*
* This file is part of SubLib.
- * Copyright (C) 2006-2008,2011 Pedro Castro
+ * Copyright (C) 2006-2017 Pedro Castro
*
* SubLib is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,12 +62,6 @@ public class SubtitleTypeInfo : IComparable {
get { return extensions; }
}
- /// <summary>A comma-separated list of the extensions the subtitle type uses.
- /// The prefix "*." is added to every extension.</summary>
- public string ExtensionsAsText {
- get { return ExtensionsToText(); }
- }
-
/// <summary>The preferred extension, which is the first on the list.</summary>
public string PreferredExtension {
get { return extensions[0]; }
@@ -105,22 +99,6 @@ public class SubtitleTypeInfo : IComparable {
internal SubtitleTypeInfo (SubtitleFormat format) : this(format.Name, format.Type, format.Mode,
format.Extensions) {
}
- /* Private members */
-
- private string ExtensionsToText () {
- if (extensions == null)
- return String.Empty;
-
- string text = ExtensionToText(extensions[0]);
- for (int count = 1 ; count < extensions.Length ; count++)
- text += ", " + ExtensionToText(extensions[count]);
-
- return text;
- }
-
- private string ExtensionToText (string extension) {
- return "*." + extension;
- }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]