[SCM] Debian packaging for libhildon. branch, debian-patches, updated. upstream/2.1.34.debian.1-1-g36f981a

Riku Voipio nchip at aardvark.home
Sun Mar 15 17:27:39 UTC 2009


The following commit has been merged in the debian-patches branch:
commit 36f981a4c9c66e306e97d5a16eaf925e7cea6eae
Author: Riku Voipio <riku.voipio at iki.fi>
Date:   Sun Mar 15 17:24:42 2009 +0200

    Revert hildon_gtk_widget_set_theme_size removal
    
    The upstream idea of moving hildon_gtk_widget_set_theme_size to
    gtk is pure crack.

diff --git a/src/hildon-dialog.c b/src/hildon-dialog.c
index 4d0e68c..d4ade35 100644
--- a/src/hildon-dialog.c
+++ b/src/hildon-dialog.c
@@ -65,6 +65,9 @@
 
 G_DEFINE_TYPE (HildonDialog, hildon_dialog, GTK_TYPE_DIALOG);
 
+/* Buttons on a HildonDialog have fixed size */
+#define                                         HILDON_DIALOG_BUTTON_WIDTH 174
+
 static void
 hildon_dialog_class_init                        (HildonDialogClass *dialog_class)
 {
@@ -180,7 +183,11 @@ hildon_dialog_add_button                        (HildonDialog *dialog,
 {
     GtkWidget *button;
     button = gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id);
+#ifndef MAEMO_GTK
+    hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
+    g_object_set (button, "width-request", HILDON_DIALOG_BUTTON_WIDTH, NULL);
     return button;
+#endif
 }
 
 /**
diff --git a/src/hildon-gtk.c b/src/hildon-gtk.c
index e64bf0f..e25b721 100644
--- a/src/hildon-gtk.c
+++ b/src/hildon-gtk.c
@@ -29,6 +29,63 @@
 
 #include "hildon-gtk.h"
 
+#ifndef MAEMO_GTK
+
+#define                                         HILDON_HEIGHT_FINGER 70
+
+#define                                         HILDON_HEIGHT_THUMB 105
+
+#define                                         HILDON_WIDTH_FULLSCREEN \
+                                                (gdk_screen_get_width (gdk_screen_get_default ()))
+
+#define                                         HILDON_WIDTH_HALFSCREEN \
+                                                (HILDON_WIDTH_FULLSCREEN / 2)
+
+/**
+ * hildon_gtk_widget_set_theme_size:
+ * @widget: A #GtkWidget
+ * @size: Flags indicating the size of the widget
+ *
+ * This function sets the requested size of a widget.
+ **/
+void
+hildon_gtk_widget_set_theme_size                (GtkWidget      *widget,
+                                                 HildonSizeType  size)
+{
+    gint width = -1;
+    gint height = -1;
+    gchar *widget_name = NULL;
+
+    g_return_if_fail (GTK_IS_WIDGET (widget));
+
+    /* Requested height */
+    if (size & HILDON_SIZE_FINGER_HEIGHT) {
+        height = HILDON_HEIGHT_FINGER;
+        widget_name = "-finger";
+    } else if (size & HILDON_SIZE_THUMB_HEIGHT) {
+        height = HILDON_HEIGHT_THUMB;
+        widget_name = "-thumb";
+    }
+
+    if (widget_name)
+        widget_name = g_strconcat (g_type_name (GTK_WIDGET_TYPE (widget)), widget_name, NULL);
+
+    /* Requested width */
+    if (size & HILDON_SIZE_HALFSCREEN_WIDTH) {
+        width = HILDON_WIDTH_HALFSCREEN;
+    } else if (size & HILDON_SIZE_FULLSCREEN_WIDTH) {
+        width = HILDON_WIDTH_FULLSCREEN;
+    }
+
+    gtk_widget_set_size_request (widget, width, height);
+
+    if (widget_name) {
+        gtk_widget_set_name (widget, widget_name);
+        g_free (widget_name);
+    }
+}
+#endif /* MAEMO_GTK */
+
 static void
 image_visible_changed_cb                        (GtkWidget  *image,
                                                  GParamSpec *arg1,
diff --git a/src/hildon-gtk.h b/src/hildon-gtk.h
index 15dd935..fc36d0e 100644
--- a/src/hildon-gtk.h
+++ b/src/hildon-gtk.h
@@ -21,6 +21,22 @@
 
 G_BEGIN_DECLS
 
+#ifndef MAEMO_GTK 
+typedef enum {
+   HILDON_SIZE_AUTO_WIDTH                       = 0 << 0, /* set to automatic width */
+   HILDON_SIZE_HALFSCREEN_WIDTH                 = 1 << 0, /* set to 50% screen width */
+   HILDON_SIZE_FULLSCREEN_WIDTH                 = 2 << 0, /* set to 100% screen width */
+   HILDON_SIZE_AUTO_HEIGHT                      = 0 << 2, /* set to automatic height */
+   HILDON_SIZE_FINGER_HEIGHT                    = 1 << 2, /* set to finger height */
+   HILDON_SIZE_THUMB_HEIGHT                     = 2 << 2, /* set to thumb height */
+   HILDON_SIZE_AUTO                             = (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_AUTO_HEIGHT)
+}                                               HildonSizeType;
+
+void
+hildon_gtk_widget_set_theme_size                (GtkWidget      *widget,
+                                                 HildonSizeType  size);
+
+#endif /* MAEMO_GTK */
 GtkWidget *
 hildon_gtk_menu_new                             (void);
 

-- 
Debian packaging for libhildon.



More information about the pkg-maemo-commits mailing list