Change tab components again, correct close button placement

This commit is contained in:
Christian Dywan 2008-10-26 17:08:26 +01:00
parent 819bcd6444
commit e83f93742d

View file

@ -1590,19 +1590,6 @@ midori_view_tab_label_button_release_event (GtkWidget* tab_label,
return FALSE; return FALSE;
} }
static void
midori_view_tab_icon_style_set (GtkWidget* tab_icon,
GtkStyle* previous_style)
{
GtkSettings* gtk_settings;
gint width, height;
gtk_settings = gtk_widget_get_settings (tab_icon);
gtk_icon_size_lookup_for_settings (gtk_settings, GTK_ICON_SIZE_MENU,
&width, &height);
gtk_widget_set_size_request (tab_icon, width + 4, height + 4);
}
static void static void
midori_view_tab_close_clicked (GtkWidget* tab_close, midori_view_tab_close_clicked (GtkWidget* tab_close,
GtkWidget* widget) GtkWidget* widget)
@ -1645,10 +1632,7 @@ midori_view_get_proxy_tab_label (MidoriView* view)
event_box = gtk_event_box_new (); event_box = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE); gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
hbox = gtk_hbox_new (FALSE, 1); hbox = gtk_hbox_new (FALSE, 1);
gtk_container_border_width (GTK_CONTAINER (hbox), 2);
gtk_container_add (GTK_CONTAINER (event_box), GTK_WIDGET (hbox)); gtk_container_add (GTK_CONTAINER (event_box), GTK_WIDGET (hbox));
gtk_misc_set_alignment (GTK_MISC (view->tab_icon), 0.0, 0.5);
gtk_misc_set_alignment (GTK_MISC (view->tab_title), 0.0, 0.5);
/* TODO: make the tab initially look "unvisited" until it's focused */ /* TODO: make the tab initially look "unvisited" until it's focused */
_update_label_size (view->tab_title, 10); _update_label_size (view->tab_title, 10);
@ -1661,15 +1645,16 @@ midori_view_get_proxy_tab_label (MidoriView* view)
g_object_unref (rcstyle); g_object_unref (rcstyle);
image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (view->tab_close), image); gtk_button_set_image (GTK_BUTTON (view->tab_close), image);
gtk_misc_set_alignment (GTK_MISC (image), 0.0, 0.0);
#if HAVE_OSX #if HAVE_OSX
gtk_box_pack_end (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0); gtk_box_pack_end (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (hbox), view->tab_close, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), view->tab_close, FALSE, FALSE, 0);
#else #else
gtk_box_pack_start (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), view->tab_close, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), view->tab_close, FALSE, FALSE, 0);
#endif #endif
gtk_widget_show_all (GTK_WIDGET (event_box)); gtk_widget_show_all (GTK_WIDGET (event_box));
@ -1678,8 +1663,6 @@ midori_view_get_proxy_tab_label (MidoriView* view)
g_signal_connect (event_box, "button-release-event", g_signal_connect (event_box, "button-release-event",
G_CALLBACK (midori_view_tab_label_button_release_event), view); G_CALLBACK (midori_view_tab_label_button_release_event), view);
g_signal_connect (view->tab_close, "style-set",
G_CALLBACK (midori_view_tab_icon_style_set), NULL);
g_signal_connect (view->tab_close, "clicked", g_signal_connect (view->tab_close, "clicked",
G_CALLBACK (midori_view_tab_close_clicked), view); G_CALLBACK (midori_view_tab_close_clicked), view);