[maemo-commits] [maemo-commits] r13389 - in projects/haf/trunk/hildon-1: . examples src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Aug 24 12:06:27 EEST 2007
- Previous message: [maemo-commits] r13388 - projects/haf/tags/osso-gnome-vfs2
- Next message: [maemo-commits] r13390 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2007-08-24 12:06:26 +0300 (Fri, 24 Aug 2007) New Revision: 13389 Modified: projects/haf/trunk/hildon-1/ChangeLog projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-example.c projects/haf/trunk/hildon-1/src/hildon-volumebar.c Log: Improving the focus handling in the volumebar widgets. Fixes NB#63955 and NB#65155. Also fixing the set_property accessor so that "mute" property can be actually set. I'm scared that nobody noticed it's totally broken. Modified: projects/haf/trunk/hildon-1/ChangeLog =================================================================== --- projects/haf/trunk/hildon-1/ChangeLog 2007-08-23 17:17:07 UTC (rev 13388) +++ projects/haf/trunk/hildon-1/ChangeLog 2007-08-24 09:06:26 UTC (rev 13389) @@ -1,3 +1,11 @@ +2007-08-24 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + + * examples/hildon-hvolumebar-example.c: + * src/hildon-volumebar.c: Improving the focus handling in the + volumebar widgets. Fixes NB#63955 and NB#65155. Also fixing the + set_property accessor so that "mute" property can be actually set. I'm + scared that nobody noticed it's totally broken. + 2007-08-23 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * debian/control: Use libesd0-dev or osso-esd-dev as esd dependancy. Modified: projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-example.c =================================================================== --- projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-example.c 2007-08-23 17:17:07 UTC (rev 13388) +++ projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-example.c 2007-08-24 09:06:26 UTC (rev 13389) @@ -28,6 +28,19 @@ #include <gtk/gtk.h> #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 @@ 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); Modified: projects/haf/trunk/hildon-1/src/hildon-volumebar.c =================================================================== --- projects/haf/trunk/hildon-1/src/hildon-volumebar.c 2007-08-23 17:17:07 UTC (rev 13388) +++ projects/haf/trunk/hildon-1/src/hildon-volumebar.c 2007-08-24 09:06:26 UTC (rev 13389) @@ -455,12 +455,12 @@ break; case PROP_HILDON_LEVEL: - hildon_volumebar_set_level (HILDON_VOLUMEBAR (priv->volumebar), + hildon_volumebar_set_level (HILDON_VOLUMEBAR (object), g_value_get_double (value)); break; case PROP_HILDON_MUTE: - hildon_volumebar_set_mute (HILDON_VOLUMEBAR (priv->volumebar), + hildon_volumebar_set_mute (HILDON_VOLUMEBAR (object), g_value_get_boolean (value)); break; @@ -564,20 +564,25 @@ gboolean mute) { HildonVolumebarPrivate *priv; - gboolean focusable = TRUE; + gboolean focusable; + gboolean volumebar_has_focus; + gboolean button_has_focus; g_return_if_fail (HILDON_IS_VOLUMEBAR (self)); priv = HILDON_VOLUMEBAR_GET_PRIVATE (self); g_assert (priv); + volumebar_has_focus = GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (priv->volumebar)); + button_has_focus = GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (priv->tbutton)); + /* Slider should be insensitive when mute is on */ gtk_widget_set_sensitive (GTK_WIDGET (priv->volumebar), !mute); - + focusable = GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (priv->volumebar)); if (mute){ - if (focusable) { + if (focusable && volumebar_has_focus) { /* Make mute button focusable since the slider isn't anymore */ g_object_set (G_OBJECT (priv->tbutton), "can-focus", TRUE, NULL); gtk_widget_grab_focus (GTK_WIDGET (priv->tbutton)); @@ -588,15 +593,9 @@ g_object_set (G_OBJECT (priv->tbutton), "can-focus", FALSE, NULL); /* Mute off grabs focus */ - if (focusable){ - gtk_widget_grab_focus (GTK_WIDGET (self)); + if (focusable && button_has_focus){ + gtk_widget_grab_focus (GTK_WIDGET (priv->volumebar)); } - else{ - /* If volumebar is not focusable, focus the parent window instead */ - GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (self), - GTK_TYPE_WINDOW); - gtk_window_set_focus (GTK_WINDOW (win), NULL); - } } /* Update mute button state and redraw */
- Previous message: [maemo-commits] r13388 - projects/haf/tags/osso-gnome-vfs2
- Next message: [maemo-commits] r13390 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]