Skip to content

Commit

Permalink
DetailsView: refactor to DetailsDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
birros committed Jul 18, 2018
1 parent 17638ac commit f14eef5
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 77 deletions.
2 changes: 1 addition & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ src/app/utils/tag-formater.vala
src/app/ui/content/search-view.vala
src/app/ui/content/history-view.vala
src/app/ui/content/archive-row.vala
src/app/ui/content/details-view.vala
src/app/ui/content/details-dialog.vala
src/app/ui/content/bookmark-view.vala
src/app/ui/content/status-label.vala
src/app/ui/content/home-view.vala
Expand Down
65 changes: 31 additions & 34 deletions po/fr.po
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-07-17 18:31+0200\n"
"POT-Creation-Date: 2018-07-18 17:11+0200\n"
"Content-Type: text/plain; charset=UTF-8\n"

#: data/appdata/com.github.birros.WebArchives.appdata.xml.in:7
#: data/desktop/com.github.birros.WebArchives.desktop.in:3
#: src/app/states/title-logic.vala:17 src/app/ui/window.vala:305
#: src/app/states/title-logic.vala:17 src/app/ui/window.vala:306
msgid "WebArchives"
msgstr "WebArchives"

Expand Down Expand Up @@ -56,13 +56,13 @@ msgid "Search in page"
msgstr "Chercher dans la page"

#: data/appdata/com.github.birros.WebArchives.appdata.xml.in:24
#: src/app/states/title-logic.vala:44
#: src/app/states/title-logic.vala:37
#: src/app/ui/header-bar/popover-menu.vala:60
msgid "History"
msgstr "Historique"

#: data/appdata/com.github.birros.WebArchives.appdata.xml.in:25
#: src/app/states/title-logic.vala:37
#: src/app/states/title-logic.vala:30
#: src/app/ui/header-bar/popover-menu.vala:54
msgid "Bookmarks"
msgstr "Signets"
Expand Down Expand Up @@ -278,10 +278,6 @@ msgstr "Remettre le zoom à zéro"
msgid "Print version number"
msgstr "Afficher le numéro de version"

#: src/app/states/title-logic.vala:23 src/app/ui/content/archive-row.vala:121
msgid "Details"
msgstr "Détails"

#: src/app/utils/language-formater.vala:45
msgid "Unspecified language"
msgstr "Langue non spécifiée"
Expand Down Expand Up @@ -314,70 +310,71 @@ msgstr "Pas d'historique de navigation."
msgid "%e %b %y"
msgstr ""

#: src/app/ui/content/archive-row.vala:121
#: src/app/ui/content/details-dialog.vala:11
msgid "Details"
msgstr "Détails"

#: src/app/ui/content/archive-row.vala:130
msgid "Remove"
msgstr "Retirer"

#: src/app/ui/content/details-view.vala:112
#: src/app/ui/content/details-dialog.vala:120
msgid "Favicon"
msgstr "Favicône"

#: src/app/ui/content/details-view.vala:113
#: src/app/ui/content/details-dialog.vala:121
msgid "Title"
msgstr "Titre"

#: src/app/ui/content/details-view.vala:115
#: src/app/ui/content/details-dialog.vala:123
msgid "Location"
msgstr "Emplacement"

#: src/app/ui/content/details-view.vala:117
#: src/app/ui/content/details-dialog.vala:125
msgid "Date"
msgstr "Date"

#: src/app/ui/content/details-view.vala:118
#: src/app/ui/content/details-dialog.vala:126
msgid "Lang"
msgstr "Langue"

#: src/app/ui/content/details-view.vala:120
#: src/app/ui/content/details-dialog.vala:127
msgid "Size"
msgstr "Taille"

#: src/app/ui/content/details-view.vala:121
#: src/app/ui/content/details-dialog.vala:128
msgid "Name"
msgstr "Nom"

#: src/app/ui/content/details-view.vala:122
#: src/app/ui/content/details-dialog.vala:129
msgid "Id"
msgstr "Id"

#: src/app/ui/content/details-view.vala:123
#: src/app/ui/content/details-dialog.vala:130
msgid "Description"
msgstr "Description"

#: src/app/ui/content/details-view.vala:124
#: src/app/ui/content/details-dialog.vala:131
msgid "Article count"
msgstr "Nombre d'articles"

