Add a few style classes

This will allow themes a bit more control over the styling. Since you can no
longer select objects by class name in gtk version > 3.20 there is no other
easy way to theme these elements.

Added classes for "xed-window", "xed-searchbar", "xed-statusbar", and
"xed-panel" with additional classes of "side" and "bottom" for the panels
This commit is contained in:
JosephMcc 2016-12-28 11:44:35 -08:00
parent 5058c69288
commit 9c9e564ec1
4 changed files with 21 additions and 6 deletions

View File

@ -424,6 +424,17 @@ xed_panel_constructor (GType type,
build_notebook_for_panel (panel);
gtk_box_pack_start (GTK_BOX (panel->priv->main_box), panel->priv->notebook, TRUE, TRUE, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (panel), "xed-panel");
if (panel->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
gtk_style_context_add_class (gtk_widget_get_style_context (panel), "side");
}
else
{
gtk_style_context_add_class (gtk_widget_get_style_context (panel), "bottom");
}
return obj;
}

View File

@ -564,6 +564,8 @@ xed_searchbar_init (XedSearchbar *searchbar)
NULL);
g_free (file);
gtk_style_context_add_class (gtk_widget_get_style_context (searchbar), "xed-searchbar");
searchbar->priv->search_entry = xed_history_entry_new ("history-search-for", TRUE);
gtk_widget_set_hexpand (searchbar->priv->search_entry, TRUE);
xed_history_entry_set_escape_func (XED_HISTORY_ENTRY (searchbar->priv->search_entry),

View File

@ -179,6 +179,8 @@ xed_statusbar_init (XedStatusbar *statusbar)
gtk_box_pack_start (GTK_BOX (statusbar),
statusbar->priv->error_frame,
FALSE, TRUE, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (statusbar), "xed-statusbar");
}
/**

View File

@ -3120,15 +3120,13 @@ create_side_panel (XedWindow *window)
window->priv->side_panel = xed_panel_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_pack1 (GTK_PANED(window->priv->hpaned), window->priv->side_panel,
FALSE,
FALSE);
gtk_paned_pack1 (GTK_PANED (window->priv->hpaned), window->priv->side_panel, FALSE, FALSE);
g_signal_connect_after(window->priv->side_panel, "show", G_CALLBACK (side_panel_visibility_changed), window);
g_signal_connect_after(window->priv->side_panel, "hide", G_CALLBACK (side_panel_visibility_changed), window);
g_signal_connect_after (window->priv->side_panel, "show", G_CALLBACK (side_panel_visibility_changed), window);
g_signal_connect_after (window->priv->side_panel, "hide", G_CALLBACK (side_panel_visibility_changed), window);
documents_panel = xed_documents_panel_new (window);
xed_panel_add_item_with_stock_icon (XED_PANEL(window->priv->side_panel), documents_panel, _("Documents"),
xed_panel_add_item_with_stock_icon (XED_PANEL (window->priv->side_panel), documents_panel, _("Documents"),
GTK_STOCK_FILE);
}
@ -3366,6 +3364,8 @@ xed_window_init (XedWindow *window)
window->priv->window_group = gtk_window_group_new ();
gtk_window_group_add_window (window->priv->window_group, GTK_WINDOW (window));
gtk_style_context_add_class (gtk_widget_get_style_context (window), "xed-window");
main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), main_box);
gtk_widget_show (main_box);