forked from AuroraMiddleware/gtk
Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class by the new APIs. The only remaining uses of the old API are in save/restore situations.
This commit is contained in:
parent
2bd36d490b
commit
394ea32e93
@ -214,7 +214,7 @@ constraint_view_add_child (ConstraintView *view,
|
||||
|
||||
label = gtk_label_new (name);
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "child");
|
||||
gtk_widget_add_css_class (frame, "child");
|
||||
gtk_widget_set_name (frame, name);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_set_parent (frame, GTK_WIDGET (view));
|
||||
@ -257,7 +257,7 @@ constraint_view_add_guide (ConstraintView *view,
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
|
||||
gtk_widget_add_css_class (frame, "guide");
|
||||
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
|
||||
|
@ -131,13 +131,11 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
|
||||
GtkAlign valign, halign;
|
||||
gboolean is_left, is_right, is_top, is_bottom;
|
||||
gboolean has_left, has_right, has_top, has_bottom;
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (child);
|
||||
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
|
||||
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
|
||||
is_left = is_right = is_top = is_bottom = FALSE;
|
||||
|
||||
@ -160,24 +158,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
|
||||
is_bottom = (child_allocation->y + child_allocation->height == height);
|
||||
|
||||
if (has_left && !is_left)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
else if (!has_left && is_left)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
|
||||
if (has_right && !is_right)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
else if (!has_right && is_right)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
|
||||
if (has_top && !is_top)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
else if (!has_top && is_top)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
|
||||
if (has_bottom && !is_bottom)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
else if (!has_bottom && is_bottom)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -81,7 +81,7 @@ deserialize_widget (GtkDemoWidget *demo)
|
||||
else if (demo->type == GTK_TYPE_SPINNER)
|
||||
{
|
||||
widget = g_object_new (demo->type, "spinning", demo->active, NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||
gtk_widget_add_css_class (widget, "demo");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -114,7 +114,7 @@ new_spinner_cb (GtkWidget *button,
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_spinner_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||
gtk_widget_add_css_class (widget, "demo");
|
||||
gtk_spinner_start (GTK_SPINNER (widget));
|
||||
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
||||
|
||||
|
@ -62,7 +62,7 @@ create_blurred_button (void)
|
||||
{
|
||||
GtkWidget *w = gtk_button_new ();
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
|
||||
gtk_widget_add_css_class (w, "blurred-button");
|
||||
|
||||
return w;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ create_faces (void)
|
||||
/* Add a face */
|
||||
faces[i].face = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (faces[i].face, face_size, face_size);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (faces[i].face), faces[i].css_class);
|
||||
gtk_widget_add_css_class (faces[i].face, faces[i].css_class);
|
||||
gtk_container_add (GTK_CONTAINER (fixed), faces[i].face);
|
||||
|
||||
/* Set up the transformation for each face */
|
||||
|
@ -42,7 +42,7 @@ do_headerbar (GtkWidget *do_widget)
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
|
||||
gtk_widget_add_css_class (box, "linked");
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
|
@ -74,7 +74,7 @@ do_password_entry (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (box), entry2);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Done");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
||||
gtk_widget_add_css_class (button, "suggested-action");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
@ -190,8 +190,7 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
/* Add a drawing area */
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
|
||||
rotated_text_draw,
|
||||
|
@ -63,7 +63,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
if (i == 0)
|
||||
{
|
||||
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "icon-dropshadow");
|
||||
gtk_widget_add_css_class (widget, "icon-dropshadow");
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
|
||||
}
|
||||
else
|
||||
|
@ -419,7 +419,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (tweaks, 10);
|
||||
|
||||
choices = gtk_flow_box_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (choices), GTK_STYLE_CLASS_VIEW);
|
||||
gtk_widget_add_css_class (choices, GTK_STYLE_CLASS_VIEW);
|
||||
add_choice (choices, puzzle);
|
||||
add_choice (choices, gtk_nuclear_animation_new ());
|
||||
media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
|
@ -25,7 +25,7 @@ add_tag (GtkButton *button, DemoTaggedEntry *entry)
|
||||
DemoTaggedEntryTag *tag;
|
||||
|
||||
tag = demo_tagged_entry_tag_new ("Blue");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tag)), "blue");
|
||||
gtk_widget_add_css_class (GTK_WIDGET (tag), "blue");
|
||||
demo_tagged_entry_tag_set_has_close_button (tag, TRUE);
|
||||
g_signal_connect (tag, "button-clicked", G_CALLBACK (closed_cb), entry);
|
||||
|
||||
@ -98,7 +98,7 @@ do_tagged_entry (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Done");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
||||
gtk_widget_add_css_class (button, "suggested-action");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
|
@ -481,13 +481,11 @@ static void
|
||||
on_record_button_toggled (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
gtk_style_context_remove_class (context, "destructive-action");
|
||||
gtk_widget_remove_css_class (GTK_WIDGET (button), "destructive-action");
|
||||
else
|
||||
gtk_style_context_add_class (context, "destructive-action");
|
||||
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1226,7 +1226,7 @@ create_sidebar (void)
|
||||
stack = gtk_stack_new ();
|
||||
gtk_widget_set_size_request (stack, 120, 120);
|
||||
view = gtk_label_new ("Sidebar");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
|
||||
gtk_widget_add_css_class (view, "view");
|
||||
gtk_widget_set_halign (view, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (view, GTK_ALIGN_FILL);
|
||||
gtk_widget_show (view);
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkentry.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkheaderbar.h"
|
||||
#include "gtkdialogprivate.h"
|
||||
#include "gtksearchbar.h"
|
||||
|
@ -452,7 +452,7 @@ add_action_widgets (GtkAssistant *assistant)
|
||||
if (has_default)
|
||||
{
|
||||
gtk_window_set_default_widget (GTK_WINDOW (assistant), child);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (child), GTK_STYLE_CLASS_SUGGESTED_ACTION);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
|
||||
}
|
||||
}
|
||||
g_list_free (children);
|
||||
@ -1795,7 +1795,6 @@ gtk_assistant_add_page (GtkAssistant *assistant,
|
||||
{
|
||||
GtkAssistantPrivate *priv = gtk_assistant_get_instance_private (assistant);
|
||||
gint n_pages;
|
||||
GtkStyleContext *context;
|
||||
GtkWidget *sibling;
|
||||
char *name;
|
||||
|
||||
@ -1808,8 +1807,7 @@ gtk_assistant_add_page (GtkAssistant *assistant,
|
||||
gtk_widget_show (page_info->regular_title);
|
||||
gtk_widget_hide (page_info->current_title);
|
||||
|
||||
context = gtk_widget_get_style_context (page_info->current_title);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
gtk_widget_add_css_class (page_info->current_title, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
|
||||
gtk_size_group_add_widget (priv->title_size_group, page_info->regular_title);
|
||||
gtk_size_group_add_widget (priv->title_size_group, page_info->current_title);
|
||||
|
@ -845,8 +845,7 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
if (editable == NULL)
|
||||
return NULL;
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (editable)),
|
||||
GTK_STYLE_CLASS_CELL);
|
||||
gtk_widget_add_css_class (GTK_WIDGET (editable), GTK_STYLE_CLASS_CELL);
|
||||
|
||||
g_signal_emit (cell,
|
||||
cell_renderer_signals[EDITING_STARTED], 0,
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "gtkadjustment.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkspinbutton.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkroot.h"
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "gtkcolorutils.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkrangeprivate.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkaccessible.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
@ -1003,7 +1003,6 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *selection;
|
||||
GtkUnit user_units;
|
||||
GtkStyleContext *context;
|
||||
|
||||
content_area = gtk_dialog_get_content_area (cpu_dialog);
|
||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
||||
@ -1052,8 +1051,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
|
||||
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
context = gtk_widget_get_style_context (toolbar);
|
||||
gtk_style_context_add_class (context, "linked");
|
||||
gtk_widget_add_css_class (toolbar, "linked");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), toolbar);
|
||||
|
||||
|
@ -499,7 +499,7 @@ add_emoji (GtkWidget *list,
|
||||
pango_attr_list_insert (attrs, pango_attr_scale_new (PANGO_SCALE_X_LARGE));
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "emoji");
|
||||
gtk_widget_add_css_class (label, "emoji");
|
||||
|
||||
child = g_object_new (GTK_TYPE_LIST_BOX_ROW, "css-name", "emoji-completion-row", NULL);
|
||||
gtk_widget_set_focus_on_click (child, FALSE);
|
||||
|
@ -2290,7 +2290,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
|
||||
}
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (vbox), "search-bar");
|
||||
gtk_widget_add_css_class (vbox, "search-bar");
|
||||
|
||||
impl->save_widgets_table = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (vbox), impl->save_widgets_table);
|
||||
|
@ -1419,8 +1419,7 @@ do_popup_menu_for_process_tree_view (GtkWidget *widget,
|
||||
|
||||
menu = gtk_popover_new ();
|
||||
gtk_widget_set_parent (menu, widget);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (menu),
|
||||
GTK_STYLE_CLASS_CONTEXT_MENU);
|
||||
gtk_widget_add_css_class (menu, GTK_STYLE_CLASS_CONTEXT_MENU);
|
||||
|
||||
item = gtk_model_button_new ();
|
||||
g_object_set (item, "text", _("_End Process"), NULL);
|
||||
|
@ -768,7 +768,6 @@ gtk_shortcuts_shortcut_init (GtkShortcutsShortcut *self)
|
||||
"visible", FALSE,
|
||||
"xalign", 0.0f,
|
||||
NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self->subtitle)),
|
||||
GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_widget_add_css_class (GTK_WIDGET (self->subtitle), GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_container_add (GTK_CONTAINER (self->title_box), GTK_WIDGET (self->subtitle));
|
||||
}
|
||||
|
@ -91,13 +91,13 @@ add_action (GtkInspectorActions *sl,
|
||||
gtk_container_add (GTK_CONTAINER (row), box);
|
||||
|
||||
label = gtk_label_new (name);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_size_group_add_widget (sl->priv->name, label);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
label = gtk_label_new (enabled ? "+" : "-");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
||||
gtk_size_group_add_widget (sl->priv->enabled, label);
|
||||
@ -106,20 +106,20 @@ add_action (GtkInspectorActions *sl,
|
||||
g_object_set_data (G_OBJECT (row), "enabled", label);
|
||||
|
||||
label = gtk_label_new (parameter);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_size_group_add_widget (sl->priv->parameter, label);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
label = gtk_label_new (state_string);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_size_group_add_widget (sl->priv->state, label);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
g_object_set_data (G_OBJECT (row), "state", label);
|
||||
|
||||
editor = gtk_inspector_action_editor_new (group, name, sl->priv->activate);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (editor), "cell");
|
||||
gtk_widget_add_css_class (editor, "cell");
|
||||
gtk_container_add (GTK_CONTAINER (box), editor);
|
||||
g_object_set_data (G_OBJECT (row), "editor", editor);
|
||||
|
||||
|
@ -85,7 +85,7 @@ gtk_inspector_controllers_init (GtkInspectorControllers *sl)
|
||||
gtk_widget_set_vexpand (box, TRUE);
|
||||
|
||||
sl->priv->listbox = gtk_list_box_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (sl->priv->listbox), "frame");
|
||||
gtk_widget_add_css_class (sl->priv->listbox, "frame");
|
||||
gtk_widget_set_halign (sl->priv->listbox, GTK_ALIGN_CENTER);
|
||||
g_signal_connect (sl->priv->listbox, "row-activated", G_CALLBACK (row_activated), sl);
|
||||
gtk_list_box_set_selection_mode (GTK_LIST_BOX (sl->priv->listbox), GTK_SELECTION_NONE);
|
||||
|
@ -710,18 +710,14 @@ static void
|
||||
widget_mapped (GtkWidget *widget,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (row));
|
||||
|
||||
gtk_style_context_remove_class (context, "dim-label");
|
||||
gtk_widget_remove_css_class (GTK_WIDGET (row), "dim-label");
|
||||
}
|
||||
|
||||
static void
|
||||
widget_unmapped (GtkWidget *widget,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (row));
|
||||
|
||||
gtk_style_context_add_class (context, "dim-label");
|
||||
gtk_widget_add_css_class (GTK_WIDGET (row), "dim-label");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1551,7 +1551,7 @@ constructed (GObject *object)
|
||||
|
||||
if (label)
|
||||
{
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_widget_add_css_class (label, GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
}
|
||||
|
||||
@ -1565,7 +1565,7 @@ constructed (GObject *object)
|
||||
if (!can_modify)
|
||||
{
|
||||
label = gtk_label_new ("");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_widget_add_css_class (label, GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
readonly_changed (editor->priv->object, spec, label);
|
||||
|
@ -532,28 +532,28 @@ gtk_inspector_prop_list_create_row (GtkInspectorPropList *pl,
|
||||
gtk_container_add (GTK_CONTAINER (row), box);
|
||||
|
||||
label = gtk_label_new (prop->name);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_widget_set_sensitive (label, writable);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_size_group_add_widget (pl->priv->names, label);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
label = gtk_label_new (type ? type : "");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_widget_set_sensitive (label, writable);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_size_group_add_widget (pl->priv->types, label);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
label = gtk_label_new (g_type_name (prop->owner_type));
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
|
||||
gtk_widget_add_css_class (label, "cell");
|
||||
gtk_widget_set_sensitive (label, writable);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_size_group_add_widget (pl->priv->origins, label);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
widget = gtk_inspector_prop_editor_new (pl->priv->object, prop->name, pl->priv->values);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "cell");
|
||||
gtk_widget_add_css_class (widget, "cell");
|
||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||
g_signal_connect (widget, "show-object", G_CALLBACK (show_object), pl);
|
||||
|
||||
|
@ -230,7 +230,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sl), frame);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_VIEW);
|
||||
gtk_widget_add_css_class (box, GTK_STYLE_CLASS_VIEW);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
|
@ -62,7 +62,7 @@ add_string (GtkInspectorStrvEditor *editor,
|
||||
GtkWidget *button;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
|
||||
gtk_widget_add_css_class (box, "linked");
|
||||
gtk_widget_show (box);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
@ -73,7 +73,7 @@ add_string (GtkInspectorStrvEditor *editor,
|
||||
g_signal_connect_swapped (entry, "notify::text", G_CALLBACK (emit_changed), editor);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("user-trash-symbolic");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
|
||||
gtk_widget_add_css_class (button, "image-button");
|
||||
gtk_widget_show (button);
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor);
|
||||
@ -101,7 +101,7 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor)
|
||||
gtk_widget_show (editor->box);
|
||||
|
||||
editor->button = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (editor->button), "image-button");
|
||||
gtk_widget_add_css_class (editor->button, "image-button");
|
||||
gtk_widget_set_focus_on_click (editor->button, FALSE);
|
||||
gtk_widget_set_halign (editor->button, GTK_ALIGN_END);
|
||||
gtk_widget_show (editor->button);
|
||||
|
@ -151,8 +151,7 @@ main (int argc, char *argv[])
|
||||
gtk_widget_show (revealer);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (frame),
|
||||
"app-notification");
|
||||
gtk_widget_add_css_class (frame, "app-notification");
|
||||
gtk_container_add (GTK_CONTAINER (revealer), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
@ -177,16 +177,16 @@ create_widget_visible_border (const char *text)
|
||||
GtkWidget *label;
|
||||
|
||||
outer_box = gtk_overlay_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (outer_box), "black-bg");
|
||||
gtk_widget_add_css_class (outer_box, "black-bg");
|
||||
|
||||
inner_box = gtk_overlay_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (inner_box), "blue-bg");
|
||||
gtk_widget_add_css_class (inner_box, "blue-bg");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (outer_box), inner_box);
|
||||
|
||||
|
||||
test_widget = gtk_overlay_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (test_widget), "red-bg");
|
||||
gtk_widget_add_css_class (test_widget, "red-bg");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (inner_box), test_widget);
|
||||
|
||||
|
@ -63,7 +63,7 @@ set_font_size (GtkWidget *widget, gint size)
|
||||
{
|
||||
const gchar *class[3] = { "small-font", "medium-font", "large-font" };
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), class[size]);
|
||||
gtk_widget_add_css_class (widget, class[size]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -117,49 +117,49 @@ main (int argc, char **argv)
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "one");
|
||||
gtk_widget_add_css_class (w, "one");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "two");
|
||||
gtk_widget_add_css_class (w, "two");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "three");
|
||||
gtk_widget_add_css_class (w, "three");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "four");
|
||||
gtk_widget_add_css_class (w, "four");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "five");
|
||||
gtk_widget_add_css_class (w, "five");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
|
||||
/* Bottom */
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "b1");
|
||||
gtk_widget_add_css_class (w, "b1");
|
||||
gtk_container_add (GTK_CONTAINER (bottom), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "b2");
|
||||
gtk_widget_add_css_class (w, "b2");
|
||||
gtk_container_add (GTK_CONTAINER (bottom), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "b3");
|
||||
gtk_widget_add_css_class (w, "b3");
|
||||
gtk_container_add (GTK_CONTAINER (bottom), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "b4");
|
||||
gtk_widget_add_css_class (w, "b4");
|
||||
gtk_container_add (GTK_CONTAINER (bottom), w);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (box), top);
|
||||
|
@ -107,7 +107,7 @@ canvas_new (void)
|
||||
canvas = gtk_fixed_new ();
|
||||
gtk_widget_set_hexpand (canvas, TRUE);
|
||||
gtk_widget_set_vexpand (canvas, TRUE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (canvas), "frame");
|
||||
gtk_widget_add_css_class (canvas, "frame");
|
||||
|
||||
source = gtk_drag_source_new ();
|
||||
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
|
||||
@ -218,7 +218,7 @@ canvas_item_new (int i,
|
||||
gdk_rgba_parse (&rgba, "yellow");
|
||||
|
||||
widget = gtk_label_new (label);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "frame");
|
||||
gtk_widget_add_css_class (widget, "frame");
|
||||
gtk_widget_set_name (widget, id);
|
||||
|
||||
set_color (widget, &rgba);
|
||||
@ -300,7 +300,7 @@ int main (int argc, char *argv[])
|
||||
gtk_container_add (GTK_CONTAINER (box), sw);
|
||||
|
||||
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box3), "linked");
|
||||
gtk_widget_add_css_class (box3, "linked");
|
||||
gtk_container_add (GTK_CONTAINER (sw), box3);
|
||||
|
||||
for (i = 0; colors[i]; i++)
|
||||
|
@ -269,8 +269,8 @@ main (int argc, char **argv)
|
||||
gtk_grid_attach (GTK_GRID (grid), entry, 1, 6, 1, 1);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), "view");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), "entry-frame");
|
||||
gtk_widget_add_css_class (box, "view");
|
||||
gtk_widget_add_css_class (box, "entry-frame");
|
||||
gtk_widget_set_cursor_from_name (box, "text");
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (entry, TRUE);
|
||||
|
@ -94,8 +94,8 @@ change_header (GtkButton *button, gpointer data)
|
||||
if (button && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
|
||||
{
|
||||
header = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (header), "titlebar");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (header), "header-bar");
|
||||
gtk_widget_add_css_class (header, "titlebar");
|
||||
gtk_widget_add_css_class (header, "header-bar");
|
||||
gtk_widget_set_margin_start (header, 10);
|
||||
gtk_widget_set_margin_end (header, 10);
|
||||
gtk_widget_set_margin_top (header, 10);
|
||||
@ -110,12 +110,12 @@ change_header (GtkButton *button, gpointer data)
|
||||
else
|
||||
{
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (header), "titlebar");
|
||||
gtk_widget_add_css_class (header, "titlebar");
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Example header");
|
||||
|
||||
widget = gtk_button_new_with_label ("_Close");
|
||||
gtk_button_set_use_underline (GTK_BUTTON (widget), TRUE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "suggested-action");
|
||||
gtk_widget_add_css_class (widget, "suggested-action");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (quit_cb), &done);
|
||||
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), widget);
|
||||
@ -144,7 +144,7 @@ main (int argc, char *argv[])
|
||||
gtk_init ();
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (window), "main");
|
||||
gtk_widget_add_css_class (window, "main");
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
|
@ -115,49 +115,49 @@ main (int argc, char **argv)
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "one");
|
||||
gtk_widget_add_css_class (w, "one");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "two");
|
||||
gtk_widget_add_css_class (w, "two");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "three");
|
||||
gtk_widget_add_css_class (w, "three");
|
||||
gtk_widget_set_opacity (w, 0.7);
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "four");
|
||||
gtk_widget_add_css_class (w, "four");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "five");
|
||||
gtk_widget_add_css_class (w, "five");
|
||||
gtk_container_add (GTK_CONTAINER (top), w);
|
||||
|
||||
/* Bottom */
|
||||
w = gtk_button_new ();
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "b1");
|
||||
gtk_widget_add_css_class (w, "b1");
|
||||
gtk_container_add (GTK_CONTAINER (bottom), w);
|
||||
|
||||
/*w = gtk_button_new ();*/
|
||||
/*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
|
||||
/*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b2");*/
|
||||
/*gtk_widget_add_css_class (w, "b2");*/
|
||||
/*gtk_container_add (GTK_CONTAINER (bottom), w);*/
|
||||
|
||||
/*w = gtk_button_new ();*/
|
||||
/*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
|
||||
/*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b3");*/
|
||||
/*gtk_widget_add_css_class (w, "b3");*/
|
||||
/*gtk_container_add (GTK_CONTAINER (bottom), w);*/
|
||||
|
||||
/*w = gtk_button_new ();*/
|
||||
/*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
|
||||
/*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b4");*/
|
||||
/*gtk_widget_add_css_class (w, "b4");*/
|
||||
/*gtk_container_add (GTK_CONTAINER (bottom), w);*/
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (box), top);
|
||||
|
@ -429,7 +429,7 @@ test_stacking (void)
|
||||
grid = gtk_grid_new ();
|
||||
overlay = gtk_overlay_new ();
|
||||
main_child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (main_child), "overlay-green");
|
||||
gtk_widget_add_css_class (main_child, "overlay-green");
|
||||
gtk_widget_set_hexpand (main_child, TRUE);
|
||||
gtk_widget_set_vexpand (main_child, TRUE);
|
||||
label = gtk_label_new ("Main child");
|
||||
|
@ -43,8 +43,7 @@ on_activate (GApplication *app,
|
||||
|
||||
sidebar = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (sidebar, 150, -1);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (sidebar),
|
||||
GTK_STYLE_CLASS_SIDEBAR);
|
||||
gtk_widget_add_css_class (sidebar, GTK_STYLE_CLASS_SIDEBAR);
|
||||
gtk_container_add (GTK_CONTAINER (revealer), sidebar);
|
||||
|
||||
img = gtk_image_new ();
|
||||
|
@ -114,7 +114,7 @@ selection_mode_enter (GtkButton *button, GtkBuilder *builder)
|
||||
selectbutton = GTK_WIDGET (gtk_builder_get_object (builder, "select-button"));
|
||||
titlestack = GTK_WIDGET (gtk_builder_get_object (builder, "titlestack"));
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (header), "selection-mode");
|
||||
gtk_widget_add_css_class (header, "selection-mode");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_widget_hide (headerbutton);
|
||||
gtk_widget_hide (selectbutton);
|
||||
@ -143,7 +143,7 @@ selection_mode_leave (GtkButton *button, GtkBuilder *builder)
|
||||
selectbutton = GTK_WIDGET (gtk_builder_get_object (builder, "select-button"));
|
||||
titlestack = GTK_WIDGET (gtk_builder_get_object (builder, "titlestack"));
|
||||
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (header), "selection-mode");
|
||||
gtk_widget_remove_css_class (header, "selection-mode");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_widget_show (headerbutton);
|
||||
gtk_widget_show (selectbutton);
|
||||
|
@ -26,7 +26,7 @@ int main (int argc, char *argv[])
|
||||
gtk_widget_set_margin_top (box3, 10);
|
||||
gtk_widget_set_margin_bottom (box3, 10);
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box3), GTK_STYLE_CLASS_LINKED);
|
||||
gtk_widget_add_css_class (box3, GTK_STYLE_CLASS_LINKED);
|
||||
button = gtk_button_new_from_icon_name ("document-new-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (box3), button);
|
||||
button = gtk_button_new_from_icon_name ("document-open-symbolic");
|
||||
|
@ -47,7 +47,7 @@ my_tooltip_init (MyTooltip *tt)
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (tt), label);
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tt)), "background");
|
||||
gtk_widget_add_css_class (GTK_WIDGET (tt), "background");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -93,7 +93,6 @@ G_MODULE_EXPORT gboolean
|
||||
add_reference_class_if_no_animation (GtkWidget *widget)
|
||||
{
|
||||
gboolean enabled;
|
||||
GtkStyleContext *context;
|
||||
|
||||
g_object_get (gtk_widget_get_settings (widget), "gtk-enable-animations", &enabled, NULL);
|
||||
if (enabled)
|
||||
@ -101,8 +100,7 @@ add_reference_class_if_no_animation (GtkWidget *widget)
|
||||
|
||||
g_message ("Adding reference class because animation is disabled");
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_add_class (context, "reference");
|
||||
gtk_widget_add_css_class (widget, "reference");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user