[maemo-commits] [maemo-commits] r9810 - in projects/haf/branches/hildon-libs/hildon-1: . examples src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Feb 13 11:00:36 EET 2007
Author: mdk
Date: 2007-02-13 11:00:34 +0200 (Tue, 13 Feb 2007)
New Revision: 9810

Added:
   projects/haf/branches/hildon-libs/hildon-1/examples/hildon-hvolumebar-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-code-dialog-example.c
   projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.c
   projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.h
Log:
Adding a patch by Santtu Lakkala that add an 'input' signal to the code dialog that is fired each time the user presses any of the dialog input buttons.


Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2	2007-02-13 08:28:55 UTC (rev 9809)
+++ projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2	2007-02-13 09:00:34 UTC (rev 9810)
@@ -1,3 +1,16 @@
+2007-02-13  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
+	* examples/Makefile.am:
+	* examples/hildon-hvolumebar-example.c: A hvolumebar test program.
+
+	* src/hildon-code-dialog.c:
+	* src/hildon-code-dialog.h: Adding a patch by Santtu Lakkala that adds
+	an 'input' signal to the code dialog that is fired each time the user
+	presses any of the dialog input buttons.
+
+	* examples/hildon-code-dialog-example.c: Adding test case for the
+	new signal.
+
 2007-02-12  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	* examples/hildon-window-example.c: Adding some title setting to check

Modified: projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am	2007-02-13 08:28:55 UTC (rev 9809)
+++ projects/haf/branches/hildon-libs/hildon-1/examples/Makefile.am	2007-02-13 09:00:34 UTC (rev 9810)
@@ -21,7 +21,8 @@
 					  hildon-window-cmn-menu-example	\
 					  hildon-vvolumebar-example		\
 					  hildon-toolbar-example		\
-					  hildon-code-dialog-example	
+					  hildon-code-dialog-example		\
+					  hildon-hvolumebar-example
 
 # HIldon window
 hildon_window_example_LDADD		= $(HILDON_OBJ_LIBS)
@@ -106,7 +107,7 @@
 # HIldon window menu example
 hildon_window_menu_example_LDADD	= $(HILDON_OBJ_LIBS)
 hildon_window_menu_example_CFLAGS	= $(HILDON_OBJ_CFLAGS)
-hildon_window_menu__example_SOURCES	= hildon-window-menu-example.c
+hildon_window_menu_example_SOURCES	= hildon-window-menu-example.c
 
 # Hildon window common menu example
 hildon_window_cmn_menu_example_LDADD	= $(HILDON_OBJ_LIBS)
@@ -118,6 +119,11 @@
 hildon_vvolumebar_example_CFLAGS	= $(HILDON_OBJ_CFLAGS)
 hildon_vvolumebar_example_SOURCES	= hildon-vvolumebar-example.c
 
+# Hildon hvolume bar example
+hildon_hvolumebar_example_LDADD		= $(HILDON_OBJ_LIBS)
+hildon_hvolumebar_example_CFLAGS	= $(HILDON_OBJ_CFLAGS)
+hildon_hvolumebar_example_SOURCES	= hildon-hvolumebar-example.c
+
 # Hildon toolbar example
 hildon_toolbar_example_LDADD		= $(HILDON_OBJ_LIBS)
 hildon_toolbar_example_CFLAGS		= $(HILDON_OBJ_CFLAGS)

Modified: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-code-dialog-example.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/examples/hildon-code-dialog-example.c	2007-02-13 08:28:55 UTC (rev 9809)
+++ projects/haf/branches/hildon-libs/hildon-1/examples/hildon-code-dialog-example.c	2007-02-13 09:00:34 UTC (rev 9810)
@@ -28,12 +28,24 @@
 #include                                        <gtk/gtk.h>
 #include                                        "hildon.h"
 
+static gboolean
+on_input                                        (void);
+
+gboolean
+on_input                                        (void)
+{
+    g_debug ("Input in the code dialog!");
+    return TRUE;
+}
+
 int
