X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=examples%2Fhildon-hvolumebar-example.c;h=27e8b86da242904aafeb73fe89dedeb73f249d1e;hb=03db66b02641d8cf92322c339b3533c8d01bfe99;hp=65e94d5e979aef488665d353c8f0f2231e94c988;hpb=c6de6e4fa45ec49339f4cc42b239272f30241e1d;p=hildon diff --git a/examples/hildon-hvolumebar-example.c b/examples/hildon-hvolumebar-example.c index 65e94d5..27e8b86 100644 --- a/examples/hildon-hvolumebar-example.c +++ b/examples/hildon-hvolumebar-example.c @@ -8,7 +8,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 of - * the License. + * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,6 +28,19 @@ #include #include "hildon.h" +void +on_mute_clicked (GtkWidget *clicked, + GObject *bar); + +void +on_mute_clicked (GtkWidget *clicked, + GObject *bar) +{ + gboolean focus; + g_object_get (bar, "mute", &focus, NULL); + g_object_set (bar, "mute", !focus, NULL); +} + int main (int argc, char **args) @@ -35,13 +48,17 @@ main (int argc, gtk_init (&argc, &args); GtkDialog *dialog = GTK_DIALOG (gtk_dialog_new ()); + GtkButton *button = GTK_BUTTON (gtk_button_new_with_label ("mute")); HildonHVolumebar *bar = HILDON_HVOLUMEBAR (hildon_hvolumebar_new ()); gtk_widget_set_size_request (GTK_WIDGET (bar), 400, -1); gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (bar), FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (button), FALSE, FALSE, 0); gtk_dialog_add_button (dialog, "Close", GTK_RESPONSE_CLOSE); + g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_mute_clicked), bar); + gtk_widget_show_all (GTK_WIDGET (dialog)); gtk_dialog_run (dialog);