Some more interning

This avoids more strdups at startup.
This commit is contained in:
Matthias Clasen 2017-11-18 08:18:11 -05:00
parent 997f0de4d5
commit a8531605db
20 changed files with 62 additions and 67 deletions

View File

@ -1063,7 +1063,7 @@ get_component_paddings (GtkCalendar *calendar,
if (day_padding)
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "day-number");
gtk_style_context_add_class (context, I_("day-number"));
gtk_style_context_get_padding (context, day_padding);
gtk_style_context_restore (context);
}
@ -1071,7 +1071,7 @@ get_component_paddings (GtkCalendar *calendar,
if (day_name_padding)
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "day-name");
gtk_style_context_add_class (context, I_("day-name"));
gtk_style_context_get_padding (context, day_name_padding);
gtk_style_context_restore (context);
}
@ -1079,7 +1079,7 @@ get_component_paddings (GtkCalendar *calendar,
if (week_padding)
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "week-number");
gtk_style_context_add_class (context, I_("week-number"));
gtk_style_context_get_padding (context, week_padding);
gtk_style_context_restore (context);
}

View File

@ -131,10 +131,8 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
g_param_spec_int ("minimum-width",
P_("Minimum Width"),
P_("Minimum cached width"),
-1,
G_MAXINT,
-1,
G_PARAM_READABLE));
-1, G_MAXINT, -1,
GTK_PARAM_READABLE));
/**
* GtkCellAreaContext:natural-width:
@ -150,10 +148,8 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
g_param_spec_int ("natural-width",
P_("Minimum Width"),
P_("Minimum cached width"),
-1,
G_MAXINT,
-1,
G_PARAM_READABLE));
-1, G_MAXINT, -1,
GTK_PARAM_READABLE));
/**
* GtkCellAreaContext:minimum-height:
@ -169,10 +165,8 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
g_param_spec_int ("minimum-height",
P_("Minimum Height"),
P_("Minimum cached height"),
-1,
G_MAXINT,
-1,
G_PARAM_READABLE));
-1, G_MAXINT, -1,
GTK_PARAM_READABLE));
/**
* GtkCellAreaContext:natural-height:
@ -188,10 +182,8 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class)
g_param_spec_int ("natural-height",
P_("Minimum Height"),
P_("Minimum cached height"),
-1,
G_MAXINT,
-1,
G_PARAM_READABLE));
-1, G_MAXINT, -1,
GTK_PARAM_READABLE));
}
/*************************************************************

View File

@ -553,7 +553,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
gtk_container_add (GTK_CONTAINER (box), button);
cc->priv->settings = g_settings_new ("org.gtk.Settings.ColorChooser");
variant = g_settings_get_value (cc->priv->settings, "custom-colors");
variant = g_settings_get_value (cc->priv->settings, I_("custom-colors"));
g_variant_iter_init (&iter, variant);
i = 0;
p = NULL;
@ -587,7 +587,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
gtk_container_add (GTK_CONTAINER (cc), box);
gtk_container_add (GTK_CONTAINER (box), cc->priv->editor);
g_settings_get (cc->priv->settings, "selected-color", "(bdddd)",
g_settings_get (cc->priv->settings, I_("selected-color"), "(bdddd)",
&selected,
&color.red, &color.green, &color.blue, &color.alpha);
if (selected)

View File

@ -26,6 +26,7 @@
#include "gtkgesturelongpress.h"
#include "gtkintl.h"
#include "gtksnapshot.h"
#include "gtkprivate.h"
struct _GtkColorPlanePrivate
{
@ -516,7 +517,7 @@ gtk_color_plane_class_init (GtkColorPlaneClass *class)
"Hue Adjustment",
"Hue Adjustment",
GTK_TYPE_ADJUSTMENT,
G_PARAM_WRITABLE |
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
@ -525,7 +526,7 @@ gtk_color_plane_class_init (GtkColorPlaneClass *class)
"Saturation Adjustment",
"Saturation Adjustment",
GTK_TYPE_ADJUSTMENT,
G_PARAM_WRITABLE |
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
@ -534,7 +535,7 @@ gtk_color_plane_class_init (GtkColorPlaneClass *class)
"Value Adjustment",
"Value Adjustment",
GTK_TYPE_ADJUSTMENT,
G_PARAM_WRITABLE |
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
}

View File

@ -22,6 +22,7 @@
#include "gtkicontheme.h"
#include "gtksettingsprivate.h"
#include "gtkstyleproviderprivate.h"
#include "gtkintl.h"
/*
* The idea behind this value (and the '-gtk-icon-theme' CSS property) is
@ -134,7 +135,7 @@ gtk_css_icon_theme_value_new (GtkIconTheme *icontheme)
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_ICON_THEME);
result->icontheme = g_object_ref (icontheme);
g_object_set_data (G_OBJECT (icontheme), "-gtk-css-value", result);
g_object_set_data (G_OBJECT (icontheme), I_("-gtk-css-value"), result);
result->changed_id = g_signal_connect (icontheme, "changed", G_CALLBACK (gtk_css_value_icon_theme_changed_cb), result);
return result;

View File

@ -1218,8 +1218,7 @@ parse_simple_selector (GtkCssParser *parser,
name = _gtk_css_parser_try_ident (parser, FALSE);
if (name)
{
selector = gtk_css_selector_new (&GTK_CSS_SELECTOR_NAME,
selector);
selector = gtk_css_selector_new (&GTK_CSS_SELECTOR_NAME, selector);
selector->name.name = g_intern_string (name);
g_free (name);
parsed_something = TRUE;

View File

@ -33,6 +33,7 @@
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsstransitionprivate.h"
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtksettings.h"
#include "gtkstyleanimationprivate.h"
#include "gtkstylepropertyprivate.h"
@ -158,7 +159,7 @@ gtk_css_static_style_get_default (void)
default_style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER (settings),
NULL,
NULL);
g_object_set_data_full (G_OBJECT (settings), "gtk-default-style",
g_object_set_data_full (G_OBJECT (settings), I_("gtk-default-style"),
default_style, clear_default_style);
}

View File

@ -8436,14 +8436,14 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
P_("Search mode"),
P_("Search mode"),
FALSE,
G_PARAM_READWRITE));
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_SUBTITLE,
g_param_spec_string ("subtitle",
P_("Subtitle"),
P_("Subtitle"),
"",
G_PARAM_READABLE));
GTK_PARAM_READABLE));
_gtk_file_chooser_install_properties (gobject_class);

View File

@ -3409,7 +3409,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("The selection mode"),
GTK_TYPE_SELECTION_MODE,
GTK_SELECTION_SINGLE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkFlowBox:activate-on-single-click:
@ -3422,7 +3422,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("Activate on Single Click"),
P_("Activate row on a single click"),
TRUE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkFlowBox:homogeneous:
@ -3435,7 +3435,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("Homogeneous"),
P_("Whether the children should all be the same size"),
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkFlowBox:min-children-per-line:
@ -3453,7 +3453,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("The minimum number of children to allocate "
"consecutively in the given orientation."),
0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkFlowBox:max-children-per-line:
@ -3467,7 +3467,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("The maximum amount of children to request space for "
"consecutively in the given orientation."),
1, G_MAXUINT, DEFAULT_MAX_CHILDREN_PER_LINE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkFlowBox:row-spacing:
@ -3479,7 +3479,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("Vertical spacing"),
P_("The amount of vertical space between two children"),
0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkFlowBox:column-spacing:
@ -3491,7 +3491,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
P_("Horizontal spacing"),
P_("The amount of horizontal space between two children"),
0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, LAST_PROP, props);

View File

@ -244,7 +244,7 @@ gtk_lock_button_init (GtkLockButton *button)
update_state (button);
context = gtk_widget_get_style_context (GTK_WIDGET (button));
gtk_style_context_add_class (context, "lock");
gtk_style_context_add_class (context, I_("lock"));
}
static void

View File

@ -22,6 +22,7 @@
#include "gtkmenutrackeritem.h"
#include "gtkactionmuxer.h"
#include "gtkdebug.h"
#include "gtkintl.h"
#include "gtkactionmuxer.h"
@ -141,7 +142,7 @@ gtk_menu_tracker_item_role_get_type (void)
};
GType type;
type = g_enum_register_static ("GtkMenuTrackerItemRole", values);
type = g_enum_register_static (I_("GtkMenuTrackerItemRole"), values);
g_once_init_leave (&gtk_menu_tracker_item_role_type, type);
}

View File

@ -64,6 +64,7 @@
#include "gtkgesturelongpress.h"
#include "gtkbox.h"
#include "gtkmodelbutton.h"
#include "gtkprivate.h"
/**
* SECTION:gtkplacessidebar
@ -4683,56 +4684,56 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
P_("Location to Select"),
P_("The location to highlight in the sidebar"),
G_TYPE_FILE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_OPEN_FLAGS] =
g_param_spec_flags ("open-flags",
P_("Open Flags"),
P_("Modes in which the calling application can open locations selected in the sidebar"),
GTK_TYPE_PLACES_OPEN_FLAGS,
GTK_PLACES_OPEN_NORMAL,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_SHOW_RECENT] =
g_param_spec_boolean ("show-recent",
P_("Show recent files"),
P_("Whether the sidebar includes a builtin shortcut for recent files"),
TRUE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_SHOW_DESKTOP] =
g_param_spec_boolean ("show-desktop",
P_("Show “Desktop”"),
P_("Whether the sidebar includes a builtin shortcut to the Desktop folder"),
TRUE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_SHOW_ENTER_LOCATION] =
g_param_spec_boolean ("show-enter-location",
P_("Show “Enter Location”"),
P_("Whether the sidebar includes a builtin shortcut to manually enter a location"),
FALSE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_LOCAL_ONLY] =
g_param_spec_boolean ("local-only",
P_("Local Only"),
P_("Whether the sidebar only includes local files"),
FALSE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_SHOW_TRASH] =
g_param_spec_boolean ("show-trash",
P_("Show “Trash”"),
P_("Whether the sidebar includes a builtin shortcut to the Trash location"),
TRUE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_SHOW_OTHER_LOCATIONS] =
g_param_spec_boolean ("show-other-locations",
P_("Show “Other locations”"),
P_("Whether the sidebar includes an item to show external locations"),
FALSE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_SHOW_STARRED_LOCATION] =
g_param_spec_boolean ("show-starred-location",
P_("Show “Starred Location”"),
P_("Whether the sidebar includes an item to show starred files"),
FALSE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
/**
@ -4744,7 +4745,7 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
* Since: 3.18
*/
properties[PROP_POPULATE_ALL] =
g_param_spec_boolean ("populate-all",
g_param_spec_boolean (I_("populate-all"),
P_("Populate all"),
P_("Whether to emit ::populate-popup for popups that are not menus"),
FALSE,

View File

@ -22,6 +22,7 @@
#include <gio/gvfs.h>
#include <gtk/gtk.h>
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkplacesviewprivate.h"
@ -2193,21 +2194,21 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
P_("Local Only"),
P_("Whether the sidebar only includes local files"),
FALSE,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
properties[PROP_LOADING] =
g_param_spec_boolean ("loading",
P_("Loading"),
P_("Whether the view is loading locations"),
FALSE,
G_PARAM_READABLE);
GTK_PARAM_READABLE);
properties[PROP_FETCHING_NETWORKS] =
g_param_spec_boolean ("fetching-networks",
P_("Fetching networks"),
P_("Whether the view is fetching networks"),
FALSE,
G_PARAM_READABLE);
GTK_PARAM_READABLE);
properties[PROP_OPEN_FLAGS] =
g_param_spec_flags ("open-flags",
@ -2215,7 +2216,7 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
P_("Modes in which the calling application can open locations selected in the sidebar"),
GTK_TYPE_PLACES_OPEN_FLAGS,
GTK_PLACES_OPEN_NORMAL,
G_PARAM_READWRITE);
GTK_PARAM_READWRITE);
g_object_class_install_properties (object_class, LAST_PROP, properties);

