Adding a patch by Santtu Lakkala that add an 'input' signal to the code dialog that...
authorMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Tue, 13 Feb 2007 09:00:34 +0000 (09:00 +0000)
committerMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Tue, 13 Feb 2007 09:00:34 +0000 (09:00 +0000)
ChangeLog.2
examples/Makefile.am
examples/hildon-code-dialog-example.c
examples/hildon-hvolumebar-example.c [new file with mode: 0644]
src/hildon-code-dialog.c
src/hildon-code-dialog.h

index 8d2b8f1..b271839 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-13  Michael Dominic Kostrzewa  <michael.kostrzewa@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@nokia.com> 
 
        * examples/hildon-window-example.c: Adding some title setting to check
index 913a759..f17cee5 100644 (file)
@@ -21,7 +21,8 @@ noinst_PROGRAMS                               = hildon-window-example                 \
                                          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_set_password_dialog_example_SOURCES  = hildon-set-password-dialog-example.
 # 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_LDADD            = $(HILDON_OBJ_LIBS)
 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)
index 4af5d45..cd0d09e 100644 (file)
 #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);
diff --git a/examples/hildon-hvolumebar-example.c b/examples/hildon-hvolumebar-example.c
new file mode 100644 (file)
index 0000000..1bfa718
--- /dev/null
@@ -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@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;
+}
+
+
index 857a6c8..f48ccb1 100644 (file)
@@ -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 @@ hildon_code_dialog_key_press_event              (GtkWidget *widget,
                                                  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 @@ hildon_code_dialog_class_init                   (HildonCodeDialogClass *cd_class
 {
     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 @@ hildon_code_dialog_insert_text                  (GtkEditable *editable,
         /* 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 @@ hildon_code_dialog_set_help_text                (HildonCodeDialog *dialog,
 
     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);
+}
index eb7490d..bbc1b3b 100644 (file)
@@ -60,6 +60,7 @@ struct                                          _HildonCodeDialog
 struct _HildonCodeDialogClass
 {
     GtkDialogClass parent_class;
+    void (*input) (HildonCodeDialog *dialog);
 };
 
 GType G_GNUC_CONST