[maemo-commits] [maemo-commits] r9651 - in projects/haf/branches/hildon-libs/hildon-1: . examples src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Feb 5 17:16:55 EET 2007
- Previous message: [maemo-commits] r9650 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r9652 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2007-02-05 17:16:54 +0200 (Mon, 05 Feb 2007) New Revision: 9651 Added: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-insensitive-example.c Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am projects/haf/branches/hildon-libs/hildon-1/src/hildon-helper.c Log: Example for the insensitive message setting. Insensitive implementation by Xan Lopez. Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 2007-02-05 15:09:02 UTC (rev 9650) +++ projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 2007-02-05 15:16:54 UTC (rev 9651) @@ -1,5 +1,13 @@ 2007-02-05 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * examples/Makefile.am: + * examples/hildon-insensitive-example.c: Example for the insensitive + message setting. + + * src/hildon-helper.c: Insensitive implementation by Xan Lopez. + +2007-02-05 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * examples/hildon-controlbar-example.c: * src/hildon-controlbar.c: Fixing the controlbar to behave as if minimal-bars-visible (old 2.6 mod) was equal 1. Modified: projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am 2007-02-05 15:09:02 UTC (rev 9650) +++ projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am 2007-02-05 15:16:54 UTC (rev 9651) @@ -13,7 +13,8 @@ hildon-color-button-example \ hildon-login-dialog-example \ hildon-time-editor-example \ - hildon-icon-sizes-example + hildon-icon-sizes-example \ + hildon-insensitive-example # HIldon window hildon_window_example_LDADD = $(HILDON_OBJ_LIBS) @@ -80,4 +81,10 @@ hildon_icon_sizes_example_CFLAGS = $(HILDON_OBJ_CFLAGS) hildon_icon_sizes_example_SOURCES = hildon-icon-sizes-example.c +# HIldon insensitive example +hildon_insensitive_example_LDADD = $(HILDON_OBJ_LIBS) +hildon_insensitive_example_CFLAGS = $(HILDON_OBJ_CFLAGS) +hildon_insensitive_example_SOURCES = hildon-insensitive-example.c + + endif Added: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-insensitive-example.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/examples/hildon-insensitive-example.c 2007-02-05 15:09:02 UTC (rev 9650) +++ projects/haf/branches/hildon-libs/hildon-1/examples/hildon-insensitive-example.c 2007-02-05 15:16:54 UTC (rev 9651) @@ -0,0 +1,53 @@ +/* + * 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. + * + * 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 ()); + GtkWidget *button = gtk_button_new_with_label ("Click me"); + + hildon_helper_set_insensitive_message (button, "Do not poke me!"); + gtk_widget_set_sensitive (button, FALSE); + + gtk_box_pack_start (GTK_BOX (dialog->vbox), button, TRUE, TRUE, 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/branches/hildon-libs/hildon-1/src/hildon-helper.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/src/hildon-helper.c 2007-02-05 15:09:02 UTC (rev 9650) +++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-helper.c 2007-02-05 15:16:54 UTC (rev 9651) @@ -38,6 +38,7 @@ #include <gtk/gtk.h> #include "hildon-helper.h" +#include "hildon-banner.h" #define HILDON_FINGER_PRESSURE_THRESHOLD 0.4 @@ -233,6 +234,15 @@ return signum; } +static void +show_insensitive_message (GtkWidget *widget, + const gchar *message) +{ + g_assert (GTK_IS_WIDGET (widget)); + + hildon_banner_show_information (widget, NULL, message); +} + /** * hildon_helper_set_insensitive_message * @widget : A @GtkWidget to assign a banner to @@ -250,7 +260,14 @@ g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (message != NULL); - g_warning ("FIXME: I'm not implemented yet!"); + g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, + G_CALLBACK (show_insensitive_message), NULL); + + if (message != NULL) { + g_signal_connect (G_OBJECT (widget), "insensitive-press", + G_CALLBACK (show_insensitive_message), (gpointer) message); + } }
- Previous message: [maemo-commits] r9650 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r9652 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]