Make the pageholder work again

This commit is contained in:
Christian Dywan 2008-10-19 00:15:02 +02:00
parent 952729e4ae
commit 567e402eaa
2 changed files with 37 additions and 20 deletions

View file

@ -3610,6 +3610,8 @@ midori_browser_init (MidoriBrowser* browser)
/* Pageholder */ /* Pageholder */
browser->panel_pageholder = midori_view_new (); browser->panel_pageholder = midori_view_new ();
midori_view_set_settings (MIDORI_VIEW (browser->panel_pageholder),
browser->settings);
gtk_widget_show (browser->panel_pageholder); gtk_widget_show (browser->panel_pageholder);
midori_panel_append_page (MIDORI_PANEL (browser->panel), midori_panel_append_page (MIDORI_PANEL (browser->panel),
browser->panel_pageholder, NULL, browser->panel_pageholder, NULL,

View file

@ -11,6 +11,7 @@
#include "midori-panel.h" #include "midori-panel.h"
#include "midori-view.h"
#include "sokoke.h" #include "sokoke.h"
#include "compat.h" #include "compat.h"
@ -421,7 +422,7 @@ midori_panel_append_page (MidoriPanel* panel,
{ {
menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL); menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
g_object_set_data (G_OBJECT (menuitem), "page", scrolled); g_object_set_data (G_OBJECT (menuitem), "page", child);
g_object_set_data (G_OBJECT (menuitem), "toolitem", toolitem); g_object_set_data (G_OBJECT (menuitem), "toolitem", toolitem);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
G_CALLBACK (midori_panel_menu_item_activate_cb), G_CALLBACK (midori_panel_menu_item_activate_cb),
@ -454,7 +455,13 @@ static GtkWidget*
_midori_panel_child_for_scrolled (MidoriPanel* panel, _midori_panel_child_for_scrolled (MidoriPanel* panel,
GtkWidget* scrolled) GtkWidget* scrolled)
{ {
GtkWidget* child = gtk_bin_get_child (GTK_BIN (scrolled)); GtkWidget* child;
/* This is a lazy hack, we should have a way of determining
whether the scrolled is the actual child. */
if (MIDORI_IS_VIEW (scrolled))
return scrolled;
child = gtk_bin_get_child (GTK_BIN (scrolled));
if (GTK_IS_VIEWPORT (child)) if (GTK_IS_VIEWPORT (child))
child = gtk_bin_get_child (GTK_BIN (child)); child = gtk_bin_get_child (GTK_BIN (child));
return child; return child;
@ -474,9 +481,11 @@ GtkWidget*
midori_panel_get_nth_page (MidoriPanel* panel, midori_panel_get_nth_page (MidoriPanel* panel,
guint page_num) guint page_num)
{ {
GtkWidget* scrolled;
g_return_val_if_fail (MIDORI_IS_PANEL (panel), NULL); g_return_val_if_fail (MIDORI_IS_PANEL (panel), NULL);
GtkWidget* scrolled = gtk_notebook_get_nth_page ( scrolled = gtk_notebook_get_nth_page (
GTK_NOTEBOOK (panel->notebook), page_num); GTK_NOTEBOOK (panel->notebook), page_num);
if (scrolled) if (scrolled)
return _midori_panel_child_for_scrolled (panel, scrolled); return _midori_panel_child_for_scrolled (panel, scrolled);
@ -503,7 +512,13 @@ static GtkWidget*
_midori_panel_scrolled_for_child (MidoriPanel* panel, _midori_panel_scrolled_for_child (MidoriPanel* panel,
GtkWidget* child) GtkWidget* child)
{ {
GtkWidget* scrolled = gtk_widget_get_parent (GTK_WIDGET (child)); GtkWidget* scrolled;
/* This is a lazy hack, we should have a way of determining
whether the scrolled is the actual child. */
if (MIDORI_IS_VIEW (child))
return child;
scrolled = gtk_widget_get_parent (GTK_WIDGET (child));
if (GTK_IS_VIEWPORT (scrolled)) if (GTK_IS_VIEWPORT (scrolled))
scrolled = gtk_widget_get_parent (scrolled); scrolled = gtk_widget_get_parent (scrolled);
return scrolled; return scrolled;