#: src/app/ui/content/details-view.vala:125
#: src/app/ui/content/details-dialog.vala:132
msgid "Media count"
msgstr "Nombre de médias"

#: src/app/ui/content/details-view.vala:126
#: src/app/ui/content/details-dialog.vala:133
msgid "Creator"
msgstr "Créateur"

#: src/app/ui/content/details-view.vala:127
#: src/app/ui/content/details-dialog.vala:134
msgid "Publisher"
msgstr "Éditeur"

#: src/app/ui/content/details-view.vala:131
#: src/app/ui/content/details-dialog.vala:135
msgid "Tags"
msgstr "Étiquettes"

#: src/app/ui/content/details-view.vala:133
msgid "Url"
msgstr ""

#: src/app/ui/content/bookmark-view.vala:23
msgid "No bookmarks saved."
msgstr "Pas de signets sauvegardés."
Expand Down Expand Up @@ -463,20 +460,20 @@ msgstr "Téléchargement"
msgid "No archive available for download."
msgstr "Aucune archive disponible en téléchargement."

#: src/app/ui/content/home-view.vala:409
#: src/app/ui/content/home-view.vala:418
#, c-format
msgid "How would you like to download %s ?"
msgstr "Comment souhaitez-vous télécharger %s ?"

#: src/app/ui/content/home-view.vala:413
#: src/app/ui/content/home-view.vala:422
msgid "This will open a third-party application to download the archive."
msgstr "Ceci ouvrira une application tierce pour télécharger l'archive."

#: src/app/ui/content/home-view.vala:415
#: src/app/ui/content/home-view.vala:424
msgid "From a server"
msgstr "Depuis un serveur"

#: src/app/ui/content/home-view.vala:416
#: src/app/ui/content/home-view.vala:425
msgid "Peer-to-peer network"
msgstr "Réseau pair à pair"

Expand Down Expand Up @@ -512,18 +509,18 @@ msgstr "Quitter"
msgid "Night mode"
msgstr "Mode nuit"

#: src/app/ui/window.vala:306
#: src/app/ui/window.vala:307
msgid "A Web archives viewer."
msgstr "Un visionneur d'archives web."

#: src/app/ui/window.vala:307
#: src/app/ui/window.vala:308
msgid "Copyright © 2017-2017 - Birros"
msgstr "Copyright © 2017-2017 - Birros"

#: src/app/ui/window.vala:387
#: src/app/ui/window.vala:427
msgid "Please choose a file"
msgstr "Veuillez choisir un fichier"

