Add a GObject property for view filtering

This commit is contained in:
Přemysl Eric Janouch 2021-12-17 07:26:50 +01:00
parent 1c2a441cb5
commit c136c089fa
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,7 @@ static FastivIoOrientation view_right[9] = {
enum {
PROP_SCALE = 1,
PROP_SCALE_TO_FIT,
PROP_FILTER,
N_PROPERTIES
};
@ -113,6 +114,9 @@ fastiv_view_get_property(
case PROP_SCALE_TO_FIT:
g_value_set_boolean(value, self->scale_to_fit);
break;
case PROP_FILTER:
g_value_set_boolean(value, self->filter);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
}
@ -755,6 +759,8 @@ fastiv_view_key_press_event(GtkWidget *widget, GdkEventKey *event)
case GDK_KEY_i:
self->filter = !self->filter;
g_object_notify_by_pspec(
G_OBJECT(self), view_properties[PROP_FILTER]);
gtk_widget_queue_draw(widget);
return TRUE;
@ -791,6 +797,9 @@ fastiv_view_class_init(FastivViewClass *klass)
view_properties[PROP_SCALE_TO_FIT] = g_param_spec_boolean(
"scale-to-fit", "Scale to fit", "Scale images down to fit the window",
TRUE, G_PARAM_READABLE);
view_properties[PROP_FILTER] = g_param_spec_boolean(
"filter", "Use filtering", "Scale images smoothly",
TRUE, G_PARAM_READABLE);
g_object_class_install_properties(
object_class, N_PROPERTIES, view_properties);