[gnome-subtitles/gtk3] About Dialog refactor
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles/gtk3] About Dialog refactor
- Date: Thu, 1 Feb 2018 22:31:32 +0000 (UTC)
commit 9119756b352976da46bc77a292a1e8bc206f90e8
Author: Pedro Castro <pedro gnomesubtitles org>
Date: Tue Jan 30 18:46:14 2018 +0000
About Dialog refactor
AUTHORS | 62 +-------------------------
gnome-subtitles.csproj | 53 +++++++++++------------
src/Glade/{ => old.glade}/AboutDialog.glade | 0
src/Glade/{ => old.glade}/AboutDialog.ui | 0
src/GnomeSubtitles/Dialog/AboutDialog.cs | 52 ++++++++++++----------
src/GnomeSubtitles/Dialog/BaseDialog.cs | 24 +++++-----
src/GnomeSubtitles/Dialog/Dialogs.cs | 2 +-
7 files changed, 70 insertions(+), 123 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
index aa20c8d..1bc8ab2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,27 +1,12 @@
Gnome Subtitles
-=============================
+=========================
http://gnomesubtitles.org
-Authors
-=======
+Author
+======
Pedro Castro <pedro gnomesubtitles.org>
-Contributors
-============
-Arx Cruz
-Cristina Yenyxe
-David Krkoska
-Dominique Leuenberger
-Fernando Zorrilla
-György Balló
-Keith Madill
-Michał Sawicz
-Miguel Filho
-Nazar Kulyk
-Paweł Brzeski
-Valmir Sena
-
Artwork
=======
Stefan A. Keel (Sak) - Logo and Icons
@@ -30,47 +15,6 @@ Documentation
=============
Erin Bloom - User Manual
-Translation
-===========
-Djihed Afifi (ar)
-Alexander Shopov, Svetoslav Stefanov (bg)
-Joan Duran (ca)
-Carles Ferrando, Joan Duran (ca@valencia)
-Kamil Paral, Lucas Lommer, Marek Černocký, Petr Kovar, Rinu (cs)
-Joe Hansen, Kenneth Nielsen, Kristian Kjærgaard (da)
-Felix Braun, Mario Blättermann (de)
-Yumkee Lhamo (dz)
-Efstathios Iosifidis, Mel Argyropoulou, Nick Agianniotis, Simos Xenitellis (el)
-Philip Withnall (en_GB)
-Daniel Mustieles, Francisco Serrador, Gabriel Ruiz, Jorge González, Paulino Padial (es)
-Ilkka Tuohela (fi)
-Alain Lojewski, Alexandre Imache, Bruno Brouard, Claude Paroz, Frederic Peters, Stéphane Raimbault (fr)
-Antón Méixome, Fran Diéguez, Leandro Regueiro, Lois, Marcos Lans (gl)
-Mark Krapivner, Yair Hershkovitz, Yaron Shahrabani (he)
-Gabor Kelemen, Laszlo Csordas (hu)
-Claudio Arseni, Luca Ferretti, Simone Oberti (it)
-Kjartan Maraas (nb)
-Yannig Marchegay (oc)
-A S Alam (pa)
-Piotr Drąg, Tomasz Sałaciński (pl)
-António Lima (pt)
-César Veiga, Djavan Fagundes, Fábio Nogueira, Henrique Machado, Krix Apolinário, Leonardo Fontenelle, Marco
de Freitas, Rafael Ferreira, Raphael Higino (pt_BR)
-Daniel Șerbănescu, Lucian Grijincu (ro)
-Nickolay V. Shmyrev, Yuri Myasoedov (ru)
-Andrej Žnidaršič, Matej Urbančič (sl)
-Đorđe Vasiljević, Miroslav Nikolić (sr)
-Daniel Nylander (sv)
-Baris Cicek, Serkan Yılmaz (tr)
-Aron Xu, Yinghua Wang (zh_CN)
-Chao-Hsiung Liao (zh_HK)
-Chao-Hsiung Liao (zh_TW)
-
-Supporters
-==========
-Allan Vidal
-David Prieto
-Henrique Malheiro
-
Includes code from
==================
Fuse Media Centre (http://sf.net/projects/fusemc)
diff --git a/gnome-subtitles.csproj b/gnome-subtitles.csproj
index 7e1f3f0..e709aca 100644
--- a/gnome-subtitles.csproj
+++ b/gnome-subtitles.csproj
@@ -57,33 +57,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="src\Glade\AboutDialog.glade">
- <LogicalName>AboutDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\FilePropertiesDialog.glade">
- <LogicalName>FilePropertiesDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\PreferencesDialog.glade">
- <LogicalName>PreferencesDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\SearchDialog.glade">
- <LogicalName>SearchDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\SetLanguageDialog.glade">
- <LogicalName>SetLanguageDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\TimingsAdjustDialog.glade">
- <LogicalName>TimingsAdjustDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\TimingsShiftDialog.glade">
- <LogicalName>TimingsShiftDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\TimingsSynchronizeDialog.glade">
- <LogicalName>TimingsSynchronizeDialog.glade</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="src\Glade\VideoSeekToDialog.glade">
- <LogicalName>VideoSeekToDialog.glade</LogicalName>
- </EmbeddedResource>
<EmbeddedResource Include="data\gnome-subtitles.svg">
<DeployService-Deploy>True</DeployService-Deploy>
<LogicalName>gnome-subtitles.svg</LogicalName>
@@ -100,6 +73,9 @@
<EmbeddedResource Include="src\Glade\MainWindow.ui">
<LogicalName>MainWindow.ui</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="data\gnome-subtitles-logo.png">
+ <LogicalName>gnome-subtitles-logo.png</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="src\External\GStreamerPlaybin\Engine.cs" />
@@ -315,4 +291,27 @@
<Folder Include="Properties\" />
<Folder Include="src\SubLib\Util\" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="src\Glade\AboutDialog.glade">
+ <LogicalName>AboutDialog.glade</LogicalName>
+ </None>
+ <None Include="src\Glade\SearchDialog.glade">
+ <LogicalName>SearchDialog.glade</LogicalName>
+ </None>
+ <None Include="src\Glade\SetLanguageDialog.glade">
+ <LogicalName>SetLanguageDialog.glade</LogicalName>
+ </None>
+ <None Include="src\Glade\TimingsAdjustDialog.glade">
+ <LogicalName>TimingsAdjustDialog.glade</LogicalName>
+ </None>
+ <None Include="src\Glade\TimingsShiftDialog.glade">
+ <LogicalName>TimingsShiftDialog.glade</LogicalName>
+ </None>
+ <None Include="src\Glade\TimingsSynchronizeDialog.glade">
+ <LogicalName>TimingsSynchronizeDialog.glade</LogicalName>
+ </None>
+ <None Include="src\Glade\VideoSeekToDialog.glade">
+ <LogicalName>VideoSeekToDialog.glade</LogicalName>
+ </None>
+ </ItemGroup>
</Project>
diff --git a/src/Glade/AboutDialog.glade b/src/Glade/old.glade/AboutDialog.glade
similarity index 100%
rename from src/Glade/AboutDialog.glade
rename to src/Glade/old.glade/AboutDialog.glade
diff --git a/src/Glade/AboutDialog.ui b/src/Glade/old.glade/AboutDialog.ui
similarity index 100%
rename from src/Glade/AboutDialog.ui
rename to src/Glade/old.glade/AboutDialog.ui
diff --git a/src/GnomeSubtitles/Dialog/AboutDialog.cs b/src/GnomeSubtitles/Dialog/AboutDialog.cs
index 79b5598..dd7b6dc 100644
--- a/src/GnomeSubtitles/Dialog/AboutDialog.cs
+++ b/src/GnomeSubtitles/Dialog/AboutDialog.cs
@@ -17,47 +17,51 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using Mono.Unix;
using GnomeSubtitles.Core;
using Gtk;
using System;
namespace GnomeSubtitles.Dialog {
-public class AboutDialog : BuilderDialog {
-
- /* Constant strings */
- private const string gladeFilename = "AboutDialog.glade";
- private const string logoFilename = "gnome-subtitles-logo.png";
+public class AboutDialog : BaseDialog {
+ private const string LogoFilename = "gnome-subtitles-logo.png";
public AboutDialog () {
- SetHooks();
- Init(gladeFilename, true);
-
- SetInfo();
+ Init(BuildDialog());
}
/* Private members */
- /// <summary>Sets the Url and Email hooks. These must be set before the dialog is realized.</summary>
- private void SetHooks () {
-// Gtk.AboutDialog.SetUrlHook(AboutDialogOpenUrl); //FIXME
-// Gtk.AboutDialog.SetEmailHook(AboutDialogOpenEmail); //FIXME
- }
+ private Gtk.AboutDialog BuildDialog () {
+ Gtk.AboutDialog dialog = new Gtk.AboutDialog();
- private void AboutDialogOpenUrl (object o, ActivateLinkArgs args) {
- //Core.Util.OpenUrl(url); / //FIXME
- }
+ dialog.Modal = true;
- private void AboutDialogOpenEmail (Gtk.AboutDialog about, string email) {
- Core.Util.OpenSendEmail(email);
- }
+ dialog.Title = Catalog.GetString("About Gnome Subtitles");
+ dialog.ProgramName = Base.ExecutionContext.ApplicationName;
+ dialog.Version = Base.ExecutionContext.Version;
+ dialog.Logo = new Gdk.Pixbuf(null, LogoFilename);
+ dialog.Website = "http://gnomesubtitles.org";
+ dialog.WebsiteLabel = dialog.Website;
+ dialog.Comments = Catalog.GetString("Video subtitling for the GNOME desktop");
+ dialog.Copyright = "Copyright © 2006-2018 Pedro Castro";
+ dialog.LicenseType = License.Gpl20;
- private void SetInfo () {
- Gtk.AboutDialog dialog = Dialog as Gtk.AboutDialog;
+ dialog.Authors = new string[]{
+ "Pedro Castro"
+ };
- dialog.Version = Base.ExecutionContext.Version;
- dialog.Logo = new Gdk.Pixbuf(null, logoFilename);
+ dialog.Documenters = new string[]{
+ "Erin Bloom"
+ };
+
+ dialog.Artists = new string[]{
+ "Stefan A. Keel (Sak)"
+ };
+
+ return dialog;
}
}
diff --git a/src/GnomeSubtitles/Dialog/BaseDialog.cs b/src/GnomeSubtitles/Dialog/BaseDialog.cs
index a8f6d9f..f506cf8 100644
--- a/src/GnomeSubtitles/Dialog/BaseDialog.cs
+++ b/src/GnomeSubtitles/Dialog/BaseDialog.cs
@@ -73,9 +73,11 @@ public abstract class BaseDialog {
EmitDestroyedEvent();
}
-
-
- //TODO check if this is needed
+ /**
+ * Used when we want to open a dialog and continue execution based on the dialog response.
+ * This way, the dialog doesn't need to understand who its caller is. It will just set its
+ * response value (in its object) and the caller will obtain it once the dialog returns.
+ */
public virtual bool WaitForResponse () {
Dialog.Run();
return returnValue;
@@ -90,7 +92,13 @@ public abstract class BaseDialog {
protected void Init (Gtk.Dialog dialog) {
Dialog = dialog;
- //SetBaseWindow(dialog, Base.Ui.Window);
+
+ /* If the dialog doesn't specify a parent, we assume it's the main window.
+ * Usually the parent is specified when creating dialogs, but not in all types (e.g.,
AboutDialog).
+ */
+ if (dialog.TransientFor == null) {
+ dialog.TransientFor = Base.Ui.Window;
+ }
Dialog.Response += OnResponse;
Dialog.DeleteEvent += OnDeleteEvent;
@@ -126,14 +134,6 @@ public abstract class BaseDialog {
}
}
-
- /* Private members */
-
-// private void SetBaseWindow (Gtk.Dialog dialog, Window window) {
-// dialog.TransientFor = window;
-// dialog.Icon = window.Icon; //TODO is this still needed?
-// }
-
}
}
diff --git a/src/GnomeSubtitles/Dialog/Dialogs.cs b/src/GnomeSubtitles/Dialog/Dialogs.cs
index 98b0711..fa9b84f 100644
--- a/src/GnomeSubtitles/Dialog/Dialogs.cs
+++ b/src/GnomeSubtitles/Dialog/Dialogs.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2007-2009 Pedro Castro
+ * Copyright (C) 2007-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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]