Use secondary toolbar class for panel title

Also introduce a utility function to make adding
the class more readable.

Fixes: https://bugs.launchpad.net/midori/+bug/1026384
This commit is contained in:
Christian Dywan 2012-07-28 11:06:40 +02:00
parent 5bed5082ed
commit 96f616a237
8 changed files with 26 additions and 31 deletions

View file

@ -477,11 +477,8 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
#endif #endif
NULL); NULL);
#if GTK_CHECK_VERSION (3, 0, 0) katze_widget_add_class (gtk_dialog_get_widget_for_response (
gtk_style_context_add_class (gtk_widget_get_style_context ( GTK_DIALOG (dialog), GTK_RESPONSE_HELP), "help_button");
gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
GTK_RESPONSE_HELP)), "help_button");
#endif
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
g_signal_connect (dialog, "destroy", g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed), &dialog); G_CALLBACK (gtk_widget_destroyed), &dialog);

View file

@ -110,11 +110,8 @@ katze_preferences_init (KatzePreferences* preferences)
gtk_dialog_add_buttons (GTK_DIALOG (preferences), gtk_dialog_add_buttons (GTK_DIALOG (preferences),
GTK_STOCK_HELP, GTK_RESPONSE_HELP, GTK_STOCK_HELP, GTK_RESPONSE_HELP,
NULL); NULL);
#if GTK_CHECK_VERSION (3, 0, 0) katze_widget_add_class (gtk_dialog_get_widget_for_response (
gtk_style_context_add_class (gtk_widget_get_style_context ( GTK_DIALOG (preferences), GTK_RESPONSE_HELP), "help_button");
gtk_dialog_get_widget_for_response (GTK_DIALOG (preferences),
GTK_RESPONSE_HELP)), "help_button");
#endif
gtk_dialog_add_buttons (GTK_DIALOG (preferences), gtk_dialog_add_buttons (GTK_DIALOG (preferences),
#if HAVE_HILDON #if HAVE_HILDON

View file

@ -1576,6 +1576,16 @@ katze_uri_entry_new (GtkWidget* other_widget)
return entry; return entry;
} }
void
katze_widget_add_class (GtkWidget* widget,
const gchar* class_name)
{
#if GTK_CHECK_VERSION (3,0,0)
GtkStyleContext* context = gtk_widget_get_style_context (widget);
gtk_style_context_add_class (context, class_name);
#endif
}
/** /**
* katze_assert_str_equal: * katze_assert_str_equal:
* @input: a string * @input: a string

View file

@ -160,6 +160,10 @@ katze_load_cached_icon (const gchar* uri,
GtkWidget* GtkWidget*
katze_uri_entry_new (GtkWidget* other_widget); katze_uri_entry_new (GtkWidget* other_widget);
void
katze_widget_add_class (GtkWidget* widget,
const gchar* class_name);
void void
katze_assert_str_equal (const gchar* input, katze_assert_str_equal (const gchar* input,
const gchar* result, const gchar* result,

View file

@ -4798,11 +4798,8 @@ _action_clear_private_data_activate (GtkAction* action,
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL); _("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL);
#if GTK_CHECK_VERSION (3, 0, 0) katze_widget_add_class (gtk_dialog_get_widget_for_response (
gtk_style_context_add_class (gtk_widget_get_style_context ( GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT), "noundo");
gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
GTK_RESPONSE_ACCEPT)), "noundo");
#endif
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
screen = gtk_widget_get_screen (GTK_WIDGET (browser)); screen = gtk_widget_get_screen (GTK_WIDGET (browser));
@ -6523,9 +6520,7 @@ midori_browser_init (MidoriBrowser* browser)
/* Create the navigationbar */ /* Create the navigationbar */
browser->navigationbar = gtk_ui_manager_get_widget ( browser->navigationbar = gtk_ui_manager_get_widget (
ui_manager, "/toolbar_navigation"); ui_manager, "/toolbar_navigation");
#if GTK_CHECK_VERSION(3,0,0) katze_widget_add_class (browser->navigationbar, "primary-toolbar");
gtk_style_context_add_class(gtk_widget_get_style_context(browser->navigationbar), "primary-toolbar");
#endif
/* FIXME: Settings should be connected with screen changes */ /* FIXME: Settings should be connected with screen changes */
gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser)); gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
if (gtk_settings) if (gtk_settings)
@ -6557,10 +6552,7 @@ midori_browser_init (MidoriBrowser* browser)
/* Bookmarkbar */ /* Bookmarkbar */
browser->bookmarkbar = gtk_toolbar_new (); browser->bookmarkbar = gtk_toolbar_new ();
#if GTK_CHECK_VERSION (3, 0, 0) katze_widget_add_class (browser->bookmarkbar, "secondary-toolbar");
gtk_style_context_add_class (
gtk_widget_get_style_context (browser->bookmarkbar), "secondary-toolbar");
#endif
gtk_widget_set_name (browser->bookmarkbar, "MidoriBookmarkbar"); gtk_widget_set_name (browser->bookmarkbar, "MidoriBookmarkbar");
gtk_toolbar_set_icon_size (GTK_TOOLBAR (browser->bookmarkbar), gtk_toolbar_set_icon_size (GTK_TOOLBAR (browser->bookmarkbar),
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);

View file

@ -300,6 +300,7 @@ midori_panel_init (MidoriPanel* panel)
/* Create the titlebar */ /* Create the titlebar */
labelbar = gtk_toolbar_new (); labelbar = gtk_toolbar_new ();
katze_widget_add_class (labelbar, "secondary-toolbar");
panel->labelbar = labelbar; panel->labelbar = labelbar;
gtk_toolbar_set_icon_size (GTK_TOOLBAR (labelbar), GTK_ICON_SIZE_MENU); gtk_toolbar_set_icon_size (GTK_TOOLBAR (labelbar), GTK_ICON_SIZE_MENU);
gtk_toolbar_set_style (GTK_TOOLBAR (labelbar), GTK_TOOLBAR_ICONS); gtk_toolbar_set_style (GTK_TOOLBAR (labelbar), GTK_TOOLBAR_ICONS);

View file

@ -1341,11 +1341,8 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
#endif #endif
NULL); NULL);
#if GTK_CHECK_VERSION (3, 0, 0) katze_widget_add_class (gtk_dialog_get_widget_for_response (
gtk_style_context_add_class (gtk_widget_get_style_context ( GTK_DIALOG (dialog), GTK_RESPONSE_HELP), "help_button");
gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
GTK_RESPONSE_HELP)), "help_button");
#endif
g_signal_connect (dialog, "destroy", g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed), &search_action->dialog); G_CALLBACK (gtk_widget_destroyed), &search_action->dialog);
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PROPERTIES); gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PROPERTIES);

View file

@ -263,10 +263,7 @@ midori_findbar_init (MidoriFindbar* findbar)
GtkToolItem* toolitem; GtkToolItem* toolitem;
gtk_widget_set_name (GTK_WIDGET (findbar), "MidoriFindbar"); gtk_widget_set_name (GTK_WIDGET (findbar), "MidoriFindbar");
#if GTK_CHECK_VERSION (3, 0, 0) katze_widget_add_class (GTK_WIDGET (findbar), "bottom-toolbar");
gtk_style_context_add_class (
gtk_widget_get_style_context (GTK_WIDGET (findbar)), "bottom-toolbar");
#endif
gtk_toolbar_set_icon_size (GTK_TOOLBAR (findbar), GTK_ICON_SIZE_MENU); gtk_toolbar_set_icon_size (GTK_TOOLBAR (findbar), GTK_ICON_SIZE_MENU);
gtk_toolbar_set_style (GTK_TOOLBAR (findbar), GTK_TOOLBAR_BOTH_HORIZ); gtk_toolbar_set_style (GTK_TOOLBAR (findbar), GTK_TOOLBAR_BOTH_HORIZ);
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (findbar), FALSE); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (findbar), FALSE);