summaryrefslogtreecommitdiff
path: root/src/Page.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:43:08 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:43:08 +0200
commit2b3f22361da0c1d8e6ce70d71352821758186db7 (patch)
tree5d10633b47369b3aa52a05bf889ede0dbe5ee108 /src/Page.vala
parent211da5fc3048ca2b6ccee2166b0aaaade55cb84f (diff)
parentdc6c76eb04dfe3d4262a1806808f0bc0bf523238 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/Page.vala')
-rw-r--r--src/Page.vala38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/Page.vala b/src/Page.vala
index 88fecc7..ea8606e 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -328,18 +328,6 @@ public abstract class Page : Gtk.ScrolledWindow {
action.set_enabled (sensitive);
}
- public void set_action_important(string name, bool important) {
- set_action_sensitive (name, important);
- }
-
- public void set_action_visible(string name, bool visible) {
- set_action_sensitive (name, visible);
- }
-
- public void set_action_short_label(string name, string short_label) {
- debug ("=> Set action short_label called for %s", name);
- }
-
public void set_action_details(string name, string? label, string? tooltip, bool sensitive) {
GLib.SimpleAction? action = get_action(name) as GLib.SimpleAction;
@@ -2031,6 +2019,11 @@ public abstract class SinglePhotoPage : Page {
canvas.draw.connect(on_canvas_exposed);
set_event_source(canvas);
+ Config.Facade.get_instance().colors_changed.connect(on_colors_changed);
+ }
+
+ ~SinglePhotoPage() {
+ Config.Facade.get_instance().colors_changed.disconnect(on_colors_changed);
}
public bool is_transition_in_progress() {
@@ -2081,9 +2074,7 @@ public abstract class SinglePhotoPage : Page {
int draw_y = (pixmap_dim.height - view_rect.height) / 2;
draw_y = draw_y.clamp(0, int.MAX);
-
- Gdk.cairo_set_source_pixbuf(pixmap_ctx, zoomed, draw_x, draw_y);
- pixmap_ctx.paint();
+ paint_pixmap_with_background(pixmap_ctx, zoomed, draw_x, draw_y);
}
protected void on_interactive_zoom(ZoomState interactive_zoom_state) {
@@ -2270,7 +2261,7 @@ public abstract class SinglePhotoPage : Page {
// when the resize is completed, do a high-quality repaint
repaint();
}
-
+
private bool on_canvas_exposed(Cairo.Context exposed_ctx) {
// draw pixmap onto canvas unless it's not been instantiated, in which case draw black
// (so either old image or contents of another page is not left on screen)
@@ -2290,7 +2281,7 @@ public abstract class SinglePhotoPage : Page {
protected virtual void updated_pixbuf(Gdk.Pixbuf pixbuf, UpdateReason reason, Dimensions old_dim) {
}
-
+
protected virtual void paint(Cairo.Context ctx, Dimensions ctx_dim) {
if (is_zoom_supported() && (!static_zoom_state.is_default())) {
set_source_color_from_string(ctx, "#000");
@@ -2301,12 +2292,11 @@ public abstract class SinglePhotoPage : Page {
} else if (!transition_clock.paint(ctx, ctx_dim.width, ctx_dim.height)) {
// transition is not running, so paint the full image on a black background
set_source_color_from_string(ctx, "#000");
-
+
ctx.rectangle(0, 0, pixmap_dim.width, pixmap_dim.height);
ctx.fill();
-
- Gdk.cairo_set_source_pixbuf(ctx, scaled, scaled_pos.x, scaled_pos.y);
- ctx.paint();
+
+ paint_pixmap_with_background(ctx, scaled, scaled_pos.x, scaled_pos.y);
}
}
@@ -2485,6 +2475,11 @@ public abstract class SinglePhotoPage : Page {
return (base.key_press_event != null) ? base.key_press_event(event) : true;
}
+
+ private void on_colors_changed() {
+ invalidate_transparent_background();
+ repaint();
+ }
}
//
@@ -2667,5 +2662,4 @@ public class DragAndDropHandler {
exporter = null;
}
-
}