-main (int argc, char **args)
+main                                            (int argc, 
+                                                 char **args)
 {
     gtk_init (&argc, &args);
     
     GtkDialog *dialog = GTK_DIALOG (hildon_code_dialog_new ());
+    g_signal_connect (G_OBJECT (dialog), "input", G_CALLBACK (on_input), NULL);
 
     gtk_widget_show_all (GTK_WIDGET (dialog));
     gtk_dialog_run (dialog);

Added: projects/haf/branches/hildon-libs/hildon-1/examples/hildon-hvolumebar-example.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/examples/hildon-hvolumebar-example.c	2007-02-13 08:28:55 UTC (rev 9809)
+++ projects/haf/branches/hildon-libs/hildon-1/examples/hildon-hvolumebar-example.c	2007-02-13 09:00:34 UTC (rev 9810)
@@ -0,0 +1,50 @@
+/*
+ * 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 ());
+
+    HildonHVolumebar *bar = HILDON_HVOLUMEBAR (hildon_hvolumebar_new ());
+
+    gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (bar), 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/branches/hildon-libs/hildon-1/src/hildon-code-dialog.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.c	2007-02-13 08:28:55 UTC (rev 9809)
+++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.c	2007-02-13 09:00:34 UTC (rev 9810)
@@ -27,7 +27,8 @@
  * @short_description: A keypad-like widget used to enter pincodes.
  *
  * #HildonCodeDialog displays a keypad that can be used to enter 
- * numerical pin codes or lock codes. 
+ * numerical pin codes or lock codes. It emits a 'input' signal each time 
+ * an input action is performed on the dialog.
  *
  */
 
@@ -97,8 +98,16 @@
                                                  GdkEventKey *event,
                                                  gpointer user_data);
 
+static void 
+hildon_code_dialog_real_input                   (HildonCodeDialog *dialog);
+
+static void
+hildon_code_dialog_input                        (HildonCodeDialog *dialog);
+
 static GtkDialogClass*                          parent_class = NULL;
 
+static guint                                    input_signal;
+
 /**
  * hildon_code_dialog_get_type:
  *
@@ -136,6 +145,18 @@
 {
     parent_class = GTK_DIALOG_CLASS (g_type_class_peek_parent (cd_class));
     g_type_class_add_private (cd_class, sizeof (HildonCodeDialogPrivate));
+
+    cd_class->input = hildon_code_dialog_real_input;
+
+    /* FIXME Document this signal! */
+    input_signal = g_signal_new("input",
+                                HILDON_TYPE_CODE_DIALOG,
+                                G_SIGNAL_RUN_LAST,
+                                G_STRUCT_OFFSET (HildonCodeDialogClass, input),
+                                NULL, NULL,
+                                g_cclosure_marshal_VOID__VOID,
+                                G_TYPE_NONE,
+                                0);
 }
 
 static void 
@@ -377,6 +398,8 @@
         /* make the Ok button sensitive */
         gtk_widget_set_sensitive (priv->buttons[4][0], TRUE);
     }
+
+    hildon_code_dialog_input (dialog);
 }
 
 static gboolean 
@@ -506,3 +529,15 @@
 
     gtk_label_set_text (GTK_LABEL (priv->help_text), text);
 }
+
+static void 
+hildon_code_dialog_real_input                   (HildonCodeDialog *dialog)
+{
+}
+
+static void 
+hildon_code_dialog_input                        (HildonCodeDialog *dialog)
+{
+    /* Emit the signal */
+    g_signal_emit (dialog, input_signal, 0);
+}

Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.h
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.h	2007-02-13 08:28:55 UTC (rev 9809)
+++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-code-dialog.h	2007-02-13 09:00:34 UTC (rev 9810)
@@ -60,6 +60,7 @@
 struct _HildonCodeDialogClass
 {
     GtkDialogClass parent_class;
+    void (*input) (HildonCodeDialog *dialog);
 };
 
 GType G_GNUC_CONST


More information about the maemo-commits mailing list