]> spindle.queued.net Git - midori/commitdiff
Sort out boxes and scrollables with GTK+ 3.2
authorChristian Dywan <christian@twotoasts.de>
Sun, 20 Nov 2011 21:14:30 +0000 (22:14 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sun, 20 Nov 2011 21:14:30 +0000 (22:14 +0100)
There is only GtkBox, neither GtkHBox nor GtkVBox.

Constructors and defaults have changed, we need
to set "orientation" for vertical boxes.

The panel takes care of its pages, and the view
of itself.

gtk_container_add on GtkBox is different to GtkVBox
so we must use gtk_box_pack_start.

GtkScrollable exists as a proper interface now.

katze/gtk3-compat.h
midori/midori-panel.c
midori/midori-view.c

index 70a811f755d38df2224136ee12f80861e82edd19..c1a2dd5f9eb851f5fc9473d81633a40ef39af3a3 100644 (file)
@@ -10,9 +10,15 @@ G_BEGIN_DECLS
     #define GTK_TYPE_VBOX GTK_TYPE_BOX
     #define GtkVBox GtkBox
     #define GtkVBoxClass GtkBoxClass
+    #define gtk_vbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \
+        "homogeneous", hmg, "spacing", spc, \
+        "orientation", GTK_ORIENTATION_VERTICAL, NULL)
     #define GTK_TYPE_HBOX GTK_TYPE_BOX
     #define GtkHBox GtkBox
     #define GtkHBoxClass GtkBoxClass
+    #define gtk_hbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \
+        "homogeneous", hmg, "spacing", spc, \
+        "orientation", GTK_ORIENTATION_HORIZONTAL, NULL)
 #endif
 
 #if !GLIB_CHECK_VERSION (2, 32, 0)
index c14577907073cc37df57c07134bbe0efed4c0585..ffe110e6218b17dd6d6a21ca1359d6f659a33208 100644 (file)
@@ -685,7 +685,9 @@ midori_panel_append_page (MidoriPanel*    panel,
                           MidoriViewable* viewable)
 {
     GtkWidget* scrolled;
+    #if !GTK_CHECK_VERSION (3, 0, 0)
     GObjectClass* gobject_class;
+    #endif
     GtkWidget* widget;
     GtkWidget* toolbar;
     GtkToolItem* toolitem;
@@ -696,6 +698,12 @@ midori_panel_append_page (MidoriPanel*    panel,
     g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);
     g_return_val_if_fail (MIDORI_IS_VIEWABLE (viewable), -1);
 
+    #if GTK_CHECK_VERSION (3, 2, 0)
+    if (GTK_IS_ORIENTABLE (viewable))
+        gtk_orientable_set_orientation (GTK_ORIENTABLE (viewable),
+                                        GTK_ORIENTATION_VERTICAL);
+    #endif
+
     if (GTK_IS_SCROLLED_WINDOW (viewable))
         scrolled = (GtkWidget*)viewable;
     else
@@ -706,12 +714,14 @@ midori_panel_append_page (MidoriPanel*    panel,
                                         GTK_POLICY_AUTOMATIC);
         gtk_widget_set_can_focus (scrolled, TRUE);
         gtk_widget_show (scrolled);
+        #if GTK_CHECK_VERSION (3, 0, 0)
+        if (GTK_IS_SCROLLABLE (viewable))
+        #else
         gobject_class = G_OBJECT_GET_CLASS (viewable);
-#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
         if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
+        #endif
             widget = (GtkWidget*)viewable;
         else
-#endif
         {
             widget = gtk_viewport_new (NULL, NULL);
             gtk_widget_show (widget);
index c4bae490497f882e4d1f9e156cba380185478560..5cdeb4dd7badb3b6283b56c5cb920f32f5d30b6f 100644 (file)
@@ -3048,12 +3048,16 @@ midori_view_init (MidoriView* view)
     view->scrollh = view->scrollv = -2;
     view->back_forward_set = FALSE;
 
+    #if GTK_CHECK_VERSION (3, 2, 0)
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (view), GTK_ORIENTATION_VERTICAL);
+    #endif
+
     view->web_view = NULL;
     /* Adjustments are not created initially, but overwritten later */
     view->scrolled_window = katze_scrolled_new (NULL, NULL);
     gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window),
                                          GTK_SHADOW_NONE);
-    gtk_container_add (GTK_CONTAINER (view), view->scrolled_window);
+    gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
 
     g_signal_connect (view->item, "meta-data-changed",
         G_CALLBACK (midori_view_item_meta_data_changed), view);