[maemo-commits] [maemo-commits] r10253 - in projects/haf/branches/hildon-libs/hildon-1: . examples src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Feb 28 14:25:38 EET 2007
- Previous message: [maemo-commits] r10252 - in projects/haf/trunk/hildon-theme-plankton: . wallpaper
- Next message: [maemo-commits] r10254 - projects/haf/branches/gtk+/maemo-gtk-2-10
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2007-02-28 14:25:38 +0200 (Wed, 28 Feb 2007) New Revision: 10253 Added: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-number-editor-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/examples/hildon-color-button-example.c projects/haf/branches/hildon-libs/hildon-1/src/hildon-color-chooser-dialog.c projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c Log: Adding number editor example. Free the list used to detach menus. Fixes the MB#1065. Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 2007-02-28 12:15:27 UTC (rev 10252) +++ projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 2007-02-28 12:25:38 UTC (rev 10253) @@ -1,3 +1,13 @@ +2007-02-28 Michael Dominic Kostrzewa <michael.kostrzewa at 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 at nokia.com> * doc/hildon.types: Modified: projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am 2007-02-28 12:15:27 UTC (rev 10252) +++ projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am 2007-02-28 12:25:38 UTC (rev 10253) @@ -23,7 +23,8 @@ 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) @@ -140,4 +141,9 @@ 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 Modified: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-color-button-example.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/examples/hildon-color-button-example.c 2007-02-28 12:15:27 UTC (rev 10252) +++ projects/haf/branches/hildon-libs/hildon-1/examples/hildon-color-button-example.c 2007-02-28 12:25:38 UTC (rev 10253) @@ -47,6 +47,11 @@ 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; } Added: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-number-editor-example.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/examples/hildon-number-editor-example.c 2007-02-28 12:15:27 UTC (rev 10252) +++ projects/haf/branches/hildon-libs/hildon-1/examples/hildon-number-editor-example.c 2007-02-28 12:25:38 UTC (rev 10253) @@ -0,0 +1,54 @@ +/* + * 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 *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; +} + + Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-color-chooser-dialog.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/src/hildon-color-chooser-dialog.c 2007-02-28 12:15:27 UTC (rev 10252) +++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-color-chooser-dialog.c 2007-02-28 12:25:38 UTC (rev 10253) @@ -295,7 +295,6 @@ 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", Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c 2007-02-28 12:15:27 UTC (rev 10252) +++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c 2007-02-28 12:25:38 UTC (rev 10253) @@ -757,7 +757,8 @@ { 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); @@ -780,29 +781,31 @@ } 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) {
- Previous message: [maemo-commits] r10252 - in projects/haf/trunk/hildon-theme-plankton: . wallpaper
- Next message: [maemo-commits] r10254 - projects/haf/branches/gtk+/maemo-gtk-2-10
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]