widget-factory: Make the record button more interesting

This commit is contained in:
Matthias Clasen 2014-10-03 01:13:02 -04:00
parent 3b18ea71c3
commit b22919220b
2 changed files with 16 additions and 1 deletions

View File

@ -290,6 +290,19 @@ on_scale_button_value_changed (GtkScaleButton *button,
gtk_widget_trigger_tooltip_query (GTK_WIDGET (button));
}
static void
on_record_button_toggled (GtkToggleButton *button,
gpointer user_data)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (button));
if (gtk_toggle_button_get_active (button))
gtk_style_context_remove_class (context, "destructive-action");
else
gtk_style_context_add_class (context, "destructive-action");
}
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
@ -882,6 +895,7 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
gtk_builder_add_callback_symbol (builder, "on_record_button_toggled", (GCallback)on_record_button_toggled);
gtk_builder_connect_signals (builder, NULL);

View File

@ -3239,9 +3239,10 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton">
<object class="GtkToggleButton" id="record_button">
<property name="visible">True</property>
<property name="halign">center</property>
<signal name="toggled" handler="on_record_button_toggled"/>
<style>
<class name="text-button"/>
<class name="image-button"/>