#: src/app/ui/window.vala:457
#: src/app/ui/window.vala:497
msgid "Are you sure to open external link ?"
msgstr "Voulez-vous vraiment ouvrir le lien externe ?"
2 changes: 1 addition & 1 deletion src/app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ web_archives_sources = [
'ui/content/notification-bar.vala',
'ui/content/combo-box-text.vala',
'ui/content/combo-box-row.vala',
'ui/content/details-view.vala',
'ui/content/details-dialog.vala',
'ui/content/web-view.vala',
'ui/content/search-view.vala',
'ui/content/search-result-row.vala',
Expand Down
1 change: 0 additions & 1 deletion src/app/states/navigation-logic.vala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public class WebArchives.NavigationLogic : Object {
case RouteState.Route.SEARCH:
case RouteState.Route.SEARCHIN:
case RouteState.Route.BOOKMARK:
case RouteState.Route.DETAILS:
case RouteState.Route.HISTORY:
{
context.route_state.route = context.route_state.last_route;
Expand Down
1 change: 0 additions & 1 deletion src/app/states/route-state.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class WebArchives.RouteState : Object {
WEB,
SEARCH,
SEARCHIN,
DETAILS,
BOOKMARK,
HISTORY
}
Expand Down
7 changes: 0 additions & 7 deletions src/app/states/title-logic.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ public class WebArchives.TitleLogic : Object {
context.title_state.subtitle = "";
break;
}
case RouteState.Route.DETAILS:
{
context.title_state.title = _("Details");
context.title_state.subtitle =
context.archive_state.archive.title;
break;
}
case RouteState.Route.WEB:
{
context.title_state.title = context.web_view_state.title;
Expand Down
9 changes: 0 additions & 9 deletions src/app/ui/content/content.vala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
public class WebArchives.Content : Gtk.Stack {
private Context context;
private HomeView home_view;
private DetailsView details_view;
private WebView web_view;
private SearchView search_view;
private BookmarkView bookmark_view;
Expand All @@ -14,9 +13,6 @@ public class WebArchives.Content : Gtk.Stack {
home_view = new HomeView (context);
add (home_view);

details_view = new DetailsView (context);
add (details_view);

web_view = new WebView (context);
add (web_view);

Expand Down Expand Up @@ -57,11 +53,6 @@ public class WebArchives.Content : Gtk.Stack {
set_visible_child (search_view);
break;
}
case RouteState.Route.DETAILS:
{
set_visible_child (details_view);
break;
}
case RouteState.Route.BOOKMARK:
{
set_visible_child (bookmark_view);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
public class WebArchives.DetailsView : Gtk.Box {
private Context context;
public class WebArchives.DetailsDialog : Gtk.Dialog {
private Gtk.Grid grid;

public DetailsView (Context context) {
this.context = context;
set_homogeneous (true);
public DetailsDialog (ArchiveItem archive) {
GLib.Object (
use_header_bar: 1
);

Gtk.HeaderBar header_bar = (Gtk.HeaderBar) get_header_bar ();
header_bar.show_close_button = true;
header_bar.title = _("Details");
header_bar.subtitle = archive.title;

Gtk.Box content_area = get_content_area ();
content_area.set_homogeneous (true);

Gtk.ScrolledWindow scrolled_window = new Gtk.ScrolledWindow (
null, null
);
add (scrolled_window);
content_area.add (scrolled_window);

Hdy.Column max_width_bin = new Hdy.Column ();
max_width_bin.set_maximum_width (500);
max_width_bin.set_maximum_width (900);
scrolled_window.add (max_width_bin);

grid = new Gtk.Grid ();
grid.orientation = Gtk.Orientation.VERTICAL;
grid.column_homogeneous = true;
grid.margin_top = 12;
grid.margin_bottom = 12;
grid.column_spacing = 24;
grid.row_spacing = 12;
max_width_bin.add (grid);

context.archive_state.notify["archive"].connect (on_archive);
show_infos (archive);
}

private void show_text (string label, string content) {
Expand Down Expand Up @@ -90,16 +99,7 @@ public class WebArchives.DetailsView : Gtk.Box {
return label_widget;
}

private void on_archive () {
if (context.archive_state.archive == null) {
return;
}

ArchiveItem archive = context.archive_state.archive;

grid.forall ((element) => grid.remove (element));


private void show_infos (ArchiveItem archive) {
string folder_uri = "";
string folder_path = "";
if (archive.path != "") {
Expand Down Expand Up @@ -132,7 +132,5 @@ public class WebArchives.DetailsView : Gtk.Box {
show_text (_("Creator"), archive.creator);
show_text (_("Publisher"), archive.publisher);
show_text (_("Tags"), tags_text);

show_all ();
}
}
13 changes: 11 additions & 2 deletions src/app/ui/content/home-view.vala
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,25 @@ public class WebArchives.HomeView : Gtk.Overlay {
}
});
row.details.connect (() => {
context.archive_state.archive = archive;
revealer.reveal_child = false;
context.route_state.route = RouteState.Route.DETAILS;
show_details (archive);
});
row.download.connect (() => {
ask_for_downloading (archive);
});
return row;
}

private void show_details (ArchiveItem archive) {
Gtk.Window win = (Gtk.Window) this.get_toplevel ();
DetailsDialog details_dialog = new DetailsDialog (archive);
details_dialog.modal = true;
details_dialog.set_transient_for (win);
details_dialog.default_width = 600;
details_dialog.default_height = 510;
details_dialog.show_all ();
}

private void ask_for_downloading (ArchiveItem archive) {
Gtk.Window win = (Gtk.Window) this.get_toplevel ();
string espaced_title = Markup.escape_text (archive.title);
Expand Down
1 change: 0 additions & 1 deletion src/app/ui/header-bar/header-bar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public class WebArchives.HeaderBar : Gtk.HeaderBar {
context.search_in_state.focus ();
break;
}
case RouteState.Route.DETAILS:
case RouteState.Route.BOOKMARK:
case RouteState.Route.HISTORY:
{
Expand Down

0 comments on commit f14eef5

Please sign in to comment.