Commit 01879512 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

fishbowl: Fix the lock button

parent fb86fd90
Pipeline #83765 passed with stages
in 25 minutes and 15 seconds
...@@ -234,6 +234,15 @@ prev_button_clicked_cb (GtkButton *source, ...@@ -234,6 +234,15 @@ prev_button_clicked_cb (GtkButton *source,
set_widget_type (fishbowl, new_index); set_widget_type (fishbowl, new_index);
} }
void
changes_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
if (gtk_toggle_button_get_active (button))
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-prevent");
else
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-allow");
}
GtkWidget * GtkWidget *
do_fishbowl (GtkWidget *do_widget) do_fishbowl (GtkWidget *do_widget)
...@@ -261,6 +270,7 @@ do_fishbowl (GtkWidget *do_widget) ...@@ -261,6 +270,7 @@ do_fishbowl (GtkWidget *do_widget)
gtk_builder_add_callback_symbols (builder, gtk_builder_add_callback_symbols (builder,
"next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb), "next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb),
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb), "prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
"changes_toggled_cb", G_CALLBACK (changes_toggled_cb),
NULL); NULL);
gtk_builder_connect_signals (builder, NULL); gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<interface> <interface>
<object class="GtkWindow" id="window"> <object class="GtkWindow" id="window">
<property name="title" translatable="yes">Fishbowl</property> <property name="title" translatable="yes">Fishbowl</property>
<property name="default-width">400</property>
<property name="default-height">400</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id=""> <object class="GtkHeaderBar" id="">
<property name="show-title-buttons">1</property> <property name="show-title-buttons">1</property>
...@@ -46,17 +48,9 @@ ...@@ -46,17 +48,9 @@
</child> </child>
<child type="end"> <child type="end">
<object class="GtkToggleButton" id="changes_allow"> <object class="GtkToggleButton" id="changes_allow">
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
<property name="icon-name">changes-allow</property> <property name="icon-name">changes-allow</property>
<property name="relief">none</property> <property name="relief">none</property>
</object> <signal name="notify::active" handler="changes_toggled_cb"/>
</child>
<child type="end">
<object class="GtkToggleButton" id="changes_prevent">
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean"/>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean"/>
<property name="icon-name">changes-prevent</property>
<property name="relief">none</property>
</object> </object>
</child> </child>
</object> </object>
...@@ -65,7 +59,7 @@ ...@@ -65,7 +59,7 @@
<object class="GtkFishbowl" id="bowl"> <object class="GtkFishbowl" id="bowl">
<property name="visible">True</property> <property name="visible">True</property>
<property name="animating">True</property> <property name="animating">True</property>
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/> <property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean | sync-create"/>
</object> </object>
</child> </child>
</object> </object>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment