2008-09-08 Alberto Garcia <agarcia@igalia.com>
authorAlberto Garcia <agarcia@igalia.com>
Mon, 8 Sep 2008 18:28:21 +0000 (18:28 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Mon, 8 Sep 2008 18:28:21 +0000 (18:28 +0000)
* src/hildon-dialog.h
* src/hildon-dialog.c
(hildon_dialog_add_button, hildon_dialog_add_buttons):
New methods to add buttons with finger size.
(hildon_dialog_new_with_buttons):
Create buttons with finger size.

* examples/hildon-dialog-example.c (main): Use HildonDialog
methods to add buttons.

ChangeLog
examples/hildon-dialog-example.c
src/hildon-dialog.c
src/hildon-dialog.h

index b785495..923a57e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2008-09-08  Alberto Garcia  <agarcia@igalia.com>
 
+       * src/hildon-dialog.h
+       * src/hildon-dialog.c
+       (hildon_dialog_add_button, hildon_dialog_add_buttons):
+       New methods to add buttons with finger size.
+       (hildon_dialog_new_with_buttons):
+       Create buttons with finger size.
+
+       * examples/hildon-dialog-example.c (main): Use HildonDialog
+       methods to add buttons.
+
+2008-09-08  Alberto Garcia  <agarcia@igalia.com>
+
        * src/hildon-entry.c: Updated HildonButton documentation.
 
 2008-09-08  Alberto Garcia  <agarcia@igalia.com>
index 10376eb..9d8cdab 100644 (file)
@@ -39,7 +39,7 @@ main                                            (int argc,
     label = gtk_label_new ("Hello, world!");
 
     gtk_window_set_title (GTK_WINDOW (d), "Hi!");
-    gtk_dialog_add_button (GTK_DIALOG (d), GTK_STOCK_OK, GTK_RESPONSE_NONE);
+    hildon_dialog_add_button (HILDON_DIALOG (d), GTK_STOCK_OK, GTK_RESPONSE_NONE);
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG(d)->vbox), label);
 
     gtk_widget_show_all (GTK_WIDGET (d));
index b511e75..38fa822 100644 (file)
@@ -57,6 +57,7 @@
  */
 
 #include                                        "hildon-dialog.h"
+#include                                        "hildon-gtk.h"
 
 G_DEFINE_TYPE (HildonDialog, hildon_dialog, GTK_TYPE_DIALOG);
 
@@ -137,7 +138,7 @@ hildon_dialog_new_with_buttons                  (const gchar *title,
         response_id = va_arg (args, gint);
 
         while (text != NULL) {
-            gtk_dialog_add_button (GTK_DIALOG (dialog), text, response_id);
+            hildon_dialog_add_button (HILDON_DIALOG (dialog), text, response_id);
 
             text = va_arg (args, gchar*);
             if (text == NULL)
@@ -149,3 +150,62 @@ hildon_dialog_new_with_buttons                  (const gchar *title,
 
     return dialog;
 }
+
+/**
+ * hildon_dialog_add_button:
+ * @dialog: a #HildonDialog
+ * @button_text: text of the button, or stock ID
+ * @response_id: response ID for the button.
+ *
+ * Adds a button to the dialog. Works exactly like
+ * gtk_dialog_add_button(), the only difference being that the button
+ * has finger size.
+ *
+ * Returns: the button widget that was added
+ */
+GtkWidget *
+hildon_dialog_add_button                        (HildonDialog *dialog,
+                                                 const gchar  *button_text,
+                                                 gint          response_id)
+{
+    GtkWidget *button;
+    button = gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id);
+    hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
+    return button;
+}
+
+/**
+ * hildon_dialog_add_buttons:
+ * @dialog: a #HildonDialog
+ * @first_button_text: text of the button, or stock ID
+ * @Varargs: response ID for first button, then more text-response_id pairs
+ *
+ * Adds several buttons to the dialog. Works exactly like
+ * gtk_dialog_add_buttons(), the only difference being that the
+ * buttons have finger size.
+ */
+void
+hildon_dialog_add_buttons                       (HildonDialog *dialog,
+                                                 const gchar  *first_button_text,
+                                                 ...)
+{
+    va_list args;
+    const gchar *text;
+    gint response_id;
+
+    va_start (args, first_button_text);
+    text = first_button_text;
+    response_id = va_arg (args, gint);
+
+    while (text != NULL) {
+        hildon_dialog_add_button (HILDON_DIALOG (dialog), text, response_id);
+
+        text = va_arg (args, gchar*);
+        if (text == NULL)
+            break;
+        response_id = va_arg (args, int);
+    }
+
+    va_end (args);
+}
+
index e9b09c8..d88be5b 100644 (file)
@@ -82,6 +82,16 @@ hildon_dialog_new_with_buttons                  (const gchar    *title,
                                                  const gchar    *first_button_text,
                                                  ...);
 
+GtkWidget *
+hildon_dialog_add_button                        (HildonDialog *dialog,
+                                                 const gchar  *button_text,
+                                                 gint          response_id);
+
+void
+hildon_dialog_add_buttons                       (HildonDialog *dialog,
+                                                 const gchar  *first_button_text,
+                                                 ...);
+
 G_END_DECLS
 
 #endif                                          /* __HILDON_DIALOG_H__ */