Sort out boxes and scrollables with GTK+ 3.2

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.
This commit is contained in:
Christian Dywan 2011-11-20 22:14:30 +01:00
parent 1cd86c32f4
commit 0d2a6cd72f
3 changed files with 23 additions and 3 deletions

View file

@ -10,9 +10,15 @@ G_BEGIN_DECLS
#define GTK_TYPE_VBOX GTK_TYPE_BOX #define GTK_TYPE_VBOX GTK_TYPE_BOX
#define GtkVBox GtkBox #define GtkVBox GtkBox
#define GtkVBoxClass GtkBoxClass #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 GTK_TYPE_HBOX GTK_TYPE_BOX
#define GtkHBox GtkBox #define GtkHBox GtkBox
#define GtkHBoxClass GtkBoxClass #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 #endif
#if !GLIB_CHECK_VERSION (2, 32, 0) #if !GLIB_CHECK_VERSION (2, 32, 0)

View file

@ -685,7 +685,9 @@ midori_panel_append_page (MidoriPanel* panel,
MidoriViewable* viewable) MidoriViewable* viewable)
{ {
GtkWidget* scrolled; GtkWidget* scrolled;
#if !GTK_CHECK_VERSION (3, 0, 0)
GObjectClass* gobject_class; GObjectClass* gobject_class;
#endif
GtkWidget* widget; GtkWidget* widget;
GtkWidget* toolbar; GtkWidget* toolbar;
GtkToolItem* toolitem; 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_PANEL (panel), -1);
g_return_val_if_fail (MIDORI_IS_VIEWABLE (viewable), -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)) if (GTK_IS_SCROLLED_WINDOW (viewable))
scrolled = (GtkWidget*)viewable; scrolled = (GtkWidget*)viewable;
else else
@ -706,12 +714,14 @@ midori_panel_append_page (MidoriPanel* panel,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_set_can_focus (scrolled, TRUE); gtk_widget_set_can_focus (scrolled, TRUE);
gtk_widget_show (scrolled); gtk_widget_show (scrolled);
#if GTK_CHECK_VERSION (3, 0, 0)
if (GTK_IS_SCROLLABLE (viewable))
#else
gobject_class = G_OBJECT_GET_CLASS (viewable); 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) if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
#endif
widget = (GtkWidget*)viewable; widget = (GtkWidget*)viewable;
else else
#endif
{ {
widget = gtk_viewport_new (NULL, NULL); widget = gtk_viewport_new (NULL, NULL);
gtk_widget_show (widget); gtk_widget_show (widget);

View file

@ -3048,12 +3048,16 @@ midori_view_init (MidoriView* view)
view->scrollh = view->scrollv = -2; view->scrollh = view->scrollv = -2;
view->back_forward_set = FALSE; 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; view->web_view = NULL;
/* Adjustments are not created initially, but overwritten later */ /* Adjustments are not created initially, but overwritten later */
view->scrolled_window = katze_scrolled_new (NULL, NULL); view->scrolled_window = katze_scrolled_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window),
GTK_SHADOW_NONE); 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_signal_connect (view->item, "meta-data-changed",
G_CALLBACK (midori_view_item_meta_data_changed), view); G_CALLBACK (midori_view_item_meta_data_changed), view);