2007-02-05 Michael Dominic Kostrzewa <michael.kostrzewa@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@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.
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)
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
--- /dev/null
+/*
+ * This file is a part of hildon examples
+ *
+ * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
+ *
+ * Author: Michael Dominic Kostrzewa <michael.kostrzewa@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;
+}
+
+
#include <gtk/gtk.h>
#include "hildon-helper.h"
+#include "hildon-banner.h"
#define HILDON_FINGER_PRESSURE_THRESHOLD 0.4
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
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);
+ }
}