From 3edbbd1cf0abb5eac6c6f4f232dee6992aa2dc80 Mon Sep 17 00:00:00 2001 From: esq4 Date: Sun, 24 Nov 2024 01:45:11 +0700 Subject: [PATCH] icon for snapshots restore button --- src/dtgtk/paint.c | 16 ++++++++++++++++ src/dtgtk/paint.h | 3 +++ src/libs/snapshots.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/dtgtk/paint.c b/src/dtgtk/paint.c index eae1c65ae7cc..6b338657c1c9 100644 --- a/src/dtgtk/paint.c +++ b/src/dtgtk/paint.c @@ -3449,6 +3449,22 @@ void dtgtk_cairo_paint_filtering_menu(cairo_t *cr, gint x, gint y, gint w, gint FINISH } +void dtgtk_cairo_paint_snapshots_restore(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data) +{ + PREAMBLE(1, 1, 0, 0) + + cairo_move_to(cr, 0.5, 0.05); + cairo_line_to(cr, 0.5, 0.95); + cairo_move_to(cr, 0.3, 0.6); + cairo_line_to(cr, 0.5, 0.95); + cairo_line_to(cr, 0.7, 0.6); + cairo_move_to(cr, 0.2, 0.95); + cairo_line_to(cr, 0.8, 0.95); + cairo_stroke(cr); + + FINISH +} + // clang-format off // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py // vim: shiftwidth=2 expandtab tabstop=2 cindent diff --git a/src/dtgtk/paint.h b/src/dtgtk/paint.h index 4133119c582b..ee918b22d261 100644 --- a/src/dtgtk/paint.h +++ b/src/dtgtk/paint.h @@ -347,6 +347,9 @@ void dtgtk_cairo_paint_pin(cairo_t *cr, gint x, gint y, gint w, gint h, gint fla /** Paint a menu icon for filtering in topbar */ void dtgtk_cairo_paint_filtering_menu(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data); +/** Paint an icon for snapshots restore button */ +void dtgtk_cairo_paint_snapshots_restore(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data); + #ifdef __cplusplus } // extern "C" #endif /* __cplusplus */ diff --git a/src/libs/snapshots.c b/src/libs/snapshots.c index 99efb1b6412c..d6cfb1e02616 100644 --- a/src/libs/snapshots.c +++ b/src/libs/snapshots.c @@ -554,7 +554,7 @@ static void _init_snapshot_entry(dt_lib_module_t *self, dt_lib_snapshot_t *s) g_signal_connect(G_OBJECT(s->entry), "activate", G_CALLBACK(_entry_activated_callback), self); - s->restore_button = gtk_button_new_with_label("⤓"); + s->restore_button = dtgtk_togglebutton_new(dtgtk_cairo_paint_snapshots_restore, 0, NULL); gtk_widget_set_tooltip_text(s->restore_button, _("restore snapshot into current history")); g_signal_connect(G_OBJECT(s->restore_button), "clicked",