mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
stylecontext: Remove deprecated API
This commit is contained in:
parent
5c526c9926
commit
502e63eddc
@ -5396,7 +5396,6 @@ gtk_style_context_new
|
||||
gtk_style_context_add_provider
|
||||
gtk_style_context_add_provider_for_screen
|
||||
gtk_style_context_get
|
||||
gtk_style_context_get_direction
|
||||
GtkJunctionSides
|
||||
gtk_style_context_get_junction_sides
|
||||
gtk_style_context_get_parent
|
||||
@ -5417,7 +5416,6 @@ gtk_style_context_get_border
|
||||
gtk_style_context_get_padding
|
||||
gtk_style_context_get_margin
|
||||
gtk_style_context_get_font
|
||||
gtk_style_context_invalidate
|
||||
gtk_style_context_state_is_running
|
||||
gtk_style_context_lookup_color
|
||||
gtk_style_context_remove_provider
|
||||
@ -5426,7 +5424,6 @@ gtk_style_context_reset_widgets
|
||||
gtk_style_context_set_background
|
||||
gtk_style_context_restore
|
||||
gtk_style_context_save
|
||||
gtk_style_context_set_direction
|
||||
gtk_style_context_set_junction_sides
|
||||
gtk_style_context_set_parent
|
||||
gtk_style_context_set_path
|
||||
|
@ -144,7 +144,6 @@ struct _GtkStyleContextPrivate
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_SCREEN,
|
||||
PROP_DIRECTION,
|
||||
PROP_FRAME_CLOCK,
|
||||
PROP_PARENT,
|
||||
LAST_PROP
|
||||
@ -230,14 +229,6 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
properties[PROP_DIRECTION] =
|
||||
g_param_spec_enum ("direction",
|
||||
P_("Direction"),
|
||||
P_("Text direction"),
|
||||
GTK_TYPE_TEXT_DIRECTION,
|
||||
GTK_TEXT_DIR_LTR,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
|
||||
|
||||
/**
|
||||
* GtkStyleContext:parent:
|
||||
*
|
||||
@ -394,11 +385,6 @@ gtk_style_context_impl_set_property (GObject *object,
|
||||
case PROP_SCREEN:
|
||||
gtk_style_context_set_screen (context, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_DIRECTION:
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
gtk_style_context_set_direction (context, g_value_get_enum (value));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
break;
|
||||
case PROP_FRAME_CLOCK:
|
||||
gtk_style_context_set_frame_clock (context, g_value_get_object (value));
|
||||
break;
|
||||
@ -425,11 +411,6 @@ gtk_style_context_impl_get_property (GObject *object,
|
||||
case PROP_SCREEN:
|
||||
g_value_set_object (value, priv->screen);
|
||||
break;
|
||||
case PROP_DIRECTION:
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
g_value_set_enum (value, gtk_style_context_get_direction (context));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
break;
|
||||
case PROP_FRAME_CLOCK:
|
||||
g_value_set_object (value, priv->frame_clock);
|
||||
break;
|
||||
@ -898,17 +879,9 @@ void
|
||||
gtk_style_context_set_state (GtkStyleContext *context,
|
||||
GtkStateFlags flags)
|
||||
{
|
||||
GtkStateFlags old_flags;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
old_flags = gtk_css_node_get_state (context->priv->cssnode);
|
||||
|
||||
gtk_css_node_set_state (context->priv->cssnode, flags);
|
||||
|
||||
if (((old_flags ^ flags) & (GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL)) &&
|
||||
!gtk_style_context_is_saved (context))
|
||||
g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_DIRECTION]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1757,83 +1730,6 @@ gtk_style_context_get_frame_clock (GtkStyleContext *context)
|
||||
return context->priv->frame_clock;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_set_direction:
|
||||
* @context: a #GtkStyleContext
|
||||
* @direction: the new direction.
|
||||
*
|
||||
* Sets the reading direction for rendering purposes.
|
||||
*
|
||||
* If you are using a #GtkStyleContext returned from
|
||||
* gtk_widget_get_style_context(), you do not need to
|
||||
* call this yourself.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Use gtk_style_context_set_state() with
|
||||
* #GTK_STATE_FLAG_DIR_LTR and #GTK_STATE_FLAG_DIR_RTL
|
||||
* instead.
|
||||
**/
|
||||
void
|
||||
gtk_style_context_set_direction (GtkStyleContext *context,
|
||||
GtkTextDirection direction)
|
||||
{
|
||||
GtkStateFlags state;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
state = gtk_style_context_get_state (context);
|
||||
state &= ~(GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL);
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case GTK_TEXT_DIR_LTR:
|
||||
state |= GTK_STATE_FLAG_DIR_LTR;
|
||||
break;
|
||||
|
||||
case GTK_TEXT_DIR_RTL:
|
||||
state |= GTK_STATE_FLAG_DIR_RTL;
|
||||
break;
|
||||
|
||||
case GTK_TEXT_DIR_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_style_context_set_state (context, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_get_direction:
|
||||
* @context: a #GtkStyleContext
|
||||
*
|
||||
* Returns the widget direction used for rendering.
|
||||
*
|
||||
* Returns: the widget direction
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Use gtk_style_context_get_state() and
|
||||
* check for #GTK_STATE_FLAG_DIR_LTR and
|
||||
* #GTK_STATE_FLAG_DIR_RTL instead.
|
||||
**/
|
||||
GtkTextDirection
|
||||
gtk_style_context_get_direction (GtkStyleContext *context)
|
||||
{
|
||||
GtkStateFlags state;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), GTK_TEXT_DIR_LTR);
|
||||
|
||||
state = gtk_style_context_get_state (context);
|
||||
|
||||
if (state & GTK_STATE_FLAG_DIR_LTR)
|
||||
return GTK_TEXT_DIR_LTR;
|
||||
else if (state & GTK_STATE_FLAG_DIR_RTL)
|
||||
return GTK_TEXT_DIR_RTL;
|
||||
else
|
||||
return GTK_TEXT_DIR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_set_junction_sides:
|
||||
* @context: a #GtkStyleContext
|
||||
@ -1956,28 +1852,6 @@ gtk_style_context_validate (GtkStyleContext *context,
|
||||
priv->invalidating_context = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_invalidate:
|
||||
* @context: a #GtkStyleContext.
|
||||
*
|
||||
* Invalidates @context style information, so it will be reconstructed
|
||||
* again. It is useful if you modify the @context and need the new
|
||||
* information immediately.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.12: Style contexts are invalidated automatically.
|
||||
**/
|
||||
void
|
||||
gtk_style_context_invalidate (GtkStyleContext *context)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_clear_property_cache (context);
|
||||
|
||||
gtk_style_context_validate (context, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_get_color:
|
||||
* @context: a #GtkStyleContext
|
||||
|
@ -1080,12 +1080,6 @@ void gtk_style_context_set_frame_clock (GtkStyleContext *context,
|
||||
GDK_AVAILABLE_IN_3_8
|
||||
GdkFrameClock *gtk_style_context_get_frame_clock (GtkStyleContext *context);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8_FOR(gtk_style_context_set_state)
|
||||
void gtk_style_context_set_direction (GtkStyleContext *context,
|
||||
GtkTextDirection direction);
|
||||
GDK_DEPRECATED_IN_3_8_FOR(gtk_style_context_get_state)
|
||||
GtkTextDirection gtk_style_context_get_direction (GtkStyleContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_set_junction_sides (GtkStyleContext *context,
|
||||
GtkJunctionSides sides);
|
||||
@ -1118,8 +1112,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_get_margin (GtkStyleContext *context,
|
||||
GtkBorder *margin);
|
||||
|
||||
GDK_DEPRECATED_IN_3_12
|
||||
void gtk_style_context_invalidate (GtkStyleContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_reset_widgets (GdkScreen *screen);
|
||||
|
||||
|
@ -257,24 +257,6 @@ test_basic_properties (void)
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
void
|
||||
test_invalidate_saved (void)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkStyleContext *context;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
context = gtk_widget_get_style_context (window);
|
||||
gtk_style_context_save (context);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_invalidate (context);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
void
|
||||
test_widget_path_parent (void)
|
||||
{
|
||||
@ -533,7 +515,6 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/style/path", test_path);
|
||||
g_test_add_func ("/style/match", test_match);
|
||||
g_test_add_func ("/style/basic", test_basic_properties);
|
||||
g_test_add_func ("/style/invalidate-saved", test_invalidate_saved);
|
||||
g_test_add_func ("/style/widget-path-parent", test_widget_path_parent);
|
||||
g_test_add_func ("/style/classes", test_style_classes);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user