[gtk+] widget-factory: Make the record button more interesting
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget-factory: Make the record button more interesting
- Date: Fri, 3 Oct 2014 05:13:22 +0000 (UTC)
commit b22919220b9183bdd00ec58768a82fb28d1ea716
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 3 01:13:02 2014 -0400
widget-factory: Make the record button more interesting
demos/widget-factory/widget-factory.c | 14 ++++++++++++++
demos/widget-factory/widget-factory.ui | 3 ++-
2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 53a044b..12d10a9 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -291,6 +291,19 @@ on_scale_button_value_changed (GtkScaleButton *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,
gpointer data)
@@ -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);
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 158f90f..c56a66c 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -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"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]