Rearrange statusbar packing to keep themes happy

This commit is contained in:
Christian Dywan 2009-10-27 23:55:17 +01:00
parent cba3abdce9
commit bda19771c3

View file

@ -67,6 +67,7 @@ struct _MidoriBrowser
gboolean find_typing; gboolean find_typing;
GtkWidget* statusbar; GtkWidget* statusbar;
GtkWidget* statusbar_contents;
GtkWidget* transferbar; GtkWidget* transferbar;
GtkWidget* transferbar_clear; GtkWidget* transferbar_clear;
GtkWidget* progressbar; GtkWidget* progressbar;
@ -1903,13 +1904,19 @@ midori_browser_class_init (MidoriBrowserClass* class)
MIDORI_LOAD_FINISHED, MIDORI_LOAD_FINISHED,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* MidoriBrowser:statusbar:
*
* The widget representing the statusbar contents. This is
* not an actual #GtkStatusbar but rather a #GtkBox.
*/
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_STATUSBAR, PROP_STATUSBAR,
g_param_spec_object ( g_param_spec_object (
"statusbar", "statusbar",
"Statusbar", "Statusbar",
"The statusbar", "The statusbar",
GTK_TYPE_STATUSBAR, GTK_TYPE_BOX,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/** /**
@ -5696,22 +5703,39 @@ midori_browser_init (MidoriBrowser* browser)
/* Statusbar */ /* Statusbar */
browser->statusbar = gtk_statusbar_new (); browser->statusbar = gtk_statusbar_new ();
/* Rearrange the statusbar packing. This is necessariy to keep
themes happy while there is no support from GtkStatusbar. */
#if 1
browser->statusbar_contents = gtk_hbox_new (FALSE, 4);
gtk_widget_show (browser->statusbar_contents);
g_object_ref (GTK_STATUSBAR (browser->statusbar)->label);
gtk_container_remove (GTK_CONTAINER (GTK_STATUSBAR (browser->statusbar)->frame),
GTK_STATUSBAR (browser->statusbar)->label);
gtk_box_pack_start (GTK_BOX (browser->statusbar_contents),
GTK_STATUSBAR (browser->statusbar)->label, TRUE, TRUE, 0);
g_object_unref (GTK_STATUSBAR (browser->statusbar)->label);
gtk_container_add (GTK_CONTAINER (GTK_STATUSBAR (browser->statusbar)->frame),
browser->statusbar_contents);
gtk_label_set_ellipsize (GTK_LABEL (GTK_STATUSBAR (browser->statusbar)->label), FALSE);
#else
browser->statusbar_contents = browser->statusbar;
#endif
/* Adjust the statusbar's padding to avoid child overlapping */ /* Adjust the statusbar's padding to avoid child overlapping */
rcstyle = gtk_rc_style_new (); rcstyle = gtk_rc_style_new ();
rcstyle->xthickness = rcstyle->ythickness = -4; rcstyle->xthickness = rcstyle->ythickness = -4;
gtk_widget_modify_style (browser->statusbar, rcstyle); gtk_widget_modify_style (browser->statusbar_contents, rcstyle);
g_object_unref (rcstyle); g_object_unref (rcstyle);
gtk_box_pack_start (GTK_BOX (vbox), browser->statusbar, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), browser->statusbar, FALSE, FALSE, 0);
browser->progressbar = gtk_progress_bar_new (); browser->progressbar = gtk_progress_bar_new ();
/* Set the progressbar's height to 1 to fit it in the statusbar */ /* Set the progressbar's height to 1 to fit it in the statusbar */
gtk_widget_set_size_request (browser->progressbar, -1, 1); gtk_widget_set_size_request (browser->progressbar, -1, 1);
gtk_box_pack_start (GTK_BOX (browser->statusbar), browser->progressbar, gtk_box_pack_start (GTK_BOX (browser->statusbar_contents),
FALSE, FALSE, 3); browser->progressbar, FALSE, FALSE, 3);
browser->transferbar = gtk_hbox_new (FALSE, 0); browser->transferbar = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (browser->statusbar), browser->transferbar, gtk_box_pack_start (GTK_BOX (browser->statusbar_contents),
FALSE, FALSE, 3); browser->transferbar, FALSE, FALSE, 3);
gtk_widget_show (browser->transferbar); gtk_widget_show (browser->transferbar);
browser->transferbar_clear = gtk_button_new_with_label (_("Clear All")); browser->transferbar_clear = gtk_button_new_with_label (_("Clear All"));
icon = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU); icon = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
@ -6314,7 +6338,7 @@ midori_browser_get_property (GObject* object,
break; break;
} }
case PROP_STATUSBAR: case PROP_STATUSBAR:
g_value_set_object (value, browser->statusbar); g_value_set_object (value, browser->statusbar_contents);
break; break;
case PROP_STATUSBAR_TEXT: case PROP_STATUSBAR_TEXT:
g_value_set_string (value, browser->statusbar_text); g_value_set_string (value, browser->statusbar_text);