+2007-02-28 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+
+ * examples/Makefile.am:
+ * examples/hildon-color-button-example.c:
+ * examples/hildon-number-editor-example.c: Adding number editor
+ example.
+
+ * src/hildon-window.c: Free the list used to detach menus. Fixes the
+ MB#1065.
+
2007-02-19 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
* doc/hildon.types:
hildon-toolbar-example \
hildon-code-dialog-example \
hildon-hvolumebar-example \
- hildon-lookup-example
+ hildon-lookup-example \
+ hildon-number-editor-example
# HIldon window
hildon_window_example_LDADD = $(HILDON_OBJ_LIBS)
hildon_lookup_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
hildon_lookup_example_SOURCES = hildon-lookup-example.c
+# Hildon number editor
+hildon_number_editor_example_LDADD = $(HILDON_OBJ_LIBS)
+hildon_number_editor_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
+hildon_number_editor_example_SOURCES = hildon-number-editor-example.c
+
endif
gtk_widget_show_all (GTK_WIDGET (dialog));
gtk_dialog_run (dialog);
+
+ GdkColor *color;
+ g_object_get (G_OBJECT (button), "color", &color, NULL);
+
+ g_debug ("Color is: %d %d %d", color->red, color->green, color->blue);
return 0;
}
--- /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 *editor = hildon_number_editor_new (2, 5);
+ GtkWidget *label = gtk_label_new ("Enter number:");
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 12);
+
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), editor, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, 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;
+}
+
+
GTK_TYPE_BORDER,
G_PARAM_READABLE));
-
gtk_widget_class_install_style_property (widget_klass,
g_param_spec_boxed ("default_color", "Default color",
"Default color for nonpainted custom colors",
{
HildonWindow *self = HILDON_WINDOW (obj);
HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (obj);
- GList *menu_list;
+ GList *menu_list = NULL;
+ GList *menu_node = NULL;
g_assert (priv != NULL);
}
menu_list = g_list_copy (gtk_menu_get_for_attach_widget (GTK_WIDGET (obj)));
+ menu_node = menu_list;
- while (menu_list)
+ while (menu_node)
{
- if (GTK_IS_MENU (menu_list->data))
+ if (GTK_IS_MENU (menu_node->data))
{
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (menu_list->data)))
+ if (GTK_WIDGET_VISIBLE (GTK_WIDGET (menu_node->data)))
{
- gtk_menu_popdown (GTK_MENU (menu_list->data));
- gtk_menu_shell_deactivate (GTK_MENU_SHELL (menu_list->data));
+ gtk_menu_popdown (GTK_MENU (menu_node->data));
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (menu_node->data));
}
- gtk_menu_detach (GTK_MENU (menu_list->data));
+ gtk_menu_detach (GTK_MENU (menu_node->data));
/* Destroy it, but only if it's not a common menu */
if (priv->program &&
- hildon_program_get_common_menu (priv->program) != menu_list->data) {
- g_object_unref (menu_list->data);
- gtk_object_destroy (GTK_OBJECT (menu_list->data));
+ hildon_program_get_common_menu (priv->program) != menu_node->data) {
+ gtk_object_destroy (GTK_OBJECT (menu_node->data));
+ g_object_unref (menu_node->data);
}
}
- menu_list = menu_list->next;
+ menu_node = menu_node->next;
}
g_list_free (menu_list);
+ menu_list = NULL;
if (priv->program)
{