View File

@ -289,7 +289,7 @@ gtk_recent_manager_class_init (GtkRecentManagerClass *klass)
P_("Filename"),
P_("The full path to the file to be used to store and read the list"),
NULL,
(G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)));
(G_PARAM_CONSTRUCT_ONLY | GTK_PARAM_READWRITE)));
/**
* GtkRecentManager:size:
@ -303,10 +303,8 @@ gtk_recent_manager_class_init (GtkRecentManagerClass *klass)
g_param_spec_int ("size",
P_("Size"),
P_("The size of the recently used resources list"),
-1,
G_MAXINT,
0,
G_PARAM_READABLE));
-1, G_MAXINT, 0,
GTK_PARAM_READABLE));
/**
* GtkRecentManager::changed:

View File

@ -258,7 +258,7 @@ gtk_revealer_class_init (GtkRevealerClass *klass)
P_("Child Revealed"),
P_("Whether the child is revealed and the animation target reached"),
FALSE,
G_PARAM_READABLE);
GTK_PARAM_READABLE);
g_object_class_install_properties (object_class, LAST_PROP, props);

View File

@ -370,7 +370,7 @@ gtk_search_entry_init (GtkSearchEntry *entry)
if (GTK_IS_ACCESSIBLE (atk_obj))
atk_object_set_name (atk_obj, _("Search"));
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (entry)), "search");
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (entry)), I_("search"));
}
/**

View File

@ -302,7 +302,7 @@ add_child (GtkWidget *widget,
g_signal_connect (widget, "child-notify::position",
G_CALLBACK (on_position_updated), sidebar);
g_object_set_data (G_OBJECT (item), "stack-child", widget);
g_object_set_data (G_OBJECT (item), I_("stack-child"), widget);
g_hash_table_insert (priv->rows, widget, row);
gtk_container_add (GTK_CONTAINER (priv->list), row);
}

View File

@ -1532,7 +1532,7 @@ gtk_text_attr_appearance_new (const GtkTextAppearance *appearance)
if (!klass.type)
klass.type = gtk_text_attr_appearance_type =
pango_attr_type_register ("GtkTextAttrAppearance");
pango_attr_type_register (I_("GtkTextAttrAppearance"));
result = g_slice_new (GtkTextAttrAppearance);
result->attr.klass = &klass;

View File

@ -32,6 +32,7 @@
#include "gtkadjustment.h"
#include "gtkintl.h"
#include "gtktooltip.h"
#include "gtkprivate.h"
/**
@ -168,7 +169,7 @@ gtk_volume_button_class_init (GtkVolumeButtonClass *klass)
P_("Use symbolic icons"),
P_("Whether to use symbolic icons"),
TRUE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY));
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY));
/* Bind class to template
*/

View File

@ -6475,7 +6475,7 @@ void
_gtk_widget_set_captured_event_handler (GtkWidget *widget,
GtkCapturedEventHandler callback)
{
g_object_set_data (G_OBJECT (widget), "captured-event-handler", callback);
g_object_set_data (G_OBJECT (widget), I_("captured-event-handler"), callback);
}
static gboolean
@ -6576,7 +6576,7 @@ _gtk_widget_captured_event (GtkWidget *widget,
return_val = _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_CAPTURE);
handler = g_object_get_data (G_OBJECT (widget), "captured-event-handler");
handler = g_object_get_data (G_OBJECT (widget), I_("captured-event-handler"));
if (!handler)
goto out;
@ -15458,8 +15458,7 @@ gtk_widget_init_legacy_controller (GtkWidget *widget)
GtkEventController *controller;
controller = _gtk_event_controller_legacy_new (widget);
g_object_set_data_full (G_OBJECT (widget),
"gtk-widget-legacy-event-controller",
g_object_set_data_full (G_OBJECT (widget), I_("gtk-widget-legacy-event-controller"),
controller, g_object_unref);
}