Ignore deprecations where needed

There are a few places where we are still using deprecated
API internally - ignore deprecations around these uses.
This commit is contained in:
Matthias Clasen 2013-05-05 10:31:08 -04:00
parent 7d8e755d16
commit f5f5b70355
8 changed files with 112 additions and 22 deletions

View File

@ -222,7 +222,9 @@ rgba_value_compute (GtkStyleProviderPrivate *provider,
const GValue *value;
value = _gtk_css_typed_value_get (specified);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR))
{
GtkSymbolicColor *symbolic = g_value_get_boxed (value);
@ -250,6 +252,8 @@ rgba_value_compute (GtkStyleProviderPrivate *provider,
}
else
return _gtk_css_value_ref (specified);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
static gboolean
@ -314,7 +318,9 @@ color_value_compute (GtkStyleProviderPrivate *provider,
const GValue *value;
value = _gtk_css_typed_value_get (specified);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR))
{
GValue new_value = G_VALUE_INIT;
@ -334,13 +340,15 @@ color_value_compute (GtkStyleProviderPrivate *provider,
color.blue = rgba->blue * 65535. + 0.5;
_gtk_css_value_unref (val);
}
g_value_init (&new_value, GDK_TYPE_COLOR);
g_value_set_boxed (&new_value, &color);
return _gtk_css_typed_value_new_take (&new_value);
}
else
return _gtk_css_value_ref (specified);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
static gboolean
@ -742,8 +750,13 @@ pattern_value_parse (GtkCssParser *parser,
else if (_gtk_css_parser_begins_with (parser, '-'))
{
g_value_unset (value);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_value_init (value, GTK_TYPE_GRADIENT);
return gradient_value_parse (parser, value);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
else
{
@ -871,11 +884,13 @@ pattern_value_compute (GtkStyleProviderPrivate *provider,
{
const GValue *value = _gtk_css_typed_value_get (specified);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (G_VALUE_HOLDS (value, GTK_TYPE_GRADIENT))
{
GValue new_value = G_VALUE_INIT;
cairo_pattern_t *gradient;
gradient = _gtk_gradient_resolve_full (g_value_get_boxed (value), provider, values, parent_values, dependencies);
g_value_init (&new_value, CAIRO_GOBJECT_TYPE_PATTERN);
@ -884,6 +899,8 @@ pattern_value_compute (GtkStyleProviderPrivate *provider,
}
else
return _gtk_css_value_ref (specified);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
static gboolean
@ -999,10 +1016,16 @@ gtk_css_style_funcs_init (void)
color_value_parse,
color_value_print,
color_value_compute);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
register_conversion_function (GTK_TYPE_SYMBOLIC_COLOR,
symbolic_color_value_parse,
symbolic_color_value_print,
NULL);
G_GNUC_END_IGNORE_DEPRECATIONS;
register_conversion_function (PANGO_TYPE_FONT_DESCRIPTION,
font_description_value_parse,
font_description_value_print,
@ -1039,10 +1062,16 @@ gtk_css_style_funcs_init (void)
border_value_parse,
border_value_print,
NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
register_conversion_function (GTK_TYPE_GRADIENT,
gradient_value_parse,
gradient_value_print,
NULL);
G_GNUC_END_IGNORE_DEPRECATIONS;
register_conversion_function (CAIRO_GOBJECT_TYPE_PATTERN,
pattern_value_parse,
pattern_value_print,

View File

@ -1796,9 +1796,11 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set,
GtkStateFlags flags = 0;
g_return_val_if_fail (icon_set != NULL, NULL);
g_return_val_if_fail (style == NULL || GTK_IS_STYLE (style), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_return_val_if_fail (style == NULL || GTK_IS_STYLE (style), NULL);
if (style && gtk_style_has_context (style))
{
g_object_get (style, "context", &context, NULL);
@ -1830,6 +1832,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_style_context_set_state (context, flags);
gtk_style_context_set_direction (context, direction);
G_GNUC_END_IGNORE_DEPRECATIONS;
icon = gtk_icon_set_render_icon_pixbuf (icon_set, context, size);

View File

@ -5489,9 +5489,14 @@ child_at (GtkMenu *menu,
{
child = children->data;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (child_offset + child_requisition.height > y &&
!GTK_IS_TEAROFF_MENU_ITEM (child))
return child;
G_GNUC_END_IGNORE_DEPRECATIONS
}
child_offset += child_requisition.height;

View File

@ -1139,12 +1139,18 @@ gtk_menu_is_empty (GtkWidget *menu)
{
if (gtk_widget_get_visible (cur->data))
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!GTK_IS_TEAROFF_MENU_ITEM (cur->data) &&
!g_object_get_data (cur->data, "gtk-empty-menu-item"))
{
result = FALSE;
break;
}
G_GNUC_END_IGNORE_DEPRECATIONS
}
cur = cur->next;
}

View File

@ -1544,8 +1544,14 @@ gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
_gtk_menu_item_is_selectable (child))
{
to_select = child;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!GTK_IS_TEAROFF_MENU_ITEM (child))
break;
G_GNUC_END_IGNORE_DEPRECATIONS
}
tmp_list = tmp_list->next;
@ -1572,8 +1578,13 @@ _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
_gtk_menu_item_is_selectable (child))
{
to_select = child;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!GTK_IS_TEAROFF_MENU_ITEM (child))
break;
G_GNUC_END_IGNORE_DEPRECATIONS
}
tmp_list = tmp_list->prev;

View File

@ -54,8 +54,6 @@
#include "deprecated/gtkrc.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* SECTION:gtksettings
* @Short_description: Sharing settings between applications
@ -2109,6 +2107,8 @@ gtk_settings_set_double_property (GtkSettings *settings,
g_value_unset (&svalue.value);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* gtk_rc_property_parse_color:
* @pspec: a #GParamSpec
@ -2444,6 +2444,8 @@ gtk_rc_property_parse_border (const GParamSpec *pspec,
return success;
}
G_GNUC_END_IGNORE_DEPRECATIONS
void
_gtk_settings_handle_event (GdkEventSetting *event)
{

View File

@ -45,11 +45,6 @@
#include "gtkwindow.h"
#include "gtkprivate.h"
#undef GDK_DEPRECATED
#undef GDK_DEPRECATED_FOR
#define GDK_DEPRECATED
#define GDK_DEPRECATED_FOR(f)
#include "gtkuimanager.h"
#include "deprecated/gtktearoffmenuitem.h"
@ -2299,10 +2294,16 @@ find_menu_position (GNode *node,
if (GTK_IS_MENU_ITEM (menushell))
menushell = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menushell));
siblings = gtk_container_get_children (GTK_CONTAINER (menushell));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
pos = 1;
else
pos = 0;
G_GNUC_END_IGNORE_DEPRECATIONS
g_list_free (siblings);
break;
case NODE_TYPE_MENU_PLACEHOLDER:
@ -2483,15 +2484,21 @@ update_smart_separators (GtkWidget *proxy)
else if (gtk_widget_get_visible (cur->data))
{
last = NULL;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_TEAROFF_MENU_ITEM (cur->data) || cur->data == filler)
visible = FALSE;
else
else
{
visible = TRUE;
empty = FALSE;
}
G_GNUC_END_IGNORE_DEPRECATIONS
}
cur = cur->next;
}
@ -2597,16 +2604,19 @@ update_node (GtkUIManager *manager,
*/
if (info->proxy != NULL && action == info->action)
{
if (info->type == NODE_TYPE_MENU)
if (info->type == NODE_TYPE_MENU)
{
GtkWidget *menu;
GList *siblings;
if (GTK_IS_MENU (info->proxy))
menu = info->proxy;
else
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
siblings = gtk_container_get_children (GTK_CONTAINER (menu));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
{
if (manager->private_data->add_tearoffs && !in_popup)
@ -2614,9 +2624,12 @@ update_node (GtkUIManager *manager,
else
gtk_widget_hide (GTK_WIDGET (siblings->data));
}
G_GNUC_END_IGNORE_DEPRECATIONS
g_list_free (siblings);
}
goto recurse_children;
}
@ -2684,10 +2697,14 @@ update_node (GtkUIManager *manager,
{
GtkWidget *tearoff;
GtkWidget *filler;
menu = gtk_menu_new ();
gtk_widget_set_name (menu, info->name);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
tearoff = gtk_tearoff_menu_item_new ();
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_set_no_show_all (tearoff, TRUE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
filler = gtk_menu_item_new_with_label (_("Empty"));
@ -2698,7 +2715,7 @@ update_node (GtkUIManager *manager,
gtk_widget_set_no_show_all (filler, TRUE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), filler);
}
if (NODE_INFO (node->parent)->type == NODE_TYPE_TOOLITEM)
{
info->proxy = menu;
@ -2718,7 +2735,7 @@ update_node (GtkUIManager *manager,
g_signal_connect (info->proxy, "notify::visible",
G_CALLBACK (update_smart_separators), NULL);
gtk_widget_set_name (info->proxy, info->name);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), menu);
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell), info->proxy, pos);
}
@ -2726,20 +2743,23 @@ update_node (GtkUIManager *manager,
}
else
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), action);
if (prev_submenu)
{
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy),
prev_submenu);
g_object_unref (prev_submenu);
}
if (GTK_IS_MENU (info->proxy))
menu = info->proxy;
else
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
siblings = gtk_container_get_children (GTK_CONTAINER (menu));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
{
if (manager->private_data->add_tearoffs && !in_popup)
@ -2747,6 +2767,9 @@ update_node (GtkUIManager *manager,
else
gtk_widget_hide (GTK_WIDGET (siblings->data));
}
G_GNUC_END_IGNORE_DEPRECATIONS
g_list_free (siblings);
}
break;

View File

@ -1285,6 +1285,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
P_("Whether the widget is part of a composite widget"),
FALSE,
GTK_PARAM_READABLE));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_object_class_install_property (gobject_class,
PROP_STYLE,
g_param_spec_object ("style",
@ -1292,6 +1295,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
P_("The style of the widget, which contains information about how it will look (colors etc)"),
GTK_TYPE_STYLE,
GTK_PARAM_READWRITE));
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_class_install_property (gobject_class,
PROP_EVENTS,
g_param_spec_flags ("events",
@ -1870,6 +1876,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
*
* Deprecated:3.0: Use the #GtkWidget::style-updated signal
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
widget_signals[STYLE_SET] =
g_signal_new (I_("style-set"),
G_TYPE_FROM_CLASS (gobject_class),
@ -1880,6 +1889,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
G_TYPE_NONE, 1,
GTK_TYPE_STYLE);
G_GNUC_END_IGNORE_DEPRECATIONS
/**
* GtkWidget::style-updated:
* @widget: the object on which the signal is emitted