mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 07:04:29 +00:00
Start using GtkWidget's new style class API
This commit is contained in:
parent
b1d64a6b3a
commit
b7ee2cbc28
@ -452,8 +452,8 @@ setup_search (GtkAppChooserDialog *self)
|
|||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
image = gtk_image_new_from_icon_name ("edit-find-symbolic");
|
image = gtk_image_new_from_icon_name ("edit-find-symbolic");
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
|
gtk_widget_add_style_class (button, "image-button");
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (button), "text-button");
|
gtk_widget_remove_style_class (button, "text-button");
|
||||||
|
|
||||||
header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
|
header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||||
|
@ -654,9 +654,8 @@ gtk_button_new_with_mnemonic (const gchar *label)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_button_set_relief (GtkButton *button,
|
gtk_button_set_relief (GtkButton *button,
|
||||||
GtkReliefStyle relief)
|
GtkReliefStyle relief)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkReliefStyle old_relief;
|
GtkReliefStyle old_relief;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BUTTON (button));
|
g_return_if_fail (GTK_IS_BUTTON (button));
|
||||||
@ -664,11 +663,10 @@ gtk_button_set_relief (GtkButton *button,
|
|||||||
old_relief = gtk_button_get_relief (button);
|
old_relief = gtk_button_get_relief (button);
|
||||||
if (old_relief != relief)
|
if (old_relief != relief)
|
||||||
{
|
{
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
|
||||||
if (relief == GTK_RELIEF_NONE)
|
if (relief == GTK_RELIEF_NONE)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT);
|
gtk_widget_add_style_class (GTK_WIDGET (button), GTK_STYLE_CLASS_FLAT);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FLAT);
|
gtk_widget_remove_style_class (GTK_WIDGET (button), GTK_STYLE_CLASS_FLAT);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_RELIEF]);
|
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_RELIEF]);
|
||||||
}
|
}
|
||||||
@ -685,12 +683,9 @@ gtk_button_set_relief (GtkButton *button,
|
|||||||
GtkReliefStyle
|
GtkReliefStyle
|
||||||
gtk_button_get_relief (GtkButton *button)
|
gtk_button_get_relief (GtkButton *button)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL);
|
g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
if (gtk_widget_has_style_class (GTK_WIDGET (button), GTK_STYLE_CLASS_FLAT))
|
||||||
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_FLAT))
|
|
||||||
return GTK_RELIEF_NONE;
|
return GTK_RELIEF_NONE;
|
||||||
else
|
else
|
||||||
return GTK_RELIEF_NORMAL;
|
return GTK_RELIEF_NORMAL;
|
||||||
@ -787,12 +782,9 @@ gtk_button_set_label (GtkButton *button,
|
|||||||
{
|
{
|
||||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BUTTON (button));
|
g_return_if_fail (GTK_IS_BUTTON (button));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (button));
|
child = gtk_bin_get_child (GTK_BIN (button));
|
||||||
|
|
||||||
if (priv->child_type != LABEL_CHILD || child == NULL)
|
if (priv->child_type != LABEL_CHILD || child == NULL)
|
||||||
@ -811,8 +803,8 @@ gtk_button_set_label (GtkButton *button,
|
|||||||
gtk_label_set_xalign (GTK_LABEL (child), 0.0);
|
gtk_label_set_xalign (GTK_LABEL (child), 0.0);
|
||||||
}
|
}
|
||||||
gtk_container_add (GTK_CONTAINER (button), child);
|
gtk_container_add (GTK_CONTAINER (button), child);
|
||||||
gtk_style_context_remove_class (context, "image-button");
|
gtk_widget_remove_style_class (GTK_WIDGET (button), "image-button");
|
||||||
gtk_style_context_add_class (context, "text-button");
|
gtk_widget_add_style_class (GTK_WIDGET (button), "text-button");
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_label_set_label (GTK_LABEL (child), label);
|
gtk_label_set_label (GTK_LABEL (child), label);
|
||||||
@ -944,13 +936,11 @@ gtk_button_set_icon_name (GtkButton *button,
|
|||||||
{
|
{
|
||||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BUTTON (button));
|
g_return_if_fail (GTK_IS_BUTTON (button));
|
||||||
g_return_if_fail (icon_name != NULL);
|
g_return_if_fail (icon_name != NULL);
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (button));
|
child = gtk_bin_get_child (GTK_BIN (button));
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
|
||||||
|
|
||||||
if (priv->child_type != ICON_CHILD || child == NULL)
|
if (priv->child_type != ICON_CHILD || child == NULL)
|
||||||
{
|
{
|
||||||
@ -959,8 +949,8 @@ gtk_button_set_icon_name (GtkButton *button,
|
|||||||
|
|
||||||
child = gtk_image_new_from_icon_name (icon_name);
|
child = gtk_image_new_from_icon_name (icon_name);
|
||||||
gtk_container_add (GTK_CONTAINER (button), child);
|
gtk_container_add (GTK_CONTAINER (button), child);
|
||||||
gtk_style_context_remove_class (context, "text-button");
|
gtk_widget_remove_style_class (GTK_WIDGET (button), "text-button");
|
||||||
gtk_style_context_add_class (context, "image-button");
|
gtk_widget_add_style_class (GTK_WIDGET (button), "image-button");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -743,16 +743,15 @@ gtk_calendar_init (GtkCalendar *calendar)
|
|||||||
|
|
||||||
gtk_widget_set_can_focus (widget, TRUE);
|
gtk_widget_set_can_focus (widget, TRUE);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (calendar)),
|
gtk_widget_add_style_class (GTK_WIDGET (calendar), GTK_STYLE_CLASS_VIEW);
|
||||||
GTK_STYLE_CLASS_VIEW);
|
|
||||||
|
|
||||||
priv->header_box = g_object_new (GTK_TYPE_BOX,
|
priv->header_box = g_object_new (GTK_TYPE_BOX,
|
||||||
"css-name", "header",
|
"css-name", "header",
|
||||||
NULL);
|
NULL);
|
||||||
priv->year_label = gtk_label_new ("");
|
priv->year_label = gtk_label_new ("");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->year_label), "year");
|
gtk_widget_add_style_class (priv->year_label, "year");
|
||||||
priv->month_name_stack = gtk_stack_new ();
|
priv->month_name_stack = gtk_stack_new ();
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->month_name_stack), "month");
|
gtk_widget_add_style_class (priv->month_name_stack, "month");
|
||||||
priv->arrow_widgets[0] = gtk_button_new_from_icon_name ("pan-start-symbolic");
|
priv->arrow_widgets[0] = gtk_button_new_from_icon_name ("pan-start-symbolic");
|
||||||
g_signal_connect_swapped (priv->arrow_widgets[0], "clicked", G_CALLBACK (calendar_set_month_prev), calendar);
|
g_signal_connect_swapped (priv->arrow_widgets[0], "clicked", G_CALLBACK (calendar_set_month_prev), calendar);
|
||||||
priv->arrow_widgets[1] = gtk_button_new_from_icon_name ("pan-end-symbolic");
|
priv->arrow_widgets[1] = gtk_button_new_from_icon_name ("pan-end-symbolic");
|
||||||
|
@ -393,10 +393,9 @@ gtk_check_button_init (GtkCheckButton *check_button)
|
|||||||
{
|
{
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
||||||
|
|
||||||
|
|
||||||
gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE);
|
gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE);
|
||||||
|
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (check_button)), "toggle");
|
gtk_widget_remove_style_class (GTK_WIDGET (check_button), "toggle");
|
||||||
|
|
||||||
priv->draw_indicator = TRUE;
|
priv->draw_indicator = TRUE;
|
||||||
draw_indicator_changed (check_button);
|
draw_indicator_changed (check_button);
|
||||||
|
@ -299,7 +299,6 @@ gtk_color_button_init (GtkColorButton *button)
|
|||||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
PangoRectangle rect;
|
PangoRectangle rect;
|
||||||
GtkStyleContext *context;
|
|
||||||
GdkContentFormats *targets;
|
GdkContentFormats *targets;
|
||||||
GdkContentProvider *content;
|
GdkContentProvider *content;
|
||||||
GtkDragSource *source;
|
GtkDragSource *source;
|
||||||
@ -340,8 +339,7 @@ gtk_color_button_init (GtkColorButton *button)
|
|||||||
g_signal_connect (source, "drag-begin", G_CALLBACK (gtk_color_button_drag_begin), button);
|
g_signal_connect (source, "drag-begin", G_CALLBACK (gtk_color_button_drag_begin), button);
|
||||||
gtk_widget_add_controller (priv->button, GTK_EVENT_CONTROLLER (source));
|
gtk_widget_add_controller (priv->button, GTK_EVENT_CONTROLLER (source));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (priv->button));
|
gtk_widget_add_style_class (priv->button, "color");
|
||||||
gtk_style_context_add_class (context, "color");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -378,19 +378,19 @@ add_palette (GtkColorChooserWidget *cc,
|
|||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
if (pos == left)
|
if (pos == left)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (p, GTK_STYLE_CLASS_LEFT);
|
||||||
else if (pos == right)
|
else if (pos == right)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (p, GTK_STYLE_CLASS_RIGHT);
|
||||||
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), p, pos, line, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), p, pos, line, 1, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pos == 0)
|
if (pos == 0)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_TOP);
|
gtk_widget_add_style_class (p, GTK_STYLE_CLASS_TOP);
|
||||||
else if (pos == colors_per_line - 1)
|
else if (pos == colors_per_line - 1)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (p, GTK_STYLE_CLASS_BOTTOM);
|
||||||
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), p, line, pos, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), p, line, pos, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -386,11 +386,9 @@ gtk_color_editor_init (GtkColorEditor *editor)
|
|||||||
gtk_widget_init_template (GTK_WIDGET (editor));
|
gtk_widget_init_template (GTK_WIDGET (editor));
|
||||||
|
|
||||||
if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
|
gtk_widget_add_style_class (editor->priv->h_slider, "marks-before");
|
||||||
"marks-before");
|
|
||||||
else
|
else
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
|
gtk_widget_add_style_class (editor->priv->h_slider, "marks-after");
|
||||||
"marks-after");
|
|
||||||
|
|
||||||
/* Create the scaled popup adjustments manually here because connecting user data is not
|
/* Create the scaled popup adjustments manually here because connecting user data is not
|
||||||
* supported by template GtkBuilder xml (it would be possible to set this up in the xml
|
* supported by template GtkBuilder xml (it would be possible to set this up in the xml
|
||||||
@ -419,7 +417,7 @@ gtk_color_editor_init (GtkColorEditor *editor)
|
|||||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||||
gtk_widget_add_controller (editor->priv->a_entry, controller);
|
gtk_widget_add_controller (editor->priv->a_entry, controller);
|
||||||
|
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (editor->priv->swatch), "activatable");
|
gtk_widget_remove_style_class (editor->priv->swatch, "activatable");
|
||||||
|
|
||||||
editor->priv->picker = gtk_color_picker_new ();
|
editor->priv->picker = gtk_color_picker_new ();
|
||||||
if (editor->priv->picker == NULL)
|
if (editor->priv->picker == NULL)
|
||||||
|
@ -148,7 +148,6 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale,
|
|||||||
static void
|
static void
|
||||||
gtk_color_scale_init (GtkColorScale *scale)
|
gtk_color_scale_init (GtkColorScale *scale)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
|
|
||||||
gesture = gtk_gesture_long_press_new ();
|
gesture = gtk_gesture_long_press_new ();
|
||||||
@ -158,8 +157,7 @@ gtk_color_scale_init (GtkColorScale *scale)
|
|||||||
GTK_PHASE_TARGET);
|
GTK_PHASE_TARGET);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
|
gtk_widget_add_style_class (GTK_WIDGET (scale), "color");
|
||||||
gtk_style_context_add_class (context, "color");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -558,7 +558,7 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
|||||||
G_CALLBACK (key_controller_key_pressed), swatch);
|
G_CALLBACK (key_controller_key_pressed), swatch);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (swatch), controller);
|
gtk_widget_add_controller (GTK_WIDGET (swatch), controller);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (swatch)), "activatable");
|
gtk_widget_add_style_class (GTK_WIDGET (swatch), "activatable");
|
||||||
|
|
||||||
priv->overlay_widget = g_object_new (GTK_TYPE_IMAGE,
|
priv->overlay_widget = g_object_new (GTK_TYPE_IMAGE,
|
||||||
"css-name", "overlay",
|
"css-name", "overlay",
|
||||||
@ -591,9 +591,6 @@ gtk_color_swatch_set_rgba (GtkColorSwatch *swatch,
|
|||||||
const GdkRGBA *color)
|
const GdkRGBA *color)
|
||||||
{
|
{
|
||||||
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
|
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (swatch));
|
|
||||||
|
|
||||||
if (!priv->has_color)
|
if (!priv->has_color)
|
||||||
{
|
{
|
||||||
@ -614,13 +611,14 @@ gtk_color_swatch_set_rgba (GtkColorSwatch *swatch,
|
|||||||
|
|
||||||
if (INTENSITY (priv->color.red, priv->color.green, priv->color.blue) > 0.5)
|
if (INTENSITY (priv->color.red, priv->color.green, priv->color.blue) > 0.5)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, "light");
|
gtk_widget_add_style_class (GTK_WIDGET (swatch), "light");
|
||||||
gtk_style_context_remove_class (context, "dark");
|
gtk_widget_remove_style_class (GTK_WIDGET (swatch), "dark");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, "dark");
|
gtk_widget_add_style_class (GTK_WIDGET (swatch), "dark");
|
||||||
gtk_style_context_remove_class (context, "light");
|
gtk_widget_remove_style_class (GTK_WIDGET (swatch), "light");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (swatch));
|
gtk_widget_queue_draw (GTK_WIDGET (swatch));
|
||||||
|
@ -825,7 +825,6 @@ static void
|
|||||||
gtk_combo_box_init (GtkComboBox *combo_box)
|
gtk_combo_box_init (GtkComboBox *combo_box)
|
||||||
{
|
{
|
||||||
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
|
|
||||||
priv->active = -1;
|
priv->active = -1;
|
||||||
@ -848,9 +847,8 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
|||||||
g_type_ensure (GTK_TYPE_TREE_POPOVER);
|
g_type_ensure (GTK_TYPE_TREE_POPOVER);
|
||||||
gtk_widget_init_template (GTK_WIDGET (combo_box));
|
gtk_widget_init_template (GTK_WIDGET (combo_box));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->button);
|
gtk_widget_remove_style_class (priv->button, "toggle");
|
||||||
gtk_style_context_remove_class (context, "toggle");
|
gtk_widget_add_style_class (priv->button, "combo");
|
||||||
gtk_style_context_add_class (context, "combo");
|
|
||||||
|
|
||||||
gtk_tree_popover_set_row_separator_func (GTK_TREE_POPOVER (priv->popup_widget),
|
gtk_tree_popover_set_row_separator_func (GTK_TREE_POPOVER (priv->popup_widget),
|
||||||
(GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func,
|
(GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func,
|
||||||
@ -1029,13 +1027,11 @@ gtk_combo_box_create_child (GtkComboBox *combo_box)
|
|||||||
if (priv->has_entry)
|
if (priv->has_entry)
|
||||||
{
|
{
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (combo_box), entry);
|
gtk_container_add (GTK_CONTAINER (combo_box), entry);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
|
gtk_widget_add_style_class (GTK_WIDGET (entry), "combo");
|
||||||
gtk_style_context_add_class (context, "combo");
|
|
||||||
|
|
||||||
g_signal_connect (combo_box, "changed",
|
g_signal_connect (combo_box, "changed",
|
||||||
G_CALLBACK (gtk_combo_box_entry_active_changed), NULL);
|
G_CALLBACK (gtk_combo_box_entry_active_changed), NULL);
|
||||||
|
@ -398,12 +398,11 @@ update_suggested_action (GtkDialog *dialog)
|
|||||||
for (l = children; l != NULL; l = l->next)
|
for (l = children; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
GtkWidget *child = l->data;
|
GtkWidget *child = l->data;
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (child);
|
|
||||||
|
|
||||||
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_DEFAULT))
|
if (gtk_widget_has_style_class (child, GTK_STYLE_CLASS_DEFAULT))
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUGGESTED_ACTION);
|
gtk_widget_add_style_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SUGGESTED_ACTION);
|
gtk_widget_remove_style_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
|
||||||
}
|
}
|
||||||
g_list_free (children);
|
g_list_free (children);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ show_variations (GtkEmojiChooser *chooser,
|
|||||||
parent_popover = gtk_widget_get_ancestor (child, GTK_TYPE_POPOVER);
|
parent_popover = gtk_widget_get_ancestor (child, GTK_TYPE_POPOVER);
|
||||||
popover = gtk_popover_new (child);
|
popover = gtk_popover_new (child);
|
||||||
view = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
view = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
|
gtk_widget_add_style_class (view, "view");
|
||||||
box = gtk_flow_box_new ();
|
box = gtk_flow_box_new ();
|
||||||
gtk_flow_box_set_homogeneous (GTK_FLOW_BOX (box), TRUE);
|
gtk_flow_box_set_homogeneous (GTK_FLOW_BOX (box), TRUE);
|
||||||
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 6);
|
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 6);
|
||||||
|
@ -1341,7 +1341,6 @@ update_icon_style (GtkWidget *widget,
|
|||||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||||
EntryIconInfo *icon_info = priv->icons[icon_pos];
|
EntryIconInfo *icon_info = priv->icons[icon_pos];
|
||||||
const gchar *sides[2] = { GTK_STYLE_CLASS_LEFT, GTK_STYLE_CLASS_RIGHT };
|
const gchar *sides[2] = { GTK_STYLE_CLASS_LEFT, GTK_STYLE_CLASS_RIGHT };
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (icon_info == NULL)
|
if (icon_info == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1349,9 +1348,8 @@ update_icon_style (GtkWidget *widget,
|
|||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
icon_pos = 1 - icon_pos;
|
icon_pos = 1 - icon_pos;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (icon_info->widget);
|
gtk_widget_add_style_class (icon_info->widget, sides[icon_pos]);
|
||||||
gtk_style_context_add_class (context, sides[icon_pos]);
|
gtk_widget_remove_style_class (icon_info->widget, sides[1 - icon_pos]);
|
||||||
gtk_style_context_remove_class (context, sides[1 - icon_pos]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2207,8 +2205,6 @@ void
|
|||||||
gtk_entry_set_has_frame (GtkEntry *entry,
|
gtk_entry_set_has_frame (GtkEntry *entry,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||||
|
|
||||||
setting = (setting != FALSE);
|
setting = (setting != FALSE);
|
||||||
@ -2216,11 +2212,10 @@ gtk_entry_set_has_frame (GtkEntry *entry,
|
|||||||
if (setting == gtk_entry_get_has_frame (entry))
|
if (setting == gtk_entry_get_has_frame (entry))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
|
|
||||||
if (setting)
|
if (setting)
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FLAT);
|
gtk_widget_remove_style_class (GTK_WIDGET (entry), GTK_STYLE_CLASS_FLAT);
|
||||||
else
|
else
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT);
|
gtk_widget_add_style_class (GTK_WIDGET (entry), GTK_STYLE_CLASS_FLAT);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_HAS_FRAME]);
|
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_HAS_FRAME]);
|
||||||
}
|
}
|
||||||
@ -2236,13 +2231,9 @@ gtk_entry_set_has_frame (GtkEntry *entry,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_entry_get_has_frame (GtkEntry *entry)
|
gtk_entry_get_has_frame (GtkEntry *entry)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
|
return !gtk_widget_has_style_class (GTK_WIDGET (entry), GTK_STYLE_CLASS_FRAME);
|
||||||
|
|
||||||
return !gtk_style_context_has_class (context, GTK_STYLE_CLASS_FLAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -585,7 +585,7 @@ gtk_entry_completion_constructed (GObject *object)
|
|||||||
gtk_popover_set_position (GTK_POPOVER (priv->popup_window), GTK_POS_BOTTOM);
|
gtk_popover_set_position (GTK_POPOVER (priv->popup_window), GTK_POS_BOTTOM);
|
||||||
gtk_popover_set_autohide (GTK_POPOVER (priv->popup_window), FALSE);
|
gtk_popover_set_autohide (GTK_POPOVER (priv->popup_window), FALSE);
|
||||||
gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_window), FALSE);
|
gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_window), FALSE);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_window), "entry-completion");
|
gtk_widget_add_style_class (priv->popup_window, "entry-completion");
|
||||||
|
|
||||||
controller = gtk_event_controller_key_new ();
|
controller = gtk_event_controller_key_new ();
|
||||||
g_signal_connect (controller, "key-pressed",
|
g_signal_connect (controller, "key-pressed",
|
||||||
|
@ -370,8 +370,7 @@ gtk_expander_init (GtkExpander *expander)
|
|||||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->title_widget);
|
gtk_container_add (GTK_CONTAINER (priv->box), priv->title_widget);
|
||||||
|
|
||||||
priv->arrow_widget = gtk_builtin_icon_new ("expander");
|
priv->arrow_widget = gtk_builtin_icon_new ("expander");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->arrow_widget),
|
gtk_widget_add_style_class (priv->arrow_widget, GTK_STYLE_CLASS_HORIZONTAL);
|
||||||
GTK_STYLE_CLASS_HORIZONTAL);
|
|
||||||
gtk_container_add (GTK_CONTAINER (priv->title_widget), priv->arrow_widget);
|
gtk_container_add (GTK_CONTAINER (priv->title_widget), priv->arrow_widget);
|
||||||
|
|
||||||
formats = gdk_content_formats_new (NULL, 0);
|
formats = gdk_content_formats_new (NULL, 0);
|
||||||
|
@ -555,7 +555,6 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
|
|||||||
static void
|
static void
|
||||||
gtk_font_button_init (GtkFontButton *font_button)
|
gtk_font_button_init (GtkFontButton *font_button)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (font_button);
|
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (font_button);
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
|
|
||||||
@ -592,8 +591,7 @@ gtk_font_button_init (GtkFontButton *font_button)
|
|||||||
|
|
||||||
gtk_font_button_take_font_desc (font_button, NULL);
|
gtk_font_button_take_font_desc (font_button, NULL);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (priv->button));
|
gtk_widget_add_style_class (priv->button, "font");
|
||||||
gtk_style_context_add_class (context, "font");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -534,11 +534,9 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
|
|||||||
priv->shadow_type = type;
|
priv->shadow_type = type;
|
||||||
|
|
||||||
if (type == GTK_SHADOW_NONE)
|
if (type == GTK_SHADOW_NONE)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (frame)),
|
gtk_widget_add_style_class (GTK_WIDGET (frame), "flat");
|
||||||
GTK_STYLE_CLASS_FLAT);
|
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (frame)),
|
gtk_widget_remove_style_class (GTK_WIDGET (frame), "flat");
|
||||||
GTK_STYLE_CLASS_FLAT);
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (frame), frame_props[PROP_SHADOW_TYPE]);
|
g_object_notify_by_pspec (G_OBJECT (frame), frame_props[PROP_SHADOW_TYPE]);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,6 @@ init_sizing_box (GtkHeaderBar *bar)
|
|||||||
{
|
{
|
||||||
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
|
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
|
||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
/* We use this box to always request size for the two labels (title
|
/* We use this box to always request size for the two labels (title
|
||||||
* and subtitle) as if they were always visible, but then allocate
|
* and subtitle) as if they were always visible, but then allocate
|
||||||
@ -174,8 +173,7 @@ init_sizing_box (GtkHeaderBar *bar)
|
|||||||
priv->label_sizing_box = g_object_ref_sink (w);
|
priv->label_sizing_box = g_object_ref_sink (w);
|
||||||
|
|
||||||
w = gtk_label_new (NULL);
|
w = gtk_label_new (NULL);
|
||||||
context = gtk_widget_get_style_context (w);
|
gtk_widget_add_style_class (w, GTK_STYLE_CLASS_TITLE);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE);
|
|
||||||
gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
|
gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
|
||||||
gtk_label_set_wrap (GTK_LABEL (w), FALSE);
|
gtk_label_set_wrap (GTK_LABEL (w), FALSE);
|
||||||
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
|
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
|
||||||
@ -183,8 +181,7 @@ init_sizing_box (GtkHeaderBar *bar)
|
|||||||
gtk_label_set_width_chars (GTK_LABEL (w), MIN_TITLE_CHARS);
|
gtk_label_set_width_chars (GTK_LABEL (w), MIN_TITLE_CHARS);
|
||||||
|
|
||||||
w = gtk_label_new (NULL);
|
w = gtk_label_new (NULL);
|
||||||
context = gtk_widget_get_style_context (w);
|
gtk_widget_add_style_class (w, GTK_STYLE_CLASS_SUBTITLE);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE);
|
|
||||||
gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
|
gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
|
||||||
gtk_label_set_wrap (GTK_LABEL (w), FALSE);
|
gtk_label_set_wrap (GTK_LABEL (w), FALSE);
|
||||||
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
|
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
|
||||||
@ -202,14 +199,12 @@ create_title_box (const char *title,
|
|||||||
GtkWidget *label_box;
|
GtkWidget *label_box;
|
||||||
GtkWidget *title_label;
|
GtkWidget *title_label;
|
||||||
GtkWidget *subtitle_label;
|
GtkWidget *subtitle_label;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
label_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
label_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_widget_set_valign (label_box, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (label_box, GTK_ALIGN_CENTER);
|
||||||
|
|
||||||
title_label = gtk_label_new (title);
|
title_label = gtk_label_new (title);
|
||||||
context = gtk_widget_get_style_context (title_label);
|
gtk_widget_add_style_class (title_label, GTK_STYLE_CLASS_TITLE);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE);
|
|
||||||
gtk_label_set_wrap (GTK_LABEL (title_label), FALSE);
|
gtk_label_set_wrap (GTK_LABEL (title_label), FALSE);
|
||||||
gtk_label_set_single_line_mode (GTK_LABEL (title_label), TRUE);
|
gtk_label_set_single_line_mode (GTK_LABEL (title_label), TRUE);
|
||||||
gtk_label_set_ellipsize (GTK_LABEL (title_label), PANGO_ELLIPSIZE_END);
|
gtk_label_set_ellipsize (GTK_LABEL (title_label), PANGO_ELLIPSIZE_END);
|
||||||
@ -217,8 +212,7 @@ create_title_box (const char *title,
|
|||||||
gtk_label_set_width_chars (GTK_LABEL (title_label), MIN_TITLE_CHARS);
|
gtk_label_set_width_chars (GTK_LABEL (title_label), MIN_TITLE_CHARS);
|
||||||
|
|
||||||
subtitle_label = gtk_label_new (subtitle);
|
subtitle_label = gtk_label_new (subtitle);
|
||||||
context = gtk_widget_get_style_context (subtitle_label);
|
gtk_widget_add_style_class (subtitle_label, GTK_STYLE_CLASS_SUBTITLE);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE);
|
|
||||||
gtk_label_set_wrap (GTK_LABEL (subtitle_label), FALSE);
|
gtk_label_set_wrap (GTK_LABEL (subtitle_label), FALSE);
|
||||||
gtk_label_set_single_line_mode (GTK_LABEL (subtitle_label), TRUE);
|
gtk_label_set_single_line_mode (GTK_LABEL (subtitle_label), TRUE);
|
||||||
gtk_label_set_ellipsize (GTK_LABEL (subtitle_label), PANGO_ELLIPSIZE_END);
|
gtk_label_set_ellipsize (GTK_LABEL (subtitle_label), PANGO_ELLIPSIZE_END);
|
||||||
@ -371,7 +365,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
t = g_strsplit (tokens[i], ",", -1);
|
t = g_strsplit (tokens[i], ",", -1);
|
||||||
|
|
||||||
separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (separator), "titlebutton");
|
gtk_widget_add_style_class (separator, "titlebutton");
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
|
||||||
@ -387,8 +381,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
button = gtk_image_new ();
|
button = gtk_image_new ();
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
priv->titlebar_icon = button;
|
priv->titlebar_icon = button;
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
|
gtk_widget_add_style_class (button, "titlebutton");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "icon");
|
gtk_widget_add_style_class (button, "icon");
|
||||||
gtk_widget_set_size_request (button, 20, 20);
|
gtk_widget_set_size_request (button, 20, 20);
|
||||||
|
|
||||||
if (!_gtk_header_bar_update_window_icon (bar, window))
|
if (!_gtk_header_bar_update_window_icon (bar, window))
|
||||||
@ -405,8 +399,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
button = gtk_menu_button_new ();
|
button = gtk_menu_button_new ();
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
|
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
|
gtk_widget_add_style_class (button, "titlebutton");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "menu");
|
gtk_widget_add_style_class (button, "menu");
|
||||||
image = gtk_image_new ();
|
image = gtk_image_new ();
|
||||||
gtk_menu_button_add_child (GTK_MENU_BUTTON (button), image);
|
gtk_menu_button_add_child (GTK_MENU_BUTTON (button), image);
|
||||||
gtk_widget_set_can_focus (button, FALSE);
|
gtk_widget_set_can_focus (button, FALSE);
|
||||||
@ -426,8 +420,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
{
|
{
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
|
gtk_widget_add_style_class (button, "titlebutton");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "minimize");
|
gtk_widget_add_style_class (button, "minimize");
|
||||||
image = gtk_image_new_from_icon_name ("window-minimize-symbolic");
|
image = gtk_image_new_from_icon_name ("window-minimize-symbolic");
|
||||||
g_object_set (image, "use-fallback", TRUE, NULL);
|
g_object_set (image, "use-fallback", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
@ -449,8 +443,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
icon_name = maximized ? "window-restore-symbolic" : "window-maximize-symbolic";
|
icon_name = maximized ? "window-restore-symbolic" : "window-maximize-symbolic";
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
|
gtk_widget_add_style_class (button, "titlebutton");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "maximize");
|
gtk_widget_add_style_class (button, "maximize");
|
||||||
image = gtk_image_new_from_icon_name (icon_name);
|
image = gtk_image_new_from_icon_name (icon_name);
|
||||||
g_object_set (image, "use-fallback", TRUE, NULL);
|
g_object_set (image, "use-fallback", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
@ -468,8 +462,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
image = gtk_image_new_from_icon_name ("window-close-symbolic");
|
image = gtk_image_new_from_icon_name ("window-close-symbolic");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
|
gtk_widget_add_style_class (button, "titlebutton");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "close");
|
gtk_widget_add_style_class (button, "close");
|
||||||
g_object_set (image, "use-fallback", TRUE, NULL);
|
g_object_set (image, "use-fallback", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
gtk_widget_set_can_focus (button, FALSE);
|
gtk_widget_set_can_focus (button, FALSE);
|
||||||
@ -503,9 +497,9 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
gtk_box_reorder_child_after (GTK_BOX (box), separator, NULL);
|
gtk_box_reorder_child_after (GTK_BOX (box), separator, NULL);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (box, GTK_STYLE_CLASS_LEFT);
|
||||||
else
|
else
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (box, GTK_STYLE_CLASS_RIGHT);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@ -540,7 +534,6 @@ update_default_decoration (GtkHeaderBar *bar)
|
|||||||
{
|
{
|
||||||
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
|
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
|
||||||
GtkLayoutManager *layout = gtk_widget_get_layout_manager (GTK_WIDGET (bar));
|
GtkLayoutManager *layout = gtk_widget_get_layout_manager (GTK_WIDGET (bar));
|
||||||
GtkStyleContext *context;
|
|
||||||
gboolean have_children = FALSE;
|
gboolean have_children = FALSE;
|
||||||
|
|
||||||
/* Check whether we have any child widgets that we didn't add ourselves */
|
/* Check whether we have any child widgets that we didn't add ourselves */
|
||||||
@ -576,12 +569,10 @@ update_default_decoration (GtkHeaderBar *bar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (bar));
|
|
||||||
|
|
||||||
if (have_children || priv->custom_title != NULL)
|
if (have_children || priv->custom_title != NULL)
|
||||||
gtk_style_context_remove_class (context, "default-decoration");
|
gtk_widget_remove_style_class (GTK_WIDGET (bar), "default-decoration");
|
||||||
else
|
else
|
||||||
gtk_style_context_add_class (context, "default-decoration");
|
gtk_widget_add_style_class (GTK_WIDGET (bar), "default-decoration");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1242,11 +1233,11 @@ gtk_header_bar_init (GtkHeaderBar *bar)
|
|||||||
|
|
||||||
layout = gtk_widget_get_layout_manager (GTK_WIDGET (bar));
|
layout = gtk_widget_get_layout_manager (GTK_WIDGET (bar));
|
||||||
priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->start_box), "start");
|
gtk_widget_add_style_class (priv->start_box, "start");
|
||||||
gtk_widget_set_parent (priv->start_box, GTK_WIDGET (bar));
|
gtk_widget_set_parent (priv->start_box, GTK_WIDGET (bar));
|
||||||
gtk_center_layout_set_start_widget (GTK_CENTER_LAYOUT (layout), priv->start_box);
|
gtk_center_layout_set_start_widget (GTK_CENTER_LAYOUT (layout), priv->start_box);
|
||||||
priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->end_box), "end");
|
gtk_widget_add_style_class (priv->end_box, "end");
|
||||||
gtk_widget_set_parent (priv->end_box, GTK_WIDGET (bar));
|
gtk_widget_set_parent (priv->end_box, GTK_WIDGET (bar));
|
||||||
gtk_center_layout_set_end_widget (GTK_CENTER_LAYOUT (layout), priv->end_box);
|
gtk_center_layout_set_end_widget (GTK_CENTER_LAYOUT (layout), priv->end_box);
|
||||||
|
|
||||||
|
@ -956,8 +956,7 @@ gtk_icon_view_init (GtkIconView *icon_view)
|
|||||||
icon_view->priv->row_contexts =
|
icon_view->priv->row_contexts =
|
||||||
g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
|
g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (icon_view)),
|
gtk_widget_add_style_class (GTK_WIDGET (icon_view), GTK_STYLE_CLASS_VIEW);
|
||||||
GTK_STYLE_CLASS_VIEW);
|
|
||||||
|
|
||||||
gesture = gtk_gesture_click_new ();
|
gesture = gtk_gesture_click_new ();
|
||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_icon_view_button_press),
|
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_icon_view_button_press),
|
||||||
|
@ -531,7 +531,7 @@ gtk_info_bar_init (GtkInfoBar *info_bar)
|
|||||||
priv->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
|
priv->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
|
||||||
gtk_widget_hide (priv->close_button);
|
gtk_widget_hide (priv->close_button);
|
||||||
gtk_widget_set_valign (priv->close_button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (priv->close_button, GTK_ALIGN_CENTER);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->close_button), "close");
|
gtk_widget_add_style_class (priv->close_button, "close");
|
||||||
gtk_container_add (GTK_CONTAINER (main_box), priv->close_button);
|
gtk_container_add (GTK_CONTAINER (main_box), priv->close_button);
|
||||||
g_signal_connect (priv->close_button, "clicked",
|
g_signal_connect (priv->close_button, "clicked",
|
||||||
G_CALLBACK (close_button_clicked_cb), info_bar);
|
G_CALLBACK (close_button_clicked_cb), info_bar);
|
||||||
@ -802,9 +802,9 @@ update_default_response (GtkInfoBar *info_bar,
|
|||||||
priv->default_response_sensitive = sensitive;
|
priv->default_response_sensitive = sensitive;
|
||||||
|
|
||||||
if (response_id && sensitive)
|
if (response_id && sensitive)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (info_bar)), "action");
|
gtk_widget_add_style_class (GTK_WIDGET (info_bar), "action");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (info_bar)), "action");
|
gtk_widget_remove_style_class (GTK_WIDGET (info_bar), "action");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1152,7 +1152,6 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
|
|||||||
|
|
||||||
if (priv->message_type != message_type)
|
if (priv->message_type != message_type)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
AtkObject *atk_obj;
|
AtkObject *atk_obj;
|
||||||
const char *type_class[] = {
|
const char *type_class[] = {
|
||||||
GTK_STYLE_CLASS_INFO,
|
GTK_STYLE_CLASS_INFO,
|
||||||
@ -1162,10 +1161,8 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (info_bar));
|
|
||||||
|
|
||||||
if (type_class[priv->message_type])
|
if (type_class[priv->message_type])
|
||||||
gtk_style_context_remove_class (context, type_class[priv->message_type]);
|
gtk_widget_remove_style_class (GTK_WIDGET (info_bar), type_class[priv->message_type]);
|
||||||
|
|
||||||
priv->message_type = message_type;
|
priv->message_type = message_type;
|
||||||
|
|
||||||
@ -1209,7 +1206,7 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type_class[priv->message_type])
|
if (type_class[priv->message_type])
|
||||||
gtk_style_context_add_class (context, type_class[priv->message_type]);
|
gtk_widget_add_style_class (GTK_WIDGET (info_bar), type_class[priv->message_type]);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (info_bar), props[PROP_MESSAGE_TYPE]);
|
g_object_notify_by_pspec (G_OBJECT (info_bar), props[PROP_MESSAGE_TYPE]);
|
||||||
}
|
}
|
||||||
|
@ -3315,7 +3315,6 @@ gtk_label_update_layout_attributes (GtkLabel *label)
|
|||||||
if (priv->layout == NULL)
|
if (priv->layout == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
|
||||||
|
|
||||||
if (priv->select_info && priv->select_info->links)
|
if (priv->select_info && priv->select_info->links)
|
||||||
{
|
{
|
||||||
@ -3323,6 +3322,7 @@ gtk_label_update_layout_attributes (GtkLabel *label)
|
|||||||
PangoAttribute *attribute;
|
PangoAttribute *attribute;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
attrs = pango_attr_list_new ();
|
attrs = pango_attr_list_new ();
|
||||||
|
|
||||||
for (list = priv->select_info->links; list; list = list->next)
|
for (list = priv->select_info->links; list; list = list->next)
|
||||||
@ -3351,9 +3351,16 @@ gtk_label_update_layout_attributes (GtkLabel *label)
|
|||||||
else
|
else
|
||||||
attrs = NULL;
|
attrs = NULL;
|
||||||
|
|
||||||
style_attrs = _gtk_style_context_get_pango_attributes (context);
|
if ((context = _gtk_widget_peek_style_context (widget)))
|
||||||
|
{
|
||||||
|
style_attrs = _gtk_style_context_get_pango_attributes (context);
|
||||||
|
|
||||||
|
attrs = _gtk_pango_attr_list_merge (attrs, style_attrs);
|
||||||
|
|
||||||
|
if (style_attrs)
|
||||||
|
pango_attr_list_unref (style_attrs);
|
||||||
|
}
|
||||||
|
|
||||||
attrs = _gtk_pango_attr_list_merge (attrs, style_attrs);
|
|
||||||
attrs = _gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
|
attrs = _gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
|
||||||
attrs = _gtk_pango_attr_list_merge (attrs, priv->attrs);
|
attrs = _gtk_pango_attr_list_merge (attrs, priv->attrs);
|
||||||
|
|
||||||
@ -3361,8 +3368,6 @@ gtk_label_update_layout_attributes (GtkLabel *label)
|
|||||||
|
|
||||||
if (attrs)
|
if (attrs)
|
||||||
pango_attr_list_unref (attrs);
|
pango_attr_list_unref (attrs);
|
||||||
if (style_attrs)
|
|
||||||
pango_attr_list_unref (style_attrs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -632,30 +632,21 @@ update_level_style_classes (GtkLevelBar *self)
|
|||||||
|
|
||||||
for (i = 0; i < num_filled; i++)
|
for (i = 0; i < num_filled; i++)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
|
GtkCssNode *node = gtk_widget_get_css_node (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
|
||||||
GList *classes = gtk_style_context_list_classes (context);
|
|
||||||
|
|
||||||
for (l = classes; l; l = l->next)
|
gtk_css_node_set_classes (node, NULL);
|
||||||
gtk_style_context_remove_class (context, l->data);
|
gtk_css_node_add_class (node, g_quark_from_static_string ("filled"));
|
||||||
|
|
||||||
g_list_free (classes);
|
|
||||||
|
|
||||||
gtk_style_context_add_class (context, "filled");
|
|
||||||
if (value_class)
|
if (value_class)
|
||||||
gtk_style_context_add_class (context, value_class);
|
gtk_css_node_add_class (node, g_quark_from_string (value_class));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < num_blocks; i++)
|
for (; i < num_blocks; i++)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
|
GtkCssNode *node = gtk_widget_get_css_node (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
|
||||||
GList *classes = gtk_style_context_list_classes (context);
|
|
||||||
|
|
||||||
for (l = classes; l; l = l->next)
|
gtk_css_node_set_classes (node, NULL);
|
||||||
gtk_style_context_remove_class (context, l->data);
|
gtk_css_node_add_class (node, g_quark_from_static_string ("empty"));
|
||||||
|
|
||||||
g_list_free (classes);
|
|
||||||
|
|
||||||
gtk_style_context_add_class (context, "empty");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +320,6 @@ gtk_link_content_init (GtkLinkContent *content)
|
|||||||
static void
|
static void
|
||||||
gtk_link_button_init (GtkLinkButton *link_button)
|
gtk_link_button_init (GtkLinkButton *link_button)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
GdkContentProvider *content;
|
GdkContentProvider *content;
|
||||||
GtkDragSource *source;
|
GtkDragSource *source;
|
||||||
@ -347,8 +346,7 @@ gtk_link_button_init (GtkLinkButton *link_button)
|
|||||||
link_button);
|
link_button);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (link_button), GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (GTK_WIDGET (link_button), GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (link_button));
|
gtk_widget_add_style_class (GTK_WIDGET (link_button), "link");
|
||||||
gtk_style_context_add_class (context, "link");
|
|
||||||
|
|
||||||
gtk_widget_set_cursor_from_name (GTK_WIDGET (link_button), "pointer");
|
gtk_widget_set_cursor_from_name (GTK_WIDGET (link_button), "pointer");
|
||||||
}
|
}
|
||||||
|
@ -3157,7 +3157,6 @@ static void
|
|||||||
gtk_list_box_update_row_style (GtkListBox *box,
|
gtk_list_box_update_row_style (GtkListBox *box,
|
||||||
GtkListBoxRow *row)
|
GtkListBoxRow *row)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
gboolean can_select;
|
gboolean can_select;
|
||||||
|
|
||||||
if (box && BOX_PRIV (box)->selection_mode != GTK_SELECTION_NONE)
|
if (box && BOX_PRIV (box)->selection_mode != GTK_SELECTION_NONE)
|
||||||
@ -3165,12 +3164,11 @@ gtk_list_box_update_row_style (GtkListBox *box,
|
|||||||
else
|
else
|
||||||
can_select = FALSE;
|
can_select = FALSE;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (row));
|
|
||||||
if (ROW_PRIV (row)->activatable ||
|
if (ROW_PRIV (row)->activatable ||
|
||||||
(ROW_PRIV (row)->selectable && can_select))
|
(ROW_PRIV (row)->selectable && can_select))
|
||||||
gtk_style_context_add_class (context, "activatable");
|
gtk_widget_add_style_class (GTK_WIDGET (row), "activatable");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "activatable");
|
gtk_widget_remove_style_class (GTK_WIDGET (row), "activatable");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3496,8 +3494,7 @@ gtk_list_box_row_init (GtkListBoxRow *row)
|
|||||||
ROW_PRIV (row)->activatable = TRUE;
|
ROW_PRIV (row)->activatable = TRUE;
|
||||||
ROW_PRIV (row)->selectable = TRUE;
|
ROW_PRIV (row)->selectable = TRUE;
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (row)),
|
gtk_widget_add_style_class (GTK_WIDGET (row), "activatable");
|
||||||
"activatable");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3669,9 +3666,9 @@ gtk_list_box_set_show_separators (GtkListBox *box,
|
|||||||
priv->show_separators = show_separators;
|
priv->show_separators = show_separators;
|
||||||
|
|
||||||
if (show_separators)
|
if (show_separators)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box)), "separators");
|
gtk_widget_add_style_class (GTK_WIDGET (box), "separators");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (box)), "separators");
|
gtk_widget_remove_style_class (GTK_WIDGET (box), "separators");
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_SHOW_SEPARATORS]);
|
g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_SHOW_SEPARATORS]);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,6 @@ gtk_lock_button_init (GtkLockButton *button)
|
|||||||
{
|
{
|
||||||
GtkLockButtonPrivate *priv = gtk_lock_button_get_instance_private (button);
|
GtkLockButtonPrivate *priv = gtk_lock_button_get_instance_private (button);
|
||||||
const char *names[3];
|
const char *names[3];
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (button));
|
gtk_widget_init_template (GTK_WIDGET (button));
|
||||||
|
|
||||||
@ -257,8 +256,7 @@ gtk_lock_button_init (GtkLockButton *button)
|
|||||||
|
|
||||||
update_state (button);
|
update_state (button);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
gtk_widget_add_style_class (GTK_WIDGET (button), I_("lock"));
|
||||||
gtk_style_context_add_class (context, I_("lock"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -471,7 +471,6 @@ static void
|
|||||||
gtk_menu_button_init (GtkMenuButton *menu_button)
|
gtk_menu_button_init (GtkMenuButton *menu_button)
|
||||||
{
|
{
|
||||||
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
|
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
priv->arrow_type = GTK_ARROW_DOWN;
|
priv->arrow_type = GTK_ARROW_DOWN;
|
||||||
|
|
||||||
@ -482,8 +481,7 @@ gtk_menu_button_init (GtkMenuButton *menu_button)
|
|||||||
|
|
||||||
gtk_widget_set_sensitive (priv->button, FALSE);
|
gtk_widget_set_sensitive (priv->button, FALSE);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (menu_button));
|
gtk_widget_add_style_class (GTK_WIDGET (menu_button), "popup");
|
||||||
gtk_style_context_add_class (context, "popup");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,13 +350,13 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
|
|||||||
{
|
{
|
||||||
g_object_bind_property (item, "verb-icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
g_object_bind_property (item, "verb-icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
||||||
g_object_set (widget, "iconic", TRUE, NULL);
|
g_object_set (widget, "iconic", TRUE, NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "flat");
|
gtk_widget_add_style_class (widget, "flat");
|
||||||
}
|
}
|
||||||
else if (box->circular)
|
else if (box->circular)
|
||||||
{
|
{
|
||||||
g_object_bind_property (item, "verb-icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
g_object_bind_property (item, "verb-icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
||||||
g_object_set (widget, "iconic", TRUE, NULL);
|
g_object_set (widget, "iconic", TRUE, NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "circular");
|
gtk_widget_add_style_class (widget, "circular");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
||||||
@ -556,8 +556,8 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
{
|
{
|
||||||
gtk_box_set_homogeneous (box->item_box, TRUE);
|
gtk_box_set_homogeneous (box->item_box, TRUE);
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)), GTK_STYLE_CLASS_LINKED);
|
gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "linked");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)), "horizontal-buttons");
|
gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "horizontal-buttons");
|
||||||
box->iconic = TRUE;
|
box->iconic = TRUE;
|
||||||
|
|
||||||
if (text_direction)
|
if (text_direction)
|
||||||
@ -580,7 +580,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
box->inline_buttons = TRUE;
|
box->inline_buttons = TRUE;
|
||||||
|
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)), "inline-buttons");
|
gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "inline-buttons");
|
||||||
|
|
||||||
spacer = gtk_builtin_icon_new ("none");
|
spacer = gtk_builtin_icon_new ("none");
|
||||||
gtk_container_add (GTK_CONTAINER (box->item_box), spacer);
|
gtk_container_add (GTK_CONTAINER (box->item_box), spacer);
|
||||||
@ -605,7 +605,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
{
|
{
|
||||||
gtk_box_set_homogeneous (box->item_box, TRUE);
|
gtk_box_set_homogeneous (box->item_box, TRUE);
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)), "circular-buttons");
|
gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "circular-buttons");
|
||||||
box->circular = TRUE;
|
box->circular = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
|
|
||||||
title = gtk_label_new (label);
|
title = gtk_label_new (label);
|
||||||
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
|
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (title), GTK_STYLE_CLASS_SEPARATOR);
|
gtk_widget_add_style_class (title, GTK_STYLE_CLASS_SEPARATOR);
|
||||||
gtk_widget_set_halign (title, GTK_ALIGN_START);
|
gtk_widget_set_halign (title, GTK_ALIGN_START);
|
||||||
gtk_container_add (GTK_CONTAINER (box->separator), title);
|
gtk_container_add (GTK_CONTAINER (box->separator), title);
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ gtk_message_dialog_constructed (GObject *object)
|
|||||||
gtk_widget_set_margin_bottom (label, 6);
|
gtk_widget_set_margin_bottom (label, 6);
|
||||||
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_hexpand (label, TRUE);
|
gtk_widget_set_hexpand (label, TRUE);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "title");
|
gtk_widget_add_style_class (label, "title");
|
||||||
gtk_container_add (GTK_CONTAINER (box), label);
|
gtk_container_add (GTK_CONTAINER (box), label);
|
||||||
g_signal_connect_object (dialog, "notify::title", G_CALLBACK (update_title), label, 0);
|
g_signal_connect_object (dialog, "notify::title", G_CALLBACK (update_title), label, 0);
|
||||||
|
|
||||||
|
@ -287,28 +287,20 @@ gtk_model_button_actionable_iface_init (GtkActionableInterface *iface)
|
|||||||
static void
|
static void
|
||||||
update_node_ordering (GtkModelButton *button)
|
update_node_ordering (GtkModelButton *button)
|
||||||
{
|
{
|
||||||
GtkStyleContext *start_indicator_context = NULL;
|
|
||||||
GtkStyleContext *end_indicator_context = NULL;
|
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
if (button->start_indicator)
|
|
||||||
start_indicator_context = gtk_widget_get_style_context (button->start_indicator);
|
|
||||||
|
|
||||||
if (button->end_indicator)
|
|
||||||
end_indicator_context = gtk_widget_get_style_context (button->end_indicator);
|
|
||||||
|
|
||||||
if (gtk_widget_get_direction (GTK_WIDGET (button)) == GTK_TEXT_DIR_LTR)
|
if (gtk_widget_get_direction (GTK_WIDGET (button)) == GTK_TEXT_DIR_LTR)
|
||||||
{
|
{
|
||||||
if (start_indicator_context)
|
if (button->start_indicator)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (start_indicator_context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (button->start_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
gtk_style_context_remove_class (start_indicator_context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (button->start_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end_indicator_context)
|
if (button->end_indicator)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (end_indicator_context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (button->end_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
gtk_style_context_remove_class (end_indicator_context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (button->end_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
child = gtk_widget_get_first_child (GTK_WIDGET (button));
|
child = gtk_widget_get_first_child (GTK_WIDGET (button));
|
||||||
@ -321,16 +313,17 @@ update_node_ordering (GtkModelButton *button)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (start_indicator_context)
|
if (button->start_indicator)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (start_indicator_context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (button->start_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
gtk_style_context_remove_class (start_indicator_context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (button->start_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end_indicator_context)
|
if (button->end_indicator)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (end_indicator_context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (button->end_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
gtk_style_context_remove_class (end_indicator_context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (button->end_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
child = gtk_widget_get_first_child (GTK_WIDGET (button));
|
child = gtk_widget_get_first_child (GTK_WIDGET (button));
|
||||||
@ -347,22 +340,19 @@ static void
|
|||||||
update_end_indicator (GtkModelButton *self)
|
update_end_indicator (GtkModelButton *self)
|
||||||
{
|
{
|
||||||
const gboolean is_ltr = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR;
|
const gboolean is_ltr = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (!self->end_indicator)
|
if (!self->end_indicator)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (self->end_indicator);
|
|
||||||
|
|
||||||
if (is_ltr)
|
if (is_ltr)
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (self->end_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (self->end_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (self->end_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (self->end_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,25 +377,23 @@ static void
|
|||||||
update_start_indicator (GtkModelButton *self)
|
update_start_indicator (GtkModelButton *self)
|
||||||
{
|
{
|
||||||
const gboolean is_ltr = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR;
|
const gboolean is_ltr = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (!self->start_indicator)
|
if (!self->start_indicator)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_set_state_flags (self->start_indicator, get_start_indicator_state (self), TRUE);
|
gtk_widget_set_state_flags (self->start_indicator, get_start_indicator_state (self), TRUE);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (self->start_indicator);
|
|
||||||
|
|
||||||
if (is_ltr)
|
if (is_ltr)
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (self->start_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (self->start_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (self->start_indicator, GTK_STYLE_CLASS_RIGHT);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (self->start_indicator, GTK_STYLE_CLASS_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -548,12 +536,12 @@ gtk_model_button_set_role (GtkModelButton *self,
|
|||||||
|
|
||||||
if (role == GTK_BUTTON_ROLE_TITLE)
|
if (role == GTK_BUTTON_ROLE_TITLE)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "title");
|
gtk_widget_add_style_class (GTK_WIDGET (self), "title");
|
||||||
gtk_widget_set_halign (self->label, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (self->label, GTK_ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "title");
|
gtk_widget_remove_style_class (GTK_WIDGET (self), "title");
|
||||||
gtk_widget_set_halign (self->label, GTK_ALIGN_START);
|
gtk_widget_set_halign (self->label, GTK_ALIGN_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,8 +649,8 @@ static void
|
|||||||
gtk_model_button_set_iconic (GtkModelButton *self,
|
gtk_model_button_set_iconic (GtkModelButton *self,
|
||||||
gboolean iconic)
|
gboolean iconic)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET (self);
|
||||||
GtkCssNode *widget_node;
|
GtkCssNode *widget_node;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
iconic = !!iconic;
|
iconic = !!iconic;
|
||||||
if (self->iconic == iconic)
|
if (self->iconic == iconic)
|
||||||
@ -670,23 +658,22 @@ gtk_model_button_set_iconic (GtkModelButton *self,
|
|||||||
|
|
||||||
self->iconic = iconic;
|
self->iconic = iconic;
|
||||||
|
|
||||||
widget_node = gtk_widget_get_css_node (GTK_WIDGET (self));
|
widget_node = gtk_widget_get_css_node (widget);
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
|
||||||
if (iconic)
|
if (iconic)
|
||||||
{
|
{
|
||||||
gtk_widget_hide (self->start_box);
|
gtk_widget_hide (self->start_box);
|
||||||
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("button"));
|
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("button"));
|
||||||
gtk_style_context_add_class (context, "model");
|
gtk_widget_add_style_class (widget, "model");
|
||||||
gtk_style_context_add_class (context, "image-button");
|
gtk_widget_add_style_class (widget, "image-button");
|
||||||
gtk_style_context_remove_class (context, "flat");
|
gtk_widget_remove_style_class (widget, "flat");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_show (self->start_box);
|
gtk_widget_show (self->start_box);
|
||||||
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("modelbutton"));
|
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("modelbutton"));
|
||||||
gtk_style_context_remove_class (context, "model");
|
gtk_widget_remove_style_class (widget, "model");
|
||||||
gtk_style_context_remove_class (context, "image-button");
|
gtk_widget_remove_style_class (widget, "image-button");
|
||||||
gtk_style_context_add_class (context, "flat");
|
gtk_widget_add_style_class (widget, "flat");
|
||||||
}
|
}
|
||||||
|
|
||||||
self->centered = iconic;
|
self->centered = iconic;
|
||||||
@ -1397,7 +1384,7 @@ gtk_model_button_init (GtkModelButton *self)
|
|||||||
gtk_widget_insert_after (self->start_box, GTK_WIDGET (self), NULL);
|
gtk_widget_insert_after (self->start_box, GTK_WIDGET (self), NULL);
|
||||||
update_node_ordering (self);
|
update_node_ordering (self);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "flat");
|
gtk_widget_add_style_class (GTK_WIDGET (self), "flat");
|
||||||
|
|
||||||
controller = gtk_event_controller_motion_new ();
|
controller = gtk_event_controller_motion_new ();
|
||||||
g_signal_connect (controller, "enter", G_CALLBACK (enter_cb), self);
|
g_signal_connect (controller, "enter", G_CALLBACK (enter_cb), self);
|
||||||
|
@ -1331,8 +1331,7 @@ gtk_notebook_init (GtkNotebook *notebook)
|
|||||||
priv->header_widget = g_object_new (GTK_TYPE_BOX,
|
priv->header_widget = g_object_new (GTK_TYPE_BOX,
|
||||||
"css-name", "header",
|
"css-name", "header",
|
||||||
NULL);
|
NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->header_widget),
|
gtk_widget_add_style_class (priv->header_widget, GTK_STYLE_CLASS_TOP);
|
||||||
GTK_STYLE_CLASS_TOP);
|
|
||||||
gtk_widget_hide (priv->header_widget);
|
gtk_widget_hide (priv->header_widget);
|
||||||
gtk_widget_set_parent (priv->header_widget, GTK_WIDGET (notebook));
|
gtk_widget_set_parent (priv->header_widget, GTK_WIDGET (notebook));
|
||||||
|
|
||||||
@ -1368,8 +1367,7 @@ gtk_notebook_init (GtkNotebook *notebook)
|
|||||||
g_signal_connect (controller, "motion", G_CALLBACK (gtk_notebook_motion), notebook);
|
g_signal_connect (controller, "motion", G_CALLBACK (gtk_notebook_motion), notebook);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (notebook), controller);
|
gtk_widget_add_controller (GTK_WIDGET (notebook), controller);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (notebook)),
|
gtk_widget_add_style_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
|
||||||
GTK_STYLE_CLASS_FRAME);
|
|
||||||
|
|
||||||
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
|
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_VERTICAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_VERTICAL);
|
||||||
@ -2637,7 +2635,7 @@ static void
|
|||||||
tab_drag_begin (GtkNotebook *notebook,
|
tab_drag_begin (GtkNotebook *notebook,
|
||||||
GtkNotebookPage *page)
|
GtkNotebookPage *page)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_widget), GTK_STYLE_CLASS_DND);
|
gtk_widget_add_style_class (page->tab_widget, GTK_STYLE_CLASS_DND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function undoes the reparenting that happens both when drag_surface
|
/* This function undoes the reparenting that happens both when drag_surface
|
||||||
@ -2655,7 +2653,7 @@ tab_drag_end (GtkNotebook *notebook,
|
|||||||
g_object_unref (page->tab_label);
|
g_object_unref (page->tab_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (page->tab_widget), GTK_STYLE_CLASS_DND);
|
gtk_widget_remove_style_class (page->tab_widget, GTK_STYLE_CLASS_DND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3042,7 +3040,6 @@ update_arrow_nodes (GtkNotebook *notebook)
|
|||||||
if (priv->arrow_widget[i] == NULL)
|
if (priv->arrow_widget[i] == NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *next_widget;
|
GtkWidget *next_widget;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
@ -3087,16 +3084,14 @@ update_arrow_nodes (GtkNotebook *notebook)
|
|||||||
"css-name", "arrow",
|
"css-name", "arrow",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->arrow_widget[i]);
|
|
||||||
|
|
||||||
if (i == ARROW_LEFT_BEFORE || i == ARROW_LEFT_AFTER)
|
if (i == ARROW_LEFT_BEFORE || i == ARROW_LEFT_AFTER)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, "down");
|
gtk_widget_add_style_class (priv->arrow_widget[i], "down");
|
||||||
gtk_widget_insert_after (priv->arrow_widget[i], priv->tabs_widget, next_widget);
|
gtk_widget_insert_after (priv->arrow_widget[i], priv->tabs_widget, next_widget);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, "up");
|
gtk_widget_add_style_class (priv->arrow_widget[i], "up");
|
||||||
gtk_widget_insert_before (priv->arrow_widget[i], priv->tabs_widget, next_widget);
|
gtk_widget_insert_before (priv->arrow_widget[i], priv->tabs_widget, next_widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6142,13 +6137,12 @@ gtk_notebook_set_show_border (GtkNotebook *notebook,
|
|||||||
|
|
||||||
if (priv->show_border != show_border)
|
if (priv->show_border != show_border)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (notebook));
|
|
||||||
priv->show_border = show_border;
|
priv->show_border = show_border;
|
||||||
|
|
||||||
if (show_border)
|
if (show_border)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
|
gtk_widget_add_style_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
|
gtk_widget_remove_style_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_SHOW_BORDER]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_SHOW_BORDER]);
|
||||||
}
|
}
|
||||||
@ -6273,11 +6267,9 @@ gtk_notebook_update_tab_pos (GtkNotebook *notebook)
|
|||||||
for (i = 0; i < G_N_ELEMENTS (tab_pos_names); i++)
|
for (i = 0; i < G_N_ELEMENTS (tab_pos_names); i++)
|
||||||
{
|
{
|
||||||
if (tab_pos == i)
|
if (tab_pos == i)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->header_widget),
|
gtk_widget_add_style_class (priv->header_widget, tab_pos_names[i]);
|
||||||
tab_pos_names[i]);
|
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->header_widget),
|
gtk_widget_remove_style_class (priv->header_widget, tab_pos_names[i]);
|
||||||
tab_pos_names[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
|
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
|
||||||
@ -7037,11 +7029,10 @@ gtk_notebook_set_tab_reorderable (GtkNotebook *notebook,
|
|||||||
{
|
{
|
||||||
page->reorderable = reorderable;
|
page->reorderable = reorderable;
|
||||||
if (reorderable)
|
if (reorderable)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_widget),
|
gtk_widget_add_style_class (page->tab_widget, "reorderable-page");
|
||||||
"reorderable-page");
|
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (page->tab_widget),
|
gtk_widget_remove_style_class (page->tab_widget, "reorderable-page");
|
||||||
"reorderable-page");
|
|
||||||
g_object_notify (G_OBJECT (page), "reorderable");
|
g_object_notify (G_OBJECT (page), "reorderable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,23 +110,21 @@ gtk_orientable_get_orientation (GtkOrientable *orientable)
|
|||||||
void
|
void
|
||||||
_gtk_orientable_set_style_classes (GtkOrientable *orientable)
|
_gtk_orientable_set_style_classes (GtkOrientable *orientable)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkOrientation orientation;
|
GtkOrientation orientation;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
|
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
|
||||||
g_return_if_fail (GTK_IS_WIDGET (orientable));
|
g_return_if_fail (GTK_IS_WIDGET (orientable));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
|
|
||||||
orientation = gtk_orientable_get_orientation (orientable);
|
orientation = gtk_orientable_get_orientation (orientable);
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
gtk_widget_add_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_HORIZONTAL);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
|
gtk_widget_remove_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_VERTICAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
|
gtk_widget_add_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_VERTICAL);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
gtk_widget_remove_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_HORIZONTAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,22 +319,21 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
|
|||||||
GtkWidget *child,
|
GtkWidget *child,
|
||||||
GtkAllocation *child_allocation)
|
GtkAllocation *child_allocation)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET (overlay);
|
||||||
int width, height;
|
int width, height;
|
||||||
GtkAlign valign, halign;
|
GtkAlign valign, halign;
|
||||||
gboolean is_left, is_right, is_top, is_bottom;
|
gboolean is_left, is_right, is_top, is_bottom;
|
||||||
gboolean has_left, has_right, has_top, has_bottom;
|
gboolean has_left, has_right, has_top, has_bottom;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (child);
|
has_left = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_LEFT);
|
||||||
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
|
has_right = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_RIGHT);
|
||||||
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
|
has_top = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_TOP);
|
||||||
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
|
has_bottom = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
|
|
||||||
|
|
||||||
is_left = is_right = is_top = is_bottom = FALSE;
|
is_left = is_right = is_top = is_bottom = FALSE;
|
||||||
|
|
||||||
width = gtk_widget_get_width (GTK_WIDGET (overlay));
|
width = gtk_widget_get_width (widget);
|
||||||
height = gtk_widget_get_height (GTK_WIDGET (overlay));
|
height = gtk_widget_get_height (widget);
|
||||||
|
|
||||||
halign = effective_align (gtk_widget_get_halign (child),
|
halign = effective_align (gtk_widget_get_halign (child),
|
||||||
gtk_widget_get_direction (child));
|
gtk_widget_get_direction (child));
|
||||||
@ -352,24 +351,24 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
|
|||||||
is_bottom = (child_allocation->y + child_allocation->height == height);
|
is_bottom = (child_allocation->y + child_allocation->height == height);
|
||||||
|
|
||||||
if (has_left && !is_left)
|
if (has_left && !is_left)
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_LEFT);
|
||||||
else if (!has_left && is_left)
|
else if (!has_left && is_left)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_LEFT);
|
||||||
|
|
||||||
if (has_right && !is_right)
|
if (has_right && !is_right)
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_RIGHT);
|
||||||
else if (!has_right && is_right)
|
else if (!has_right && is_right)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_RIGHT);
|
||||||
|
|
||||||
if (has_top && !is_top)
|
if (has_top && !is_top)
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_TOP);
|
||||||
else if (!has_top && is_top)
|
else if (!has_top && is_top)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_TOP);
|
||||||
|
|
||||||
if (has_bottom && !is_bottom)
|
if (has_bottom && !is_bottom)
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
else if (!has_bottom && is_bottom)
|
else if (!has_bottom && is_bottom)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2417,11 +2417,9 @@ gtk_paned_set_wide_handle (GtkPaned *paned,
|
|||||||
if (old_wide != wide)
|
if (old_wide != wide)
|
||||||
{
|
{
|
||||||
if (wide)
|
if (wide)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->handle_widget),
|
gtk_widget_add_style_class (priv->handle_widget, GTK_STYLE_CLASS_WIDE);
|
||||||
GTK_STYLE_CLASS_WIDE);
|
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->handle_widget),
|
gtk_widget_remove_style_class (priv->handle_widget, GTK_STYLE_CLASS_WIDE);
|
||||||
GTK_STYLE_CLASS_WIDE);
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (paned), paned_props[PROP_WIDE_HANDLE]);
|
g_object_notify_by_pspec (G_OBJECT (paned), paned_props[PROP_WIDE_HANDLE]);
|
||||||
}
|
}
|
||||||
@ -2442,6 +2440,5 @@ gtk_paned_get_wide_handle (GtkPaned *paned)
|
|||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_PANED (paned), FALSE);
|
g_return_val_if_fail (GTK_IS_PANED (paned), FALSE);
|
||||||
|
|
||||||
return gtk_style_context_has_class (gtk_widget_get_style_context (priv->handle_widget),
|
return gtk_widget_has_style_class (priv->handle_widget, GTK_STYLE_CLASS_WIDE);
|
||||||
GTK_STYLE_CLASS_WIDE);
|
|
||||||
}
|
}
|
||||||
|
@ -149,11 +149,11 @@ gtk_password_entry_init (GtkPasswordEntry *entry)
|
|||||||
|
|
||||||
priv->icon = gtk_image_new_from_icon_name ("caps-lock-symbolic");
|
priv->icon = gtk_image_new_from_icon_name ("caps-lock-symbolic");
|
||||||
gtk_widget_set_tooltip_text (priv->icon, _("Caps Lock is on"));
|
gtk_widget_set_tooltip_text (priv->icon, _("Caps Lock is on"));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->icon), "caps-lock-indicator");
|
gtk_widget_add_style_class (priv->icon, "caps-lock-indicator");
|
||||||
gtk_widget_set_cursor (priv->icon, gtk_widget_get_cursor (priv->entry));
|
gtk_widget_set_cursor (priv->icon, gtk_widget_get_cursor (priv->entry));
|
||||||
gtk_widget_set_parent (priv->icon, GTK_WIDGET (entry));
|
gtk_widget_set_parent (priv->icon, GTK_WIDGET (entry));
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (entry)), I_("password"));
|
gtk_widget_add_style_class (GTK_WIDGET (entry), I_("password"));
|
||||||
|
|
||||||
gtk_password_entry_set_extra_menu (entry, NULL);
|
gtk_password_entry_set_extra_menu (entry, NULL);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,6 @@ static void
|
|||||||
gtk_path_bar_init (GtkPathBar *path_bar)
|
gtk_path_bar_init (GtkPathBar *path_bar)
|
||||||
{
|
{
|
||||||
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
|
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
|
|
||||||
priv = gtk_path_bar_get_instance_private (path_bar);
|
priv = gtk_path_bar_get_instance_private (path_bar);
|
||||||
@ -233,8 +232,7 @@ gtk_path_bar_init (GtkPathBar *path_bar)
|
|||||||
g_signal_connect_swapped (priv->down_slider_button, "clicked",
|
g_signal_connect_swapped (priv->down_slider_button, "clicked",
|
||||||
G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
|
G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (path_bar));
|
gtk_widget_add_style_class (GTK_WIDGET (path_bar), GTK_STYLE_CLASS_LINKED);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
|
|
||||||
|
|
||||||
priv->get_info_cancellable = NULL;
|
priv->get_info_cancellable = NULL;
|
||||||
priv->cancellables = NULL;
|
priv->cancellables = NULL;
|
||||||
@ -1143,25 +1141,22 @@ gtk_path_bar_update_button_appearance (GtkPathBar *path_bar,
|
|||||||
gboolean current_dir)
|
gboolean current_dir)
|
||||||
{
|
{
|
||||||
const gchar *dir_name = get_dir_name (button_data);
|
const gchar *dir_name = get_dir_name (button_data);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (button_data->button);
|
gtk_widget_remove_style_class (button_data->button, "text-button");
|
||||||
|
gtk_widget_remove_style_class (button_data->button, "image-button");
|
||||||
gtk_style_context_remove_class (context, "text-button");
|
|
||||||
gtk_style_context_remove_class (context, "image-button");
|
|
||||||
|
|
||||||
if (button_data->label != NULL)
|
if (button_data->label != NULL)
|
||||||
{
|
{
|
||||||
gtk_label_set_text (GTK_LABEL (button_data->label), dir_name);
|
gtk_label_set_text (GTK_LABEL (button_data->label), dir_name);
|
||||||
if (button_data->image == NULL)
|
if (button_data->image == NULL)
|
||||||
gtk_style_context_add_class (context, "text-button");
|
gtk_widget_add_style_class (button_data->button, "text-button");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button_data->image != NULL)
|
if (button_data->image != NULL)
|
||||||
{
|
{
|
||||||
set_button_image (path_bar, button_data);
|
set_button_image (path_bar, button_data);
|
||||||
if (button_data->label == NULL)
|
if (button_data->label == NULL)
|
||||||
gtk_style_context_add_class (context, "image-button");
|
gtk_widget_add_style_class (button_data->button, "image-button");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button)) != current_dir)
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button)) != current_dir)
|
||||||
|
@ -1018,7 +1018,6 @@ update_places (GtkPlacesSidebar *sidebar)
|
|||||||
CloudProvidersAccount *cloud_provider_account;
|
CloudProvidersAccount *cloud_provider_account;
|
||||||
CloudProvidersProvider *cloud_provider;
|
CloudProvidersProvider *cloud_provider;
|
||||||
#endif
|
#endif
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
/* save original selection */
|
/* save original selection */
|
||||||
selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
|
selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
|
||||||
@ -1437,8 +1436,7 @@ update_places (GtkPlacesSidebar *sidebar)
|
|||||||
_("New bookmark"), new_bookmark_icon, NULL, NULL,
|
_("New bookmark"), new_bookmark_icon, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL, 0,
|
NULL, NULL, NULL, NULL, 0,
|
||||||
_("Add a new bookmark"));
|
_("Add a new bookmark"));
|
||||||
context = gtk_widget_get_style_context (sidebar->new_bookmark_row);
|
gtk_widget_add_style_class (sidebar->new_bookmark_row, "sidebar-new-bookmark-row");
|
||||||
gtk_style_context_add_class (context, "sidebar-new-bookmark-row");
|
|
||||||
g_object_unref (new_bookmark_icon);
|
g_object_unref (new_bookmark_icon);
|
||||||
|
|
||||||
/* network */
|
/* network */
|
||||||
@ -2646,7 +2644,7 @@ create_rename_popover (GtkPlacesSidebar *sidebar)
|
|||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
button = gtk_button_new_with_mnemonic (_("_Rename"));
|
button = gtk_button_new_with_mnemonic (_("_Rename"));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
gtk_widget_add_style_class (button, "suggested-action");
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (do_rename), sidebar);
|
g_signal_connect (button, "clicked", G_CALLBACK (do_rename), sidebar);
|
||||||
error = gtk_label_new ("");
|
error = gtk_label_new ("");
|
||||||
gtk_widget_set_halign (error, GTK_ALIGN_START);
|
gtk_widget_set_halign (error, GTK_ALIGN_START);
|
||||||
@ -2676,18 +2674,16 @@ static void
|
|||||||
update_popover_shadowing (GtkWidget *row,
|
update_popover_shadowing (GtkWidget *row,
|
||||||
gboolean shown)
|
gboolean shown)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
gint count;
|
gint count;
|
||||||
|
|
||||||
count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "popover-count"));
|
count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "popover-count"));
|
||||||
count = shown ? count + 1 : count - 1;
|
count = shown ? count + 1 : count - 1;
|
||||||
g_object_set_data (G_OBJECT (row), "popover-count", GINT_TO_POINTER (count));
|
g_object_set_data (G_OBJECT (row), "popover-count", GINT_TO_POINTER (count));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (row);
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
gtk_style_context_add_class (context, "has-open-popup");
|
gtk_widget_add_style_class (row, "has-open-popup");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "has-open-popup");
|
gtk_widget_remove_style_class (row, "has-open-popup");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4024,7 +4020,6 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
|||||||
GdkContentFormats *formats;
|
GdkContentFormats *formats;
|
||||||
GtkDropTarget *dest;
|
GtkDropTarget *dest;
|
||||||
gboolean show_desktop;
|
gboolean show_desktop;
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
GdkContentFormatsBuilder *builder;
|
GdkContentFormatsBuilder *builder;
|
||||||
@ -4056,8 +4051,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
|||||||
GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC);
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sidebar->swin), GTK_SHADOW_IN);
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sidebar->swin), GTK_SHADOW_IN);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (sidebar));
|
gtk_widget_add_style_class (GTK_WIDGET (sidebar), "sidebar");
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SIDEBAR);
|
|
||||||
|
|
||||||
/* list box */
|
/* list box */
|
||||||
sidebar->list_box = gtk_list_box_new ();
|
sidebar->list_box = gtk_list_box_new ();
|
||||||
|
@ -605,7 +605,7 @@ populate_servers (GtkPlacesView *view)
|
|||||||
gtk_widget_set_hexpand (label, TRUE);
|
gtk_widget_set_hexpand (label, TRUE);
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
|
gtk_widget_add_style_class (label, "dim-label");
|
||||||
gtk_container_add (GTK_CONTAINER (grid), label);
|
gtk_container_add (GTK_CONTAINER (grid), label);
|
||||||
|
|
||||||
/* remove button */
|
/* remove button */
|
||||||
@ -613,7 +613,7 @@ populate_servers (GtkPlacesView *view)
|
|||||||
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "sidebar-button");
|
gtk_widget_add_style_class (button, "sidebar-button");
|
||||||
gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2);
|
gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (row), grid);
|
gtk_container_add (GTK_CONTAINER (row), grid);
|
||||||
@ -1900,11 +1900,9 @@ on_address_entry_text_changed (GtkPlacesView *view)
|
|||||||
out:
|
out:
|
||||||
gtk_widget_set_sensitive (priv->connect_button, supported);
|
gtk_widget_set_sensitive (priv->connect_button, supported);
|
||||||
if (scheme && !supported)
|
if (scheme && !supported)
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->address_entry),
|
gtk_widget_add_style_class (priv->address_entry, GTK_STYLE_CLASS_ERROR);
|
||||||
GTK_STYLE_CLASS_ERROR);
|
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->address_entry),
|
gtk_widget_add_style_class (priv->address_entry, GTK_STYLE_CLASS_ERROR);
|
||||||
GTK_STYLE_CLASS_ERROR);
|
|
||||||
|
|
||||||
g_free (address);
|
g_free (address);
|
||||||
g_free (scheme);
|
g_free (scheme);
|
||||||
|
@ -201,7 +201,6 @@ static void
|
|||||||
gtk_popover_menu_init (GtkPopoverMenu *popover)
|
gtk_popover_menu_init (GtkPopoverMenu *popover)
|
||||||
{
|
{
|
||||||
GtkWidget *stack;
|
GtkWidget *stack;
|
||||||
GtkStyleContext *style_context;
|
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
|
|
||||||
stack = gtk_stack_new ();
|
stack = gtk_stack_new ();
|
||||||
@ -212,8 +211,7 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
|
|||||||
g_signal_connect (stack, "notify::visible-child-name",
|
g_signal_connect (stack, "notify::visible-child-name",
|
||||||
G_CALLBACK (visible_submenu_changed), popover);
|
G_CALLBACK (visible_submenu_changed), popover);
|
||||||
|
|
||||||
style_context = gtk_widget_get_style_context (GTK_WIDGET (popover));
|
gtk_widget_add_style_class (GTK_WIDGET (popover), "menu");
|
||||||
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_MENU);
|
|
||||||
|
|
||||||
controller = gtk_event_controller_key_new ();
|
controller = gtk_event_controller_key_new ();
|
||||||
g_signal_connect (controller, "focus-out", G_CALLBACK (focus_out), popover);
|
g_signal_connect (controller, "focus-out", G_CALLBACK (focus_out), popover);
|
||||||
@ -222,7 +220,6 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
|
|||||||
controller = gtk_event_controller_motion_new ();
|
controller = gtk_event_controller_motion_new ();
|
||||||
g_signal_connect (controller, "leave", G_CALLBACK (leave_cb), popover);
|
g_signal_connect (controller, "leave", G_CALLBACK (leave_cb), popover);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (popover), controller);
|
gtk_widget_add_controller (GTK_WIDGET (popover), controller);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -266,7 +266,6 @@ static void
|
|||||||
update_fraction_classes (GtkProgressBar *pbar)
|
update_fraction_classes (GtkProgressBar *pbar)
|
||||||
{
|
{
|
||||||
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
|
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
|
||||||
GtkStyleContext *context;
|
|
||||||
gboolean empty = FALSE;
|
gboolean empty = FALSE;
|
||||||
gboolean full = FALSE;
|
gboolean full = FALSE;
|
||||||
|
|
||||||
@ -281,25 +280,22 @@ update_fraction_classes (GtkProgressBar *pbar)
|
|||||||
full = TRUE;
|
full = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->trough_widget);
|
|
||||||
|
|
||||||
if (empty)
|
if (empty)
|
||||||
gtk_style_context_add_class (context, "empty");
|
gtk_widget_add_style_class (priv->trough_widget, "empty");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "empty");
|
gtk_widget_remove_style_class (priv->trough_widget, "empty");
|
||||||
|
|
||||||
if (full)
|
if (full)
|
||||||
gtk_style_context_add_class (context, "full");
|
gtk_widget_add_style_class (priv->trough_widget, "full");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "full");
|
gtk_widget_remove_style_class (priv->trough_widget, "full");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_node_classes (GtkProgressBar *pbar)
|
update_node_classes (GtkProgressBar *pbar)
|
||||||
{
|
{
|
||||||
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
|
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
|
||||||
GtkStyleContext *context;
|
gboolean left = FALSE;
|
||||||
gboolean left = FALSE;
|
|
||||||
gboolean right = FALSE;
|
gboolean right = FALSE;
|
||||||
gboolean top = FALSE;
|
gboolean top = FALSE;
|
||||||
gboolean bottom = FALSE;
|
gboolean bottom = FALSE;
|
||||||
@ -344,27 +340,25 @@ update_node_classes (GtkProgressBar *pbar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->progress_widget);
|
|
||||||
|
|
||||||
if (left)
|
if (left)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_LEFT);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_LEFT);
|
||||||
|
|
||||||
if (right)
|
if (right)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_RIGHT);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_RIGHT);
|
||||||
|
|
||||||
if (top)
|
if (top)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_TOP);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_TOP);
|
||||||
|
|
||||||
if (bottom)
|
if (bottom)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
|
|
||||||
update_fraction_classes (pbar);
|
update_fraction_classes (pbar);
|
||||||
}
|
}
|
||||||
@ -667,7 +661,7 @@ gtk_progress_bar_act_mode_enter (GtkProgressBar *pbar)
|
|||||||
GtkWidget *widget = GTK_WIDGET (pbar);
|
GtkWidget *widget = GTK_WIDGET (pbar);
|
||||||
gboolean inverted;
|
gboolean inverted;
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->progress_widget), GTK_STYLE_CLASS_PULSE);
|
gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_PULSE);
|
||||||
|
|
||||||
inverted = priv->inverted;
|
inverted = priv->inverted;
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
@ -707,8 +701,7 @@ gtk_progress_bar_act_mode_leave (GtkProgressBar *pbar)
|
|||||||
gtk_widget_remove_tick_callback (GTK_WIDGET (pbar), priv->tick_id);
|
gtk_widget_remove_tick_callback (GTK_WIDGET (pbar), priv->tick_id);
|
||||||
priv->tick_id = 0;
|
priv->tick_id = 0;
|
||||||
|
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->progress_widget),
|
gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_PULSE);
|
||||||
GTK_STYLE_CLASS_PULSE);
|
|
||||||
update_node_classes (pbar);
|
update_node_classes (pbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,22 +712,19 @@ static void
|
|||||||
update_highlight_position (GtkRange *range)
|
update_highlight_position (GtkRange *range)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (!priv->highlight_widget)
|
if (!priv->highlight_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->highlight_widget);
|
|
||||||
|
|
||||||
if (should_invert (range))
|
if (should_invert (range))
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_add_style_class (priv->highlight_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_remove_style_class (priv->highlight_widget, GTK_STYLE_CLASS_TOP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (priv->highlight_widget, GTK_STYLE_CLASS_TOP);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (priv->highlight_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,22 +732,19 @@ static void
|
|||||||
update_fill_position (GtkRange *range)
|
update_fill_position (GtkRange *range)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (!priv->fill_widget)
|
if (!priv->fill_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->fill_widget);
|
|
||||||
|
|
||||||
if (should_invert (range))
|
if (should_invert (range))
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_add_style_class (priv->fill_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_remove_style_class (priv->fill_widget, GTK_STYLE_CLASS_TOP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (priv->fill_widget, GTK_STYLE_CLASS_TOP);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (priv->fill_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1662,9 +1656,6 @@ range_grab_add (GtkRange *range,
|
|||||||
GtkWidget *location)
|
GtkWidget *location)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (range));
|
|
||||||
|
|
||||||
/* Don't perform any GDK/GTK+ grab here. Since a button
|
/* Don't perform any GDK/GTK+ grab here. Since a button
|
||||||
* is down, there's an ongoing implicit grab on
|
* is down, there's an ongoing implicit grab on
|
||||||
@ -1673,7 +1664,7 @@ range_grab_add (GtkRange *range,
|
|||||||
*/
|
*/
|
||||||
priv->grab_location = location;
|
priv->grab_location = location;
|
||||||
|
|
||||||
gtk_style_context_add_class (context, "dragging");
|
gtk_widget_add_style_class (GTK_WIDGET (range), "dragging");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1681,14 +1672,11 @@ update_zoom_state (GtkRange *range,
|
|||||||
gboolean enabled)
|
gboolean enabled)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (range));
|
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
gtk_style_context_add_class (context, "fine-tune");
|
gtk_widget_add_style_class (GTK_WIDGET (range), "fine-tune");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "fine-tune");
|
gtk_widget_remove_style_class (GTK_WIDGET (range), "fine-tune");
|
||||||
|
|
||||||
priv->zoom = enabled;
|
priv->zoom = enabled;
|
||||||
}
|
}
|
||||||
@ -1697,18 +1685,15 @@ static void
|
|||||||
range_grab_remove (GtkRange *range)
|
range_grab_remove (GtkRange *range)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (!priv->grab_location)
|
if (!priv->grab_location)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (range));
|
|
||||||
|
|
||||||
priv->grab_location = NULL;
|
priv->grab_location = NULL;
|
||||||
|
|
||||||
update_zoom_state (range, FALSE);
|
update_zoom_state (range, FALSE);
|
||||||
|
|
||||||
gtk_style_context_remove_class (context, "dragging");
|
gtk_widget_remove_style_class (GTK_WIDGET (range), "dragging");
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkScrollType
|
static GtkScrollType
|
||||||
|
@ -1042,24 +1042,21 @@ static void
|
|||||||
update_value_position (GtkScale *scale)
|
update_value_position (GtkScale *scale)
|
||||||
{
|
{
|
||||||
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (!priv->value_widget)
|
if (!priv->value_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (priv->value_widget);
|
gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_TOP);
|
||||||
|
gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_RIGHT);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_LEFT);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
|
||||||
|
|
||||||
switch (priv->value_pos)
|
switch (priv->value_pos)
|
||||||
{
|
{
|
||||||
case GTK_POS_TOP: gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP); break;
|
case GTK_POS_TOP: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_TOP); break;
|
||||||
case GTK_POS_RIGHT: gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT); break;
|
case GTK_POS_RIGHT: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_RIGHT); break;
|
||||||
case GTK_POS_BOTTOM: gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM); break;
|
case GTK_POS_BOTTOM: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_BOTTOM); break;
|
||||||
case GTK_POS_LEFT: gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT); break;
|
case GTK_POS_LEFT: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_LEFT); break;
|
||||||
|
|
||||||
default: g_assert_not_reached ();
|
default: g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
@ -1646,20 +1643,17 @@ void
|
|||||||
gtk_scale_clear_marks (GtkScale *scale)
|
gtk_scale_clear_marks (GtkScale *scale)
|
||||||
{
|
{
|
||||||
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_SCALE (scale));
|
g_return_if_fail (GTK_IS_SCALE (scale));
|
||||||
|
|
||||||
g_slist_free_full (priv->marks, gtk_scale_mark_free);
|
g_slist_free_full (priv->marks, gtk_scale_mark_free);
|
||||||
priv->marks = NULL;
|
priv->marks = NULL;
|
||||||
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->top_marks_widget, gtk_widget_unparent);
|
g_clear_pointer (&priv->top_marks_widget, gtk_widget_unparent);
|
||||||
g_clear_pointer (&priv->bottom_marks_widget, gtk_widget_unparent);
|
g_clear_pointer (&priv->bottom_marks_widget, gtk_widget_unparent);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
|
gtk_widget_remove_style_class (GTK_WIDGET (scale), "marks-before");
|
||||||
gtk_style_context_remove_class (context, "marks-before");
|
gtk_widget_remove_style_class (GTK_WIDGET (scale), "marks-after");
|
||||||
gtk_style_context_remove_class (context, "marks-after");
|
|
||||||
|
|
||||||
_gtk_range_set_stop_values (GTK_RANGE (scale), NULL, 0);
|
_gtk_range_set_stop_values (GTK_RANGE (scale), NULL, 0);
|
||||||
|
|
||||||
@ -1700,7 +1694,6 @@ gtk_scale_add_mark (GtkScale *scale,
|
|||||||
GSList *m;
|
GSList *m;
|
||||||
gdouble *values;
|
gdouble *values;
|
||||||
gint n, i;
|
gint n, i;
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkWidget *marks_widget;
|
GtkWidget *marks_widget;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_SCALE (scale));
|
g_return_if_fail (GTK_IS_SCALE (scale));
|
||||||
@ -1735,8 +1728,7 @@ gtk_scale_add_mark (GtkScale *scale,
|
|||||||
(priv->value_widget &&
|
(priv->value_widget &&
|
||||||
(priv->value_pos == GTK_POS_TOP || priv->value_pos == GTK_POS_LEFT)) ?
|
(priv->value_pos == GTK_POS_TOP || priv->value_pos == GTK_POS_LEFT)) ?
|
||||||
priv->value_widget : NULL);
|
priv->value_widget : NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->top_marks_widget),
|
gtk_widget_add_style_class (priv->top_marks_widget, GTK_STYLE_CLASS_TOP);
|
||||||
GTK_STYLE_CLASS_TOP);
|
|
||||||
}
|
}
|
||||||
marks_widget = priv->top_marks_widget;
|
marks_widget = priv->top_marks_widget;
|
||||||
}
|
}
|
||||||
@ -1755,8 +1747,7 @@ gtk_scale_add_mark (GtkScale *scale,
|
|||||||
(priv->value_widget &&
|
(priv->value_widget &&
|
||||||
(priv->value_pos == GTK_POS_BOTTOM || priv->value_pos == GTK_POS_RIGHT)) ?
|
(priv->value_pos == GTK_POS_BOTTOM || priv->value_pos == GTK_POS_RIGHT)) ?
|
||||||
priv->value_widget: NULL);
|
priv->value_widget: NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->bottom_marks_widget),
|
gtk_widget_add_style_class (priv->bottom_marks_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
GTK_STYLE_CLASS_BOTTOM);
|
|
||||||
}
|
}
|
||||||
marks_widget = priv->bottom_marks_widget;
|
marks_widget = priv->bottom_marks_widget;
|
||||||
}
|
}
|
||||||
@ -1810,11 +1801,11 @@ gtk_scale_add_mark (GtkScale *scale,
|
|||||||
|
|
||||||
g_free (values);
|
g_free (values);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
|
|
||||||
if (priv->top_marks_widget)
|
if (priv->top_marks_widget)
|
||||||
gtk_style_context_add_class (context, "marks-before");
|
gtk_widget_add_style_class (GTK_WIDGET (scale), "marks-before");
|
||||||
|
|
||||||
if (priv->bottom_marks_widget)
|
if (priv->bottom_marks_widget)
|
||||||
gtk_style_context_add_class (context, "marks-after");
|
gtk_widget_add_style_class (GTK_WIDGET (scale), "marks-after");
|
||||||
|
|
||||||
gtk_widget_queue_resize (widget);
|
gtk_widget_queue_resize (widget);
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,6 @@ static void
|
|||||||
gtk_scale_button_init (GtkScaleButton *button)
|
gtk_scale_button_init (GtkScaleButton *button)
|
||||||
{
|
{
|
||||||
GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
|
GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
|
|
||||||
priv->click_id = 0;
|
priv->click_id = 0;
|
||||||
@ -384,8 +383,7 @@ gtk_scale_button_init (GtkScaleButton *button)
|
|||||||
g_object_ref_sink (priv->adjustment);
|
g_object_ref_sink (priv->adjustment);
|
||||||
gtk_range_set_adjustment (GTK_RANGE (priv->scale), priv->adjustment);
|
gtk_range_set_adjustment (GTK_RANGE (priv->scale), priv->adjustment);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
gtk_widget_add_style_class (GTK_WIDGET (button), "scale");
|
||||||
gtk_style_context_add_class (context, "scale");
|
|
||||||
|
|
||||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
|
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
|
||||||
g_signal_connect (controller, "scroll",
|
g_signal_connect (controller, "scroll",
|
||||||
|
@ -462,28 +462,25 @@ static void
|
|||||||
update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
|
update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
|
||||||
{
|
{
|
||||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||||
GtkStyleContext *context;
|
|
||||||
gboolean is_rtl;
|
gboolean is_rtl;
|
||||||
|
|
||||||
if (priv->hscrollbar != NULL)
|
if (priv->hscrollbar != NULL)
|
||||||
{
|
{
|
||||||
context = gtk_widget_get_style_context (priv->hscrollbar);
|
|
||||||
if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
||||||
priv->window_placement == GTK_CORNER_TOP_RIGHT)
|
priv->window_placement == GTK_CORNER_TOP_RIGHT)
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (priv->hscrollbar, GTK_STYLE_CLASS_BOTTOM);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (priv->hscrollbar, GTK_STYLE_CLASS_TOP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_style_class (priv->hscrollbar, GTK_STYLE_CLASS_TOP);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
gtk_widget_remove_style_class (priv->hscrollbar, GTK_STYLE_CLASS_BOTTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->vscrollbar != NULL)
|
if (priv->vscrollbar != NULL)
|
||||||
{
|
{
|
||||||
context = gtk_widget_get_style_context (priv->vscrollbar);
|
|
||||||
is_rtl = _gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL;
|
is_rtl = _gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL;
|
||||||
if ((is_rtl &&
|
if ((is_rtl &&
|
||||||
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
||||||
@ -492,13 +489,13 @@ update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
|
|||||||
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
||||||
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
|
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (priv->vscrollbar, GTK_STYLE_CLASS_RIGHT);
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (priv->vscrollbar, GTK_STYLE_CLASS_LEFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
gtk_widget_add_style_class (priv->vscrollbar, GTK_STYLE_CLASS_LEFT);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
gtk_widget_remove_style_class (priv->vscrollbar, GTK_STYLE_CLASS_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1036,8 +1033,6 @@ static void
|
|||||||
indicator_set_over (Indicator *indicator,
|
indicator_set_over (Indicator *indicator,
|
||||||
gboolean over)
|
gboolean over)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
if (indicator->over_timeout_id)
|
if (indicator->over_timeout_id)
|
||||||
{
|
{
|
||||||
g_source_remove (indicator->over_timeout_id);
|
g_source_remove (indicator->over_timeout_id);
|
||||||
@ -1047,13 +1042,12 @@ indicator_set_over (Indicator *indicator,
|
|||||||
if (indicator->over == over)
|
if (indicator->over == over)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (indicator->scrollbar);
|
|
||||||
indicator->over = over;
|
indicator->over = over;
|
||||||
|
|
||||||
if (indicator->over)
|
if (indicator->over)
|
||||||
gtk_style_context_add_class (context, "hovering");
|
gtk_widget_add_style_class (indicator->scrollbar, "hovering");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "hovering");
|
gtk_widget_remove_style_class (indicator->scrollbar, "hovering");
|
||||||
|
|
||||||
gtk_widget_queue_resize (indicator->scrollbar);
|
gtk_widget_queue_resize (indicator->scrollbar);
|
||||||
}
|
}
|
||||||
@ -2439,10 +2433,9 @@ gtk_scrolled_window_unset_placement (GtkScrolledWindow *scrolled_window)
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
|
gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
|
||||||
GtkShadowType type)
|
GtkShadowType type)
|
||||||
{
|
{
|
||||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||||
g_return_if_fail (type >= GTK_SHADOW_NONE && type <= GTK_SHADOW_ETCHED_OUT);
|
g_return_if_fail (type >= GTK_SHADOW_NONE && type <= GTK_SHADOW_ETCHED_OUT);
|
||||||
@ -2451,11 +2444,10 @@ gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
|
|||||||
{
|
{
|
||||||
priv->shadow_type = type;
|
priv->shadow_type = type;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (scrolled_window));
|
|
||||||
if (type != GTK_SHADOW_NONE)
|
if (type != GTK_SHADOW_NONE)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
|
gtk_widget_add_style_class (GTK_WIDGET (scrolled_window), GTK_STYLE_CLASS_FRAME);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
|
gtk_widget_remove_style_class (GTK_WIDGET (scrolled_window), GTK_STYLE_CLASS_FRAME);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_SHADOW_TYPE]);
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_SHADOW_TYPE]);
|
||||||
}
|
}
|
||||||
@ -3763,18 +3755,16 @@ setup_indicator (GtkScrolledWindow *scrolled_window,
|
|||||||
Indicator *indicator,
|
Indicator *indicator,
|
||||||
GtkWidget *scrollbar)
|
GtkWidget *scrollbar)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
if (scrollbar == NULL)
|
if (scrollbar == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (scrollbar);
|
|
||||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
||||||
|
|
||||||
indicator->scrollbar = scrollbar;
|
indicator->scrollbar = scrollbar;
|
||||||
|
|
||||||
gtk_style_context_add_class (context, "overlay-indicator");
|
gtk_widget_add_style_class (scrollbar, "overlay-indicator");
|
||||||
g_signal_connect (adjustment, "value-changed",
|
g_signal_connect (adjustment, "value-changed",
|
||||||
G_CALLBACK (indicator_value_changed), indicator);
|
G_CALLBACK (indicator_value_changed), indicator);
|
||||||
|
|
||||||
@ -3787,7 +3777,6 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
|
|||||||
Indicator *indicator)
|
Indicator *indicator)
|
||||||
{
|
{
|
||||||
GtkWidget *scrollbar;
|
GtkWidget *scrollbar;
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
if (indicator->scrollbar == NULL)
|
if (indicator->scrollbar == NULL)
|
||||||
@ -3796,8 +3785,7 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
|
|||||||
scrollbar = indicator->scrollbar;
|
scrollbar = indicator->scrollbar;
|
||||||
indicator->scrollbar = NULL;
|
indicator->scrollbar = NULL;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (scrollbar);
|
gtk_widget_remove_style_class (scrollbar, "overlay-indicator");
|
||||||
gtk_style_context_remove_class (context, "overlay-indicator");
|
|
||||||
|
|
||||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
||||||
g_signal_handlers_disconnect_by_data (adjustment, indicator);
|
g_signal_handlers_disconnect_by_data (adjustment, indicator);
|
||||||
|
@ -351,7 +351,7 @@ gtk_search_bar_init (GtkSearchBar *bar)
|
|||||||
gtk_widget_set_hexpand (priv->box_center, TRUE);
|
gtk_widget_set_hexpand (priv->box_center, TRUE);
|
||||||
|
|
||||||
priv->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
|
priv->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->close_button), "close");
|
gtk_widget_add_style_class (priv->close_button, "close");
|
||||||
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->box_center), priv->close_button);
|
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->box_center), priv->close_button);
|
||||||
gtk_widget_hide (priv->close_button);
|
gtk_widget_hide (priv->close_button);
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ gtk_search_entry_init (GtkSearchEntry *entry)
|
|||||||
g_signal_connect (press, "released", G_CALLBACK (gtk_search_entry_icon_release), entry);
|
g_signal_connect (press, "released", G_CALLBACK (gtk_search_entry_icon_release), entry);
|
||||||
gtk_widget_add_controller (priv->icon, GTK_EVENT_CONTROLLER (press));
|
gtk_widget_add_controller (priv->icon, GTK_EVENT_CONTROLLER (press));
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (entry)), I_("search"));
|
gtk_widget_add_style_class (GTK_WIDGET (entry), I_("search"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,7 +258,7 @@ dim_label (const gchar *text)
|
|||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
label = gtk_label_new (text);
|
label = gtk_label_new (text);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
|
gtk_widget_add_style_class (label, "dim-label");
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ display_shortcut (GtkWidget *self,
|
|||||||
if (i < n_mods)
|
if (i < n_mods)
|
||||||
gtk_widget_set_size_request (disp, 50, -1);
|
gtk_widget_set_size_request (disp, 50, -1);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (disp), "keycap");
|
gtk_widget_add_style_class (disp, "keycap");
|
||||||
gtk_label_set_use_markup (GTK_LABEL (disp), TRUE);
|
gtk_label_set_use_markup (GTK_LABEL (disp), TRUE);
|
||||||
|
|
||||||
gtk_widget_set_parent (disp, self);
|
gtk_widget_set_parent (disp, self);
|
||||||
|
@ -433,7 +433,7 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
|
|||||||
"visible", FALSE,
|
"visible", FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self->switcher)), GTK_STYLE_CLASS_LINKED);
|
gtk_widget_remove_style_class (GTK_WIDGET (self->switcher), GTK_STYLE_CLASS_LINKED);
|
||||||
|
|
||||||
self->show_all = gtk_button_new_with_mnemonic (_("_Show All"));
|
self->show_all = gtk_button_new_with_mnemonic (_("_Show All"));
|
||||||
gtk_widget_hide (self->show_all);
|
gtk_widget_hide (self->show_all);
|
||||||
@ -729,8 +729,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
|
|||||||
{
|
{
|
||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self->switcher)),
|
gtk_widget_add_style_class (GTK_WIDGET (self->switcher), "circular");
|
||||||
"circular");
|
|
||||||
|
|
||||||
for (w = gtk_widget_get_first_child (GTK_WIDGET (self->switcher));
|
for (w = gtk_widget_get_first_child (GTK_WIDGET (self->switcher));
|
||||||
w != NULL;
|
w != NULL;
|
||||||
@ -738,7 +737,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
|
|||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "circular");
|
gtk_widget_add_style_class (w, "circular");
|
||||||
|
|
||||||
label = gtk_bin_get_child (GTK_BIN (w));
|
label = gtk_bin_get_child (GTK_BIN (w));
|
||||||
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
|
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
|
||||||
|
@ -917,18 +917,18 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
|||||||
|
|
||||||
/* Translators: This is the window title for the shortcuts window in normal mode */
|
/* Translators: This is the window title for the shortcuts window in normal mode */
|
||||||
label = gtk_label_new (_("Shortcuts"));
|
label = gtk_label_new (_("Shortcuts"));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE);
|
gtk_widget_add_style_class (label, GTK_STYLE_CLASS_TITLE);
|
||||||
gtk_stack_add_named (priv->title_stack, label, "title");
|
gtk_stack_add_named (priv->title_stack, label, "title");
|
||||||
|
|
||||||
/* Translators: This is the window title for the shortcuts window in search mode */
|
/* Translators: This is the window title for the shortcuts window in search mode */
|
||||||
label = gtk_label_new (_("Search Results"));
|
label = gtk_label_new (_("Search Results"));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE);
|
gtk_widget_add_style_class (label, GTK_STYLE_CLASS_TITLE);
|
||||||
gtk_stack_add_named (priv->title_stack, label, "search");
|
gtk_stack_add_named (priv->title_stack, label, "search");
|
||||||
|
|
||||||
priv->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON,
|
priv->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON,
|
||||||
"focus-on-click", FALSE,
|
"focus-on-click", FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (priv->menu_button)), "flat");
|
gtk_widget_add_style_class (GTK_WIDGET (priv->menu_button), "flat");
|
||||||
gtk_stack_add_named (priv->title_stack, GTK_WIDGET (priv->menu_button), "sections");
|
gtk_stack_add_named (priv->title_stack, GTK_WIDGET (priv->menu_button), "sections");
|
||||||
|
|
||||||
priv->popover = g_object_new (GTK_TYPE_POPOVER,
|
priv->popover = g_object_new (GTK_TYPE_POPOVER,
|
||||||
@ -971,7 +971,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
|||||||
"halign", GTK_ALIGN_CENTER,
|
"halign", GTK_ALIGN_CENTER,
|
||||||
"orientation", GTK_ORIENTATION_VERTICAL,
|
"orientation", GTK_ORIENTATION_VERTICAL,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box)), "shortcuts-search-results");
|
gtk_widget_add_style_class (GTK_WIDGET (box), "shortcuts-search-results");
|
||||||
gtk_container_add (GTK_CONTAINER (scroller), GTK_WIDGET (box));
|
gtk_container_add (GTK_CONTAINER (scroller), GTK_WIDGET (box));
|
||||||
gtk_stack_add_named (priv->stack, scroller, "internal-search");
|
gtk_stack_add_named (priv->stack, scroller, "internal-search");
|
||||||
|
|
||||||
@ -997,7 +997,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
|||||||
"halign", GTK_ALIGN_CENTER,
|
"halign", GTK_ALIGN_CENTER,
|
||||||
"valign", GTK_ALIGN_CENTER,
|
"valign", GTK_ALIGN_CENTER,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (empty), GTK_STYLE_CLASS_DIM_LABEL);
|
gtk_widget_add_style_class (empty, GTK_STYLE_CLASS_DIM_LABEL);
|
||||||
gtk_grid_attach (GTK_GRID (empty),
|
gtk_grid_attach (GTK_GRID (empty),
|
||||||
g_object_new (GTK_TYPE_IMAGE,
|
g_object_new (GTK_TYPE_IMAGE,
|
||||||
"icon-name", "edit-find-symbolic",
|
"icon-name", "edit-find-symbolic",
|
||||||
|
@ -212,7 +212,6 @@ gtk_sidebar_row_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkSidebarRow *self = GTK_SIDEBAR_ROW (object);
|
GtkSidebarRow *self = GTK_SIDEBAR_ROW (object);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -353,8 +352,7 @@ gtk_sidebar_row_set_property (GObject *object,
|
|||||||
(GtkCallback) gtk_widget_destroy,
|
(GtkCallback) gtk_widget_destroy,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
gtk_widget_add_style_class (GTK_WIDGET (self), "sidebar-placeholder-row");
|
||||||
gtk_style_context_add_class (context, "sidebar-placeholder-row");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -965,7 +965,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
|
|||||||
gtk_widget_set_parent (priv->entry, GTK_WIDGET (spin_button));
|
gtk_widget_set_parent (priv->entry, GTK_WIDGET (spin_button));
|
||||||
|
|
||||||
priv->down_button = gtk_button_new_from_icon_name ("value-decrease-symbolic");
|
priv->down_button = gtk_button_new_from_icon_name ("value-decrease-symbolic");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "down");
|
gtk_widget_add_style_class (priv->down_button, "down");
|
||||||
gtk_widget_set_can_focus (priv->down_button, FALSE);
|
gtk_widget_set_can_focus (priv->down_button, FALSE);
|
||||||
gtk_widget_set_parent (priv->down_button, GTK_WIDGET (spin_button));
|
gtk_widget_set_parent (priv->down_button, GTK_WIDGET (spin_button));
|
||||||
|
|
||||||
@ -980,7 +980,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
|
|||||||
gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
priv->up_button = gtk_button_new_from_icon_name ("value-increase-symbolic");
|
priv->up_button = gtk_button_new_from_icon_name ("value-increase-symbolic");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up");
|
gtk_widget_add_style_class (priv->up_button, "up");
|
||||||
gtk_widget_set_can_focus (priv->up_button, FALSE);
|
gtk_widget_set_can_focus (priv->up_button, FALSE);
|
||||||
gtk_widget_set_parent (priv->up_button, GTK_WIDGET (spin_button));
|
gtk_widget_set_parent (priv->up_button, GTK_WIDGET (spin_button));
|
||||||
|
|
||||||
|
@ -154,7 +154,6 @@ gtk_stack_sidebar_row_selected (GtkListBox *box,
|
|||||||
static void
|
static void
|
||||||
gtk_stack_sidebar_init (GtkStackSidebar *self)
|
gtk_stack_sidebar_init (GtkStackSidebar *self)
|
||||||
{
|
{
|
||||||
GtkStyleContext *style;
|
|
||||||
GtkWidget *sw;
|
GtkWidget *sw;
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
@ -173,8 +172,7 @@ gtk_stack_sidebar_init (GtkStackSidebar *self)
|
|||||||
g_signal_connect (self->list, "row-selected",
|
g_signal_connect (self->list, "row-selected",
|
||||||
G_CALLBACK (gtk_stack_sidebar_row_selected), self);
|
G_CALLBACK (gtk_stack_sidebar_row_selected), self);
|
||||||
|
|
||||||
style = gtk_widget_get_style_context (GTK_WIDGET (self));
|
gtk_widget_add_style_class (GTK_WIDGET (self), "sidebar");
|
||||||
gtk_style_context_add_class (style, "sidebar");
|
|
||||||
|
|
||||||
self->rows = g_hash_table_new (NULL, NULL);
|
self->rows = g_hash_table_new (NULL, NULL);
|
||||||
}
|
}
|
||||||
@ -188,7 +186,6 @@ update_row (GtkStackSidebar *self,
|
|||||||
gchar *title;
|
gchar *title;
|
||||||
gboolean needs_attention;
|
gboolean needs_attention;
|
||||||
gboolean visible;
|
gboolean visible;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_object_get (page,
|
g_object_get (page,
|
||||||
"title", &title,
|
"title", &title,
|
||||||
@ -201,11 +198,10 @@ update_row (GtkStackSidebar *self,
|
|||||||
|
|
||||||
gtk_widget_set_visible (row, visible && title != NULL);
|
gtk_widget_set_visible (row, visible && title != NULL);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (row);
|
|
||||||
if (needs_attention)
|
if (needs_attention)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
gtk_widget_add_style_class (row, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
gtk_widget_remove_style_class (row, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
||||||
|
|
||||||
g_free (title);
|
g_free (title);
|
||||||
}
|
}
|
||||||
|
@ -113,14 +113,12 @@ static void
|
|||||||
gtk_stack_switcher_init (GtkStackSwitcher *switcher)
|
gtk_stack_switcher_init (GtkStackSwitcher *switcher)
|
||||||
{
|
{
|
||||||
GtkStackSwitcherPrivate *priv = gtk_stack_switcher_get_instance_private (switcher);
|
GtkStackSwitcherPrivate *priv = gtk_stack_switcher_get_instance_private (switcher);
|
||||||
GtkStyleContext *context;
|
|
||||||
GdkContentFormats *formats;
|
GdkContentFormats *formats;
|
||||||
GtkDropTarget *dest;
|
GtkDropTarget *dest;
|
||||||
|
|
||||||
priv->buttons = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
|
priv->buttons = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (switcher));
|
gtk_widget_add_style_class (GTK_WIDGET (switcher), "linked");
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
|
|
||||||
|
|
||||||
formats = gdk_content_formats_new (NULL, 0);
|
formats = gdk_content_formats_new (NULL, 0);
|
||||||
dest = gtk_drop_target_new (formats, 0);
|
dest = gtk_drop_target_new (formats, 0);
|
||||||
@ -159,7 +157,6 @@ rebuild_child (GtkWidget *self,
|
|||||||
const gchar *icon_name,
|
const gchar *icon_name,
|
||||||
const gchar *title)
|
const gchar *title)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkWidget *button_child;
|
GtkWidget *button_child;
|
||||||
|
|
||||||
button_child = gtk_bin_get_child (GTK_BIN (self));
|
button_child = gtk_bin_get_child (GTK_BIN (self));
|
||||||
@ -167,7 +164,6 @@ rebuild_child (GtkWidget *self,
|
|||||||
gtk_widget_destroy (button_child);
|
gtk_widget_destroy (button_child);
|
||||||
|
|
||||||
button_child = NULL;
|
button_child = NULL;
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
if (icon_name != NULL)
|
if (icon_name != NULL)
|
||||||
{
|
{
|
||||||
@ -175,8 +171,8 @@ rebuild_child (GtkWidget *self,
|
|||||||
if (title != NULL)
|
if (title != NULL)
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (self), title);
|
gtk_widget_set_tooltip_text (GTK_WIDGET (self), title);
|
||||||
|
|
||||||
gtk_style_context_remove_class (context, "text-button");
|
gtk_widget_remove_style_class (self, "text-button");
|
||||||
gtk_style_context_add_class (context, "image-button");
|
gtk_widget_add_style_class (self, "image-button");
|
||||||
}
|
}
|
||||||
else if (title != NULL)
|
else if (title != NULL)
|
||||||
{
|
{
|
||||||
@ -184,8 +180,8 @@ rebuild_child (GtkWidget *self,
|
|||||||
|
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
|
gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
|
||||||
|
|
||||||
gtk_style_context_remove_class (context, "image-button");
|
gtk_widget_remove_style_class (self, "image-button");
|
||||||
gtk_style_context_add_class (context, "text-button");
|
gtk_widget_add_style_class (self, "text-button");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button_child)
|
if (button_child)
|
||||||
@ -204,7 +200,6 @@ update_button (GtkStackSwitcher *self,
|
|||||||
gchar *icon_name;
|
gchar *icon_name;
|
||||||
gboolean needs_attention;
|
gboolean needs_attention;
|
||||||
gboolean visible;
|
gboolean visible;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_object_get (page,
|
g_object_get (page,
|
||||||
"title", &title,
|
"title", &title,
|
||||||
@ -217,11 +212,10 @@ update_button (GtkStackSwitcher *self,
|
|||||||
|
|
||||||
gtk_widget_set_visible (button, visible && (title != NULL || icon_name != NULL));
|
gtk_widget_set_visible (button, visible && (title != NULL || icon_name != NULL));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (button);
|
|
||||||
if (needs_attention)
|
if (needs_attention)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
gtk_widget_add_style_class (button, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
gtk_widget_remove_style_class (button, GTK_STYLE_CLASS_NEEDS_ATTENTION);
|
||||||
|
|
||||||
g_free (title);
|
g_free (title);
|
||||||
g_free (icon_name);
|
g_free (icon_name);
|
||||||
|
@ -1899,8 +1899,7 @@ gtk_text_ensure_magnifier (GtkText *self)
|
|||||||
gtk_widget_set_size_request (priv->magnifier, 100, 60);
|
gtk_widget_set_size_request (priv->magnifier, 100, 60);
|
||||||
_gtk_magnifier_set_magnification (GTK_MAGNIFIER (priv->magnifier), 2.0);
|
_gtk_magnifier_set_magnification (GTK_MAGNIFIER (priv->magnifier), 2.0);
|
||||||
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (self));
|
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (self));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->magnifier_popover),
|
gtk_widget_add_style_class (priv->magnifier_popover, "magnifier");
|
||||||
"magnifier");
|
|
||||||
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
|
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
|
||||||
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
|
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
|
||||||
priv->magnifier);
|
priv->magnifier);
|
||||||
@ -5324,7 +5323,6 @@ gtk_text_set_editable (GtkText *self,
|
|||||||
gboolean is_editable)
|
gboolean is_editable)
|
||||||
{
|
{
|
||||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
if (is_editable != priv->editable)
|
if (is_editable != priv->editable)
|
||||||
{
|
{
|
||||||
@ -5339,11 +5337,11 @@ gtk_text_set_editable (GtkText *self,
|
|||||||
priv->preedit_length = 0;
|
priv->preedit_length = 0;
|
||||||
priv->preedit_cursor = 0;
|
priv->preedit_cursor = 0;
|
||||||
|
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_READ_ONLY);
|
gtk_widget_remove_style_class (GTK_WIDGET (self), GTK_STYLE_CLASS_READ_ONLY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_READ_ONLY);
|
gtk_widget_add_style_class (GTK_WIDGET (self), GTK_STYLE_CLASS_READ_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->editable = is_editable;
|
priv->editable = is_editable;
|
||||||
@ -6006,7 +6004,7 @@ append_bubble_item (GtkText *self,
|
|||||||
image = gtk_image_new_from_icon_name (icon_name);
|
image = gtk_image_new_from_icon_name (icon_name);
|
||||||
gtk_widget_show (image);
|
gtk_widget_show (image);
|
||||||
gtk_container_add (GTK_CONTAINER (item), image);
|
gtk_container_add (GTK_CONTAINER (item), image);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (item), "image-button");
|
gtk_widget_add_style_class (item, "image-button");
|
||||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
|
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
|
||||||
gtk_widget_show (GTK_WIDGET (item));
|
gtk_widget_show (GTK_WIDGET (item));
|
||||||
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
||||||
@ -6041,8 +6039,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
|
|||||||
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
|
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
|
||||||
|
|
||||||
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (self));
|
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (self));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
|
gtk_widget_add_style_class (priv->selection_bubble, GTK_STYLE_CLASS_TOUCH_SELECTION);
|
||||||
GTK_STYLE_CLASS_TOUCH_SELECTION);
|
|
||||||
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
|
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
|
||||||
gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
|
gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
|
||||||
g_signal_connect (priv->selection_bubble, "notify::visible",
|
g_signal_connect (priv->selection_bubble, "notify::visible",
|
||||||
@ -6052,7 +6049,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
|
|||||||
g_object_set (box, "margin", 10, NULL);
|
g_object_set (box, "margin", 10, NULL);
|
||||||
gtk_widget_show (box);
|
gtk_widget_show (box);
|
||||||
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "linked");
|
gtk_widget_add_style_class (toolbar, "linked");
|
||||||
gtk_container_add (GTK_CONTAINER (priv->selection_bubble), box);
|
gtk_container_add (GTK_CONTAINER (priv->selection_bubble), box);
|
||||||
gtk_container_add (GTK_CONTAINER (box), toolbar);
|
gtk_container_add (GTK_CONTAINER (box), toolbar);
|
||||||
|
|
||||||
|
@ -1614,7 +1614,6 @@ gtk_text_view_init (GtkTextView *text_view)
|
|||||||
GdkContentFormats *formats;
|
GdkContentFormats *formats;
|
||||||
GtkDropTarget *dest;
|
GtkDropTarget *dest;
|
||||||
GtkTextViewPrivate *priv;
|
GtkTextViewPrivate *priv;
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
|
|
||||||
@ -1624,8 +1623,7 @@ gtk_text_view_init (GtkTextView *text_view)
|
|||||||
gtk_widget_set_can_focus (widget, TRUE);
|
gtk_widget_set_can_focus (widget, TRUE);
|
||||||
gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
|
gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_VIEW);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
|
|
||||||
|
|
||||||
gtk_widget_set_cursor_from_name (widget, "text");
|
gtk_widget_set_cursor_from_name (widget, "text");
|
||||||
|
|
||||||
@ -1762,8 +1760,7 @@ _gtk_text_view_ensure_magnifier (GtkTextView *text_view)
|
|||||||
priv->magnifier = _gtk_magnifier_new (GTK_WIDGET (text_view));
|
priv->magnifier = _gtk_magnifier_new (GTK_WIDGET (text_view));
|
||||||
_gtk_magnifier_set_magnification (GTK_MAGNIFIER (priv->magnifier), 2.0);
|
_gtk_magnifier_set_magnification (GTK_MAGNIFIER (priv->magnifier), 2.0);
|
||||||
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (text_view));
|
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (text_view));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->magnifier_popover),
|
gtk_widget_add_style_class (priv->magnifier_popover, "magnifier");
|
||||||
"magnifier");
|
|
||||||
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
|
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
|
||||||
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
|
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
|
||||||
priv->magnifier);
|
priv->magnifier);
|
||||||
@ -8850,7 +8847,7 @@ append_bubble_item (GtkTextView *text_view,
|
|||||||
gtk_widget_set_focus_on_click (item, FALSE);
|
gtk_widget_set_focus_on_click (item, FALSE);
|
||||||
image = gtk_image_new_from_icon_name (icon_name);
|
image = gtk_image_new_from_icon_name (icon_name);
|
||||||
gtk_container_add (GTK_CONTAINER (item), image);
|
gtk_container_add (GTK_CONTAINER (item), image);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (item), "image-button");
|
gtk_widget_add_style_class (item, "image-button");
|
||||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
|
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
||||||
@ -8874,8 +8871,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data)
|
|||||||
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
|
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
|
||||||
|
|
||||||
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (text_view));
|
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (text_view));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
|
gtk_widget_add_style_class (priv->selection_bubble, GTK_STYLE_CLASS_TOUCH_SELECTION);
|
||||||
GTK_STYLE_CLASS_TOUCH_SELECTION);
|
|
||||||
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
|
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
|
||||||
gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
|
gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
|
||||||
g_signal_connect (priv->selection_bubble, "notify::visible",
|
g_signal_connect (priv->selection_bubble, "notify::visible",
|
||||||
@ -8884,7 +8880,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data)
|
|||||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||||
g_object_set (box, "margin", 10, NULL);
|
g_object_set (box, "margin", 10, NULL);
|
||||||
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "linked");
|
gtk_widget_add_style_class (toolbar, "linked");
|
||||||
gtk_container_add (GTK_CONTAINER (priv->selection_bubble), box);
|
gtk_container_add (GTK_CONTAINER (priv->selection_bubble), box);
|
||||||
gtk_container_add (GTK_CONTAINER (box), toolbar);
|
gtk_container_add (GTK_CONTAINER (box), toolbar);
|
||||||
|
|
||||||
@ -9623,20 +9619,19 @@ void
|
|||||||
gtk_text_view_set_monospace (GtkTextView *text_view,
|
gtk_text_view_set_monospace (GtkTextView *text_view,
|
||||||
gboolean monospace)
|
gboolean monospace)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
gboolean has_monospace;
|
gboolean has_monospace;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
|
has_monospace = gtk_text_view_get_monospace (text_view);
|
||||||
has_monospace = gtk_style_context_has_class (context, GTK_STYLE_CLASS_MONOSPACE);
|
|
||||||
|
|
||||||
if (has_monospace != monospace)
|
if (has_monospace != monospace)
|
||||||
{
|
{
|
||||||
if (monospace)
|
if (monospace)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MONOSPACE);
|
gtk_widget_add_style_class (GTK_WIDGET (text_view), GTK_STYLE_CLASS_MONOSPACE);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_MONOSPACE);
|
gtk_widget_remove_style_class (GTK_WIDGET (text_view), GTK_STYLE_CLASS_MONOSPACE);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (text_view), "monospace");
|
g_object_notify (G_OBJECT (text_view), "monospace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9652,13 +9647,9 @@ gtk_text_view_set_monospace (GtkTextView *text_view,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_text_view_get_monospace (GtkTextView *text_view)
|
gtk_text_view_get_monospace (GtkTextView *text_view)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
|
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
|
return gtk_widget_has_style_class (GTK_WIDGET (text_view), GTK_STYLE_CLASS_MONOSPACE);
|
||||||
|
|
||||||
return gtk_style_context_has_class (context, GTK_STYLE_CLASS_MONOSPACE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -189,12 +189,10 @@ static void
|
|||||||
gtk_toggle_button_init (GtkToggleButton *toggle_button)
|
gtk_toggle_button_init (GtkToggleButton *toggle_button)
|
||||||
{
|
{
|
||||||
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
|
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
priv->active = FALSE;
|
priv->active = FALSE;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (toggle_button));
|
gtk_widget_add_style_class (GTK_WIDGET (toggle_button), "toggle");
|
||||||
gtk_style_context_add_class (context, "toggle");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,7 +256,6 @@ static void
|
|||||||
gtk_tree_popover_init (GtkTreePopover *popover)
|
gtk_tree_popover_init (GtkTreePopover *popover)
|
||||||
{
|
{
|
||||||
GtkWidget *stack;
|
GtkWidget *stack;
|
||||||
GtkStyleContext *style_context;
|
|
||||||
|
|
||||||
stack = gtk_stack_new ();
|
stack = gtk_stack_new ();
|
||||||
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
|
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
|
||||||
@ -264,8 +263,7 @@ gtk_tree_popover_init (GtkTreePopover *popover)
|
|||||||
gtk_stack_set_interpolate_size (GTK_STACK (stack), TRUE);
|
gtk_stack_set_interpolate_size (GTK_STACK (stack), TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER (popover), stack);
|
gtk_container_add (GTK_CONTAINER (popover), stack);
|
||||||
|
|
||||||
style_context = gtk_widget_get_style_context (GTK_WIDGET (popover));
|
gtk_widget_add_style_class (GTK_WIDGET (popover), GTK_STYLE_CLASS_MENU);
|
||||||
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_MENU);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkCellArea *
|
static GtkCellArea *
|
||||||
@ -682,19 +680,19 @@ gtk_tree_popover_create_item (GtkTreePopover *popover,
|
|||||||
|
|
||||||
item = gtk_gizmo_new ("modelbutton", NULL, NULL, NULL, NULL);
|
item = gtk_gizmo_new ("modelbutton", NULL, NULL, NULL, NULL);
|
||||||
gtk_widget_set_layout_manager (item, gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL));
|
gtk_widget_set_layout_manager (item, gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL));
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (item), "flat");
|
gtk_widget_add_style_class (item, "flat");
|
||||||
|
|
||||||
if (header_item)
|
if (header_item)
|
||||||
{
|
{
|
||||||
indicator = gtk_builtin_icon_new ("arrow");
|
indicator = gtk_builtin_icon_new ("arrow");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (indicator), "left");
|
gtk_widget_add_style_class (indicator, "left");
|
||||||
gtk_widget_set_parent (indicator, item);
|
gtk_widget_set_parent (indicator, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_set_parent (view, item);
|
gtk_widget_set_parent (view, item);
|
||||||
|
|
||||||
indicator = gtk_builtin_icon_new (has_submenu ? "arrow" : "none");
|
indicator = gtk_builtin_icon_new (has_submenu ? "arrow" : "none");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (indicator), "right");
|
gtk_widget_add_style_class (indicator, "right");
|
||||||
gtk_widget_set_parent (indicator, item);
|
gtk_widget_set_parent (indicator, item);
|
||||||
|
|
||||||
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
|
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
|
||||||
|
@ -1781,8 +1781,7 @@ gtk_tree_view_init (GtkTreeView *tree_view)
|
|||||||
gtk_tree_view_do_set_vadjustment (tree_view, NULL);
|
gtk_tree_view_do_set_vadjustment (tree_view, NULL);
|
||||||
gtk_tree_view_do_set_hadjustment (tree_view, NULL);
|
gtk_tree_view_do_set_hadjustment (tree_view, NULL);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tree_view)),
|
gtk_widget_add_style_class (GTK_WIDGET (tree_view), GTK_STYLE_CLASS_VIEW);
|
||||||
GTK_STYLE_CLASS_VIEW);
|
|
||||||
|
|
||||||
widget_node = gtk_widget_get_css_node (GTK_WIDGET (tree_view));
|
widget_node = gtk_widget_get_css_node (GTK_WIDGET (tree_view));
|
||||||
tree_view->header_node = gtk_css_node_new ();
|
tree_view->header_node = gtk_css_node_new ();
|
||||||
|
@ -354,8 +354,7 @@ gtk_viewport_init (GtkViewport *viewport)
|
|||||||
priv->hadjustment = NULL;
|
priv->hadjustment = NULL;
|
||||||
priv->vadjustment = NULL;
|
priv->vadjustment = NULL;
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget),
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_FRAME);
|
||||||
GTK_STYLE_CLASS_FRAME);
|
|
||||||
viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, NULL);
|
viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||||
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, NULL);
|
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, NULL);
|
||||||
}
|
}
|
||||||
@ -451,27 +450,20 @@ viewport_set_adjustment (GtkViewport *viewport,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_viewport_set_shadow_type (GtkViewport *viewport,
|
gtk_viewport_set_shadow_type (GtkViewport *viewport,
|
||||||
GtkShadowType type)
|
GtkShadowType type)
|
||||||
{
|
{
|
||||||
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
|
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
|
||||||
GtkWidget *widget;
|
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
||||||
|
|
||||||
widget = GTK_WIDGET (viewport);
|
|
||||||
|
|
||||||
if ((GtkShadowType) priv->shadow_type != type)
|
if ((GtkShadowType) priv->shadow_type != type)
|
||||||
{
|
{
|
||||||
priv->shadow_type = type;
|
priv->shadow_type = type;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
|
||||||
if (type != GTK_SHADOW_NONE)
|
if (type != GTK_SHADOW_NONE)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
|
gtk_widget_add_style_class (GTK_WIDGET (viewport), GTK_STYLE_CLASS_FRAME);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
|
gtk_widget_remove_style_class (GTK_WIDGET (viewport), GTK_STYLE_CLASS_FRAME);
|
||||||
|
|
||||||
gtk_widget_queue_resize (widget);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (viewport), "shadow-type");
|
g_object_notify (G_OBJECT (viewport), "shadow-type");
|
||||||
}
|
}
|
||||||
|
@ -5454,16 +5454,13 @@ _gtk_widget_set_has_default (GtkWidget *widget,
|
|||||||
gboolean has_default)
|
gboolean has_default)
|
||||||
{
|
{
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
priv->has_default = has_default;
|
priv->has_default = has_default;
|
||||||
|
|
||||||
context = _gtk_widget_get_style_context (widget);
|
|
||||||
|
|
||||||
if (has_default)
|
if (has_default)
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT);
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_DEFAULT);
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_DEFAULT);
|
gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9728,13 +9725,10 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable,
|
|||||||
else if (strcmp (tagname, "style") == 0)
|
else if (strcmp (tagname, "style") == 0)
|
||||||
{
|
{
|
||||||
StyleParserData *style_data = (StyleParserData *)user_data;
|
StyleParserData *style_data = (StyleParserData *)user_data;
|
||||||
GtkStyleContext *context;
|
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
context = _gtk_widget_get_style_context (GTK_WIDGET (buildable));
|
|
||||||
|
|
||||||
for (l = style_data->classes; l; l = l->next)
|
for (l = style_data->classes; l; l = l->next)
|
||||||
gtk_style_context_add_class (context, (const gchar *)l->data);
|
gtk_widget_add_style_class (GTK_WIDGET (buildable), (const char *)l->data);
|
||||||
|
|
||||||
gtk_widget_reset_style (GTK_WIDGET (buildable));
|
gtk_widget_reset_style (GTK_WIDGET (buildable));
|
||||||
|
|
||||||
|
@ -3690,13 +3690,9 @@ gtk_window_enable_csd (GtkWindow *window)
|
|||||||
|
|
||||||
/* We need a visual with alpha for client shadows */
|
/* We need a visual with alpha for client shadows */
|
||||||
if (priv->use_client_shadow)
|
if (priv->use_client_shadow)
|
||||||
{
|
gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_CSD);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_CSD);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
gtk_widget_add_style_class (widget, "solid-csd");
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "solid-csd");
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->client_decorated = TRUE;
|
priv->client_decorated = TRUE;
|
||||||
}
|
}
|
||||||
@ -3755,7 +3751,7 @@ gtk_window_set_titlebar (GtkWindow *window,
|
|||||||
if (titlebar == NULL)
|
if (titlebar == NULL)
|
||||||
{
|
{
|
||||||
priv->client_decorated = FALSE;
|
priv->client_decorated = FALSE;
|
||||||
gtk_style_context_remove_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_CSD);
|
gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_CSD);
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -3777,8 +3773,7 @@ gtk_window_set_titlebar (GtkWindow *window,
|
|||||||
on_titlebar_title_notify (GTK_HEADER_BAR (titlebar), NULL, window);
|
on_titlebar_title_notify (GTK_HEADER_BAR (titlebar), NULL, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (titlebar),
|
gtk_widget_add_style_class (titlebar, GTK_STYLE_CLASS_TITLEBAR);
|
||||||
GTK_STYLE_CLASS_TITLEBAR);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (was_mapped)
|
if (was_mapped)
|
||||||
@ -4787,7 +4782,6 @@ create_titlebar (GtkWindow *window)
|
|||||||
{
|
{
|
||||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||||
GtkWidget *titlebar;
|
GtkWidget *titlebar;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
titlebar = gtk_header_bar_new ();
|
titlebar = gtk_header_bar_new ();
|
||||||
g_object_set (titlebar,
|
g_object_set (titlebar,
|
||||||
@ -4795,9 +4789,8 @@ create_titlebar (GtkWindow *window)
|
|||||||
"has-subtitle", FALSE,
|
"has-subtitle", FALSE,
|
||||||
"show-title-buttons", TRUE,
|
"show-title-buttons", TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
context = gtk_widget_get_style_context (titlebar);
|
gtk_widget_add_style_class (titlebar, GTK_STYLE_CLASS_TITLEBAR);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLEBAR);
|
gtk_widget_add_style_class (titlebar, "default-decoration");
|
||||||
gtk_style_context_add_class (context, "default-decoration");
|
|
||||||
|
|
||||||
return titlebar;
|
return titlebar;
|
||||||
}
|
}
|
||||||
@ -5692,56 +5685,50 @@ static void
|
|||||||
update_window_style_classes (GtkWindow *window)
|
update_window_style_classes (GtkWindow *window)
|
||||||
{
|
{
|
||||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||||
GtkStyleContext *context;
|
GtkWidget *widget = GTK_WIDGET (window);
|
||||||
guint edge_constraints;
|
guint edge_constraints;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
|
||||||
edge_constraints = priv->edge_constraints;
|
edge_constraints = priv->edge_constraints;
|
||||||
|
|
||||||
if (!priv->edge_constraints)
|
if (!priv->edge_constraints)
|
||||||
{
|
{
|
||||||
if (priv->tiled)
|
if (priv->tiled)
|
||||||
gtk_style_context_add_class (context, "tiled");
|
gtk_widget_add_style_class (widget, "titled");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "tiled");
|
gtk_widget_remove_style_class (widget, "tiled");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (edge_constraints & GDK_SURFACE_STATE_TOP_TILED)
|
if (edge_constraints & GDK_SURFACE_STATE_TOP_TILED)
|
||||||
gtk_style_context_add_class (context, "tiled-top");
|
gtk_widget_add_style_class (widget, "titled-top");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "tiled-top");
|
gtk_widget_remove_style_class (widget, "tiled-top");
|
||||||
|
|
||||||
if (edge_constraints & GDK_SURFACE_STATE_RIGHT_TILED)
|
if (edge_constraints & GDK_SURFACE_STATE_RIGHT_TILED)
|
||||||
gtk_style_context_add_class (context, "tiled-right");
|
gtk_widget_add_style_class (widget, "titled-right");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "tiled-right");
|
gtk_widget_remove_style_class (widget, "tiled-right");
|
||||||
|
|
||||||
if (edge_constraints & GDK_SURFACE_STATE_BOTTOM_TILED)
|
if (edge_constraints & GDK_SURFACE_STATE_BOTTOM_TILED)
|
||||||
gtk_style_context_add_class (context, "tiled-bottom");
|
gtk_widget_add_style_class (widget, "titled-bottom");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "tiled-bottom");
|
gtk_widget_remove_style_class (widget, "tiled-bottom");
|
||||||
|
|
||||||
if (edge_constraints & GDK_SURFACE_STATE_LEFT_TILED)
|
if (edge_constraints & GDK_SURFACE_STATE_LEFT_TILED)
|
||||||
gtk_style_context_add_class (context, "tiled-left");
|
gtk_widget_add_style_class (widget, "titled-left");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "tiled-left");
|
gtk_widget_remove_style_class (widget, "tiled-left");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->maximized)
|
if (priv->maximized)
|
||||||
gtk_style_context_add_class (context, "maximized");
|
gtk_widget_add_style_class (widget, "maximized");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "maximized");
|
gtk_widget_remove_style_class (widget, "maximized");
|
||||||
|
|
||||||
if (priv->maximized)
|
|
||||||
gtk_style_context_add_class (context, "maximized");
|
|
||||||
else
|
|
||||||
gtk_style_context_remove_class (context, "maximized");
|
|
||||||
|
|
||||||
if (priv->fullscreen)
|
if (priv->fullscreen)
|
||||||
gtk_style_context_add_class (context, "fullscreen");
|
gtk_widget_add_style_class (widget, "fullscreen");
|
||||||
else
|
else
|
||||||
gtk_style_context_remove_class (context, "fullscreen");
|
gtk_widget_remove_style_class (widget, "fullscreen");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user