Skip to content

Commit 8896b5b

Browse files
committed
change sensitivity of next/prev/refresh
1 parent afd2f03 commit 8896b5b

File tree

3 files changed

+29
-21
lines changed

3 files changed

+29
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ master
44
- much better focus indicator in imagedisplay
55
- update from nip4 again to get faster and prettier repaints
66
- better complex image display
7+
- much better prev / next / refresh handling
78

89
## 4.0.0 31/05/25
910

src/gtk/imagewindow.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,23 @@
141141
</child>
142142

143143
<child type="start">
144-
<object class="GtkButton">
144+
<object class="GtkButton" id="prev">
145145
<property name="icon-name">go-previous-symbolic</property>
146146
<property name="action-name">win.prev_image</property>
147147
<property name="tooltip-text">Previous image</property>
148148
</object>
149149
</child>
150150

151151
<child type="start">
152-
<object class="GtkButton">
152+
<object class="GtkButton" id="next">
153153
<property name="icon-name">go-next-symbolic</property>
154154
<property name="action-name">win.next_image</property>
155155
<property name="tooltip-text">Next image</property>
156156
</object>
157157
</child>
158158

159159
<child type="start">
160-
<object class="GtkButton">
160+
<object class="GtkButton" id="refresh">
161161
<property name="icon-name">view-refresh-symbolic</property>
162162
<property name="action-name">win.reload</property>
163163
<property name="tooltip-text">Reload</property>

src/imagewindow.c

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ struct _Imagewindow {
6565
GFile *load_folder;
6666

6767
GtkWidget *right_click_menu;
68+
GtkWidget *prev;
69+
GtkWidget *next;
70+
GtkWidget *refresh;
6871
GtkWidget *title;
6972
GtkWidget *subtitle;
7073
GtkWidget *gears;
@@ -753,6 +756,11 @@ imagewindow_imageui_set_visible(Imagewindow *win,
753756

754757
// update the menus
755758
imagewindow_tilesource_changed(new_tilesource, win);
759+
760+
// update sensitivity of titlebar buttons
761+
gtk_widget_set_sensitive(win->prev, win->n_files > 1);
762+
gtk_widget_set_sensitive(win->next, win->n_files > 1);
763+
gtk_widget_set_sensitive(win->refresh, win->n_files > 0);
756764
}
757765

758766
static void
@@ -1616,10 +1624,6 @@ imagewindow_error_clicked(GtkWidget *button, Imagewindow *win)
16161624
imagewindow_error_hide(win);
16171625
}
16181626

1619-
#define BIND(field) \
1620-
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), \
1621-
Imagewindow, field);
1622-
16231627
static void
16241628
imagewindow_class_init(ImagewindowClass *class)
16251629
{
@@ -1628,20 +1632,23 @@ imagewindow_class_init(ImagewindowClass *class)
16281632
gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS(class),
16291633
APP_PATH "/imagewindow.ui");
16301634

1631-
BIND(right_click_menu);
1632-
BIND(title);
1633-
BIND(subtitle);
1634-
BIND(gears);
1635-
BIND(progress_bar);
1636-
BIND(progress);
1637-
BIND(progress_cancel);
1638-
BIND(error_bar);
1639-
BIND(error_label);
1640-
BIND(main_box);
1641-
BIND(stack);
1642-
BIND(properties);
1643-
BIND(display_bar);
1644-
BIND(info_bar);
1635+
BIND_VARIABLE(Imagewindow, right_click_menu);
1636+
BIND_VARIABLE(Imagewindow, prev);
1637+
BIND_VARIABLE(Imagewindow, next);
1638+
BIND_VARIABLE(Imagewindow, refresh);
1639+
BIND_VARIABLE(Imagewindow, title);
1640+
BIND_VARIABLE(Imagewindow, subtitle);
1641+
BIND_VARIABLE(Imagewindow, gears);
1642+
BIND_VARIABLE(Imagewindow, progress_bar);
1643+
BIND_VARIABLE(Imagewindow, progress);
1644+
BIND_VARIABLE(Imagewindow, progress_cancel);
1645+
BIND_VARIABLE(Imagewindow, error_bar);
1646+
BIND_VARIABLE(Imagewindow, error_label);
1647+
BIND_VARIABLE(Imagewindow, main_box);
1648+
BIND_VARIABLE(Imagewindow, stack);
1649+
BIND_VARIABLE(Imagewindow, properties);
1650+
BIND_VARIABLE(Imagewindow, display_bar);
1651+
BIND_VARIABLE(Imagewindow, info_bar);
16451652

16461653
BIND_CALLBACK(imagewindow_pressed_cb);
16471654
BIND_CALLBACK(imagewindow_error_clicked);

0 commit comments

Comments
 (0)