summaryrefslogtreecommitdiff
path: root/src/PhotoPage.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:20 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:20 +0200
commit5e9f4eea451a77ba3b93db3747841ed2bd969e9f (patch)
tree75046a38ca68975261d853a2e56ff7bf6b3e1daa /src/PhotoPage.vala
parent18b52c2983a1b3409011f72d27f15de576c5eb1c (diff)
New upstream version 0.30.1upstream/0.30.1
Diffstat (limited to 'src/PhotoPage.vala')
-rw-r--r--src/PhotoPage.vala75
1 files changed, 59 insertions, 16 deletions
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index 5c2a1de..af1d50c 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -396,6 +396,9 @@ public abstract class EditingHostPage : SinglePhotoPage {
private Gtk.ToggleToolButton redeye_button = null;
private Gtk.ToggleToolButton adjust_button = null;
private Gtk.ToggleToolButton straighten_button = null;
+#if ENABLE_FACES
+ private Gtk.ToggleToolButton faces_button = null;
+#endif
private Gtk.ToolButton enhance_button = null;
private Gtk.Scale zoom_slider = null;
private Gtk.ToolButton prev_button = new Gtk.ToolButton(null, Resources.PREVIOUS_LABEL);
@@ -446,7 +449,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
// crop tool
crop_button = new Gtk.ToggleToolButton ();
- crop_button.set_icon_name("crop");
+ crop_button.set_icon_name("image-crop-symbolic");
crop_button.set_label(Resources.CROP_LABEL);
crop_button.set_tooltip_text(Resources.CROP_TOOLTIP);
crop_button.toggled.connect(on_crop_toggled);
@@ -455,7 +458,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
// straightening tool
straighten_button = new Gtk.ToggleToolButton ();
- straighten_button.set_icon_name("straighten");
+ straighten_button.set_icon_name(Resources.STRAIGHTEN);
straighten_button.set_label(Resources.STRAIGHTEN_LABEL);
straighten_button.set_tooltip_text(Resources.STRAIGHTEN_TOOLTIP);
straighten_button.toggled.connect(on_straighten_toggled);
@@ -464,7 +467,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
// redeye reduction tool
redeye_button = new Gtk.ToggleToolButton ();
- redeye_button.set_icon_name("redeye");
+ redeye_button.set_icon_name("stock-eye-symbolic");
redeye_button.set_label(Resources.RED_EYE_LABEL);
redeye_button.set_tooltip_text(Resources.RED_EYE_TOOLTIP);
redeye_button.toggled.connect(on_redeye_toggled);
@@ -488,6 +491,13 @@ public abstract class EditingHostPage : SinglePhotoPage {
enhance_button.is_important = true;
toolbar.insert(enhance_button, -1);
+#if ENABLE_FACES
+ // faces tool
+ insert_faces_button(toolbar);
+ faces_button = new Gtk.ToggleToolButton();
+ //face_button
+#endif
+
// separator to force next/prev buttons to right side of toolbar
Gtk.SeparatorToolItem separator = new Gtk.SeparatorToolItem();
separator.set_expand(true);
@@ -496,8 +506,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
Gtk.Box zoom_group = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
- Gtk.Image zoom_out = new Gtk.Image.from_pixbuf(Resources.load_icon(Resources.ICON_ZOOM_OUT,
- Resources.ICON_ZOOM_SCALE));
+ Gtk.Image zoom_out = new Gtk.Image.from_icon_name("image-zoom-out-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
Gtk.EventBox zoom_out_box = new Gtk.EventBox();
zoom_out_box.set_above_child(true);
zoom_out_box.set_visible_window(false);
@@ -518,8 +527,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
zoom_group.pack_start(zoom_slider, false, false, 0);
- Gtk.Image zoom_in = new Gtk.Image.from_pixbuf(Resources.load_icon(Resources.ICON_ZOOM_IN,
- Resources.ICON_ZOOM_SCALE));
+ Gtk.Image zoom_in = new Gtk.Image.from_icon_name("image-zoom-in-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
Gtk.EventBox zoom_in_box = new Gtk.EventBox();
zoom_in_box.set_above_child(true);
zoom_in_box.set_visible_window(false);
@@ -534,15 +542,19 @@ public abstract class EditingHostPage : SinglePhotoPage {
toolbar.insert(group_wrapper, -1);
+ separator = new Gtk.SeparatorToolItem();
+ separator.set_draw(false);
+ toolbar.insert(separator, -1);
+
// previous button
prev_button.set_tooltip_text(_("Previous photo"));
- prev_button.set_icon_name("go-previous");
+ prev_button.set_icon_name("go-previous-symbolic");
prev_button.clicked.connect(on_previous_photo);
toolbar.insert(prev_button, -1);
// next button
next_button.set_tooltip_text(_("Next photo"));
- next_button.set_icon_name("go-next");
+ next_button.set_icon_name("go-next-symbolic");
next_button.clicked.connect(on_next_photo);
toolbar.insert(next_button, -1);
}
@@ -2226,9 +2238,9 @@ public abstract class EditingHostPage : SinglePhotoPage {
Gtk.Allocation toolbar_alloc;
get_toolbar().get_allocation(out toolbar_alloc);
- Gdk.Screen screen = get_container().get_screen();
- x = screen.get_width();
- y = screen.get_height() - toolbar_alloc.height -
+ var dimensions = Scaling.get_screen_dimensions(get_container());
+ x = dimensions.width;
+ y = dimensions.height - toolbar_alloc.height -
tool_alloc.height - TOOL_WINDOW_SEPARATOR;
// put larger adjust tool off to the side
@@ -2241,9 +2253,9 @@ public abstract class EditingHostPage : SinglePhotoPage {
}
// however, clamp the window so it's never off-screen initially
- Gdk.Screen screen = get_container().get_screen();
- x = x.clamp(0, screen.get_width() - tool_alloc.width);
- y = y.clamp(0, screen.get_height() - tool_alloc.height);
+ var dimensions = Scaling.get_screen_dimensions(get_container());
+ x = x.clamp(0, dimensions.width - tool_alloc.width);
+ y = y.clamp(0, dimensions.height - tool_alloc.height);
tool_window.move(x, y);
tool_window.show();
@@ -2323,6 +2335,14 @@ public abstract class EditingHostPage : SinglePhotoPage {
protected void unset_view_collection() {
parent_view = null;
}
+
+ // This method is intentionally empty --its purpose is to allow overriding
+ // it in LibraryPhotoPage, since FacesTool must only be present in
+ // LibraryMode, but it need to be called from constructor of EditingHostPage
+ // to place it correctly in the toolbar.
+ protected virtual void insert_faces_button(Gtk.Toolbar toolbar) {
+ ;
+ }
}
//
@@ -2337,6 +2357,9 @@ public class LibraryPhotoPage : EditingHostPage {
}
}
+#if ENABLE_FACES
+ private Gtk.ToggleToolButton faces_button = null;
+#endif
private CollectionPage? return_page = null;
private bool return_to_collection_on_release = false;
private LibraryPhotoPageViewFilter filter = new LibraryPhotoPageViewFilter();
@@ -2641,7 +2664,7 @@ public class LibraryPhotoPage : EditingHostPage {
if (!has_photo() || !((LibraryPhoto) get_photo()).is_flagged())
return null;
- return Resources.get_icon(Resources.ICON_FLAGGED_TRINKET);
+ return Resources.get_flagged_trinket(scale);
}
private void on_slideshow() {
@@ -3144,5 +3167,25 @@ public class LibraryPhotoPage : EditingHostPage {
get_command_manager().execute(new ModifyTagsCommand(photo, new_tags));
}
+
+#if ENABLE_FACES
+ private void on_faces_toggled() {
+ on_tool_button_toggled(faces_button, FacesTool.factory);
+ }
+
+ protected void toggle_faces() {
+ faces_button.set_active(!faces_button.get_active());
+ }
+
+ protected override void insert_faces_button(Gtk.Toolbar toolbar) {
+ faces_button = new Gtk.ToggleToolButton.from_stock(Resources.FACES_TOOL);
+ faces_button.set_icon_name(Resources.ICON_FACES);
+ faces_button.set_label(Resources.FACES_LABEL);
+ faces_button.set_tooltip_text(Resources.FACES_TOOLTIP);
+ faces_button.toggled.connect(on_faces_toggled);
+ faces_button.is_important = true;
+ toolbar.insert(faces_button, -1);
+ }
+#endif
}