Commit 8ee99a10 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui Committed by Zander

Symbolic Previewer: show a warning when icon doesn't contain -symbolic suffix

Fixes #11
parent 3694253a
......@@ -3,6 +3,7 @@ data/org.gnome.IconPreview.desktop.in
src/exporter/colour.ui
src/exporter/symbolic.ui
src/views/colourpane.ui
src/views/symbolic.vala
src/views/symbolicpane.ui
src/help-overlay.ui
src/menus.ui
......@@ -10,4 +11,4 @@ src/recentrow.ui
src/window.ui
src/window.vala
src/wizard.ui
src/wizard.vala
\ No newline at end of file
src/wizard.vala
......@@ -4,6 +4,7 @@ namespace IconPreview {
public class Symbolic : Box, Previewer {
static string[] symbolics;
private InfoBar info_bar = new InfoBar();
private SymbolicPane light = new SymbolicPane();
private SymbolicPane dark = new SymbolicPane();
......@@ -15,8 +16,16 @@ namespace IconPreview {
set {
_icon = value;
light.icon = dark.icon = new FileIcon(_icon);
if (_icon.get_basename().contains("-symbolic")) {
this.info_bar.hide();
} else {
this.info_bar.show_all();
}
}
}
public Symbolic () {
Object(orientation: Orientation.VERTICAL);
}
public Exporter exporter {
owned get {
......@@ -43,10 +52,27 @@ namespace IconPreview {
}
construct {
var panes_container = new Box(HORIZONTAL, 0);
light.theme = "Adwaita";
dark.theme = "Adwaita-dark";
pack_start(light);
pack_end(dark);
panes_container.pack_start(light);
panes_container.pack_end(dark);
var warning_label = new Label(_("The icon is not recoloring because the file name needs to end in \"-symbolic\""));
warning_label.set_halign(START);
warning_label.set_valign(CENTER);
var content_area = info_bar.get_content_area();
var warning_img = new Image.from_icon_name("dialog-warning-symbolic", LARGE_TOOLBAR);
content_area.add(warning_img);
content_area.add(warning_label);
content_area.margin = 6;
info_bar.set_message_type(WARNING);
pack_start(info_bar);
pack_start(panes_container);
panes_container.show();
shuffle();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment