[maemo-commits] [maemo-commits] r12382 - in projects/haf/trunk/hildon-1: . examples src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Jun 19 15:00:45 EEST 2007
- Previous message: [maemo-commits] r12381 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r12383 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2007-06-19 15:00:38 +0300 (Tue, 19 Jun 2007) New Revision: 12382 Added: projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-insensitive-example.c Modified: projects/haf/trunk/hildon-1/ChangeLog projects/haf/trunk/hildon-1/examples/Makefile.am projects/haf/trunk/hildon-1/src/hildon-helper.c projects/haf/trunk/hildon-1/src/hildon-volumebar.c projects/haf/trunk/hildon-1/src/hildon-volumebar.h Log: Adding the hildon_volumebar_set_range_insensitive_message and hildon_volumebar_set_range_insensitive_messagef functions to set insensitive message on the slider of the volumebar. Fixes NB#61129. Modified: projects/haf/trunk/hildon-1/ChangeLog =================================================================== --- projects/haf/trunk/hildon-1/ChangeLog 2007-06-19 11:44:40 UTC (rev 12381) +++ projects/haf/trunk/hildon-1/ChangeLog 2007-06-19 12:00:38 UTC (rev 12382) @@ -1,3 +1,15 @@ +2007-06-19 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + + * src/hildon-volumebar.c: + * src/hildon-volumebar.h: Adding the + hildon_volumebar_set_range_insensitive_message and + hildon_volumebar_set_range_insensitive_messagef functions to set + insensitive message on the slider of the volumebar. Fixes NB#61129. + + * examples/Makefile.am: + * examples/hildon-hvolumebar-insensitive-example.c: Adding an example to + test the new insensitive messsage functionality on HildonVolumebar. + 2007-06-14 Xan Lopez <xan.lopez at nokia.com> * src/hildon-private.c (hildon_private_composite_focus): make the focus handler @@ -9,6 +21,7 @@ http://bugzilla.gnome.org/show_bug.cgi?id=56070 hiding and showing the back button on after clearing the trail. +>>>>>>> .r12381 2007-06-13 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * src/hildon-code-dialog.c: Removing the separator from the dialog. Modified: projects/haf/trunk/hildon-1/examples/Makefile.am =================================================================== --- projects/haf/trunk/hildon-1/examples/Makefile.am 2007-06-19 11:44:40 UTC (rev 12381) +++ projects/haf/trunk/hildon-1/examples/Makefile.am 2007-06-19 12:00:38 UTC (rev 12382) @@ -23,6 +23,7 @@ hildon-toolbar-example \ hildon-code-dialog-example \ hildon-hvolumebar-example \ + hildon-hvolumebar-insensitive-example \ hildon-lookup-example \ hildon-number-editor-example \ hildon-scrolled-window-example \ @@ -142,6 +143,11 @@ hildon_hvolumebar_example_CFLAGS = $(HILDON_OBJ_CFLAGS) hildon_hvolumebar_example_SOURCES = hildon-hvolumebar-example.c +# Hildon hvolume bar insensitive example +hildon_hvolumebar_insensitive_example_LDADD = $(HILDON_OBJ_LIBS) +hildon_hvolumebar_insensitive_example_CFLAGS = $(HILDON_OBJ_CFLAGS) +hildon_hvolumebar_insensitive_example_SOURCES = hildon-hvolumebar-insensitive-example.c + # Hildon toolbar example hildon_toolbar_example_LDADD = $(HILDON_OBJ_LIBS) hildon_toolbar_example_CFLAGS = $(HILDON_OBJ_CFLAGS) Added: projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-insensitive-example.c =================================================================== --- projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-insensitive-example.c 2007-06-19 11:44:40 UTC (rev 12381) +++ projects/haf/trunk/hildon-1/examples/hildon-hvolumebar-insensitive-example.c 2007-06-19 12:00:38 UTC (rev 12382) @@ -0,0 +1,57 @@ +/* + * This file is a part of hildon examples + * + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. + * + * Author: Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * + * 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, 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <glib.h> +#include <gtk/gtk.h> +#include "hildon.h" + +int +main (int argc, + char **args) +{ + gtk_init (&argc, &args); + + GtkDialog *dialog = GTK_DIALOG (gtk_dialog_new ()); + + HildonHVolumebar *bar_1 = HILDON_HVOLUMEBAR (hildon_hvolumebar_new ()); + HildonHVolumebar *bar_2 = HILDON_HVOLUMEBAR (hildon_hvolumebar_new ()); + gtk_widget_set_size_request (GTK_WIDGET (bar_1), 400, -1); + gtk_widget_set_size_request (GTK_WIDGET (bar_2), 400, -1); + + hildon_volumebar_set_range_insensitive_message ((GtkWidget *) bar_1, "Can't set volume while muted"); + hildon_volumebar_set_range_insensitive_messagef ((GtkWidget *) bar_2, "Can't set volume while %s", "muted"); + + gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (bar_1), FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (bar_2), FALSE, FALSE, 0); + gtk_dialog_add_button (dialog, "Close", GTK_RESPONSE_CLOSE); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + gtk_dialog_run (dialog); + + return 0; +} + + Modified: projects/haf/trunk/hildon-1/src/hildon-helper.c =================================================================== --- projects/haf/trunk/hildon-1/src/hildon-helper.c 2007-06-19 11:44:40 UTC (rev 12381) +++ projects/haf/trunk/hildon-1/src/hildon-helper.c 2007-06-19 12:00:38 UTC (rev 12382) @@ -271,7 +271,6 @@ * using a standard @HildonBanner. * **/ - void hildon_helper_set_insensitive_message (GtkWidget *widget, const gchar *message) @@ -304,7 +303,6 @@ * A version of hildon_helper_set_insensitive_message with string formatting. * **/ - void hildon_helper_set_insensitive_messagef (GtkWidget *widget, const gchar *format, Modified: projects/haf/trunk/hildon-1/src/hildon-volumebar.c =================================================================== --- projects/haf/trunk/hildon-1/src/hildon-volumebar.c 2007-06-19 11:44:40 UTC (rev 12381) +++ projects/haf/trunk/hildon-1/src/hildon-volumebar.c 2007-06-19 12:00:38 UTC (rev 12382) @@ -700,3 +700,56 @@ /* FIXME Use numerical val, id */ g_signal_emit_by_name (GTK_WIDGET (self), "level_changed"); } + +/** + * hildon_volumebar_set_range_insensitive_message: + * @widget: A @GtkWidget to assign the banner to + * @message: A message to display to the user + * + * Used to asign an insensitive message to the slider of the given volumebar. + * It simply calls hildon_helper_set_insensitive_message on the slider/range of + * the volumebar. + */ +void +hildon_volumebar_set_range_insensitive_message (GtkWidget *widget, + const gchar *message) +{ + g_return_if_fail (HILDON_IS_VOLUMEBAR (widget)); + + HildonVolumebarPrivate *priv; + priv = HILDON_VOLUMEBAR_GET_PRIVATE (widget); + + hildon_helper_set_insensitive_message ((GtkWidget *) priv->volumebar, message); +} + +/** + * hildon_volumebar_set_range_insensitive_messagef: + * @widget: A @GtkWidget to assign the banner to + * @format : a printf-like format string + * @varargs : arguments for the format string + * + * A helper printf-like variant of hildon_helper_set_insensitive_message. + */ +void +hildon_volumebar_set_range_insensitive_messagef (GtkWidget *widget, + const gchar *format, + ...) +{ + g_return_if_fail (HILDON_IS_VOLUMEBAR (widget)); + + HildonVolumebarPrivate *priv; + priv = HILDON_VOLUMEBAR_GET_PRIVATE (widget); + + gchar *message; + va_list args; + + va_start (args, format); + message = g_strdup_vprintf (format, args); + va_end (args); + + hildon_helper_set_insensitive_message ((GtkWidget *) priv->volumebar, message); + + g_free (message); +} + + Modified: projects/haf/trunk/hildon-1/src/hildon-volumebar.h =================================================================== --- projects/haf/trunk/hildon-1/src/hildon-volumebar.h 2007-06-19 11:44:40 UTC (rev 12381) +++ projects/haf/trunk/hildon-1/src/hildon-volumebar.h 2007-06-19 12:00:38 UTC (rev 12382) @@ -27,6 +27,7 @@ #include <gtk/gtkcontainer.h> #include <gtk/gtkadjustment.h> +#include "hildon-helper.h" G_BEGIN_DECLS @@ -87,6 +88,15 @@ GtkAdjustment* hildon_volumebar_get_adjustment (HildonVolumebar *self); +void +hildon_volumebar_set_range_insensitive_message (GtkWidget *widget, + const gchar *message); + +void +hildon_volumebar_set_range_insensitive_messagef (GtkWidget *widget, + const gchar *format, + ...); + G_END_DECLS #endif /* __HILDON_VOLUMEBAR_H__ */
- Previous message: [maemo-commits] r12381 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r12383 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]