Compare commits

..

63 Commits

Author SHA1 Message Date
Juan Pablo Ugarte 1cffd1de56 Added parent property to external-object tag 2013-02-13 19:05:02 -03:00
Juan Pablo Ugarte 6b141bff77 Updated to new external-object/template syntaxt 2012-12-10 11:38:49 -03:00
Juan Pablo Ugarte 13870e733c Renamed <template> tag with <external-object> and keep <template> tag for new inline type definitions 2012-12-10 11:24:47 -03:00
Juan Pablo Ugarte e0ce659f34 Removed return value of gtk_builder_expose_object()
and added check to notify when the object exist
2012-12-10 11:24:47 -03:00
Juan Pablo Ugarte dc78589ce2 Added inline template creation support. Now builder creates new types dinamically when needed.
that is when it finds a template element without an asociated external object.
2012-12-10 11:24:47 -03:00
Juan Pablo Ugarte e6007f10ac Added template_id parameter to gtk_container_class_set_template_from_*() functions
This way you can call your template "this" or "that" or as you wish.
2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 2b422848a3 Added return value to gtk_builder_expose_object() and made it ignore if the object id is in use. 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte b39ae75a0e Merge external object namespace with builder built objects 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 828338fbf8 Added signal data test to test_expose_object() 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 329335132c Removed gtk_builder_add_to_parent_*() functions, instead you can use gtk_builder_expose_object()
to expose the template object and simply call gtk_builder_add_from_*()

Added test_expose_object() test case
2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 7d53df8ccb Removed bogus lines changes like spaces and such. 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte bfdf7571b1 Added gtk_builder_add_to_parent() test case. 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 976b14cb63 Added template_id parameter to gtk_builder_add_to_parent_*() functions
This makes it more consistent since now you have to name the template
and let you have more than one template in a file.
2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte af394406f7 gtk_container_class_set_template() Clear list of classes with templates since
this function in rare occacions can be called more than once. (Glade)
2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte a6685346f1 Revert "Implemented GtkDialog and GtkMessageDialog using new template API."
This reverts commit a095cc6ac56876a55614a5fbb57548fefcc66191.
2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 0f257f1892 Added gtk_container_class_set_template_from_string() 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte 04444664a4 Implemented GtkDialog and GtkMessageDialog using new template API. 2012-12-10 11:24:46 -03:00
Juan Pablo Ugarte a3b93112bb Composite Widgets using GtkBuilder scripts
Added new API to enable composite widget implementations using builder scripts
  gtk_container_class_set_template_from_resource()
  gtk_container_class_declare_internal_child()
  gtk_container_class_set_connect_func()
2012-12-10 11:24:46 -03:00
Tristan Van Berkom 4d2bf8ef4a Added gtk_builder_expose_object(), gtk_builder_add_to_parent_from_file() and gtk_builder_add_to_parent_from_string().
Adding the needed GtkBuilder framework for composite containers. First the
expose_object() api is based on the work Marco Diego Aurélio Mesquita did
in bug 447972 with some bugs fixed and things cleared up. Next the
gtk_builder_add_to_parent_from_[file/string]() variants are used to extend
containers inline by adding themselves and letting the builder add the
children defined in a template file.

Added semantics to build composite children automatically from an assigned template.

This patch adds gtk_container_class_set_template[_file](),
gtk_container_class_set_connect_func() and the GtkParamSpecComposite
type. Setting the class template will result in GtkContainer building
the instance's children from the template at construct time, composite
properties will be assigned to their composite children by matching
the property names with the child GtkBuildable ids. The exposed connect
function is there to allow language bindings to automatically assign
methods for the interface callbacks when they assign templates to classes.

Made GtkDialog and GtkMessageDialog composite widgets using gtk_container_class_set_template().

Enhanced documentation for gtk_container_class_set_template()

Fixing dialog separator property to be construct-only

Implemented gtk_container_buildable_get_internal_child() and removed GSEAL macros

Added missing parameter to _gtk_builder_parser_parse_buffer() calls

Fixed composite implementation

Added gtk_builder_add_to_parent_from_resource()
Used gtk_builder_add_to_parent_from_* as gtk_builder_add_from_* implementation.

Removed GtkParamSpecComposite
Added GtkContainerClassPrivate
Added gtk_container_class_declare_internal_child() funtion to make internal children declaration explicit
Added GtkContainerTemplateType type parameter to gtk_container_class_set_template()

Updated GtkDialog and GtkMessageDialog implementation to new GtkContainer template API

Reworked GtkDialog and GtkMessageDialog xml template into a GResource

Fixed property setting and signal connection for parent objects (ie: gtk_builder_add_to_parent_*())
Use intern strings for properties and signal names and a GType instead of a class name in GtkBuilder
Added new private function _gtk_builder_object_get_name()

Removed gtk_container_get_composite_child()
Get a reference to every internal object declared with gtk_container_class_declare_internal_child() which gets dropped on GtkContainer::destroy signal
Implemented "template" tag, this allow us to also build anarchist objects

Replaced GtkDialog and GtkMessageDialog template file extension with .ui

Implemented id tag for template and added cheack for id to be 'this'

Cleaned up template API, we only provided a function to set a resource as a template

Fixed identation
2012-12-10 11:24:46 -03:00
Alexander Larsson d8fae21b1c css: Avoid looking up the GtkCssStyleProperty class a lot
Instead of constantly looking up the class we just stash it away in
class_init.
2012-12-10 14:49:51 +01:00
Alexander Larsson a1ee2b7b82 css: Speed up name matching
We use the new g_type_get_type_registration_serial() so that we can
cache and properly invalidate the result of g_type_from_name().

This bumps the glib requirement to 2.35.3 to get the new function.

https://bugzilla.gnome.org/show_bug.cgi?id=689847
2012-12-10 12:57:10 +01:00
Alexander Larsson 089eafb468 css: Clean up tree_match implementations
A bunch of repeated code is broken out into the helper
gtk_css_selector_tree_match_previous().
2012-12-10 12:28:44 +01:00
Alexander Larsson eb4667b6e1 css: Do get_change directly on the tree without matching first
Rather than first collecting matches and then getting the change
for them we do the change collection directly on the tree. This
is about twice as fast.
2012-12-10 12:11:02 +01:00
Alexander Larsson 03c626bb15 css: Factor out some of the position matching code 2012-12-10 12:11:02 +01:00
Mario Sanchez Prada 57e1e0de94 Add missing NULL-check in GtkEntryAccessible
Only call to atk_object_set_name if gtk_entry_get_icon_name() is not NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=689923
2012-12-09 11:52:11 +01:00
Daniel Mustieles fb312af979 Updated Spanish translation 2012-12-08 19:50:40 +01:00
Colin Walters 549a0af12b Fix build by un-translating org.gtk.Settings.FileChooser
At the moment, gtk+ doesn't depend on intltool, which is the program
that knows how to translate schemas.  Attempting to translate them
causes a build failure, so for now, let's leave them in en_US.

https://bugzilla.gnome.org/show_bug.cgi?id=689584
2012-12-07 14:05:58 -05:00
Timothy Arceri f1532993eb Add summary and description to "show-hidden" key
https://bugzilla.gnome.org/show_bug.cgi?id=689584
2012-12-07 11:57:45 -06:00
Cosimo Cecchi 26ea8e710a scale: render scale mark lines with separator style class
So that the theme can distinguish them from the mark text.
2012-12-07 11:41:03 -05:00
Cosimo Cecchi b855e91f7a build: fix some GCC warnings 2012-12-07 11:35:06 -05:00
Michael Natterer 9d31a04d12 quartz: fix crash in the recent clipboard "fix", and really fix it
We must not release the GtkClipboardOwner in pasteboardChangedOwner
becaue we don't own a reference to ourselves (NSPasteboard does).
Instead, release the owner right after setting it, transferring
ownership to NSPasteboard

Also, fix repeated setting of the same owner by keeping the
owner around in GtkCLipboard, and re-use it if "user_data"
doesn't change. To avoid clipboard_unset()ting our own contents
in the process, add an ugly "setting_same_owner" boolean to
GtkClipboardOwner, set it during re-setting the same owner,
and avoid calling clipboard_unset() from pasteboardChangedOwner
if it's TRUE.
(cherry picked from commit 4a8df7a33c)
2012-12-07 12:30:15 +01:00
Jasper St. Pierre 34318b9163 gtkcssselector: Fix build
destroy vs. free strikes again
2012-12-06 17:48:15 -05:00
Jasper St. Pierre 736ccb6ce1 gtkcssselector: Don't leak the hash table
We should probably free the memory we allocate. Sounds like a winning
strategy.
2012-12-06 17:39:09 -05:00
Alexander Larsson 4ca293e006 treeview: Don't invalidate whole tree unless needed
We currently invalidate the whole tree every time the style state
changes in the tree view. The primary reason for this is to catch
default font changes as that may affect text cell renderers. But
cell renderers could *potentially* also read other style properties
(although that seems weird and unlikely).

We handle this by invalidating only when some state that affects sizes
is changed. This includes all the font properties.
2012-12-06 22:28:11 +01:00
Alexander Larsson fd964ca178 textview: Only clear the layout in style_update if the font actually changes 2012-12-06 21:16:19 +01:00
Alexander Larsson 6dfee46cdb css: Add _gtk_css_style_property_affects_font
This checks if a style_update affects the font.
2012-12-06 21:14:02 +01:00
Alexander Larsson e6de45964d entry: No need to reset layouts on style_updated
With pango handling changes to the PangoLayout there now is no
style changes that can affect the layout for the entry, so we don't
have to reset the layout whenever the style is updated.
2012-12-06 19:54:05 +01:00
Alexander Larsson bf35c2f044 GtkLabel: Rely on the new pango support for context change tracking
Now that Pango tracks changes to the context automatically there is
no need to do it manually in e.g. style-updated or direction-changed,
in fact the only case we have to care about is when we re-create
the PangoContext due to a screen change, so we only have to clear
the layouts in GtkLabel in screen-changed.

This means we're not clearing all the layouts whenever the state changes,
which happens to every widget when the window is unfocused, which helps
performance a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=340066
2012-12-06 19:54:05 +01:00
Alexander Larsson 53e08b58aa Require new pango with automatic tracking of PangoContext changes
Pango 1.32.4 has a feature where any PangoLayout automatically handles
the case where a PangoContext is changed. We want to rely on this to
avoid having to clear layouts too often, so we make this a hard dep.
2012-12-06 19:54:05 +01:00
Benjamin Otte 9ae9649188 stylecontext: Deprecate gtk_style_context_get_font()
This is for a very simple reason: The getter is returning a const value
and the font isn't const anymore. So we need to store the font
description somewhere but we can't reuse it as it's changing all the
time (yay animations, yay inherited values). Sucks.

So keep the hack in here but deprecate the function.
2012-12-06 02:57:19 +01:00
Benjamin Otte 82a6106920 switch: Remove hack to change text size
The same effect can now be achieved via
  .switch { font-size: smaller; }
so there is no need to hardcode things.
2012-12-06 02:57:18 +01:00
Benjamin Otte 1b1f4da5c7 gtk: Query font size directly
... instead of calling gtk_style_context_get_font() and then
pango_font_description_get_size().
2012-12-06 02:57:18 +01:00
Benjamin Otte 055b5d83d5 gtk: Use gtk_style_context_get()
... instead of soon-to-be-deprecated gtk_style_context_get_font().
2012-12-06 02:57:18 +01:00
Benjamin Otte 7747910b9d gtk: Use context's font
Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.
2012-12-06 02:57:18 +01:00
Benjamin Otte a405c9917c tests: Don't call to-be-deprecated function 2012-12-06 02:57:18 +01:00
Benjamin Otte fbbb66ae7d aboutdialog: Add text tag to get small text
This is to get rid of gtk_widget_override_font() and
gtk_style_context_get_font().

FIXME: This should probably be done by the theme somehow?
2012-12-06 02:57:18 +01:00
Benjamin Otte 732e89e4f3 stylecontext: Always recompute font
This is necessary  because values in a GtkCssComputedValues can change
now. So if the font-size is inherited or animated, the cached value will
be outdated.

Fixes the fontchooser preview not updating.
2012-12-06 02:57:18 +01:00
Daniel Mustieles f79cd24937 Updated Spanish translation 2012-12-05 20:10:39 +01:00
Daniel Mustieles 6e2dec0344 Updated Spanish translation 2012-12-05 20:10:27 +01:00
Jasper St. Pierre 7ee5e7af70 treemodelfilter: Make the constructor binding friendly
This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065
2012-12-05 13:43:19 -05:00
Aleksander Morgado a61b359498 GdkBroadwayDisplay: include proper port number in error trace 2012-12-05 11:23:35 +01:00
Aleksander Morgado 4dabc8ba84 GdkBroadwayDisplay: initialize GError before using it 2012-12-05 11:23:28 +01:00
Alexander Larsson cd016ef8e3 Revert "Don't queue resize for hidden widgets without a size group"
This seems to break redraw of the middle pane in glade.

This reverts commit faaae520c9.
2012-12-04 21:30:04 +01:00
Alexander Larsson d3377e9d7a Don't unnecessarily queue resize in GtkWindow.style_updated
GtkWindow always queues a resize on style updates if there is
a grip, because it may have been the grip size style properties
that changed. However, even if it *were*, and it likely wasn't
that would not affect the windows size request, so no need
to queue a resize.
2012-12-04 21:24:24 +01:00
Alexander Larsson faaae520c9 Don't queue resize for hidden widgets without a size group
queue_resize basically tells the parent widget that it may need
to pick a different size/layout. However, for a hidden child widget
that should never be needed. It may be that the widget is in a
sizegroup that has ignore_hidden == FALSE though, so it may
affect the size group calculations.

However, if a widget is not visible and not in a size group then
its safe to avoid the resize, as the widget will be resized on
becoming visible anyway.

This avoids a lot of size allocation for hidden things like menus
and tooltips.
2012-12-04 20:16:44 +01:00
Alexander Larsson 47714f55ee css: Avoid queue_resize in _gtk_widget_style_context_invalidated
We've already emitted style_updated, and the handler for that queues
a resize if necessary.
2012-12-04 20:16:44 +01:00
Alexander Larsson c3e9112f7f css: Avoid allocations in gtk_css_value_array_compute
Almost all array computations lead to no changes (99% in nautilus)
so we avoid the upfront allocation and delay it until we know its
needed. This drops the allocate/free from the profile.
2012-12-04 20:16:44 +01:00
Alexander Larsson 7ec33e63c0 css: Start array allocation with a better size
All computed values will compute all normal properties at least, so
we might as well allocate these upfront, which leads to a lot less
reallocations.
2012-12-04 20:16:44 +01:00
Alexander Larsson afc1a143a4 css: Use internal return_if_fail in some commonly called code
These are internal apis, and any external issues should have been
caught by checks at public API points. We use the internal checks
here because these checks show up in a non-neglible way on profiles.
2012-12-04 20:16:44 +01:00
Alexander Larsson 5833b8495e Add internal versions of g_return_[val_]_if_fail
These are only enabled on debug=yes, so not by default
in released tarballs.
2012-12-04 20:16:44 +01:00
Rico Tzschichholz b4767ea9da po: Fix xgettext failing on unicode strings
It is needed to use -from-code=utf-8 to override the ASCII default

Caused by ceb866dfe6
2012-12-04 20:06:19 +01:00
Benjamin Otte 85d8f3c51e reftests: Fix wrong name in test
Typo in d8306aaeb3
2012-12-04 20:02:36 +01:00
Alexander Larsson c1e9d46c64 css: Return 0 as change for the GtkSettingsStyleProvider 2012-12-04 19:56:18 +01:00
76 changed files with 2904 additions and 1715 deletions
+2 -2
View File
@@ -39,8 +39,8 @@ AC_CONFIG_AUX_DIR([build-aux])
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.35.0])
m4_define([pango_required_version], [1.30.0])
m4_define([glib_required_version], [2.35.3])
m4_define([pango_required_version], [1.32.4])
m4_define([atk_required_version], [2.5.3])
m4_define([cairo_required_version], [1.10.0])
m4_define([gdk_pixbuf_required_version], [2.26.0])
+1
View File
@@ -536,6 +536,7 @@ gtk_builder_add_objects_from_string
gtk_builder_add_objects_from_resource
gtk_builder_get_object
gtk_builder_get_objects
gtk_builder_expose_object
gtk_builder_connect_signals
gtk_builder_connect_signals_full
gtk_builder_set_translation_domain
+2 -2
View File
@@ -1060,7 +1060,7 @@ _gdk_broadway_display_open (const gchar *display_name)
{
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
GError *error;
GError *error = NULL;
int port;
display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL);
@@ -1104,7 +1104,7 @@ _gdk_broadway_display_open (const gchar *display_name)
G_OBJECT (display),
&error))
{
g_printerr ("Unable to listen to port %d: %s\n", 8080, error->message);
g_printerr ("Unable to listen to port %d: %s\n", port, error->message);
g_error_free (error);
return NULL;
}
+2 -1
View File
@@ -1130,7 +1130,8 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) $(deprecated_h_sources) gtk
gtkresources.h: gtk.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/gtk.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-header --manual-register
gtkresources.c: gtk.gresource.xml gtk-default.css gtk-win32.css gtk-win32-xp.css gtk-win32-base.css gtk-win32-classic.css $(DND_CURSORS)
gtkresources.c: gtk.gresource.xml \
$(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies gtk.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/gtk.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-source --manual-register
+4 -2
View File
@@ -549,7 +549,8 @@ gtk_entry_accessible_notify_gtk (GObject *obj,
const gchar *name;
name = gtk_entry_get_icon_name (gtk_entry,
GTK_ENTRY_ICON_PRIMARY);
atk_object_set_name (priv->icons[GTK_ENTRY_ICON_PRIMARY], name);
if (name)
atk_object_set_name (priv->icons[GTK_ENTRY_ICON_PRIMARY], name);
}
}
else if (g_strcmp0 (pspec->name, "secondary-icon-name") == 0)
@@ -559,7 +560,8 @@ gtk_entry_accessible_notify_gtk (GObject *obj,
const gchar *name;
name = gtk_entry_get_icon_name (gtk_entry,
GTK_ENTRY_ICON_SECONDARY);
atk_object_set_name (priv->icons[GTK_ENTRY_ICON_SECONDARY], name);
if (name)
atk_object_set_name (priv->icons[GTK_ENTRY_ICON_SECONDARY], name);
}
}
else if (g_strcmp0 (pspec->name, "primary-icon-tooltip-text") == 0)
+7 -12
View File
@@ -2095,11 +2095,9 @@ text_view_new (GtkAboutDialog *about,
GdkColor color;
GdkColor link_color;
GdkColor visited_link_color;
gint size;
PangoFontDescription *font_desc;
GtkAboutDialogPrivate *priv = about->priv;
GtkStyleContext *context;
GtkStateFlags state;
GtkTextIter start_iter, end_iter;
GtkTextTag *tag;
gtk_widget_style_get (GTK_WIDGET (about),
"link-color", &style_link_color,
@@ -2128,14 +2126,11 @@ text_view_new (GtkAboutDialog *about,
gtk_text_view_set_editable (text_view, FALSE);
gtk_text_view_set_wrap_mode (text_view, wrap_mode);
context = gtk_widget_get_style_context (view);
state = gtk_widget_get_state_flags (view);
size = pango_font_description_get_size (gtk_style_context_get_font (context, state));
font_desc = pango_font_description_new ();
pango_font_description_set_size (font_desc, size * PANGO_SCALE_SMALL);
gtk_widget_override_font (view, font_desc);
pango_font_description_free (font_desc);
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_get_start_iter (buffer, &end_iter);
tag = gtk_text_tag_new (NULL);
g_object_set (tag, "font-scale", PANGO_SCALE_SMALL, NULL);
gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
gtk_text_view_set_left_margin (text_view, 8);
gtk_text_view_set_right_margin (text_view, 8);
+203 -202
View File
@@ -123,22 +123,24 @@
* (can be specified by their name, nick or integer value), flags (can be
* specified by their name, nick, integer value, optionally combined with "|",
* e.g. "GTK_VISIBLE|GTK_REALIZED") and colors (in a format understood by
* gdk_color_parse()). Objects can be referred to by their name. Pixbufs can be
* specified as a filename of an image file to load. In general, GtkBuilder
* allows forward references to objects &mdash; an object doesn't have to be
* constructed before it can be referred to. The exception to this rule is that
* an object has to be constructed before it can be used as the value of a
* construct-only property.
* gdk_color_parse()). Pixbufs can be specified as a filename of an image file to load.
* Objects can be referred to by their name and by default refer to objects declared
* in the local xml fragment and objects exposed via gtk_builder_expose_object().
*
* In general, GtkBuilder allows forward references to objects &mdash declared
* in the local xml; an object doesn't have to be constructed before it can be referred to.
* The exception to this rule is that an object has to be constructed before
* it can be used as the value of a construct-only property.
*
* Signal handlers are set up with the &lt;signal&gt; element. The "name"
* attribute specifies the name of the signal, and the "handler" attribute
* specifies the function to connect to the signal. By default, GTK+ tries to
* find the handler using g_module_symbol(), but this can be changed by passing
* a custom #GtkBuilderConnectFunc to gtk_builder_connect_signals_full(). The
* remaining attributes, "after", "swapped" and "object", have the same meaning
* attributes "after", "swapped" and "object", have the same meaning
* as the corresponding parameters of the g_signal_connect_object() or
* g_signal_connect_data() functions. A "last_modification_time" attribute
* is also allowed, but it does not have a meaning to the builder.
* g_signal_connect_data() functions. A "last_modification_time" attribute is also
* allowed, but it does not have a meaning to the builder.
*
* Sometimes it is necessary to refer to widgets which have implicitly been
* constructed by GTK+ as part of a composite widget, to set properties on them
@@ -272,6 +274,8 @@ struct _GtkBuilderPrivate
GSList *signals;
gchar *filename;
gchar *resource_prefix;
GType ignore_type;
};
G_DEFINE_TYPE (GtkBuilder, gtk_builder, G_TYPE_OBJECT)
@@ -490,22 +494,24 @@ gtk_builder_get_parameters (GtkBuilder *builder,
if (G_IS_PARAM_SPEC_OBJECT (pspec) &&
(G_PARAM_SPEC_VALUE_TYPE (pspec) != GDK_TYPE_PIXBUF))
{
GObject *object = gtk_builder_get_object (builder, prop->data);
GObject *object;
if (object)
if (pspec->flags & G_PARAM_CONSTRUCT_ONLY)
{
g_value_init (&parameter.value, G_OBJECT_TYPE (object));
g_value_set_object (&parameter.value, object);
}
else
{
if (pspec->flags & G_PARAM_CONSTRUCT_ONLY)
object = gtk_builder_get_object (builder, prop->data);
if (!object)
{
g_warning ("Failed to get constuct only property "
"%s of %s with value `%s'",
prop->name, object_name, prop->data);
continue;
}
g_value_init (&parameter.value, G_OBJECT_TYPE (object));
g_value_set_object (&parameter.value, object);
}
else
{
/* Delay setting property */
property = g_slice_new (DelayedProperty);
property->object = g_strdup (object_name);
@@ -562,7 +568,7 @@ gtk_builder_get_internal_child (GtkBuilder *builder,
obj = gtk_buildable_get_internal_child (GTK_BUILDABLE (info->object),
builder,
childname);
};
}
if (!obj)
{
@@ -574,6 +580,33 @@ gtk_builder_get_internal_child (GtkBuilder *builder,
return obj;
}
static inline void
object_set_name (GObject *object, const gchar *name)
{
if (GTK_IS_BUILDABLE (object))
gtk_buildable_set_name (GTK_BUILDABLE (object), name);
else
g_object_set_data_full (object, "gtk-builder-name", g_strdup (name), g_free);
}
void
_gtk_builder_add_object (GtkBuilder *builder,
const gchar *id,
GObject *object)
{
object_set_name (object, id);
g_hash_table_insert (builder->priv->objects, g_strdup (id), g_object_ref (object));
}
const gchar *
_gtk_builder_object_get_name (GObject *object)
{
if (GTK_IS_BUILDABLE (object))
return gtk_buildable_get_name (GTK_BUILDABLE (object));
else
return g_object_get_data (object, "gtk-builder-name");
}
GObject *
_gtk_builder_construct (GtkBuilder *builder,
ObjectInfo *info,
@@ -587,25 +620,32 @@ _gtk_builder_construct (GtkBuilder *builder,
gboolean custom_set_property;
GtkBuildable *buildable;
g_assert (info->class_name != NULL);
object_type = gtk_builder_get_type_from_name (builder, info->class_name);
if (object_type == G_TYPE_INVALID)
if ((object_type = info->object_type) == G_TYPE_INVALID)
{
g_set_error (error,
GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_INVALID_VALUE,
"Invalid object type `%s'",
info->class_name);
g_type_name (object_type));
return NULL;
}
gtk_builder_get_parameters (builder, object_type,
/* Safeguard to avoid recursion if we are building a new type with builder */
if (object_type == builder->priv->ignore_type)
return NULL;
gtk_builder_get_parameters (builder, info->object_type,
info->id,
info->properties,
&parameters,
&construct_parameters);
if (info->constructor)
if (info->object)
{
/* external_object */
obj = g_object_ref (info->object);
}
else if (info->constructor)
{
GObject *constructor;
@@ -662,7 +702,7 @@ _gtk_builder_construct (GtkBuilder *builder,
g_object_ref_sink (obj);
GTK_NOTE (BUILDER,
g_print ("created %s of type %s\n", info->id, info->class_name));
g_print ("created %s of type %s\n", info->id, g_type_name (object_type)));
for (i = 0; i < construct_parameters->len; i++)
{
@@ -703,29 +743,16 @@ _gtk_builder_construct (GtkBuilder *builder,
g_value_unset (&param->value);
}
g_array_free (parameters, TRUE);
if (GTK_IS_BUILDABLE (obj))
gtk_buildable_set_name (buildable, info->id);
else
g_object_set_data_full (obj,
"gtk-builder-name",
g_strdup (info->id),
g_free);
/* we already own a reference to obj. put it in the hash table. */
g_hash_table_insert (builder->priv->objects, g_strdup (info->id), obj);
/* put it in the hash table. */
_gtk_builder_add_object (builder, info->id, obj);
/* we already own a reference to obj. */
g_object_unref (obj);
return obj;
}
void
_gtk_builder_add_object (GtkBuilder *builder,
const gchar *id,
GObject *object)
{
g_hash_table_insert (builder->priv->objects, g_strdup (id), g_object_ref (object));
}
void
_gtk_builder_add (GtkBuilder *builder,
ChildInfo *child_info)
@@ -851,6 +878,41 @@ gtk_builder_new (void)
return g_object_new (GTK_TYPE_BUILDER, NULL);
}
static guint
gtk_builder_add_from_file_real (GtkBuilder *builder,
const gchar *filename,
gchar **object_ids,
GError **error)
{
GError *tmp_error = NULL;
gchar *buffer;
gsize length;
if (!g_file_get_contents (filename, &buffer, &length, &tmp_error))
{
g_propagate_error (error, tmp_error);
return 0;
}
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (filename);
builder->priv->resource_prefix = NULL;
_gtk_builder_parser_parse_buffer (builder, filename, buffer, length,
object_ids, &tmp_error);
g_free (buffer);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
return 1;
}
/**
* gtk_builder_add_from_file:
* @builder: a #GtkBuilder
@@ -873,41 +935,11 @@ gtk_builder_add_from_file (GtkBuilder *builder,
const gchar *filename,
GError **error)
{
gchar *buffer;
gsize length;
GError *tmp_error;
g_return_val_if_fail (GTK_IS_BUILDER (builder), 0);
g_return_val_if_fail (filename != NULL, 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
tmp_error = NULL;
if (!g_file_get_contents (filename, &buffer, &length, &tmp_error))
{
g_propagate_error (error, tmp_error);
return 0;
}
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (filename);
builder->priv->resource_prefix = NULL;
_gtk_builder_parser_parse_buffer (builder, filename,
buffer, length,
NULL,
&tmp_error);
g_free (buffer);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
return 1;
return gtk_builder_add_from_file_real (builder, filename, NULL, error);
}
/**
@@ -941,34 +973,52 @@ gtk_builder_add_objects_from_file (GtkBuilder *builder,
gchar **object_ids,
GError **error)
{
gchar *buffer;
gsize length;
GError *tmp_error;
g_return_val_if_fail (GTK_IS_BUILDER (builder), 0);
g_return_val_if_fail (filename != NULL, 0);
g_return_val_if_fail (object_ids != NULL && object_ids[0] != NULL, 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
return gtk_builder_add_from_file_real (builder, filename, object_ids, error);
}
static guint
gtk_builder_add_from_resource_real (GtkBuilder *builder,
const gchar *path,
gchar **object_ids,
GError **error)
{
GError *tmp_error;
GBytes *data;
char *filename_for_errors;
char *slash;
tmp_error = NULL;
if (!g_file_get_contents (filename, &buffer, &length, &tmp_error))
data = g_resources_lookup_data (path, 0, &tmp_error);
if (data == NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (filename);
builder->priv->resource_prefix = NULL;
builder->priv->filename = g_strdup (".");
_gtk_builder_parser_parse_buffer (builder, filename,
buffer, length,
object_ids,
&tmp_error);
slash = strrchr (path, '/');
if (slash != NULL)
builder->priv->resource_prefix = g_strndup (path, slash - path + 1);
else
builder->priv->resource_prefix = g_strdup ("/");
g_free (buffer);
filename_for_errors = g_strconcat ("<resource>", path, NULL);
_gtk_builder_parser_parse_buffer (builder, filename_for_errors,
g_bytes_get_data (data, NULL), g_bytes_get_size (data),
object_ids, &tmp_error);
g_free (filename_for_errors);
g_bytes_unref (data);
if (tmp_error != NULL)
{
@@ -1001,53 +1051,11 @@ gtk_builder_add_from_resource (GtkBuilder *builder,
const gchar *resource_path,
GError **error)
{
GError *tmp_error;
GBytes *data;
char *filename_for_errors;
char *slash;
g_return_val_if_fail (GTK_IS_BUILDER (builder), 0);
g_return_val_if_fail (resource_path != NULL, 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
tmp_error = NULL;
data = g_resources_lookup_data (resource_path, 0, &tmp_error);
if (data == NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (".");
slash = strrchr (resource_path, '/');
if (slash != NULL)
builder->priv->resource_prefix =
g_strndup (resource_path, slash - resource_path + 1);
else
builder->priv->resource_prefix =
g_strdup ("/");
filename_for_errors = g_strconcat ("<resource>", resource_path, NULL);
_gtk_builder_parser_parse_buffer (builder, filename_for_errors,
g_bytes_get_data (data, NULL), g_bytes_get_size (data),
NULL,
&tmp_error);
g_free (filename_for_errors);
g_bytes_unref (data);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
return 1;
return gtk_builder_add_from_resource_real (builder, resource_path, NULL, error);
}
/**
@@ -1081,46 +1089,31 @@ gtk_builder_add_objects_from_resource (GtkBuilder *builder,
gchar **object_ids,
GError **error)
{
GError *tmp_error;
GBytes *data;
char *filename_for_errors;
char *slash;
g_return_val_if_fail (GTK_IS_BUILDER (builder), 0);
g_return_val_if_fail (resource_path != NULL, 0);
g_return_val_if_fail (object_ids != NULL && object_ids[0] != NULL, 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
tmp_error = NULL;
return gtk_builder_add_from_resource_real (builder, resource_path,
object_ids, error);
}
data = g_resources_lookup_data (resource_path, 0, &tmp_error);
if (data == NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
static guint
gtk_builder_add_from_string_real (GtkBuilder *builder,
const gchar *buffer,
gsize length,
gchar **object_ids,
GError **error)
{
GError *tmp_error = NULL;
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (".");
builder->priv->resource_prefix = NULL;
slash = strrchr (resource_path, '/');
if (slash != NULL)
builder->priv->resource_prefix =
g_strndup (resource_path, slash - resource_path + 1);
else
builder->priv->resource_prefix =
g_strdup ("/");
filename_for_errors = g_strconcat ("<resource>", resource_path, NULL);
_gtk_builder_parser_parse_buffer (builder, filename_for_errors,
g_bytes_get_data (data, NULL), g_bytes_get_size (data),
object_ids,
&tmp_error);
g_free (filename_for_errors);
g_bytes_unref (data);
_gtk_builder_parser_parse_buffer (builder, "<input>", buffer, length,
object_ids, &tmp_error);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
@@ -1153,30 +1146,11 @@ gtk_builder_add_from_string (GtkBuilder *builder,
gsize length,
GError **error)
{
GError *tmp_error;
g_return_val_if_fail (GTK_IS_BUILDER (builder), 0);
g_return_val_if_fail (buffer != NULL, 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
tmp_error = NULL;
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (".");
builder->priv->resource_prefix = NULL;
_gtk_builder_parser_parse_buffer (builder, "<input>",
buffer, length,
NULL,
&tmp_error);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
return 1;
return gtk_builder_add_from_string_real (builder, buffer, length, NULL, error);
}
/**
@@ -1211,32 +1185,13 @@ gtk_builder_add_objects_from_string (GtkBuilder *builder,
gchar **object_ids,
GError **error)
{
GError *tmp_error;
g_return_val_if_fail (GTK_IS_BUILDER (builder), 0);
g_return_val_if_fail (buffer != NULL, 0);
g_return_val_if_fail (object_ids != NULL && object_ids[0] != NULL, 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
tmp_error = NULL;
g_free (builder->priv->filename);
g_free (builder->priv->resource_prefix);
builder->priv->filename = g_strdup (".");
builder->priv->resource_prefix = NULL;
_gtk_builder_parser_parse_buffer (builder, "<input>",
buffer, length,
object_ids,
&tmp_error);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return 0;
}
return 1;
return gtk_builder_add_from_string_real (builder, buffer, length,
object_ids, error);
}
/**
@@ -1340,6 +1295,39 @@ gtk_builder_get_translation_domain (GtkBuilder *builder)
return builder->priv->domain;
}
/**
* gtk_builder_expose_object:
* @builder: a #GtkBuilder
* @name: the name of the object exposed to the builder
* @object: the object to expose
*
* Add @object to the @builder object pool so it can be referenced just like any
* other object built by builder.
*
* To make this function even more useful a new special entry point element
* &lt;external-object&gt; is defined. It is similar to &lt;object&gt; but has
* to reference an external object exposed with this function.
* This way you can change properties and even add children to an
* external object using builder, not just reference it.
*
* Since: 3.8
**/
void
gtk_builder_expose_object (GtkBuilder *builder,
const gchar *name,
GObject *object)
{
g_return_if_fail (GTK_IS_BUILDER (builder));
g_return_if_fail (name && name[0]);
g_return_if_fail (gtk_builder_get_object (builder, name) == NULL);
object_set_name (object, name);
g_hash_table_insert (builder->priv->objects,
g_strdup (name),
g_object_ref (object));
}
typedef struct {
GModule *module;
gpointer data;
@@ -1480,7 +1468,8 @@ gtk_builder_connect_signals_full (GtkBuilder *builder,
if (signal->connect_object_name)
{
connect_object = g_hash_table_lookup (builder->priv->objects,
signal->connect_object_name);
signal->connect_object_name);
if (!connect_object)
g_warning ("Could not lookup object %s on signal %s of object %s",
signal->connect_object_name, signal->name,
@@ -2088,3 +2077,15 @@ _gtk_builder_get_absolute_filename (GtkBuilder *builder, const gchar *string)
return filename;
}
void
_gtk_builder_set_ignore_type (GtkBuilder *builder, GType ignore_type)
{
builder->priv->ignore_type = ignore_type;
}
GType
_gtk_builder_get_ignore_type (GtkBuilder *builder)
{
return builder->priv->ignore_type;
}
+6 -1
View File
@@ -59,6 +59,7 @@ typedef struct _GtkBuilderPrivate GtkBuilderPrivate;
* @GTK_BUILDER_ERROR_VERSION_MISMATCH: The input file requires a newer version
* of GTK+.
* @GTK_BUILDER_ERROR_DUPLICATE_ID: An object id occurred twice.
* @GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH: The Class template is designed for a different class.
*
* Error codes that identify various errors that can occur while using
* #GtkBuilder.
@@ -73,7 +74,8 @@ typedef enum
GTK_BUILDER_ERROR_MISSING_PROPERTY_VALUE,
GTK_BUILDER_ERROR_INVALID_VALUE,
GTK_BUILDER_ERROR_VERSION_MISMATCH,
GTK_BUILDER_ERROR_DUPLICATE_ID
GTK_BUILDER_ERROR_DUPLICATE_ID,
GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH
} GtkBuilderError;
GQuark gtk_builder_error_quark (void);
@@ -141,6 +143,9 @@ guint gtk_builder_add_objects_from_string (GtkBuilder *builder,
GObject* gtk_builder_get_object (GtkBuilder *builder,
const gchar *name);
GSList* gtk_builder_get_objects (GtkBuilder *builder);
void gtk_builder_expose_object (GtkBuilder *builder,
const gchar *name,
GObject *object);
void gtk_builder_connect_signals (GtkBuilder *builder,
gpointer user_data);
void gtk_builder_connect_signals_full (GtkBuilder *builder,
+15 -1
View File
@@ -1,6 +1,6 @@
start = element interface {
attribute domain { text } ?,
( requires | object | menu ) *
( requires | object | external-object | template | menu ) *
}
requires = element requires {
@@ -16,9 +16,23 @@ object = element object {
(property | signal | child | ANY) *
}
object = element external-object {
attribute id { xsd:ID },
attribute class { text },
(property | signal | child | ANY) *
}
object = element template {
attribute id { xsd:ID },
attribute class { text },
attribute parent { text },
(property | signal | child | ANY) *
}
property = element property {
attribute name { text },
attribute translatable { "yes" | "no" } ?,
attribute external-object { "yes" | "no" } ?,
attribute comments { text } ?,
attribute context { text } ?,
text ?
+429 -52
View File
@@ -29,7 +29,7 @@
#include "gtkversion.h"
#include "gtktypebuiltins.h"
#include "gtkintl.h"
#include "gtkcontainer.h"
static void free_property_info (PropertyInfo *info);
static void free_object_info (ObjectInfo *info);
@@ -64,6 +64,32 @@ state_pop (ParserData *data)
#define state_peek_info(data, st) ((st*)state_peek(data))
#define state_pop_info(data, st) ((st*)state_pop(data))
static void
error_generic (GError **error,
GtkBuilderError code,
ParserData *data,
const gchar *tag,
const gchar *format,
...)
{
gint line_number, char_number;
gchar *message;
va_list args;
g_markup_parse_context_get_position (data->ctx,
&line_number,
&char_number);
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
g_set_error (error, GTK_BUILDER_ERROR, code, "%s:%d:%d <%s> %s",
data->filename, line_number, char_number, tag, message);
g_free (message);
}
static void
error_missing_attribute (ParserData *data,
const gchar *tag,
@@ -190,6 +216,13 @@ builder_construct (ParserData *data,
if (object_info->object)
return object_info->object;
/* Safeguard to avoid recursion if we are building a new type with builder
* _gtk_builder_construct() also checks for this, but there is no need to
* reverse the property list if we are not going to build the object.
*/
if (object_info->object_type == _gtk_builder_get_ignore_type (data->builder))
return NULL;
object_info->properties = g_slist_reverse (object_info->properties);
object = _gtk_builder_construct (data->builder, object_info, error);
@@ -203,24 +236,19 @@ builder_construct (ParserData *data,
return object;
}
static gchar *
static GType
_get_type_by_symbol (const gchar* symbol)
{
static GModule *module = NULL;
GTypeGetFunc func;
GType type;
if (!module)
module = g_module_open (NULL, 0);
if (!g_module_symbol (module, symbol, (gpointer)&func))
return NULL;
return G_TYPE_INVALID;
type = func ();
if (type == G_TYPE_INVALID)
return NULL;
return g_strdup (g_type_name (type));
return func ();
}
static void
@@ -295,6 +323,29 @@ is_requested_object (const gchar *object,
return FALSE;
}
static gboolean
parser_add_object_id (ParserData *data,
const gchar *object_id,
GError **error)
{
gint line, line2;
g_markup_parse_context_get_position (data->ctx, &line, NULL);
line2 = GPOINTER_TO_INT (g_hash_table_lookup (data->object_ids, object_id));
if (line2 != 0)
{
g_set_error (error, GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_DUPLICATE_ID,
_("Duplicate object ID '%s' on line %d (previously on line %d)"),
object_id, line, line2);
return TRUE;
}
g_hash_table_insert (data->object_ids, g_strdup (object_id), GINT_TO_POINTER (line));
return FALSE;
}
static void
parse_object (GMarkupParseContext *context,
ParserData *data,
@@ -303,13 +354,13 @@ parse_object (GMarkupParseContext *context,
const gchar **values,
GError **error)
{
GType object_type = G_TYPE_INVALID;
ObjectInfo *object_info;
ChildInfo* child_info;
int i;
gchar *object_class = NULL;
gchar *object_id = NULL;
gchar *constructor = NULL;
gint line, line2;
ChildInfo *child_info;
const gchar *object_class = NULL;
const gchar *object_id = NULL;
const gchar *constructor = NULL;
gint i, line;
child_info = state_peek_info (data, ChildInfo);
if (child_info && strcmp (child_info->tag.name, "object") == 0)
@@ -321,19 +372,19 @@ parse_object (GMarkupParseContext *context,
for (i = 0; names[i] != NULL; i++)
{
if (strcmp (names[i], "class") == 0)
object_class = g_strdup (values[i]);
object_class = values[i];
else if (strcmp (names[i], "id") == 0)
object_id = g_strdup (values[i]);
object_id = values[i];
else if (strcmp (names[i], "constructor") == 0)
constructor = g_strdup (values[i]);
constructor = values[i];
else if (strcmp (names[i], "type-func") == 0)
{
/* Call the GType function, and return the name of the GType,
* it's guaranteed afterwards that g_type_from_name on the name
* will return our GType
*/
object_class = _get_type_by_symbol (values[i]);
if (!object_class)
object_type = _get_type_by_symbol (values[i]);
if (object_type == G_TYPE_INVALID)
{
g_markup_parse_context_get_position (context, &line, NULL);
g_set_error (error, GTK_BUILDER_ERROR,
@@ -350,7 +401,7 @@ parse_object (GMarkupParseContext *context,
}
}
if (!object_class)
if (object_type == G_TYPE_INVALID && !object_class)
{
error_missing_attribute (data, element_name, "class", error);
return;
@@ -362,6 +413,20 @@ parse_object (GMarkupParseContext *context,
return;
}
if (object_type == G_TYPE_INVALID)
{
/* Make sure the class is initialized so we have intern string available */
object_type = gtk_builder_get_type_from_name (data->builder, object_class);
if (object_type == G_TYPE_INVALID)
{
g_set_error (error, GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_INVALID_VALUE,
_("Invalid class: '%s'"), object_class);
return;
}
}
++data->cur_object_level;
/* check if we reached a requested object (if it is specified) */
@@ -379,36 +444,24 @@ parse_object (GMarkupParseContext *context,
}
else
{
g_free (object_class);
g_free (object_id);
g_free (constructor);
return;
}
}
else if ((data->in_external_object && !data->external_object) ||
data->template_level)
return;
object_info = g_slice_new0 (ObjectInfo);
object_info->class_name = object_class;
object_info->id = object_id;
object_info->constructor = constructor;
object_info->object_type = object_type;
object_info->id = g_strdup (object_id);
object_info->constructor = g_strdup (constructor);
state_push (data, object_info);
object_info->tag.name = element_name;
if (child_info)
object_info->parent = (CommonInfo*)child_info;
g_markup_parse_context_get_position (context, &line, NULL);
line2 = GPOINTER_TO_INT (g_hash_table_lookup (data->object_ids, object_id));
if (line2 != 0)
{
g_set_error (error, GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_DUPLICATE_ID,
_("Duplicate object ID '%s' on line %d (previously on line %d)"),
object_id, line, line2);
return;
}
g_hash_table_insert (data->object_ids, g_strdup (object_id), GINT_TO_POINTER (line));
parser_add_object_id (data, object_id, error);
}
static void
@@ -420,7 +473,6 @@ free_object_info (ObjectInfo *info)
(GFunc)free_property_info, NULL);
g_slist_free (info->properties);
g_free (info->constructor);
g_free (info->class_name);
g_free (info->id);
g_slice_free (ObjectInfo, info);
}
@@ -531,20 +583,21 @@ parse_property (ParserData *data,
}
info = g_slice_new0 (PropertyInfo);
info->name = name;
info->name = g_intern_string (name);
info->translatable = translatable;
info->context = context;
info->text = g_string_new ("");
info->context = context;
info->text = g_string_new ("");
state_push (data, info);
info->tag.name = element_name;
g_free (name);
}
static void
free_property_info (PropertyInfo *info)
{
g_free (info->data);
g_free (info->name);
g_slice_free (PropertyInfo, info);
}
@@ -556,7 +609,7 @@ parse_signal (ParserData *data,
GError **error)
{
SignalInfo *info;
gchar *name = NULL;
const gchar *name = NULL;
gchar *handler = NULL;
gchar *object = NULL;
gboolean after = FALSE;
@@ -575,7 +628,7 @@ parse_signal (ParserData *data,
for (i = 0; names[i] != NULL; i++)
{
if (strcmp (names[i], "name") == 0)
name = g_strdup (values[i]);
name = values[i];
else if (strcmp (names[i], "handler") == 0)
handler = g_strdup (values[i]);
else if (strcmp (names[i], "after") == 0)
@@ -617,7 +670,7 @@ parse_signal (ParserData *data,
swapped = TRUE;
info = g_slice_new0 (SignalInfo);
info->name = name;
info->name = g_intern_string (name);
info->handler = handler;
if (after)
info->flags |= G_CONNECT_AFTER;
@@ -629,12 +682,303 @@ parse_signal (ParserData *data,
info->tag.name = element_name;
}
typedef struct
{
const gchar *tmpl_class;
gboolean found, done, in_tmpl;
GString *xml;
} TemplateParseData;
static void
extract_template_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
{
TemplateParseData *state = user_data;
gint i;
if (state->done) return;
if (g_strcmp0 (element_name, "template") == 0)
{
for (i = 0; attribute_names[i]; i++)
{
if (!g_strcmp0 (attribute_names[i], "class"))
state->found = (g_strcmp0 (attribute_values[i], state->tmpl_class) == 0);
}
if (state->found)
{
state->in_tmpl = TRUE;
g_string_append_printf (state->xml, "<external-object class=\"%s\" id=\"%s\">",
state->tmpl_class,
state->tmpl_class);
return;
}
else
g_string_append_printf (state->xml, "<%s", element_name);
}
else
g_string_append_printf (state->xml, "<%s", element_name);
for (i = 0; attribute_names[i]; i++)
{
g_string_append_printf (state->xml, " %s=\"%s\"",
attribute_names[i], attribute_values[i]);
}
g_string_append_printf (state->xml, ">");
}
static void
extract_template_end_element (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
GError **error)
{
TemplateParseData *state = user_data;
if (state->done) return;
if (g_strcmp0 (element_name, "template") == 0 && state->in_tmpl)
{
state->in_tmpl = FALSE;
g_string_append (state->xml, "</external-object>");
}
else
g_string_append_printf (state->xml, "</%s>", element_name);
if (g_strcmp0 (element_name, "interface") == 0 && state->found)
state->done = TRUE;
}
static void
extract_template_text (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
GError **error)
{
TemplateParseData *state = user_data;
if (state->done) return;
g_string_append_len (state->xml, text, text_len);
}
static gchar *
extract_template (const gchar *buffer, const gchar *class_name)
{
GMarkupParser parser = { extract_template_start_element, extract_template_end_element, extract_template_text };
TemplateParseData state = { class_name, FALSE, FALSE, FALSE, g_string_new ("")};
GMarkupParseContext *context;
context = g_markup_parse_context_new (&parser,
G_MARKUP_TREAT_CDATA_AS_TEXT |
G_MARKUP_PREFIX_ERROR_POSITION,
&state, NULL);
g_markup_parse_context_parse (context, buffer, -1, NULL);
g_markup_parse_context_end_parse (context, NULL);
g_markup_parse_context_free (context);
if (state.done)
{
gchar *retval = state.xml->str;
g_string_free (state.xml, FALSE);
g_file_set_contents ("/tmp/a.dump", retval, -1, NULL);
return retval;
}
g_string_free (state.xml, TRUE);
return NULL;
}
typedef struct
{
GTypeInfo *info;
gchar *tmpl;
} TmplClassData;
static void
composite_template_derived_class_init (gpointer g_class, gpointer class_data)
{
TmplClassData *data = class_data;
gtk_container_class_set_template_from_string (g_class, data->tmpl,
G_OBJECT_CLASS_NAME (g_class));
}
static GType
create_inline_type (GType parent_type,
const gchar *class_name,
const gchar *template_xml)
{
TmplClassData *tmpl;
GTypeQuery query;
GTypeInfo *info;
g_type_query (parent_type, &query);
tmpl = g_new0 (TmplClassData, 1);
tmpl->info = info = g_new0 (GTypeInfo, 1);
tmpl->tmpl = extract_template (template_xml, class_name);
info->class_size = query.class_size;
info->class_init = composite_template_derived_class_init;
info->class_data = tmpl; /* Let it leak! */
info->instance_size = query.instance_size;
return g_type_register_static (parent_type, class_name, info, 0);
}
static void
parse_template (ParserData *data,
const gchar *element_name,
const gchar **names,
const gchar **values,
GError **error)
{
const gchar *parent_class = NULL;
const gchar *class_name = NULL;
const GSList *l, *p;
GType parent_type;
gint i;
data->template_level++;
if (data->template_level > 1 ||
!((l = g_markup_parse_context_get_element_stack (data->ctx)) &&
(p = g_slist_next (l)) && g_strcmp0 (p->data, "interface") == 0))
{
error_generic (error, GTK_BUILDER_ERROR_INVALID_TAG, data,
element_name, "non toplevel template found");
return;
}
for (i = 0; names[i] != NULL; i++)
{
if (strcmp (names[i], "class") == 0)
class_name = values[i];
else if (strcmp (names[i], "parent") == 0)
parent_class = values[i];
else
{
error_invalid_attribute (data, element_name, names[i], error);
return;
}
}
if (!class_name)
{
error_missing_attribute (data, element_name, "class", error);
return;
}
if (!parent_class)
{
error_missing_attribute (data, element_name, "parent", error);
return;
}
if (g_type_from_name (class_name))
{
error_generic (error, GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH, data,
element_name, "template class '%s' already registered", class_name);
return;
}
if (!(parent_type = gtk_builder_get_type_from_name (data->builder, parent_class)))
{
error_generic (error, GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH, data,
element_name, "invalid parent class type found '%s'", parent_class);
return;
}
/* Generate inline type */
create_inline_type (parent_type, class_name, data->buffer);
}
static void
parse_external_object (ParserData *data,
const gchar *element_name,
const gchar **names,
const gchar **values,
GError **error)
{
const gchar *class_name = NULL;
const gchar *id = NULL;
GObject *parent;
gint i;
data->in_external_object = TRUE;
for (i = 0; names[i] != NULL; i++)
{
if (strcmp (names[i], "class") == 0)
class_name = values[i];
else if (strcmp (names[i], "id") == 0)
id = values[i];
else if (strcmp (names[i], "parent") == 0);
else
{
error_invalid_attribute (data, element_name, names[i], error);
return;
}
}
if (!class_name)
{
error_missing_attribute (data, element_name, "class", error);
return;
}
if (!id)
{
error_missing_attribute (data, element_name, "id", error);
return;
}
if (data->requested_objects == NULL &&
(parent = gtk_builder_get_object (data->builder, id)))
{
GType class_type, parent_type = G_OBJECT_TYPE (parent);
ObjectInfo *object_info;
if (!(class_type = g_type_from_name (class_name)))
{
error_generic (error, GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH, data,
element_name, "invalid class type found '%s'", class_name);
return;
}
if (!g_type_is_a (parent_type, class_type))
{
error_generic (error, GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH, data,
element_name, "this template is for a class type %s not for %s",
class_name, G_OBJECT_TYPE_NAME (parent));
return;
}
/* push parent to build its children from the template */
object_info = g_slice_new0 (ObjectInfo);
object_info->object = data->external_object = parent;
object_info->object_type = parent_type;
object_info->id = g_strdup (_gtk_builder_object_get_name (parent));
object_info->tag.name = "object";
state_push (data, object_info);
parser_add_object_id (data, object_info->id, error);
}
}
/* Called by GtkBuilder */
void
_free_signal_info (SignalInfo *info,
gpointer user_data)
{
g_free (info->name);
g_free (info->handler);
g_free (info->connect_object_name);
g_free (info->object_name);
@@ -875,9 +1219,15 @@ start_element (GMarkupParseContext *context,
if (strcmp (element_name, "requires") == 0)
parse_requires (data, element_name, names, values, error);
else if (strcmp (element_name, "template") == 0)
parse_template (data, element_name, names, values, error);
else if (strcmp (element_name, "external-object") == 0)
parse_external_object (data, element_name, names, values, error);
else if (strcmp (element_name, "object") == 0)
parse_object (context, data, element_name, names, values, error);
else if (data->requested_objects && !data->inside_requested_object)
else if ((data->requested_objects && !data->inside_requested_object) ||
(data->in_external_object && !data->external_object) ||
data->template_level)
{
/* If outside a requested object, simply ignore this tag */
return;
@@ -963,9 +1313,35 @@ end_element (GMarkupParseContext *context,
else if (strcmp (element_name, "interface") == 0)
{
}
else if (data->requested_objects && !data->inside_requested_object)
else if (strcmp (element_name, "template") == 0)
{
/* If outside a requested object, simply ignore this tag */
data->template_level--;
}
else if (strcmp (element_name, "external-object") == 0)
{
data->in_external_object = FALSE;
if (data->external_object)
{
ObjectInfo *object_info = state_pop_info (data, ObjectInfo);
object_info->properties = g_slist_reverse (object_info->properties);
/* This is just to apply properties to the external object */
_gtk_builder_construct (data->builder, object_info, error);
if (object_info->signals)
_gtk_builder_add_signals (data->builder, object_info->signals);
free_object_info (object_info);
data->external_object = NULL;
}
}
else if ((data->requested_objects && !data->inside_requested_object) ||
(data->in_external_object && !data->external_object) ||
data->template_level)
{
/* If outside a requested object or template, simply ignore this tag */
return;
}
else if (strcmp (element_name, "menu") == 0)
@@ -1144,6 +1520,7 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
domain = gtk_builder_get_translation_domain (builder);
data = g_new0 (ParserData, 1);
data->buffer = buffer;
data->builder = builder;
data->filename = filename;
data->domain = g_strdup (domain);
+19 -10
View File
@@ -31,7 +31,7 @@ typedef struct {
typedef struct {
TagInfo tag;
gchar *class_name;
GType object_type;
gchar *id;
gchar *constructor;
GSList *properties;
@@ -58,17 +58,17 @@ typedef struct {
typedef struct {
TagInfo tag;
gchar *name;
const gchar *name; /* Intern string */
GString *text;
gchar *data;
gboolean translatable;
gchar *context;
guint8 translatable : 1;
} PropertyInfo;
typedef struct {
TagInfo tag;
gchar *object_name;
gchar *name;
const gchar *name; /* Intern string */
gchar *handler;
GConnectFlags flags;
gchar *connect_object_name;
@@ -91,6 +91,7 @@ typedef struct {
} SubParser;
typedef struct {
const gchar *buffer;
const gchar *last_element;
GtkBuilder *builder;
gchar *domain;
@@ -107,17 +108,21 @@ typedef struct {
gint cur_object_level;
GHashTable *object_ids;
GObject *external_object;
gint in_external_object;
gint template_level;
} ParserData;
typedef GType (*GTypeGetFunc) (void);
/* Things only GtkBuilder should use */
void _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
const gchar *filename,
const gchar *buffer,
gsize length,
gchar **requested_objs,
GError **error);
void _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
const gchar *filename,
const gchar *buffer,
gsize length,
gchar **requested_objs,
GError **error);
GObject * _gtk_builder_construct (GtkBuilder *builder,
ObjectInfo *info,
GError **error);
@@ -159,5 +164,9 @@ void _gtk_builder_menu_start (ParserData *parser_data,
GError **error);
void _gtk_builder_menu_end (ParserData *parser_data);
const gchar * _gtk_builder_object_get_name (GObject *object);
void _gtk_builder_set_ignore_type (GtkBuilder *builder, GType ignore_type);
GType _gtk_builder_get_ignore_type (GtkBuilder *builder);
#endif /* __GTK_BUILDER_PRIVATE_H__ */
+3 -7
View File
@@ -1768,7 +1768,7 @@ get_size (GtkCellRenderer *cell,
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
font_desc = pango_font_description_copy_static (gtk_style_context_get_font (style_context, state));
gtk_style_context_get (style_context, state, "font", &font_desc, NULL);
pango_font_description_merge_static (font_desc, priv->font, TRUE);
if (priv->scale_set)
@@ -2128,8 +2128,6 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
{
GtkCellRendererTextPrivate *priv;
GtkCellRendererText *celltext;
GtkStyleContext *style_context;
const PangoFontDescription *font_desc;
PangoLayout *layout;
PangoContext *context;
PangoFontMetrics *metrics;
@@ -2149,8 +2147,6 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
celltext = GTK_CELL_RENDERER_TEXT (cell);
priv = celltext->priv;
style_context = gtk_widget_get_style_context (widget);
gtk_cell_renderer_get_padding (cell, &xpad, NULL);
layout = get_layout (celltext, widget, NULL, 0);
@@ -2162,8 +2158,8 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
/* Fetch the average size of a charachter */
context = pango_layout_get_context (layout);
font_desc = gtk_style_context_get_font (style_context, 0);
metrics = pango_context_get_metrics (context, font_desc,
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
+36 -19
View File
@@ -38,6 +38,13 @@ enum {
LAST_SIGNAL
};
@interface GtkClipboardOwner : NSObject {
GtkClipboard *clipboard;
gboolean setting_same_owner;
}
@end
typedef struct _GtkClipboardClass GtkClipboardClass;
struct _GtkClipboard
@@ -45,6 +52,7 @@ struct _GtkClipboard
GObject parent_instance;
NSPasteboard *pasteboard;
GtkClipboardOwner *owner;
NSInteger change_count;
GdkAtom selection;
@@ -87,12 +95,6 @@ static GtkClipboard *clipboard_peek (GdkDisplay *display,
GdkAtom selection,
gboolean only_if_exists);
@interface GtkClipboardOwner : NSObject {
GtkClipboard *clipboard;
}
@end
@implementation GtkClipboardOwner
-(void)pasteboard:(NSPasteboard *)sender provideDataForType:(NSString *)type
{
@@ -131,9 +133,8 @@ static GtkClipboard *clipboard_peek (GdkDisplay *display,
*/
- (void)pasteboardChangedOwner:(NSPasteboard *)sender
{
clipboard_unset (clipboard);
[self release];
if (! setting_same_owner)
clipboard_unset (clipboard);
}
- (id)initWithClipboard:(GtkClipboard *)aClipboard
@@ -143,6 +144,7 @@ static GtkClipboard *clipboard_peek (GdkDisplay *display,
if (self)
{
clipboard = aClipboard;
setting_same_owner = FALSE;
}
return self;
@@ -333,10 +335,6 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
NSSet *types;
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
if (!(clipboard->have_owner && have_owner) ||
clipboard->user_data != user_data)
{
@@ -351,26 +349,44 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
clipboard->user_data != user_data)
{
(*clear_func) (clipboard, user_data);
[pool release];
return FALSE;
}
else
{
[pool release];
return TRUE;
}
}
}
pool = [[NSAutoreleasePool alloc] init];
types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
/* call declareTypes before setting the clipboard members because
* declareTypes might clear the clipboard
*/
types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
owner: owner];
if (user_data && user_data == clipboard->user_data)
{
owner = [clipboard->owner retain];
owner->setting_same_owner = TRUE;
clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
owner: owner];
owner->setting_same_owner = FALSE;
}
else
{
owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
owner: owner];
}
[owner release];
[types release];
[pool release];
clipboard->owner = owner;
clipboard->user_data = user_data;
clipboard->have_owner = have_owner;
if (have_owner)
@@ -459,7 +475,8 @@ clipboard_unset (GtkClipboard *clipboard)
clipboard->n_storable_targets = -1;
g_free (clipboard->storable_targets);
clipboard->storable_targets = NULL;
clipboard->owner = NULL;
clipboard->get_func = NULL;
clipboard->clear_func = NULL;
clipboard->user_data = NULL;
+2 -8
View File
@@ -5446,12 +5446,9 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
gint font_size, arrow_size;
PangoContext *context;
PangoFontMetrics *metrics;
const PangoFontDescription *font_desc;
GtkWidget *child;
gint minimum_width = 0, natural_width = 0;
gint child_min, child_nat;
GtkStyleContext *style_context;
GtkStateFlags state;
GtkBorder padding;
gfloat arrow_scaling;
@@ -5465,14 +5462,11 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
"arrow-scaling", &arrow_scaling,
NULL);
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
get_widget_padding_and_border (widget, &padding);
font_desc = gtk_style_context_get_font (style_context, state);
context = gtk_widget_get_pango_context (GTK_WIDGET (widget));
metrics = pango_context_get_metrics (context, font_desc,
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
pango_font_metrics_get_descent (metrics));
+349
View File
@@ -231,6 +231,36 @@
* </refsect2>
*/
typedef struct
{
gchar *name;
GType type;
guint offset;
gboolean private;
} InternalChildData;
typedef struct
{
gchar *name;
GObject *object;
} InternalChild;
typedef enum
{
TMPL_STRING,
TMPL_RESOURCE
} GtkContainerTemplateType;
struct _GtkContainerClassPrivate
{
GSList *tmpl_classes;
const gchar *tmpl, *tmpl_id;
glong tmpl_len;
GtkContainerTemplateType tmpl_type;
GtkBuilderConnectFunc connect_func;
GList *internal_children; /* InternalChildData list */
};
struct _GtkContainerPrivate
{
@@ -244,6 +274,8 @@ struct _GtkContainerPrivate
guint restyle_pending : 1;
guint resize_mode : 2;
guint request_mode : 2;
GArray *internal_children; /* InternalChild array */
};
enum {
@@ -271,6 +303,9 @@ static void gtk_container_base_class_finalize (GtkContainerClass *klass);
static void gtk_container_class_init (GtkContainerClass *klass);
static void gtk_container_init (GtkContainer *container);
static void gtk_container_destroy (GtkWidget *widget);
static GObject *gtk_container_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties);
static void gtk_container_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -390,6 +425,8 @@ gtk_container_get_type (void)
GTK_TYPE_BUILDABLE,
&buildable_info);
g_type_add_class_private (container_type, sizeof (GtkContainerClassPrivate));
}
return container_type;
@@ -398,7 +435,19 @@ gtk_container_get_type (void)
static void
gtk_container_base_class_init (GtkContainerClass *class)
{
GtkContainerClassPrivate *priv;
/* reset instance specifc class fields that don't get inherited */
class->priv = priv = G_TYPE_CLASS_GET_PRIVATE (class,
GTK_TYPE_CONTAINER,
GtkContainerClassPrivate);
priv->tmpl = NULL;
priv->tmpl_id = NULL;
priv->tmpl_classes = NULL;
priv->connect_func = NULL;
priv->internal_children = NULL;
class->set_child_property = NULL;
class->get_child_property = NULL;
}
@@ -406,6 +455,7 @@ gtk_container_base_class_init (GtkContainerClass *class)
static void
gtk_container_base_class_finalize (GtkContainerClass *class)
{
GtkContainerClassPrivate *priv = class->priv;
GList *list, *node;
list = g_param_spec_pool_list_owned (_gtk_widget_child_property_pool, G_OBJECT_CLASS_TYPE (class));
@@ -418,6 +468,8 @@ gtk_container_base_class_finalize (GtkContainerClass *class)
g_param_spec_unref (pspec);
}
g_list_free (list);
g_slist_free (priv->tmpl_classes);
}
static void
@@ -431,6 +483,7 @@ gtk_container_class_init (GtkContainerClass *class)
vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
gobject_class->constructor = gtk_container_constructor;
gobject_class->set_property = gtk_container_set_property;
gobject_class->get_property = gtk_container_get_property;
@@ -520,10 +573,37 @@ gtk_container_class_init (GtkContainerClass *class)
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CONTAINER_ACCESSIBLE);
}
static GObject *
gtk_container_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const gchar *childname)
{
GArray *internal_children;
g_return_val_if_fail (childname && childname[0], NULL);
if ((internal_children = GTK_CONTAINER (buildable)->priv->internal_children))
{
gint i, len;
for (i = 0, len = internal_children->len; i < len; i++)
{
InternalChild *data = &g_array_index (internal_children, InternalChild, i);
if (g_strcmp0 (data->name, childname) == 0) return data->object;
}
}
return parent_buildable_iface->get_internal_child (buildable,
builder,
childname);
}
static void
gtk_container_buildable_init (GtkBuildableIface *iface)
{
parent_buildable_iface = g_type_interface_peek_parent (iface);
iface->get_internal_child = gtk_container_buildable_get_internal_child;
iface->add_child = gtk_container_buildable_add_child;
iface->custom_tag_start = gtk_container_buildable_custom_tag_start;
iface->custom_tag_end = gtk_container_buildable_custom_tag_end;
@@ -1319,6 +1399,152 @@ gtk_container_class_list_child_properties (GObjectClass *cclass,
return pspecs;
}
static void
gtk_container_class_set_template (GtkContainerClass *container_class,
const gchar *tmpl,
const gchar *template_id,
GtkContainerTemplateType tmpl_type)
{
GtkContainerClassPrivate *priv = container_class->priv;
GObjectClass *oclass;
priv->tmpl = tmpl;
priv->tmpl_len = g_utf8_strlen (tmpl, -1);
priv->tmpl_id = template_id;
priv->tmpl_type = tmpl_type;
if (priv->tmpl_classes)
{
g_slist_free (priv->tmpl_classes);
priv->tmpl_classes = NULL;
}
/* Collect an ordered list of class which have templates to build */
for (oclass = G_OBJECT_CLASS (container_class);
GTK_IS_CONTAINER_CLASS (oclass);
oclass = g_type_class_peek_parent (oclass))
{
GtkContainerClassPrivate *cpriv = GTK_CONTAINER_CLASS (oclass)->priv;
if (cpriv->tmpl)
priv->tmpl_classes = g_slist_prepend (priv->tmpl_classes, oclass);
}
}
/**
* gtk_container_class_set_template_from_string:
* @container_class: a #GtkContainerClass
* @template_string: the #GtkBuilder xml string
* @template_id: the template id
*
* For type implementations it is recommended to use #gtk_container_class_set_template_from_resource
* instead of this function.
*
* Since: 3.8
*/
void
gtk_container_class_set_template_from_string (GtkContainerClass *container_class,
const gchar *template_string,
const gchar *template_id)
{
g_return_if_fail (GTK_IS_CONTAINER_CLASS (container_class));
g_return_if_fail (template_string && template_string[0]);
g_return_if_fail (template_id && template_id[0]);
gtk_container_class_set_template (container_class, template_string,
template_id, TMPL_STRING);
}
/**
* gtk_container_class_set_template_from_resource:
* @container_class: a #GtkContainerClass
* @resource_path: the #GtkBuilder xml resource path
* @template_id: the template id
*
* This is used when implementing new composite widget types
* to specify a UI template for instances of this type.
*
* Templates are in the <link linkend="BUILDER-UI">GtkBuilder UI description</link>
* format and are used to implement composite widget types in
* an automated way.
*
* Instances with an assigned template will have their children built at object
* construct time.
*
* The provided xml is expected to have a <external-object> tag instead of
* <object> with id=@template_id.
*
* Since: 3.8
*/
void
gtk_container_class_set_template_from_resource (GtkContainerClass *container_class,
const gchar *resource_path,
const gchar *template_id)
{
g_return_if_fail (GTK_IS_CONTAINER_CLASS (container_class));
g_return_if_fail (resource_path && resource_path[0]);
g_return_if_fail (template_id && template_id[0]);
gtk_container_class_set_template (container_class, resource_path,
template_id, TMPL_RESOURCE);
}
/**
* gtk_container_class_set_connect_func:
* @container_class: a #GtkContainerClass
* @connect_func: the #GtkBuilderConnectFunc to use when connecting signals internally.
*
* Sets the function to be used when automatically connecting signals
* defined by this class's GtkBuilder template.
*
* Since: 3.6
*/
void
gtk_container_class_set_connect_func (GtkContainerClass *container_class,
GtkBuilderConnectFunc connect_func)
{
g_return_if_fail (GTK_IS_CONTAINER_CLASS(container_class));
g_return_if_fail (connect_func != NULL);
container_class->priv->connect_func = connect_func;
}
/**
* gtk_container_class_declare_internal_child:
* @container_class: a #GtkContainerClass
* @use_private: True if struct_offset refers to the instance private struct
* @struct_offset: offset where to save composite children pointer
* @name: the name of the composite children to declare
*
* Declare a child defined in the template as an internal children.
* Use #G_STRUCT_OFFSET to pass in the struct_offset of the pointer that will be set automatically on construction.
* If you do not need to keep a pointer set use_private to FALSE and struct_offset to 0.
*
* Since: 3.6
*/
void
gtk_container_class_declare_internal_child (GtkContainerClass *container_class,
gboolean use_private,
guint struct_offset,
const gchar *name)
{
GtkContainerClassPrivate *priv;
InternalChildData *child;
g_return_if_fail (GTK_IS_CONTAINER_CLASS (container_class));
g_return_if_fail (name);
priv = container_class->priv;
child = g_new0 (InternalChildData, 1);
child->name = g_strdup (name);
child->private = use_private;
child->type = G_TYPE_FROM_CLASS (container_class);
child->offset = struct_offset;
priv->internal_children = g_list_prepend (priv->internal_children, child);
}
static void
gtk_container_add_unimplemented (GtkContainer *container,
GtkWidget *widget)
@@ -1347,6 +1573,7 @@ gtk_container_init (GtkContainer *container)
priv->border_width = 0;
priv->resize_mode = GTK_RESIZE_PARENT;
priv->reallocate_redraws = FALSE;
priv->internal_children = NULL;
}
static void
@@ -1375,11 +1602,133 @@ gtk_container_destroy (GtkWidget *widget)
if (priv->has_focus_chain)
gtk_container_unset_focus_chain (container);
if (priv->internal_children)
{
GArray *internal_children = priv->internal_children;
gint i, len = internal_children->len;
for (i = 0; i < len; i++)
{
InternalChild *data = &g_array_index (internal_children, InternalChild, i);
g_object_unref (data->object);
}
g_array_unref (internal_children);
priv->internal_children = NULL;
}
gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
GTK_WIDGET_CLASS (parent_class)->destroy (widget);
}
static void
gtk_container_child_set_internal (GtkContainer *container,
InternalChildData *child,
GObject *internal)
{
GtkContainerPrivate *priv = container->priv;
InternalChild data;
GObject **retval;
if (!priv->internal_children)
priv->internal_children = g_array_new (FALSE, FALSE, sizeof (InternalChild));
if (GTK_IS_WIDGET (internal))
gtk_widget_set_composite_name (GTK_WIDGET (internal), child->name);
data.name = child->name;
data.object = g_object_ref (internal);
g_array_append_val (priv->internal_children, data);
if (child->private)
{
gpointer pstruct = G_TYPE_INSTANCE_GET_PRIVATE (container, child->type, gpointer);
retval = G_STRUCT_MEMBER_P (pstruct, child->offset);
}
else
retval = G_STRUCT_MEMBER_P (container, child->offset);
*retval = internal;
}
static GObject *
gtk_container_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GtkContainerClassPrivate *priv;
GtkContainer *container;
GError *error = NULL;
GtkBuilder *builder;
GObject *object;
GSList *l;
object = G_OBJECT_CLASS (parent_class)->constructor (type,
n_construct_properties,
construct_properties);
priv = GTK_CONTAINER_CLASS (G_OBJECT_GET_CLASS (object))->priv;
container = GTK_CONTAINER (object);
gtk_widget_push_composite_child ();
/* Build the templates for each class starting with the superclass descending */
for (l = priv->tmpl_classes; l; l = g_slist_next (l))
{
GtkContainerClassPrivate *cpriv = GTK_CONTAINER_CLASS (l->data)->priv;
GList *children;
guint ret;
builder = gtk_builder_new ();
gtk_builder_expose_object (builder, cpriv->tmpl_id, object);
/* Safeguard to avoid recursion */
_gtk_builder_set_ignore_type (builder, type);
if (cpriv->tmpl_type == TMPL_STRING)
ret = gtk_builder_add_from_string (builder, cpriv->tmpl, cpriv->tmpl_len, &error);
else if (cpriv->tmpl_type == TMPL_RESOURCE)
ret = gtk_builder_add_from_resource (builder, cpriv->tmpl, &error);
else
ret = 0;
if (ret)
{
/* Setup internal children */
for (children = cpriv->internal_children; children; children = g_list_next (children))
{
InternalChildData *child = children->data;
GObject *internal;
if ((internal = gtk_builder_get_object (builder, child->name)))
gtk_container_child_set_internal (container, child, internal);
else
{
g_warning ("Unable to setup internal child %s while building GtkContainer class %s",
g_type_name (type), child->name);
continue;
}
}
if (cpriv->connect_func)
gtk_builder_connect_signals_full (builder, cpriv->connect_func, container);
else
gtk_builder_connect_signals (builder, container);
}
else
{
g_critical ("Unable to build GtkContainer class %s from template: %s",
g_type_name (type), error->message);
g_error_free (error);
}
g_object_unref (builder);
}
gtk_widget_pop_composite_child ();
return object;
}
static void
gtk_container_set_property (GObject *object,
guint prop_id,
+19 -1
View File
@@ -31,6 +31,8 @@
#include <gtk/gtkwidget.h>
#include <gtk/gtkadjustment.h>
#include <gtk/gtkbuilder.h>
G_BEGIN_DECLS
@@ -46,6 +48,7 @@ G_BEGIN_DECLS
typedef struct _GtkContainer GtkContainer;
typedef struct _GtkContainerPrivate GtkContainerPrivate;
typedef struct _GtkContainerClass GtkContainerClass;
typedef struct _GtkContainerClassPrivate GtkContainerClassPrivate;
struct _GtkContainer
{
@@ -91,6 +94,8 @@ struct _GtkContainerClass
unsigned int _handle_border_width : 1;
GtkContainerClassPrivate *priv;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
@@ -99,7 +104,6 @@ struct _GtkContainerClass
void (*_gtk_reserved5) (void);
void (*_gtk_reserved6) (void);
void (*_gtk_reserved7) (void);
void (*_gtk_reserved8) (void);
};
@@ -219,6 +223,20 @@ void gtk_container_forall (GtkContainer *container,
void gtk_container_class_handle_border_width (GtkContainerClass *klass);
/* Class-level functions */
void gtk_container_class_set_template_from_string (GtkContainerClass *container_class,
const gchar *template_string,
const gchar *template_id);
void gtk_container_class_set_template_from_resource (GtkContainerClass *container_class,
const gchar *resource_path,
const gchar *template_id);
void gtk_container_class_set_connect_func (GtkContainerClass *container_class,
GtkBuilderConnectFunc connect_func);
void gtk_container_class_declare_internal_child (GtkContainerClass *container_class,
gboolean use_private,
guint struct_offset,
const gchar *name);
GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer *container,
GtkWidget *child);
-15
View File
@@ -82,20 +82,6 @@ gtk_css_value_array_compute (GtkCssValue *value,
return result;
}
static gboolean
gtk_css_value_array_needs_compute (const GtkCssValue *value)
{
guint i;
for (i = 0; i < value->n_values; i++)
{
if (_gtk_css_value_needs_compute (value->values[i]))
return TRUE;
}
return FALSE;
}
static gboolean
gtk_css_value_array_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -337,7 +323,6 @@ gtk_css_value_array_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
gtk_css_value_array_free,
gtk_css_value_array_compute,
gtk_css_value_array_needs_compute,
gtk_css_value_array_equal,
gtk_css_value_array_transition,
gtk_css_value_array_print
-9
View File
@@ -69,14 +69,6 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
value->y ? y : NULL);
}
static gboolean
gtk_css_value_bg_size_needs_compute (const GtkCssValue *value)
{
return
_gtk_css_value_needs_compute (value->x) ||
_gtk_css_value_needs_compute (value->y);
}
static gboolean
gtk_css_value_bg_size_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -158,7 +150,6 @@ gtk_css_value_bg_size_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
gtk_css_value_bg_size_free,
gtk_css_value_bg_size_compute,
gtk_css_value_bg_size_needs_compute,
gtk_css_value_bg_size_equal,
gtk_css_value_bg_size_transition,
gtk_css_value_bg_size_print
-15
View File
@@ -76,20 +76,6 @@ gtk_css_value_border_compute (GtkCssValue *value,
return computed;
}
static gboolean
gtk_css_value_border_needs_compute (const GtkCssValue *value)
{
guint i;
for (i = 0; i < 4; i++)
{
if (_gtk_css_value_needs_compute (value->values[i]))
return TRUE;
}
return FALSE;
}
static gboolean
gtk_css_value_border_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -150,7 +136,6 @@ gtk_css_value_border_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
gtk_css_value_border_free,
gtk_css_value_border_compute,
gtk_css_value_border_needs_compute,
gtk_css_value_border_equal,
gtk_css_value_border_transition,
gtk_css_value_border_print
-7
View File
@@ -334,12 +334,6 @@ gtk_css_value_color_compute (GtkCssValue *value,
return resolved;
}
static gboolean
gtk_css_value_color_needs_compute (const GtkCssValue *value)
{
return TRUE;
}
static gboolean
gtk_css_value_color_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -455,7 +449,6 @@ gtk_css_value_color_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
gtk_css_value_color_free,
gtk_css_value_color_compute,
gtk_css_value_color_needs_compute,
gtk_css_value_color_equal,
gtk_css_value_color_transition,
gtk_css_value_color_print
+1 -1
View File
@@ -137,7 +137,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
if (_gtk_css_style_property_is_inherit (prop))
specified = _gtk_css_inherit_value_new ();
else
specified = _gtk_css_initial_value_new (prop);
specified = _gtk_css_initial_value_new ();
}
else
_gtk_css_value_ref (specified);
-9
View File
@@ -60,14 +60,6 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
return _gtk_css_corner_value_new (x, y);
}
static gboolean
gtk_css_value_corner_needs_compute (const GtkCssValue *corner)
{
return
_gtk_css_value_needs_compute (corner->x) ||
_gtk_css_value_needs_compute (corner->y);
}
static gboolean
gtk_css_value_corner_equal (const GtkCssValue *corner1,
const GtkCssValue *corner2)
@@ -112,7 +104,6 @@ gtk_css_value_corner_print (const GtkCssValue *corner,
static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
gtk_css_value_corner_free,
gtk_css_value_corner_compute,
gtk_css_value_corner_needs_compute,
gtk_css_value_corner_equal,
gtk_css_value_corner_transition,
gtk_css_value_corner_print
-7
View File
@@ -60,12 +60,6 @@ gtk_css_value_ease_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_ease_needs_compute (const GtkCssValue *value)
{
return FALSE;
}
static gboolean
gtk_css_value_ease_equal (const GtkCssValue *ease1,
const GtkCssValue *ease2)
@@ -144,7 +138,6 @@ gtk_css_value_ease_print (const GtkCssValue *ease,
static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
gtk_css_value_ease_free,
gtk_css_value_ease_compute,
gtk_css_value_ease_needs_compute,
gtk_css_value_ease_equal,
gtk_css_value_ease_transition,
gtk_css_value_ease_print
-7
View File
@@ -45,12 +45,6 @@ gtk_css_value_engine_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_engine_needs_compute (const GtkCssValue *value)
{
return FALSE;
}
static gboolean
gtk_css_value_engine_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -86,7 +80,6 @@ gtk_css_value_engine_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_ENGINE = {
gtk_css_value_engine_free,
gtk_css_value_engine_compute,
gtk_css_value_engine_needs_compute,
gtk_css_value_engine_equal,
gtk_css_value_engine_transition,
gtk_css_value_engine_print
-22
View File
@@ -48,12 +48,6 @@ gtk_css_value_enum_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_enum_needs_compute (const GtkCssValue *value)
{
return FALSE;
}
static gboolean
gtk_css_value_enum_equal (const GtkCssValue *enum1,
const GtkCssValue *enum2)
@@ -82,7 +76,6 @@ gtk_css_value_enum_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -226,17 +219,9 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
return _gtk_css_number_value_new (font_size, GTK_CSS_PX);
}
static gboolean
gtk_css_value_font_size_needs_compute (const GtkCssValue *value)
{
return TRUE;
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
gtk_css_value_enum_free,
gtk_css_value_font_size_compute,
gtk_css_value_font_size_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -291,7 +276,6 @@ _gtk_css_font_size_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -340,7 +324,6 @@ _gtk_css_font_style_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -388,7 +371,6 @@ _gtk_css_font_variant_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -457,7 +439,6 @@ _gtk_css_font_weight_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -512,7 +493,6 @@ _gtk_css_area_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -568,7 +548,6 @@ _gtk_css_direction_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
@@ -622,7 +601,6 @@ _gtk_css_play_state_value_get (const GtkCssValue *value)
static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_needs_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_enum_print
-7
View File
@@ -59,12 +59,6 @@ gtk_css_value_image_compute (GtkCssValue *value,
return _gtk_css_image_value_new (computed);
}
static gboolean
gtk_css_value_image_needs_compute (const GtkCssValue *value)
{
return _gtk_css_image_value_get_image (value) != NULL;
}
static gboolean
gtk_css_value_image_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -101,7 +95,6 @@ gtk_css_value_image_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
gtk_css_value_image_free,
gtk_css_value_image_compute,
gtk_css_value_image_needs_compute,
gtk_css_value_image_equal,
gtk_css_value_image_transition,
gtk_css_value_image_print
+1 -8
View File
@@ -48,7 +48,7 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
}
else
{
return _gtk_css_value_compute (_gtk_css_initial_value_get (_gtk_css_style_property_lookup_by_id (property_id)),
return _gtk_css_value_compute (_gtk_css_initial_value_get (),
property_id,
provider,
values,
@@ -57,12 +57,6 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
}
}
static gboolean
gtk_css_value_inherit_needs_compute (const GtkCssValue *value)
{
return TRUE;
}
static gboolean
gtk_css_value_inherit_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -89,7 +83,6 @@ gtk_css_value_inherit_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
gtk_css_value_inherit_free,
gtk_css_value_inherit_compute,
gtk_css_value_inherit_needs_compute,
gtk_css_value_inherit_equal,
gtk_css_value_inherit_transition,
gtk_css_value_inherit_print
+5 -25
View File
@@ -27,8 +27,6 @@
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
GtkCssStyleProperty *property;
gboolean needs_compute;
};
static void
@@ -48,9 +46,6 @@ gtk_css_value_initial_compute (GtkCssValue *value,
{
GtkSettings *settings;
if (!value->needs_compute)
return _gtk_css_value_ref (_gtk_css_style_property_get_initial_value (value->property));
switch (property_id)
{
case GTK_CSS_PROPERTY_FONT_FAMILY:
@@ -82,7 +77,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
break;
}
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (value->property),
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
provider,
values,
@@ -90,12 +85,6 @@ gtk_css_value_initial_compute (GtkCssValue *value,
dependencies);
}
static gboolean
gtk_css_value_initial_needs_compute (const GtkCssValue *value)
{
return TRUE;
}
static gboolean
gtk_css_value_initial_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -122,7 +111,6 @@ gtk_css_value_initial_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
gtk_css_value_initial_free,
gtk_css_value_initial_compute,
gtk_css_value_initial_needs_compute,
gtk_css_value_initial_equal,
gtk_css_value_initial_transition,
gtk_css_value_initial_print
@@ -131,21 +119,13 @@ static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
static GtkCssValue initial = { &GTK_CSS_VALUE_INITIAL, 1 };
GtkCssValue *
_gtk_css_initial_value_new (GtkCssStyleProperty *property)
_gtk_css_initial_value_new (void)
{
return _gtk_css_value_ref (_gtk_css_initial_value_get (property));
return _gtk_css_value_ref (&initial);
}
GtkCssValue *
_gtk_css_initial_value_get (GtkCssStyleProperty *property)
_gtk_css_initial_value_get (void)
{
if (property->css_initial_value == NULL)
{
property->css_initial_value = g_new0 (GtkCssValue, 1);
*property->css_initial_value = initial;
property->css_initial_value->property = property;
property->css_initial_value->needs_compute =
_gtk_css_value_needs_compute (_gtk_css_style_property_get_initial_value (property));
}
return property->css_initial_value;
return &initial;
}
+3 -3
View File
@@ -21,11 +21,11 @@
#define __GTK_CSS_INITIAL_VALUE_PRIVATE_H__
#include "gtkcssvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
G_BEGIN_DECLS
GtkCssValue * _gtk_css_initial_value_new (GtkCssStyleProperty *property);
GtkCssValue * _gtk_css_initial_value_get (GtkCssStyleProperty *property);
GtkCssValue * _gtk_css_initial_value_new (void);
GtkCssValue * _gtk_css_initial_value_get (void);
G_END_DECLS
+11 -13
View File
@@ -62,13 +62,11 @@ gtk_css_matcher_widget_path_get_state (const GtkCssMatcher *matcher)
}
static gboolean
gtk_css_matcher_widget_path_has_name (const GtkCssMatcher *matcher,
const char *name)
gtk_css_matcher_widget_path_has_type (const GtkCssMatcher *matcher,
GType type)
{
const GtkWidgetPath *siblings;
GType type;
type = g_type_from_name (name);
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
return g_type_is_a (gtk_widget_path_iter_get_object_type (siblings, matcher->path.sibling_index), type);
@@ -179,7 +177,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
gtk_css_matcher_widget_path_get_parent,
gtk_css_matcher_widget_path_get_previous,
gtk_css_matcher_widget_path_get_state,
gtk_css_matcher_widget_path_has_name,
gtk_css_matcher_widget_path_has_type,
gtk_css_matcher_widget_path_has_class,
gtk_css_matcher_widget_path_has_id,
gtk_css_matcher_widget_path_has_regions,
@@ -236,8 +234,8 @@ gtk_css_matcher_any_get_state (const GtkCssMatcher *matcher)
}
static gboolean
gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher,
const char *name)
gtk_css_matcher_any_has_type (const GtkCssMatcher *matcher,
GType type)
{
return TRUE;
}
@@ -283,7 +281,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
gtk_css_matcher_any_get_parent,
gtk_css_matcher_any_get_previous,
gtk_css_matcher_any_get_state,
gtk_css_matcher_any_has_name,
gtk_css_matcher_any_has_type,
gtk_css_matcher_any_has_class,
gtk_css_matcher_any_has_id,
gtk_css_matcher_any_has_regions,
@@ -332,11 +330,11 @@ gtk_css_matcher_superset_get_state (const GtkCssMatcher *matcher)
}
static gboolean
gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher,
const char *name)
gtk_css_matcher_superset_has_type (const GtkCssMatcher *matcher,
GType type)
{
if (matcher->superset.relevant & GTK_CSS_CHANGE_NAME)
return _gtk_css_matcher_has_name (matcher->superset.subset, name);
return _gtk_css_matcher_has_type (matcher->superset.subset, type);
else
return TRUE;
}
@@ -402,7 +400,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
gtk_css_matcher_superset_get_parent,
gtk_css_matcher_superset_get_previous,
gtk_css_matcher_superset_get_state,
gtk_css_matcher_superset_has_name,
gtk_css_matcher_superset_has_type,
gtk_css_matcher_superset_has_class,
gtk_css_matcher_superset_has_id,
gtk_css_matcher_superset_has_regions,
+5 -5
View File
@@ -36,8 +36,8 @@ struct _GtkCssMatcherClass {
const GtkCssMatcher *next);
GtkStateFlags (* get_state) (const GtkCssMatcher *matcher);
gboolean (* has_name) (const GtkCssMatcher *matcher,
const char *name);
gboolean (* has_type) (const GtkCssMatcher *matcher,
GType type);
gboolean (* has_class) (const GtkCssMatcher *matcher,
GQuark class_name);
gboolean (* has_id) (const GtkCssMatcher *matcher,
@@ -103,10 +103,10 @@ _gtk_css_matcher_get_state (const GtkCssMatcher *matcher)
}
static inline gboolean
_gtk_css_matcher_has_name (const GtkCssMatcher *matcher,
const char *name)
_gtk_css_matcher_has_type (const GtkCssMatcher *matcher,
GType type)
{
return matcher->klass->has_name (matcher, name);
return matcher->klass->has_type (matcher, type);
}
static inline gboolean
-33
View File
@@ -123,38 +123,6 @@ gtk_css_value_number_compute (GtkCssValue *number,
}
}
static gboolean
gtk_css_value_number_needs_compute (const GtkCssValue *number)
{
switch (number->unit)
{
default:
g_assert_not_reached();
/* fall through */
case GTK_CSS_PERCENT:
/* percentages for font sizes are computed, other percentages aren't */
return TRUE;
case GTK_CSS_NUMBER:
case GTK_CSS_PX:
case GTK_CSS_DEG:
case GTK_CSS_S:
return FALSE;
case GTK_CSS_PT:
case GTK_CSS_PC:
case GTK_CSS_IN:
case GTK_CSS_CM:
case GTK_CSS_MM:
case GTK_CSS_EM:
case GTK_CSS_EX:
case GTK_CSS_RAD:
case GTK_CSS_GRAD:
case GTK_CSS_TURN:
case GTK_CSS_MS:
return TRUE;
}
}
static gboolean
gtk_css_value_number_equal (const GtkCssValue *number1,
const GtkCssValue *number2)
@@ -212,7 +180,6 @@ gtk_css_value_number_print (const GtkCssValue *number,
static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {
gtk_css_value_number_free,
gtk_css_value_number_compute,
gtk_css_value_number_needs_compute,
gtk_css_value_number_equal,
gtk_css_value_number_transition,
gtk_css_value_number_print
-9
View File
@@ -60,14 +60,6 @@ gtk_css_value_position_compute (GtkCssValue *position,
return _gtk_css_position_value_new (x, y);
}
static gboolean
gtk_css_value_position_needs_compute (const GtkCssValue *position)
{
return
_gtk_css_value_needs_compute (position->x) ||
_gtk_css_value_needs_compute (position->y);
}
static gboolean
gtk_css_value_position_equal (const GtkCssValue *position1,
const GtkCssValue *position2)
@@ -163,7 +155,6 @@ done:
static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
gtk_css_value_position_free,
gtk_css_value_position_compute,
gtk_css_value_position_needs_compute,
gtk_css_value_position_equal,
gtk_css_value_position_transition,
gtk_css_value_position_print
+46 -24
View File
@@ -1273,12 +1273,6 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
ruleset->styles[i].section = NULL;
}
static GtkCssChange
gtk_css_ruleset_get_change (GtkCssRuleset *ruleset)
{
return _gtk_css_selector_tree_match_get_change (ruleset->selector_match);
}
static void
gtk_css_scanner_destroy (GtkCssScanner *scanner)
{
@@ -1441,6 +1435,49 @@ verify_tree_match_results (GtkCssProvider *provider,
#endif
}
static void
verify_tree_get_change_results (GtkCssProvider *provider,
const GtkCssMatcher *matcher,
GtkCssChange change)
{
#ifdef VERIFY_TREE
{
GtkCssChange verify_change = 0;
GPtrArray *tree_rules;
int i;
tree_rules = _gtk_css_selector_tree_match_all (provider->priv->tree, matcher);
verify_tree_match_results (provider, matcher, tree_rules);
for (i = tree_rules->len - 1; i >= 0; i--)
{
GtkCssRuleset *ruleset;
ruleset = tree_rules->pdata[i];
verify_change |= _gtk_css_selector_tree_match_get_change (ruleset->selector_match);
}
if (change != verify_change)
{
GString *s;
s = g_string_new ("");
g_string_append_printf (s, "expected change 0x%x, but it was 0x%x", verify_change, change);
if ((change & ~verify_change) != 0)
g_string_append_printf (s, ", unexpectedly set: 0x%x", change & ~verify_change);
if ((~change & verify_change) != 0)
g_string_append_printf (s, ", unexpectedly no set: 0x%x", ~change & verify_change);
g_warning (s->str);
g_string_free (s, TRUE);
}
g_ptr_array_free (tree_rules, TRUE);
}
#endif
}
static gboolean
gtk_css_provider_get_style_property (GtkStyleProvider *provider,
GtkWidgetPath *path,
@@ -1585,29 +1622,14 @@ gtk_css_style_provider_get_change (GtkStyleProviderPrivate *provider,
{
GtkCssProvider *css_provider;
GtkCssProviderPrivate *priv;
GtkCssChange change = 0;
GPtrArray *tree_rules;
int i;
GtkCssChange change;
css_provider = GTK_CSS_PROVIDER (provider);
priv = css_provider->priv;
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, matcher);
verify_tree_match_results (css_provider, matcher, tree_rules);
change = _gtk_css_selector_tree_get_change_all (priv->tree, matcher);
for (i = tree_rules->len - 1; i >= 0; i--)
{
GtkCssRuleset *ruleset;
ruleset = tree_rules->pdata[i];
if (ruleset->styles == NULL)
continue;
change |= gtk_css_ruleset_get_change (ruleset);
}
g_ptr_array_free (tree_rules, TRUE);
verify_tree_get_change_results (css_provider, matcher, change);
return change;
}
-8
View File
@@ -44,12 +44,6 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_repeat_needs_compute (const GtkCssValue *value)
{
return FALSE;
}
static gboolean
gtk_css_value_repeat_equal (const GtkCssValue *repeat1,
const GtkCssValue *repeat2)
@@ -122,7 +116,6 @@ gtk_css_value_border_repeat_print (const GtkCssValue *repeat,
static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
gtk_css_value_repeat_free,
gtk_css_value_repeat_compute,
gtk_css_value_repeat_needs_compute,
gtk_css_value_repeat_equal,
gtk_css_value_repeat_transition,
gtk_css_value_background_repeat_print
@@ -131,7 +124,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_REPEAT = {
gtk_css_value_repeat_free,
gtk_css_value_repeat_compute,
gtk_css_value_repeat_needs_compute,
gtk_css_value_repeat_equal,
gtk_css_value_repeat_transition,
gtk_css_value_border_repeat_print
-7
View File
@@ -44,12 +44,6 @@ gtk_css_value_rgba_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_rgba_needs_compute (const GtkCssValue *value)
{
return FALSE;
}
static gboolean
gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
const GtkCssValue *rgba2)
@@ -86,7 +80,6 @@ gtk_css_value_rgba_print (const GtkCssValue *rgba,
static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
gtk_css_value_rgba_free,
gtk_css_value_rgba_compute,
gtk_css_value_rgba_needs_compute,
gtk_css_value_rgba_equal,
gtk_css_value_rgba_transition,
gtk_css_value_rgba_print
+534 -139
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -42,6 +42,8 @@ int _gtk_css_selector_compare (const GtkCssSelector *a,
void _gtk_css_selector_tree_free (GtkCssSelectorTree *tree);
GPtrArray * _gtk_css_selector_tree_match_all (const GtkCssSelectorTree *tree,
const GtkCssMatcher *matcher);
GtkCssChange _gtk_css_selector_tree_get_change_all (const GtkCssSelectorTree *tree,
const GtkCssMatcher *matcher);
void _gtk_css_selector_tree_match_print (const GtkCssSelectorTree *tree,
GString *str);
GtkCssChange _gtk_css_selector_tree_match_get_change (const GtkCssSelectorTree *tree);
-15
View File
@@ -72,20 +72,6 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
return result;
}
static gboolean
gtk_css_value_shadows_needs_compute (const GtkCssValue *value)
{
guint i;
for (i = 0; i < value->len; i++)
{
if (_gtk_css_value_needs_compute (value->values[i]))
return TRUE;
}
return FALSE;
}
static gboolean
gtk_css_value_shadows_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -195,7 +181,6 @@ gtk_css_value_shadows_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = {
gtk_css_value_shadows_free,
gtk_css_value_shadows_compute,
gtk_css_value_shadows_needs_compute,
gtk_css_value_shadows_equal,
gtk_css_value_shadows_transition,
gtk_css_value_shadows_print
-13
View File
@@ -94,18 +94,6 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow,
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
}
static gboolean
gtk_css_value_shadow_needs_compute (const GtkCssValue *shadow)
{
return
_gtk_css_value_needs_compute (shadow->hoffset) ||
_gtk_css_value_needs_compute (shadow->voffset) ||
_gtk_css_value_needs_compute (shadow->radius) ||
_gtk_css_value_needs_compute (shadow->spread) ||
_gtk_css_value_needs_compute (shadow->color);
}
static gboolean
gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
const GtkCssValue *shadow2)
@@ -166,7 +154,6 @@ gtk_css_value_shadow_print (const GtkCssValue *shadow,
static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
gtk_css_value_shadow_free,
gtk_css_value_shadow_compute,
gtk_css_value_shadow_needs_compute,
gtk_css_value_shadow_equal,
gtk_css_value_shadow_transition,
gtk_css_value_shadow_print
+2 -2
View File
@@ -102,7 +102,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
*/
for (i = 0; i < shorthand->subproperties->len; i++)
{
data[i] = _gtk_css_initial_value_new (shorthand->subproperties->pdata[i]);
data[i] = _gtk_css_initial_value_new ();
}
}
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
@@ -135,7 +135,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
for (i = 0; i < shorthand->subproperties->len; i++)
{
if (data[i] == NULL)
data[i] = _gtk_css_initial_value_new (shorthand->subproperties->pdata[i]);
data[i] = _gtk_css_initial_value_new ();
}
result = _gtk_css_array_value_new_from_array (data, shorthand->subproperties->len);
-8
View File
@@ -44,12 +44,6 @@ gtk_css_value_string_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_string_needs_compute (const GtkCssValue *value)
{
return FALSE;
}
static gboolean
gtk_css_value_string_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -156,7 +150,6 @@ gtk_css_value_ident_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
gtk_css_value_string_free,
gtk_css_value_string_compute,
gtk_css_value_string_needs_compute,
gtk_css_value_string_equal,
gtk_css_value_string_transition,
gtk_css_value_string_print
@@ -165,7 +158,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
static const GtkCssValueClass GTK_CSS_VALUE_IDENT = {
gtk_css_value_string_free,
gtk_css_value_string_compute,
gtk_css_value_string_needs_compute,
gtk_css_value_string_equal,
gtk_css_value_string_transition,
gtk_css_value_ident_print
+57 -13
View File
@@ -39,6 +39,7 @@ enum {
PROP_0,
PROP_ANIMATED,
PROP_AFFECTS_SIZE,
PROP_AFFECTS_FONT,
PROP_ID,
PROP_INHERIT,
PROP_INITIAL
@@ -47,6 +48,9 @@ enum {
G_DEFINE_TYPE (GtkCssStyleProperty, _gtk_css_style_property, GTK_TYPE_STYLE_PROPERTY)
static GtkBitmask *_properties_affecting_size = NULL;
static GtkBitmask *_properties_affecting_font = NULL;
static GtkCssStylePropertyClass *gtk_css_style_property_class = NULL;
static void
gtk_css_style_property_constructed (GObject *object)
@@ -60,6 +64,9 @@ gtk_css_style_property_constructed (GObject *object)
if (property->affects_size)
_properties_affecting_size = _gtk_bitmask_set (_properties_affecting_size, property->id, TRUE);
if (property->affects_font)
_properties_affecting_font = _gtk_bitmask_set (_properties_affecting_font, property->id, TRUE);
G_OBJECT_CLASS (_gtk_css_style_property_parent_class)->constructed (object);
}
@@ -79,6 +86,9 @@ gtk_css_style_property_set_property (GObject *object,
case PROP_AFFECTS_SIZE:
property->affects_size = g_value_get_boolean (value);
break;
case PROP_AFFECTS_FONT:
property->affects_font = g_value_get_boolean (value);
break;
case PROP_INHERIT:
property->inherit = g_value_get_boolean (value);
break;
@@ -108,6 +118,9 @@ gtk_css_style_property_get_property (GObject *object,
case PROP_AFFECTS_SIZE:
g_value_set_boolean (value, property->affects_size);
break;
case PROP_AFFECTS_FONT:
g_value_set_boolean (value, property->affects_font);
break;
case PROP_ID:
g_value_set_boolean (value, property->id);
break;
@@ -230,7 +243,7 @@ gtk_css_style_property_parse_value (GtkStyleProperty *property,
/* the initial value can be explicitly specified with the
* initial keyword which all properties accept.
*/
return _gtk_css_initial_value_new (style_property);
return _gtk_css_initial_value_new ();
}
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
{
@@ -270,6 +283,13 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
P_("Set if the value affects the sizing of elements"),
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_AFFECTS_FONT,
g_param_spec_boolean ("affects-font",
P_("Affects font"),
P_("Set if the value affects the font"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_ID,
g_param_spec_uint ("id",
@@ -299,6 +319,9 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
klass->style_properties = g_ptr_array_new ();
_properties_affecting_size = _gtk_bitmask_new ();
_properties_affecting_font = _gtk_bitmask_new ();
gtk_css_style_property_class = klass;
}
static GtkCssValue *
@@ -328,15 +351,13 @@ _gtk_css_style_property_get_n_properties (void)
{
GtkCssStylePropertyClass *klass;
klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
if (G_UNLIKELY (klass == NULL))
if (G_UNLIKELY (gtk_css_style_property_class == NULL))
{
_gtk_style_property_init_properties ();
klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
g_assert (klass);
g_assert (gtk_css_style_property_class);
}
return klass->style_properties->len;
return gtk_css_style_property_class->style_properties->len;
}
/**
@@ -352,18 +373,16 @@ _gtk_css_style_property_get_n_properties (void)
GtkCssStyleProperty *
_gtk_css_style_property_lookup_by_id (guint id)
{
GtkCssStylePropertyClass *klass;
klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
if (G_UNLIKELY (klass == NULL))
if (G_UNLIKELY (gtk_css_style_property_class == NULL))
{
_gtk_style_property_init_properties ();
klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
g_assert (klass);
g_assert (gtk_css_style_property_class);
}
g_return_val_if_fail (id < klass->style_properties->len, NULL);
return g_ptr_array_index (klass->style_properties, id);
g_return_val_if_fail (id < gtk_css_style_property_class->style_properties->len, NULL);
return g_ptr_array_index (gtk_css_style_property_class->style_properties, id);
}
/**
@@ -419,6 +438,25 @@ _gtk_css_style_property_affects_size (GtkCssStyleProperty *property)
return property->affects_size;
}
/**
* _gtk_css_style_property_affects_font:
* @property: the property
*
* Queries if the given @property affects the default font. This is
* used for optimizations inside GTK, where clearing pango
* layouts can be avoided if the font doesn't change.
*
* Returns: %TRUE if the property affects the font.
**/
gboolean
_gtk_css_style_property_affects_font (GtkCssStyleProperty *property)
{
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE);
return property->affects_font;
}
/**
* _gtk_css_style_property_get_id:
* @property: the property
@@ -459,3 +497,9 @@ _gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
{
return _gtk_bitmask_intersects (changes, _properties_affecting_size);
}
gboolean
_gtk_css_style_property_changes_affect_font (const GtkBitmask *changes)
{
return _gtk_bitmask_intersects (changes, _properties_affecting_font);
}
+9 -7
View File
@@ -66,7 +66,8 @@
typedef enum {
GTK_STYLE_PROPERTY_INHERIT = (1 << 0),
GTK_STYLE_PROPERTY_ANIMATED = (1 << 1),
GTK_STYLE_PROPERTY_NO_RESIZE = (1 << 2)
GTK_STYLE_PROPERTY_NO_RESIZE = (1 << 2),
GTK_STYLE_PROPERTY_AFFECTS_FONT = (1 << 3)
} GtkStylePropertyFlags;
static void
@@ -89,6 +90,7 @@ gtk_css_style_property_register (const char * name,
node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY,
"value-type", value_type,
"affects-size", (flags & GTK_STYLE_PROPERTY_NO_RESIZE) ? FALSE : TRUE,
"affects-font", (flags & GTK_STYLE_PROPERTY_AFFECTS_FONT) ? TRUE : FALSE,
"animated", (flags & GTK_STYLE_PROPERTY_ANIMATED) ? TRUE : FALSE,
"inherit", (flags & GTK_STYLE_PROPERTY_INHERIT) ? TRUE : FALSE,
"initial-value", initial_value,
@@ -162,7 +164,7 @@ assign_border (GtkCssStyleProperty *property,
const GtkBorder *border = g_value_get_boxed (value);
if (border == NULL)
return _gtk_css_initial_value_new (property);
return _gtk_css_initial_value_new ();
else
return _gtk_css_border_value_new (_gtk_css_number_value_new (border->top, GTK_CSS_PX),
_gtk_css_number_value_new (border->right, GTK_CSS_PX),
@@ -876,7 +878,7 @@ _gtk_css_style_property_init_properties (void)
gtk_css_style_property_register ("font-size",
GTK_CSS_PROPERTY_FONT_SIZE,
G_TYPE_DOUBLE,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_AFFECTS_FONT,
font_size_parse,
query_length_as_double,
assign_length_from_double,
@@ -896,7 +898,7 @@ _gtk_css_style_property_init_properties (void)
gtk_css_style_property_register ("font-family",
GTK_CSS_PROPERTY_FONT_FAMILY,
G_TYPE_STRV,
GTK_STYLE_PROPERTY_INHERIT,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_AFFECTS_FONT,
font_family_parse,
font_family_query,
font_family_assign,
@@ -904,7 +906,7 @@ _gtk_css_style_property_init_properties (void)
gtk_css_style_property_register ("font-style",
GTK_CSS_PROPERTY_FONT_STYLE,
PANGO_TYPE_STYLE,
GTK_STYLE_PROPERTY_INHERIT,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_AFFECTS_FONT,
parse_pango_style,
query_pango_style,
assign_pango_style,
@@ -912,7 +914,7 @@ _gtk_css_style_property_init_properties (void)
gtk_css_style_property_register ("font-variant",
GTK_CSS_PROPERTY_FONT_VARIANT,
PANGO_TYPE_VARIANT,
GTK_STYLE_PROPERTY_INHERIT,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_AFFECTS_FONT,
parse_pango_variant,
query_pango_variant,
assign_pango_variant,
@@ -920,7 +922,7 @@ _gtk_css_style_property_init_properties (void)
gtk_css_style_property_register ("font-weight",
GTK_CSS_PROPERTY_FONT_WEIGHT,
PANGO_TYPE_WEIGHT,
GTK_STYLE_PROPERTY_INHERIT,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_AFFECTS_FONT,
parse_pango_weight,
query_pango_weight,
assign_pango_weight,
+4 -3
View File
@@ -50,8 +50,7 @@ struct _GtkCssStyleProperty
guint inherit :1;
guint animated :1;
guint affects_size :1;
GtkCssValue *css_initial_value; /* Used to quickly find the GCssInitialValue for a property */
guint affects_font :1;
GtkCssStylePropertyParseFunc parse_value;
GtkCssStylePropertyQueryFunc query_value;
@@ -75,6 +74,7 @@ GtkCssStyleProperty * _gtk_css_style_property_lookup_by_id (guint
gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProperty *property);
gboolean _gtk_css_style_property_is_animated (GtkCssStyleProperty *property);
gboolean _gtk_css_style_property_affects_size (GtkCssStyleProperty *property);
gboolean _gtk_css_style_property_affects_font (GtkCssStyleProperty *property);
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
GtkCssValue * _gtk_css_style_property_get_initial_value
(GtkCssStyleProperty *property);
@@ -85,7 +85,8 @@ void _gtk_css_style_property_print_value (GtkCssStyleProp
gboolean _gtk_css_style_property_changes_affect_size
(const GtkBitmask *changes);
gboolean _gtk_css_style_property_changes_affect_font
(const GtkBitmask *changes);
G_END_DECLS
-7
View File
@@ -47,12 +47,6 @@ gtk_css_value_typed_compute (GtkCssValue *value,
return _gtk_css_style_compute_value (provider, values, parent_values, custom->pspec->value_type, value, dependencies);
}
static gboolean
gtk_css_value_typed_needs_compute (const GtkCssValue *value)
{
return TRUE;
}
static gboolean
gtk_css_value_typed_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
@@ -79,7 +73,6 @@ gtk_css_value_typed_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_TYPED = {
gtk_css_value_typed_free,
gtk_css_value_typed_compute,
gtk_css_value_typed_needs_compute,
gtk_css_value_typed_equal,
gtk_css_value_typed_transition,
gtk_css_value_typed_print
+3 -1
View File
@@ -50,7 +50,9 @@ typedef enum { /*< skip >*/
/* add more */
GTK_CSS_CHANGE_SOURCE = (1 << 16),
GTK_CSS_CHANGE_ANIMATE = (1 << 17),
GTK_CSS_CHANGE_FORCE_INVALIDATE = (1 << 18)
GTK_CSS_CHANGE_FORCE_INVALIDATE = (1 << 18),
GTK_CSS_CHANGE_RESERVED_BIT = (1 << 31) /* Used internally in gtkcssselector.c */
} GtkCssChange;
#define GTK_CSS_CHANGE_ANY ((1 << 19) - 1)
-21
View File
@@ -106,27 +106,6 @@ _gtk_css_value_compute (GtkCssValue *value,
return value->class->compute (value, property_id, provider, values, parent_values, dependencies);
}
/**
* _gtk_css_value_needs_compute:
* @value: the value to check or %null
*
* Checks whether a particular css value *really* needs computation.
* A lot of css values are "absolute" (like say "10 px") and never need
* any computation done. Such a value would always just return itself
* as the computed value. This can be used in some cases to avoid
* repeated computations.
*
* Returns: %false if computing this value always returns itself, %false otherwise
**/
gboolean
_gtk_css_value_needs_compute (GtkCssValue *value)
{
if (value == NULL)
return FALSE;
return value->class->needs_compute (value);
}
gboolean
_gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
-2
View File
@@ -46,7 +46,6 @@ struct _GtkCssValueClass {
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
gboolean (* needs_compute) (const GtkCssValue *value);
gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2);
GtkCssValue * (* transition) (GtkCssValue *start,
@@ -72,7 +71,6 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
gboolean _gtk_css_value_needs_compute (GtkCssValue *value);
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2);
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
+3 -19
View File
@@ -3216,19 +3216,14 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
PangoFontMetrics *metrics;
GtkBorder borders;
PangoContext *context;
GtkStyleContext *style_context;
GtkStateFlags state;
gint icon_widths = 0;
gint icon_width, i;
gint width;
context = gtk_widget_get_pango_context (widget);
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
gtk_style_context_get_font (style_context, state),
pango_context_get_font_description (context),
pango_context_get_language (context));
_gtk_entry_get_borders (entry, &borders);
@@ -3269,8 +3264,6 @@ gtk_entry_get_preferred_height (GtkWidget *widget,
GtkEntryPrivate *priv = entry->priv;
PangoFontMetrics *metrics;
GtkBorder borders;
GtkStyleContext *style_context;
GtkStateFlags state;
PangoContext *context;
gint height;
PangoLayout *layout;
@@ -3278,11 +3271,8 @@ gtk_entry_get_preferred_height (GtkWidget *widget,
layout = gtk_entry_ensure_layout (entry, TRUE);
context = gtk_widget_get_pango_context (widget);
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
gtk_style_context_get_font (style_context, state),
pango_context_get_font_description (context),
pango_context_get_language (context));
priv->ascent = pango_font_metrics_get_ascent (metrics);
@@ -4875,8 +4865,6 @@ gtk_entry_style_updated (GtkWidget *widget)
gtk_entry_update_cached_style_values (entry);
gtk_entry_recompute (entry);
icon_theme_changed (entry);
}
@@ -6574,8 +6562,6 @@ gtk_entry_move_adjustments (GtkEntry *entry)
GtkAdjustment *adjustment;
PangoContext *context;
PangoFontMetrics *metrics;
GtkStyleContext *style_context;
GtkStateFlags state;
GtkBorder borders;
gint x, layout_x;
gint char_width;
@@ -6594,11 +6580,9 @@ gtk_entry_move_adjustments (GtkEntry *entry)
/* Approximate width of a char, so user can see what is ahead/behind */
context = gtk_widget_get_pango_context (widget);
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
gtk_style_context_get_font (style_context, state),
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics) / PANGO_SCALE;
+3 -3
View File
@@ -8187,7 +8187,7 @@ find_good_size_from_style (GtkWidget *widget,
{
GtkStyleContext *context;
GtkStateFlags state;
int font_size;
double font_size;
GdkScreen *screen;
double resolution;
@@ -8204,8 +8204,8 @@ find_good_size_from_style (GtkWidget *widget,
else
resolution = 96.0; /* wheeee */
font_size = pango_font_description_get_size (gtk_style_context_get_font (context, state));
font_size = PANGO_PIXELS (font_size) * resolution / 72.0;
gtk_style_context_get (context, state, "font-size", &font_size, NULL);
font_size = font_size * resolution / 72.0 + 0.5;
*width = font_size * NUM_CHARS;
*height = font_size * NUM_LINES;
+6 -50
View File
@@ -384,9 +384,6 @@ static void gtk_label_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_label_state_flags_changed (GtkWidget *widget,
GtkStateFlags prev_state);
static void gtk_label_style_updated (GtkWidget *widget);
static void gtk_label_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir);
static gint gtk_label_draw (GtkWidget *widget,
cairo_t *cr);
static gboolean gtk_label_focus (GtkWidget *widget,
@@ -566,9 +563,7 @@ gtk_label_class_init (GtkLabelClass *class)
widget_class->destroy = gtk_label_destroy;
widget_class->size_allocate = gtk_label_size_allocate;
widget_class->state_flags_changed = gtk_label_state_flags_changed;
widget_class->style_updated = gtk_label_style_updated;
widget_class->query_tooltip = gtk_label_query_tooltip;
widget_class->direction_changed = gtk_label_direction_changed;
widget_class->draw = gtk_label_draw;
widget_class->realize = gtk_label_realize;
widget_class->unrealize = gtk_label_unrealize;
@@ -1852,6 +1847,9 @@ gtk_label_screen_changed (GtkWidget *widget,
GtkSettings *settings;
gboolean shortcuts_connected;
/* The PangoContext is replaced when the screen changes, so clear the layouts */
gtk_label_clear_layout (GTK_LABEL (widget));
if (!gtk_widget_has_screen (widget))
return;
@@ -3136,23 +3134,6 @@ gtk_label_clear_layout (GtkLabel *label)
}
}
static PangoFontMetrics *
get_font_metrics (PangoContext *context, GtkWidget *widget)
{
GtkStyleContext *style_context;
const PangoFontDescription *font;
PangoFontMetrics *retval;
style_context = gtk_widget_get_style_context (widget);
font = gtk_style_context_get_font (style_context, GTK_STATE_FLAG_NORMAL);
retval = pango_context_get_metrics (context,
font,
pango_context_get_language (context));
return retval;
}
/**
* gtk_label_get_measuring_layout:
* @label: the label
@@ -3485,7 +3466,9 @@ get_char_pixels (GtkWidget *label,
gint char_width, digit_width;
context = pango_layout_get_context (layout);
metrics = get_font_metrics (context, GTK_WIDGET (label));
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
pango_font_metrics_unref (metrics);
@@ -3826,37 +3809,10 @@ gtk_label_state_flags_changed (GtkWidget *widget,
gtk_label_update_cursor (label);
}
/* We have to clear the layout, fonts etc. may have changed */
gtk_label_clear_layout (label);
if (GTK_WIDGET_CLASS (gtk_label_parent_class)->state_flags_changed)
GTK_WIDGET_CLASS (gtk_label_parent_class)->state_flags_changed (widget, prev_state);
}
static void
gtk_label_style_updated (GtkWidget *widget)
{
GtkLabel *label = GTK_LABEL (widget);
GTK_WIDGET_CLASS (gtk_label_parent_class)->style_updated (widget);
/* We have to clear the layout, fonts etc. may have changed */
gtk_label_clear_layout (label);
}
static void
gtk_label_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
if (priv->layout)
pango_layout_context_changed (priv->layout);
GTK_WIDGET_CLASS (gtk_label_parent_class)->direction_changed (widget, previous_dir);
}
static void
get_layout_location (GtkLabel *label,
gint *xp,
+2 -10
View File
@@ -758,8 +758,6 @@ get_arrow_size (GtkWidget *widget,
gint *size,
gint *spacing)
{
GtkStyleContext *style_context;
GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
gfloat arrow_scaling;
@@ -776,11 +774,9 @@ get_arrow_size (GtkWidget *widget,
*spacing = arrow_spacing;
context = gtk_widget_get_pango_context (child);
style_context = gtk_widget_get_style_context (child);
state = gtk_widget_get_state_flags (child);
metrics = pango_context_get_metrics (context,
gtk_style_context_get_font (style_context, state),
pango_context_get_font_description (context),
pango_context_get_language (context));
*size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
@@ -814,19 +810,15 @@ gtk_menu_item_accel_width_foreach (GtkWidget *widget,
static gint
get_minimum_width (GtkWidget *widget)
{
GtkStyleContext *style_context;
GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
gint width;
gint width_chars;
context = gtk_widget_get_pango_context (widget);
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
gtk_style_context_get_font (style_context, state),
pango_context_get_font_description (context),
pango_context_get_language (context));
width = pango_font_metrics_get_approximate_char_width (metrics);
+3 -3
View File
@@ -556,15 +556,15 @@ gtk_progress_bar_get_preferred_width (GtkWidget *widget,
if (priv->ellipsize)
{
const PangoFontDescription *font_desc;
PangoContext *context;
PangoFontMetrics *metrics;
gint char_width;
/* The minimum size for ellipsized text is ~ 3 chars */
context = pango_layout_get_context (layout);
font_desc = gtk_style_context_get_font (style_context, state);
metrics = pango_context_get_metrics (context, font_desc, pango_context_get_language (context));
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
+4 -5
View File
@@ -922,7 +922,7 @@ set_default_size (GtkRecentChooserDefault *impl)
GtkScrolledWindow *scrollw;
GtkWidget *widget;
gint width, height;
gint font_size;
double font_size;
GdkScreen *screen;
gint monitor_num;
GtkRequisition req;
@@ -935,11 +935,10 @@ set_default_size (GtkRecentChooserDefault *impl)
state = gtk_widget_get_state_flags (widget);
/* Size based on characters and the icon size */
font_size = pango_font_description_get_size (gtk_style_context_get_font (context, state));
font_size = PANGO_PIXELS (font_size);
gtk_style_context_get (context, state, "font-size", &font_size, NULL);
width = impl->icon_size + font_size * NUM_CHARS;
height = (impl->icon_size + font_size) * NUM_LINES;
width = impl->icon_size + font_size * NUM_CHARS + 0.5;
height = (impl->icon_size + font_size) * NUM_LINES + 0.5;
/* Use at least the requisition size... */
gtk_widget_get_preferred_size (widget, &req, NULL);
+4
View File
@@ -1196,7 +1196,9 @@ gtk_scale_draw (GtkWidget *widget,
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MARK);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
gtk_render_line (context, cr, x1, y1, x1, y2);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SEPARATOR);
if (mark->markup)
{
@@ -1247,7 +1249,9 @@ gtk_scale_draw (GtkWidget *widget,
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MARK);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
gtk_render_line (context, cr, x1, y1, x2, y1);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SEPARATOR);
if (mark->markup)
{
+9
View File
@@ -1414,6 +1414,14 @@ gtk_settings_provider_iface_init (GtkStyleProviderIface *iface)
{
}
static GtkCssChange
gtk_settings_style_provider_get_change (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher)
{
return 0;
}
static GtkSettings *
gtk_settings_style_provider_get_settings (GtkStyleProviderPrivate *provider)
{
@@ -1424,6 +1432,7 @@ static void
gtk_settings_provider_private_init (GtkStyleProviderPrivateInterface *iface)
{
iface->get_settings = gtk_settings_style_provider_get_settings;
iface->get_change = gtk_settings_style_provider_get_change;
}
static void
+9 -9
View File
@@ -3468,6 +3468,9 @@ gtk_style_context_get_margin (GtkStyleContext *context,
* freed.
*
* Since: 3.0
*
* Deprecated: 3.8: Use gtk_style_context_get() for "font" or
* subproperties instead.
**/
const PangoFontDescription *
gtk_style_context_get_font (GtkStyleContext *context,
@@ -3486,15 +3489,12 @@ gtk_style_context_get_font (GtkStyleContext *context,
/* Yuck, fonts are created on-demand but we don't return a ref.
* Do bad things to achieve this requirement */
description = g_object_get_data (G_OBJECT (data->store), "font-cache-for-get_font");
if (description == NULL)
{
gtk_style_context_get (context, state, "font", &description, NULL);
g_object_set_data_full (G_OBJECT (data->store),
"font-cache-for-get_font",
description,
(GDestroyNotify) pango_font_description_free);
}
gtk_style_context_get (context, state, "font", &description, NULL);
g_object_set_data_full (G_OBJECT (data->store),
"font-cache-for-get_font",
description,
(GDestroyNotify) pango_font_description_free);
return description;
}
+2
View File
@@ -879,6 +879,8 @@ void gtk_style_context_get_background_color (GtkStyleContext *context,
void gtk_style_context_get_border_color (GtkStyleContext *context,
GtkStateFlags state,
GdkRGBA *color);
GDK_DEPRECATED_IN_3_8_FOR(gtk_style_context_get)
const PangoFontDescription *
gtk_style_context_get_font (GtkStyleContext *context,
GtkStateFlags state);
-20
View File
@@ -524,15 +524,12 @@ gtk_switch_draw (GtkWidget *widget,
GtkStyleContext *context;
GdkRectangle handle;
PangoLayout *layout;
PangoFontDescription *desc;
const PangoFontDescription *style_desc;
PangoRectangle rect;
gint label_x, label_y;
GtkBorder padding;
GtkStateFlags state;
gint focus_width, focus_pad;
gint x, y, width, height;
gint font_size, style_font_size;
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
@@ -585,20 +582,6 @@ gtk_switch_draw (GtkWidget *widget,
*/
layout = gtk_widget_create_pango_layout (widget, C_("switch", "ON"));
/* FIXME: this should be really done in the theme, but overriding font size
* from it doesn't currently work. So we have to hardcode this here and
* below for the "OFF" label.
*/
desc = pango_font_description_new ();
style_desc = gtk_style_context_get_font (context, state);
style_font_size = pango_font_description_get_size (style_desc);
font_size = MAX (style_font_size - 1 * PANGO_SCALE, ceil (style_font_size * PANGO_SCALE_SMALL));
pango_font_description_set_size (desc, font_size);
pango_layout_set_font_description (layout, desc);
pango_layout_get_extents (layout, NULL, &rect);
pango_extents_to_pixels (&rect, NULL);
@@ -613,7 +596,6 @@ gtk_switch_draw (GtkWidget *widget,
* glyphs then use WHITE CIRCLE (U+25CB) as the text for the state
*/
layout = gtk_widget_create_pango_layout (widget, C_("switch", "OFF"));
pango_layout_set_font_description (layout, desc);
pango_layout_get_extents (layout, NULL, &rect);
pango_extents_to_pixels (&rect, NULL);
@@ -636,8 +618,6 @@ gtk_switch_draw (GtkWidget *widget,
gtk_switch_paint_handle (widget, cr, &handle);
pango_font_description_free (desc);
return FALSE;
}
+1 -1
View File
@@ -298,7 +298,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
if (values->font)
pango_font_description_free (values->font);
values->font = pango_font_description_copy (gtk_style_context_get_font (context, state));
gtk_style_context_get (context, state, "font", &values->font, NULL);
}
cairo_surface_t *
+10 -2
View File
@@ -51,6 +51,8 @@
#include "gtkscrollable.h"
#include "gtktypebuiltins.h"
#include "gtktexthandleprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "a11y/gtktextviewaccessible.h"
@@ -4230,6 +4232,8 @@ gtk_text_view_style_updated (GtkWidget *widget)
GtkTextView *text_view;
GtkTextViewPrivate *priv;
PangoContext *ltr_context, *rtl_context;
GtkStyleContext *style_context;
const GtkBitmask *changes;
text_view = GTK_TEXT_VIEW (widget);
priv = text_view->priv;
@@ -4241,7 +4245,11 @@ gtk_text_view_style_updated (GtkWidget *widget)
gtk_text_view_set_background (text_view);
}
if (priv->layout && priv->layout->default_style)
style_context = gtk_widget_get_style_context (widget);
changes = _gtk_style_context_get_changes (style_context);
if ((changes == NULL || _gtk_css_style_property_changes_affect_font (changes)) &&
priv->layout && priv->layout->default_style)
{
gtk_text_view_set_attributes_from_style (text_view,
priv->layout->default_style);
@@ -6919,7 +6927,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
if (values->font)
pango_font_description_free (values->font);
values->font = pango_font_description_copy (gtk_style_context_get_font (context, state));
gtk_style_context_get (context, state, "font", &values->font, NULL);
gtk_style_context_restore (context);
}
+4
View File
@@ -853,6 +853,8 @@ gtk_theming_engine_get_margin (GtkThemingEngine *engine,
* freed.
*
* Since: 3.0
*
* Deprecated: 3.8: Use gtk_theming_engine_get()
**/
const PangoFontDescription *
gtk_theming_engine_get_font (GtkThemingEngine *engine,
@@ -862,8 +864,10 @@ gtk_theming_engine_get_font (GtkThemingEngine *engine,
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
priv = engine->priv;
return gtk_style_context_get_font (priv->context, state);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
/* GtkThemingModule */
+1
View File
@@ -249,6 +249,7 @@ void gtk_theming_engine_get_margin (GtkThemingEngine *engine,
GtkStateFlags state,
GtkBorder *margin);
GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get)
const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine,
GtkStateFlags state);
+2 -8
View File
@@ -3336,18 +3336,12 @@ calculate_max_homogeneous_pixels (GtkWidget *widget)
{
PangoContext *context;
PangoFontMetrics *metrics;
const PangoFontDescription *font_desc;
GtkStyleContext *style_context;
GtkStateFlags state;
gint char_width;
context = gtk_widget_get_pango_context (widget);
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
font_desc = gtk_style_context_get_font (style_context, state);
metrics = pango_context_get_metrics (context, font_desc,
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
+11 -19
View File
@@ -3758,10 +3758,14 @@ gtk_tree_model_filter_set_root (GtkTreeModelFilter *filter,
{
g_return_if_fail (GTK_IS_TREE_MODEL_FILTER (filter));
if (!root)
filter->priv->virtual_root = NULL;
if (root)
{
filter->priv->virtual_root = gtk_tree_path_copy (root);
gtk_tree_model_filter_ref_path (filter, filter->priv->virtual_root);
filter->priv->virtual_root_deleted = FALSE;
}
else
filter->priv->virtual_root = gtk_tree_path_copy (root);
filter->priv->virtual_root = NULL;
}
/* public API */
@@ -3782,24 +3786,12 @@ GtkTreeModel *
gtk_tree_model_filter_new (GtkTreeModel *child_model,
GtkTreePath *root)
{
GtkTreeModel *retval;
GtkTreeModelFilter *filter;
g_return_val_if_fail (GTK_IS_TREE_MODEL (child_model), NULL);
retval = g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
"child-model", child_model,
"virtual-root", root,
NULL);
filter = GTK_TREE_MODEL_FILTER (retval);
if (filter->priv->virtual_root)
{
gtk_tree_model_filter_ref_path (filter, filter->priv->virtual_root);
filter->priv->virtual_root_deleted = FALSE;
}
return retval;
return g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
"child-model", child_model,
"virtual-root", root,
NULL);
}
/**
+14 -8
View File
@@ -48,6 +48,7 @@
#include "gtkwidgetprivate.h"
#include "gtkentryprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtktypebuiltins.h"
#include "gtkmain.h"
#include "gtksettings.h"
@@ -8461,6 +8462,8 @@ gtk_tree_view_style_updated (GtkWidget *widget)
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *list;
GtkTreeViewColumn *column;
GtkStyleContext *style_context;
const GtkBitmask *changes;
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->style_updated (widget);
@@ -8472,16 +8475,19 @@ gtk_tree_view_style_updated (GtkWidget *widget)
gtk_tree_view_set_enable_tree_lines (tree_view, tree_view->priv->tree_lines_enabled);
}
for (list = tree_view->priv->columns; list; list = list->next)
style_context = gtk_widget_get_style_context (widget);
changes = _gtk_style_context_get_changes (style_context);
if (changes == NULL || _gtk_css_style_property_changes_affect_size (changes))
{
column = list->data;
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
tree_view->priv->fixed_height = -1;
_gtk_rbtree_mark_invalid (tree_view->priv->tree);
}
tree_view->priv->fixed_height = -1;
_gtk_rbtree_mark_invalid (tree_view->priv->tree);
gtk_widget_queue_resize (widget);
}
+14 -18
View File
@@ -4654,9 +4654,7 @@ gtk_widget_queue_resize (GtkWidget *widget)
if (gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
if (gtk_widget_get_visible (widget) ||
widget->priv->have_size_groups)
_gtk_size_group_queue_resize (widget, 0);
_gtk_size_group_queue_resize (widget, 0);
}
/**
@@ -8707,12 +8705,8 @@ gtk_widget_peek_pango_context (GtkWidget *widget)
* by gtk_widget_create_pango_context(), this context is owned by
* the widget (it can be used until the screen for the widget changes
* or the widget is removed from its toplevel), and will be updated to
* match any changes to the widget's attributes.
*
* If you create and keep a #PangoLayout using this context, you must
* deal with changes to the context by calling pango_layout_context_changed()
* on the layout in response to the #GtkWidget::style-updated and
* #GtkWidget::direction-changed signals for the widget.
* match any changes to the widget's attributes. This can be tracked
* by using the #GtkWidget::screen-changed signal on the widget.
*
* Return value: (transfer none): the #PangoContext for the widget.
**/
@@ -8740,18 +8734,21 @@ static void
update_pango_context (GtkWidget *widget,
PangoContext *context)
{
const PangoFontDescription *font_desc;
PangoFontDescription *font_desc;
GtkStyleContext *style_context;
style_context = gtk_widget_get_style_context (widget);
font_desc = gtk_style_context_get_font (style_context,
gtk_widget_get_state_flags (widget));
gtk_style_context_get (style_context,
gtk_widget_get_state_flags (widget),
"font", &font_desc,
NULL);
pango_context_set_font_description (context, font_desc);
pango_context_set_base_dir (context,
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
pango_font_description_free (font_desc);
}
static void
@@ -8820,11 +8817,10 @@ gtk_widget_create_pango_context (GtkWidget *widget)
* font description, and base direction for drawing text for
* this widget.
*
* If you keep a #PangoLayout created in this way around, in order to
* notify the layout of changes to the base direction or font of this
* widget, you must call pango_layout_context_changed() in response to
* the #GtkWidget::style-updated and #GtkWidget::direction-changed signals
* for the widget.
* If you keep a #PangoLayout created in this way around, you need
* to re-create it when the widget #PangoContext is replaced.
* This can be tracked by using the #GtkWidget::screen-changed signal
* on the widget.
*
* Return value: (transfer full): the new #PangoLayout
**/
@@ -42,6 +42,8 @@
</key>
<key name='show-hidden' type='b'>
<default>false</default>
<summary>Whether to show hidden files</summary>
<description>If set to true, then hidden files are shown by default. Hidden files are either dotfiles, listed in the folder's .hidden file or backup files ending with a tilde (~).</description>
</key>
<key name='expand-folders' type='b'>
<default>false</default>
+230
View File
@@ -2715,6 +2715,233 @@ test_level_bar (void)
g_object_unref (builder);
}
static GObject *external_object = NULL, *external_object_swapped = NULL;
void
on_button_clicked (GtkButton *button, GObject *data)
{
external_object = data;
}
void
on_button_clicked_swapped (GObject *data, GtkButton *button)
{
external_object_swapped = data;
}
static void
test_expose_object (void)
{
GtkBuilder *builder;
GError *error = NULL;
GtkWidget *image;
GObject *obj;
const gchar buffer[] =
"<interface>"
" <object class=\"GtkButton\" id=\"button\">"
" <property name=\"image\">external_image</property>"
" <signal name=\"clicked\" handler=\"on_button_clicked\" object=\"builder\" swapped=\"no\"/>"
" <signal name=\"clicked\" handler=\"on_button_clicked_swapped\" object=\"builder\"/>"
" </object>"
"</interface>";
image = gtk_image_new ();
builder = gtk_builder_new ();
gtk_builder_expose_object (builder, "external_image", G_OBJECT (image));
gtk_builder_expose_object (builder, "builder", G_OBJECT (builder));
gtk_builder_add_from_string (builder, buffer, -1, &error);
g_assert (error == NULL);
obj = gtk_builder_get_object (builder, "button");
g_assert (GTK_IS_BUTTON (obj));
g_assert (gtk_button_get_image (GTK_BUTTON (obj)) == image);
/* Connect signals and fake clicked event */
gtk_builder_connect_signals (builder, NULL);
gtk_button_clicked (GTK_BUTTON (obj));
g_assert (external_object == G_OBJECT (builder));
g_assert (external_object_swapped == G_OBJECT (builder));
}
static void
test_external_object_real (gboolean use_add_objects)
{
GError *error = NULL;
GtkBuilder *builder;
GtkWidget *mybox, *mygrid;
gboolean expand = FALSE, fill = FALSE;
GtkPackType pack_type = GTK_PACK_START;
guint padding = 0;
const gchar buffer[] =
"<interface>\n"
" <external-object class=\"GtkGrid\" id=\"mygrid\">\n"
" <property name=\"visible\">True</property>\n"
" <child>\n"
" <object class=\"GtkLabel\" id=\"gridlabel\">\n"
" <property name=\"visible\">True</property>\n"
" </object>\n"
" </child>\n"
" </external-object>\n"
/* This external_object should get ignored */
" <external-object class=\"GtkGrid\" id=\"mygrid2\">\n"
" <property name=\"visible\">True</property>\n"
" <child>\n"
" <object class=\"GtkLabel\" id=\"grid2label\">\n"
" <property name=\"visible\">True</property>\n"
" </object>\n"
" </child>\n"
" </external-object>\n"
/* This is the external_object we are interested in! */
" <external-object class=\"GtkBox\" id=\"mybox\">\n"
" <property name=\"visible\">True</property>\n"
" <property name=\"can_focus\">False</property>\n"
" <property name=\"orientation\">vertical</property>\n"
" <property name=\"spacing\">8</property>\n"
" <child>\n"
" <object class=\"GtkLabel\" id=\"boxlabel\">\n"
" <property name=\"visible\">True</property>\n"
" <property name=\"can_focus\">False</property>\n"
" <property name=\"label\" translatable=\"yes\">label</property>\n"
" </object>\n"
" <packing>\n"
" <property name=\"expand\">True</property>\n"
" <property name=\"fill\">True</property>\n"
" <property name=\"padding\">16</property>\n"
" <property name=\"pack-type\">GTK_PACK_END</property>\n"
" <property name=\"position\">0</property>\n"
" </packing>\n"
" </child>\n"
" <child>\n"
" <object class=\"GtkButton\" id=\"button\">\n"
" <property name=\"label\" translatable=\"yes\">button</property>\n"
" <property name=\"visible\">True</property>\n"
" <property name=\"can_focus\">True</property>\n"
" <property name=\"receives_default\">True</property>\n"
" </object>\n"
" <packing>\n"
" <property name=\"expand\">False</property>\n"
" <property name=\"fill\">True</property>\n"
" <property name=\"position\">1</property>\n"
" </packing>\n"
" </child>\n"
" </external-object>\n"
" <object class=\"GtkWindow\" id=\"window\">"
" <child>\n"
" <object class=\"GtkLabel\" id=\"winlabel\">\n"
" <property name=\"visible\">True</property>\n"
" </object>\n"
" </child>\n"
" </object>"
"</interface>";
builder = gtk_builder_new ();
mybox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
g_object_ref_sink (mybox);
mygrid = gtk_grid_new ();
g_object_ref_sink (mygrid);
gtk_builder_expose_object (builder, "mybox", G_OBJECT (mybox));
if (use_add_objects)
{
gchar *objs[] = {"window", NULL};
gtk_builder_add_objects_from_string (builder, buffer, -1, objs, &error);
if (error) g_warning ("%s", error->message);
/* Check if requested object creation works */
g_assert (GTK_IS_WINDOW (gtk_builder_get_object (builder, "window")));
/* external objects should be ignored if we requested a specific object */
g_assert (gtk_builder_get_object (builder, "winlabel"));
}
else
{
gtk_builder_add_from_string (builder, buffer, -1, &error);
if (error) g_warning ("%s", error->message);
g_assert (error == NULL);
/* Check template properties */
g_assert (gtk_box_get_spacing (GTK_BOX (mybox)) == 8);
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (mybox)) == GTK_ORIENTATION_VERTICAL);
/* Check if children are built */
g_assert (GTK_IS_LABEL (gtk_builder_get_object (builder, "boxlabel")));
g_assert (GTK_IS_BUTTON (gtk_builder_get_object (builder, "button")));
/* Check child packing properties */
gtk_box_query_child_packing (GTK_BOX (mybox),
GTK_WIDGET (gtk_builder_get_object (builder, "boxlabel")),
&expand, &fill, &padding, &pack_type);
g_assert (expand);
g_assert (fill);
g_assert (padding == 16);
g_assert (pack_type == GTK_PACK_END);
}
g_object_unref (builder);
g_object_unref (mybox);
g_object_unref (mygrid);
}
static void
test_external_object (void)
{
test_external_object_real (FALSE);
test_external_object_real (TRUE);
}
static void
test_template ()
{
GError *error = NULL;
GtkBuilder *builder;
const gchar buffer[] =
"<interface>\n"
" <template class=\"MyGtkGrid\" parent=\"GtkGrid\">\n"
" <property name=\"visible\">True</property>\n"
" <child>\n"
" <object class=\"GtkLabel\" id=\"gridlabel\">\n"
" <property name=\"visible\">True</property>\n"
" </object>\n"
" </child>\n"
" </template>\n"
"</interface>\n"
"<interface>\n"
" <object class=\"GtkWindow\" id=\"window\">"
" <child>\n"
" <object class=\"MyGtkGrid\" id=\"mygrid\">\n"
" <property name=\"visible\">True</property>\n"
" </object>\n"
" </child>\n"
" </object>\n"
"</interface>\n";
builder = gtk_builder_new ();
/* make sure the type we are trying to register does not exist */
g_assert (!g_type_from_name ("MyGtkGrid"));
gtk_builder_add_from_string (builder, buffer, -1, &error);
if (error) g_warning ("%s", error->message);
g_assert (error == NULL);
/* Check if new type was registered on the fly! */
g_assert (g_type_from_name ("MyGtkGrid"));
g_assert (GTK_IS_WINDOW (gtk_builder_get_object (builder, "window")));
/* Check if inline derived child was built */
g_assert (GTK_IS_GRID (gtk_builder_get_object (builder, "mygrid")));
g_object_unref (builder);
}
int
main (int argc, char **argv)
{
@@ -2763,6 +2990,9 @@ main (int argc, char **argv)
g_test_add_func ("/Builder/MessageDialog", test_message_dialog);
g_test_add_func ("/Builder/GMenu", test_gmenu);
g_test_add_func ("/Builder/LevelBar", test_level_bar);
g_test_add_func ("/Builder/Expose Object", test_expose_object);
g_test_add_func ("/Builder/External Object", test_external_object);
g_test_add_func ("/Builder/Template", test_template);
return g_test_run();
}
+1
View File
@@ -97,6 +97,7 @@ all-no:
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword --keyword=P_ \
--from-code=utf-8 \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(GETTEXT_PACKAGE).po \
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+605 -586
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -95,6 +95,7 @@ all-no:
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 \
--from-code=utf-8 \
--keyword=g_dngettext:2,3 \
--flag=g_dngettext:2:pass-c-format \
--flag=g_strdup_printf:1:c-format \
+175 -164
View File
@@ -15,18 +15,18 @@
msgid ""
msgstr ""
"Project-Id-Version: gtk+.master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%"
"2b&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2012-10-29 08:39+0000\n"
"PO-Revision-Date: 2012-10-29 11:53+0100\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk"
"%2b&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2012-12-04 18:57+0000\n"
"PO-Revision-Date: 2012-12-05 19:08+0100\n"
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
"Language-Team: Español <gnome-es-list@gnome.org>\n"
"Language-Team: Español; Castellano <gnome-es-list@gnome.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Gtranslator 2.91.5\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../gdk/gdk.c:155
#, c-format
@@ -701,19 +701,19 @@ msgstr "Página web"
msgid "About %s"
msgstr "Acerca de %s"
#: ../gtk/gtkaboutdialog.c:2399
#: ../gtk/gtkaboutdialog.c:2401
msgid "Created by"
msgstr "Creado por"
#: ../gtk/gtkaboutdialog.c:2402
#: ../gtk/gtkaboutdialog.c:2404
msgid "Documented by"
msgstr "Documentado por"
#: ../gtk/gtkaboutdialog.c:2412
#: ../gtk/gtkaboutdialog.c:2414
msgid "Translated by"
msgstr "Traducido por"
#: ../gtk/gtkaboutdialog.c:2417
#: ../gtk/gtkaboutdialog.c:2419
msgid "Artwork by"
msgstr "Arte por"
@@ -788,7 +788,8 @@ msgid "Backslash"
msgstr "Contrabarra"
#: ../gtk/gtkappchooserbutton.c:290
msgid "Other application..."
#| msgid "Other application..."
msgid "Other application…"
msgstr "Otra aplicación…"
#: ../gtk/gtkappchooserdialog.c:137
@@ -866,7 +867,7 @@ msgstr "Aplicaciones relacionadas"
msgid "Other Applications"
msgstr "Otras aplicaciones"
#: ../gtk/gtkapplication.c:1558
#: ../gtk/gtkapplication.c:1557
#, c-format
msgid ""
"%s cannot quit at this time:\n"
@@ -1031,7 +1032,8 @@ msgstr "No válido"
#. * acelerator.
#.
#: ../gtk/gtkcellrendereraccel.c:416 ../gtk/gtkcellrendereraccel.c:747
msgid "New accelerator..."
#| msgid "New accelerator..."
msgid "New accelerator…"
msgstr "Acelerador nuevo…"
#: ../gtk/gtkcellrendererprogress.c:372 ../gtk/gtkcellrendererprogress.c:462
@@ -1334,7 +1336,8 @@ msgid "mm"
msgstr "mm"
#: ../gtk/gtkcustompaperunixdialog.c:605
msgid "Margins from Printer..."
#| msgid "Margins from Printer..."
msgid "Margins from Printer…"
msgstr "Márgenes de la impresora…"
#: ../gtk/gtkcustompaperunixdialog.c:771
@@ -1374,15 +1377,15 @@ msgstr "_Derecho:"
msgid "Paper Margins"
msgstr "Márgenes del papel"
#: ../gtk/gtkentry.c:9140 ../gtk/gtktextview.c:8583
#: ../gtk/gtkentry.c:9143 ../gtk/gtktextview.c:8583
msgid "Input _Methods"
msgstr "_Métodos de entrada"
#: ../gtk/gtkentry.c:9154 ../gtk/gtktextview.c:8597
#: ../gtk/gtkentry.c:9157 ../gtk/gtktextview.c:8597
msgid "_Insert Unicode Control Character"
msgstr "_Insertar un carácter de control Unicode"
#: ../gtk/gtkentry.c:10107
#: ../gtk/gtkentry.c:10110
msgid "Caps Lock is on"
msgstr "Bloq Mayús está activado"
@@ -1431,7 +1434,7 @@ msgstr "Bloq Mayús está activado"
msgid "Select a File"
msgstr "Seleccionar un archivo"
#: ../gtk/gtkfilechooserbutton.c:105 ../gtk/gtkfilechooserdefault.c:1819
#: ../gtk/gtkfilechooserbutton.c:105 ../gtk/gtkfilechooserdefault.c:1820
msgid "Desktop"
msgstr "Escritorio"
@@ -1441,30 +1444,31 @@ msgid "(None)"
msgstr "(Ninguno)"
#: ../gtk/gtkfilechooserbutton.c:2046
msgid "Other..."
msgstr "Otra…"
#| msgid "Other..."
msgid "Other…"
msgstr "Otro…"
#: ../gtk/gtkfilechooserdefault.c:152
msgid "Type name of new folder"
msgstr "Teclee el nombre de la carpeta nueva"
#: ../gtk/gtkfilechooserdefault.c:970
#: ../gtk/gtkfilechooserdefault.c:971
msgid "Could not retrieve information about the file"
msgstr "No se pudo obtener la información acerca del archivo"
#: ../gtk/gtkfilechooserdefault.c:981
#: ../gtk/gtkfilechooserdefault.c:982
msgid "Could not add a bookmark"
msgstr "No se pudo añadir un marcador"
#: ../gtk/gtkfilechooserdefault.c:992
#: ../gtk/gtkfilechooserdefault.c:993
msgid "Could not remove bookmark"
msgstr "No se pudo quitar el marcador"
#: ../gtk/gtkfilechooserdefault.c:1003
#: ../gtk/gtkfilechooserdefault.c:1004
msgid "The folder could not be created"
msgstr "No se pudo crear la carpeta"
#: ../gtk/gtkfilechooserdefault.c:1016
#: ../gtk/gtkfilechooserdefault.c:1017
msgid ""
"The folder could not be created, as a file with the same name already "
"exists. Try using a different name for the folder, or rename the file first."
@@ -1472,16 +1476,16 @@ msgstr ""
"No se pudo crear la carpeta, debido a que ya existe un archivo con el mismo "
"nombre. Intente usar un nombre distinto o renombre el archivo primero."
#: ../gtk/gtkfilechooserdefault.c:1030
#: ../gtk/gtkfilechooserdefault.c:1031
msgid "You need to choose a valid filename."
msgstr "Debe elegir un nombre de archivo válido."
#: ../gtk/gtkfilechooserdefault.c:1033
#: ../gtk/gtkfilechooserdefault.c:1034
#, c-format
msgid "Cannot create a file under %s as it is not a folder"
msgstr "No se puede crear un archivo bajo %s ya que no es una carpeta"
#: ../gtk/gtkfilechooserdefault.c:1045
#: ../gtk/gtkfilechooserdefault.c:1046
msgid ""
"You may only select folders. The item that you selected is not a folder; "
"try using a different item."
@@ -1489,11 +1493,11 @@ msgstr ""
"Sólo puede seleccionar carpetas. El elemento que ha seleccionado no es una "
"carpeta; intente seleccionar un elemento diferente."
#: ../gtk/gtkfilechooserdefault.c:1055
#: ../gtk/gtkfilechooserdefault.c:1056
msgid "Invalid file name"
msgstr "Nombre de archivo no válido"
#: ../gtk/gtkfilechooserdefault.c:1065
#: ../gtk/gtkfilechooserdefault.c:1066
msgid "The folder contents could not be displayed"
msgstr "No se pudo mostrar el contenido de la carpeta"
@@ -1501,142 +1505,143 @@ msgstr "No se pudo mostrar el contenido de la carpeta"
#. * is a hostname. Nautilus and the panel contain the same string
#. * to translate.
#.
#: ../gtk/gtkfilechooserdefault.c:1591
#: ../gtk/gtkfilechooserdefault.c:1592
#, c-format
msgid "%1$s on %2$s"
msgstr "%1$s en %2$s"
#: ../gtk/gtkfilechooserdefault.c:1740
#: ../gtk/gtkfilechooserdefault.c:1741
msgid "Search"
msgstr "Buscar"
#: ../gtk/gtkfilechooserdefault.c:1764 ../gtk/gtkfilechooserdefault.c:4990
#: ../gtk/gtkfilechooserdefault.c:1765 ../gtk/gtkfilechooserdefault.c:4991
msgid "Recently Used"
msgstr "Usados recientemente"
#: ../gtk/gtkfilechooserdefault.c:2363
#: ../gtk/gtkfilechooserdefault.c:2364
msgid "Select which types of files are shown"
msgstr "Seleccionar qué tipos de archivos se muestran"
#: ../gtk/gtkfilechooserdefault.c:2722
#: ../gtk/gtkfilechooserdefault.c:2723
#, c-format
msgid "Add the folder '%s' to the bookmarks"
msgstr "Añadir la carpeta «%s» a los marcadores"
#: ../gtk/gtkfilechooserdefault.c:2766
#: ../gtk/gtkfilechooserdefault.c:2767
#, c-format
msgid "Add the current folder to the bookmarks"
msgstr "Añadir la carpeta actual a los marcadores"
#: ../gtk/gtkfilechooserdefault.c:2768
#: ../gtk/gtkfilechooserdefault.c:2769
#, c-format
msgid "Add the selected folders to the bookmarks"
msgstr "Añadir las carpetas seleccionadas a los marcadores"
#: ../gtk/gtkfilechooserdefault.c:2806
#: ../gtk/gtkfilechooserdefault.c:2807
#, c-format
msgid "Remove the bookmark '%s'"
msgstr "Quitar el marcador «%s»"
#: ../gtk/gtkfilechooserdefault.c:2808
#: ../gtk/gtkfilechooserdefault.c:2809
#, c-format
msgid "Bookmark '%s' cannot be removed"
msgstr "No se puede quitar el marcador «%s»"
#: ../gtk/gtkfilechooserdefault.c:2815 ../gtk/gtkfilechooserdefault.c:3701
#: ../gtk/gtkfilechooserdefault.c:2816 ../gtk/gtkfilechooserdefault.c:3702
msgid "Remove the selected bookmark"
msgstr "Quitar el marcador seleccionado"
#: ../gtk/gtkfilechooserdefault.c:3379
#: ../gtk/gtkfilechooserdefault.c:3380
msgid "Remove"
msgstr "Quitar"
#: ../gtk/gtkfilechooserdefault.c:3388
msgid "Rename..."
#: ../gtk/gtkfilechooserdefault.c:3389
#| msgid "_Rename"
msgid "Rename…"
msgstr "Renombrar…"
#. Accessible object name for the file chooser's shortcuts pane
#: ../gtk/gtkfilechooserdefault.c:3552
#: ../gtk/gtkfilechooserdefault.c:3553
msgid "Places"
msgstr "Lugares"
#. Column header for the file chooser's shortcuts pane
#: ../gtk/gtkfilechooserdefault.c:3609
#: ../gtk/gtkfilechooserdefault.c:3610
msgid "_Places"
msgstr "_Lugares"
#: ../gtk/gtkfilechooserdefault.c:3689
#: ../gtk/gtkfilechooserdefault.c:3690
msgid "Add the selected folder to the Bookmarks"
msgstr "Añade la carpeta seleccionada a los marcadores"
#: ../gtk/gtkfilechooserdefault.c:3950
#: ../gtk/gtkfilechooserdefault.c:3951
msgid "Could not select file"
msgstr "No se pudo seleccionar el archivo"
#: ../gtk/gtkfilechooserdefault.c:4175
#: ../gtk/gtkfilechooserdefault.c:4176
msgid "_Visit this file"
msgstr "_Visitar este archivo"
#: ../gtk/gtkfilechooserdefault.c:4178
#: ../gtk/gtkfilechooserdefault.c:4179
msgid "_Copy files location"
msgstr "_Copiar la ubicación del archivo"
#: ../gtk/gtkfilechooserdefault.c:4181
#: ../gtk/gtkfilechooserdefault.c:4182
msgid "_Add to Bookmarks"
msgstr "_Añadir a los marcadores"
#: ../gtk/gtkfilechooserdefault.c:4188
#: ../gtk/gtkfilechooserdefault.c:4189
msgid "Show _Hidden Files"
msgstr "Mostrar archivos _ocultos"
#: ../gtk/gtkfilechooserdefault.c:4191
#: ../gtk/gtkfilechooserdefault.c:4192
msgid "Show _Size Column"
msgstr "Mostrar columna de _tamaño"
#: ../gtk/gtkfilechooserdefault.c:4416
#: ../gtk/gtkfilechooserdefault.c:4417
msgid "Files"
msgstr "Archivos"
#: ../gtk/gtkfilechooserdefault.c:4467
#: ../gtk/gtkfilechooserdefault.c:4468
msgid "Name"
msgstr "Nombre"
#: ../gtk/gtkfilechooserdefault.c:4490
#: ../gtk/gtkfilechooserdefault.c:4491
msgid "Size"
msgstr "Tamaño"
#: ../gtk/gtkfilechooserdefault.c:4504
#: ../gtk/gtkfilechooserdefault.c:4505
msgid "Modified"
msgstr "Modificado"
#. Label
#: ../gtk/gtkfilechooserdefault.c:4597
#: ../gtk/gtkfilechooserdefault.c:4598
msgid "_Name:"
msgstr "_Nombre:"
#: ../gtk/gtkfilechooserdefault.c:4828
#: ../gtk/gtkfilechooserdefault.c:4829
msgid "Type a file name"
msgstr "Teclee un nombre de archivo"
#: ../gtk/gtkfilechooserdefault.c:4875 ../gtk/gtkfilechooserdefault.c:4886
#: ../gtk/gtkfilechooserdefault.c:4876 ../gtk/gtkfilechooserdefault.c:4887
msgid "Please select a folder below"
msgstr "Seleccionar una carpeta a continuación"
#: ../gtk/gtkfilechooserdefault.c:4881
#: ../gtk/gtkfilechooserdefault.c:4882
msgid "Please type a file name"
msgstr "Escriba un nombre de archivo"
# C en conflicto con Cancelar
#. Create Folder
#: ../gtk/gtkfilechooserdefault.c:4952
#: ../gtk/gtkfilechooserdefault.c:4953
msgid "Create Fo_lder"
msgstr "Crear car_peta"
#: ../gtk/gtkfilechooserdefault.c:5000
#: ../gtk/gtkfilechooserdefault.c:5001
msgid "Search:"
msgstr "Buscar:"
#: ../gtk/gtkfilechooserdefault.c:5051
#: ../gtk/gtkfilechooserdefault.c:5052
msgid "_Location:"
msgstr "_Lugar:"
@@ -1649,63 +1654,63 @@ msgstr "Guardar _en la carpeta:"
msgid "Create in _folder:"
msgstr "Crear en la _carpeta:"
#: ../gtk/gtkfilechooserdefault.c:6591
#: ../gtk/gtkfilechooserdefault.c:6597
#, c-format
msgid "Could not read the contents of %s"
msgstr "No se pudo leer el contenido de %s"
#: ../gtk/gtkfilechooserdefault.c:6595
#: ../gtk/gtkfilechooserdefault.c:6601
msgid "Could not read the contents of the folder"
msgstr "No se pudo leer el contenido del la carpeta"
#: ../gtk/gtkfilechooserdefault.c:6688 ../gtk/gtkfilechooserdefault.c:6756
#: ../gtk/gtkfilechooserdefault.c:6936
#: ../gtk/gtkfilechooserdefault.c:6694 ../gtk/gtkfilechooserdefault.c:6762
#: ../gtk/gtkfilechooserdefault.c:6942
msgid "Unknown"
msgstr "Desconocido"
#: ../gtk/gtkfilechooserdefault.c:6703
#: ../gtk/gtkfilechooserdefault.c:6709
msgid "%H:%M"
msgstr "%H:%M"
#: ../gtk/gtkfilechooserdefault.c:6705
#: ../gtk/gtkfilechooserdefault.c:6711
msgid "Yesterday at %H:%M"
msgstr "Ayer a las %H:%M"
#: ../gtk/gtkfilechooserdefault.c:7407
#: ../gtk/gtkfilechooserdefault.c:7413
msgid "Cannot change to folder because it is not local"
msgstr "No se pudo cambiar a la carpeta porque no es local"
#: ../gtk/gtkfilechooserdefault.c:8011 ../gtk/gtkfilechooserdefault.c:8032
#: ../gtk/gtkfilechooserdefault.c:8020 ../gtk/gtkfilechooserdefault.c:8041
#, c-format
msgid "Shortcut %s already exists"
msgstr "La combinación %s ya existe"
#: ../gtk/gtkfilechooserdefault.c:8122
#: ../gtk/gtkfilechooserdefault.c:8131
#, c-format
msgid "Shortcut %s does not exist"
msgstr "La combinación %s no existe"
#: ../gtk/gtkfilechooserdefault.c:8368 ../gtk/gtkprintunixdialog.c:548
#: ../gtk/gtkfilechooserdefault.c:8377 ../gtk/gtkprintunixdialog.c:548
#, c-format
msgid "A file named \"%s\" already exists. Do you want to replace it?"
msgstr "Ya existe un archivo llamado «%s». ¿Quiere reemplazarlo?"
#: ../gtk/gtkfilechooserdefault.c:8371 ../gtk/gtkprintunixdialog.c:552
#: ../gtk/gtkfilechooserdefault.c:8380 ../gtk/gtkprintunixdialog.c:552
#, c-format
msgid ""
"The file already exists in \"%s\". Replacing it will overwrite its contents."
msgstr ""
"El archivo ya existe en «%s». Si lo reemplaza sobreescribirá su contenido."
#: ../gtk/gtkfilechooserdefault.c:8376 ../gtk/gtkprintunixdialog.c:559
#: ../gtk/gtkfilechooserdefault.c:8385 ../gtk/gtkprintunixdialog.c:559
msgid "_Replace"
msgstr "_Reemplazar"
#: ../gtk/gtkfilechooserdefault.c:9183
#: ../gtk/gtkfilechooserdefault.c:9192
msgid "Could not start the search process"
msgstr "No se ha podido iniciar el proceso de búsqueda"
#: ../gtk/gtkfilechooserdefault.c:9184
#: ../gtk/gtkfilechooserdefault.c:9193
msgid ""
"The program was not able to create a connection to the indexer daemon. "
"Please make sure it is running."
@@ -1713,11 +1718,11 @@ msgstr ""
"El programa no fue capaz de crear una conexión con el demonio indexador. Por "
"favor asegúrese de que se está ejecutando."
#: ../gtk/gtkfilechooserdefault.c:9198
#: ../gtk/gtkfilechooserdefault.c:9207
msgid "Could not send the search request"
msgstr "No se ha podido enviar la petición de búsqueda"
#: ../gtk/gtkfilechooserdefault.c:9808
#: ../gtk/gtkfilechooserdefault.c:9817
#, c-format
msgid "Could not mount %s"
msgstr "No se pudo montar %s"
@@ -1757,12 +1762,12 @@ msgstr "Buscar nombre de tipografía"
msgid "Font Family"
msgstr "Familia tipográfica"
#: ../gtk/gtkicontheme.c:1627
#: ../gtk/gtkicontheme.c:1931
#, c-format
msgid "Icon '%s' not present in theme"
msgstr "El icono «%s» no está presente en el tema"
#: ../gtk/gtkicontheme.c:3137
#: ../gtk/gtkicontheme.c:3462
msgid "Failed to load icon"
msgstr "No se pudo cargar el icono"
@@ -1788,22 +1793,23 @@ msgid "System (%s)"
msgstr "Sistema (%s)"
#. Open Link
#: ../gtk/gtklabel.c:6224
#: ../gtk/gtklabel.c:6183
msgid "_Open Link"
msgstr "_Abrir enlace"
#. Copy Link Address
#: ../gtk/gtklabel.c:6236
#: ../gtk/gtklabel.c:6195
msgid "Copy _Link Address"
msgstr "Copiar la dirección del _enlace"
#: ../gtk/gtk-launch.c:73
msgid "APPLICATION [URI...] - launch an APPLICATION with URI."
msgstr "APLICACION [URI...]: lanzar una APLICACION con URI."
#: ../gtk/gtk-launch.c:71
#| msgid "APPLICATION [URI...] - launch an APPLICATION with URI."
msgid "APPLICATION [URI…] — launch an APPLICATION with URI."
msgstr "APLICACIÓN [URI…]: lanzar una APLICACIÓN con URI."
#. Translators: this message will appear after the usage string
#. and before the list of options.
#: ../gtk/gtk-launch.c:77
#: ../gtk/gtk-launch.c:75
msgid ""
"Launch specified application by its desktop file info\n"
"optionally passing list of URIs as arguments."
@@ -1811,38 +1817,38 @@ msgstr ""
"Lanzar la aplicación indicada por su archivo .desktop\n"
"pasándole opcionalmente la lista de URI como argumentos."
#: ../gtk/gtk-launch.c:89
#: ../gtk/gtk-launch.c:87
#, c-format
msgid "Error parsing commandline options: %s\n"
msgstr "Error al analizar las opciones de la línea de comandos: %s\n"
#: ../gtk/gtk-launch.c:91 ../gtk/gtk-launch.c:104
#: ../gtk/gtk-launch.c:89 ../gtk/gtk-launch.c:102
#, c-format
msgid "Try \"%s --help\" for more information."
msgstr "Intente «%s --help» para obtener más información."
#. Translators: the %s is the program name. This error message
#. means the user is calling gtk-launch without any argument.
#: ../gtk/gtk-launch.c:102
#: ../gtk/gtk-launch.c:100
#, c-format
msgid "%s: missing application name"
msgstr "%s: falta el nombre de la aplicación"
#: ../gtk/gtk-launch.c:123
#: ../gtk/gtk-launch.c:121
#, c-format
msgid "Creating AppInfo from id not supported on non unix operating systems"
msgstr "No se soporta crear AppInfo desde ID en sistemas operativos no UNIX"
#. Translators: the first %s is the program name, the second one
#. is the application name.
#: ../gtk/gtk-launch.c:131
#: ../gtk/gtk-launch.c:129
#, c-format
msgid "%s: no such application %s"
msgstr "%s:no existe la aplicación %s"
#. Translators: the first %s is the program name, the second one
#. is the error message.
#: ../gtk/gtk-launch.c:149
#: ../gtk/gtk-launch.c:147
#, c-format
msgid "%s: error launching application: %s\n"
msgstr "%s: error al lanzar la aplicación: %s\n"
@@ -1921,16 +1927,16 @@ msgstr "Opciones de depuración GTK+ a quitar"
msgid "default:LTR"
msgstr "default:LTR"
#: ../gtk/gtkmain.c:772
#: ../gtk/gtkmain.c:769
#, c-format
msgid "Cannot open display: %s"
msgstr "No se puede abrir el visor: %s"
#: ../gtk/gtkmain.c:838
#: ../gtk/gtkmain.c:835
msgid "GTK+ Options"
msgstr "Opciones GTK+"
#: ../gtk/gtkmain.c:838
#: ../gtk/gtkmain.c:835
msgid "Show GTK+ Options"
msgstr "Mostrar opciones GTK+"
@@ -2019,7 +2025,7 @@ msgstr "Shell Z"
msgid "Cannot end process with PID %d: %s"
msgstr "No se puede finalizar el proceso con PID %d: %s"
#: ../gtk/gtknotebook.c:5067 ../gtk/gtknotebook.c:7721
#: ../gtk/gtknotebook.c:5069 ../gtk/gtknotebook.c:7723
#, c-format
msgid "Page %u"
msgstr "Página %u"
@@ -2062,8 +2068,9 @@ msgstr ""
" Inferior: %s %s"
#: ../gtk/gtkpagesetupunixdialog.c:845 ../gtk/gtkprintunixdialog.c:3329
msgid "Manage Custom Sizes..."
msgstr "Gestión de tamaños personalizados…"
#| msgid "Manage Custom Sizes"
msgid "Manage Custom Sizes…"
msgstr "Gestionar tamaños personalizados…"
#: ../gtk/gtkpagesetupunixdialog.c:896
msgid "_Format for:"
@@ -2245,7 +2252,8 @@ msgid "Getting printer information failed"
msgstr "Falló la obtención de la información de la impresora"
#: ../gtk/gtkprintunixdialog.c:1916
msgid "Getting printer information..."
#| msgid "Getting printer information..."
msgid "Getting printer information…"
msgstr "Obteniendo la información de la impresora…"
#: ../gtk/gtkprintunixdialog.c:2184
@@ -2322,42 +2330,42 @@ msgstr "General"
#. * multiple pages on a sheet when printing
#.
#: ../gtk/gtkprintunixdialog.c:3058
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3686
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3692
msgid "Left to right, top to bottom"
msgstr "De izquierda a derecha, de arriba a abajo"
#: ../gtk/gtkprintunixdialog.c:3058
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3686
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3692
msgid "Left to right, bottom to top"
msgstr "De izquierda a derecha, de abajo a arriba"
#: ../gtk/gtkprintunixdialog.c:3059
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3687
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3693
msgid "Right to left, top to bottom"
msgstr "De derecha a izquierda, de arriba a abajo"
#: ../gtk/gtkprintunixdialog.c:3059
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3687
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3693
msgid "Right to left, bottom to top"
msgstr "De derecha a izquierda, de abajo a arriba"
#: ../gtk/gtkprintunixdialog.c:3060
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3688
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3694
msgid "Top to bottom, left to right"
msgstr "De arriba a abajo, de izquierda a derecha"
#: ../gtk/gtkprintunixdialog.c:3060
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3688
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3694
msgid "Top to bottom, right to left"
msgstr "De arriba a abajo, de derecha a izquierda"
#: ../gtk/gtkprintunixdialog.c:3061
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3689
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3695
msgid "Bottom to top, left to right"
msgstr "De abajo a arriba, de izquierda a derecha"
#: ../gtk/gtkprintunixdialog.c:3061
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3689
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3695
msgid "Bottom to top, right to left"
msgstr "De abajo a arriba, de derecha a izquierda"
@@ -2365,7 +2373,7 @@ msgstr "De abajo a arriba, de derecha a izquierda"
#. * dialog that controls in what order multiple pages are arranged
#.
#: ../gtk/gtkprintunixdialog.c:3065 ../gtk/gtkprintunixdialog.c:3078
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3766
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3772
msgid "Page Ordering"
msgstr "Orden de las hojas"
@@ -4539,117 +4547,117 @@ msgstr "Pausado; rechazando trabajos"
msgid "Rejecting Jobs"
msgstr "Rechazando trabajos"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2909
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2915
msgid "Two Sided"
msgstr "Dos caras"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2910
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2916
msgid "Paper Type"
msgstr "Tipo de papel"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2911
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2917
msgid "Paper Source"
msgstr "Fuente de papel"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2912
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2918
msgid "Output Tray"
msgstr "Bandeja de salida"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2913
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2919
msgid "Resolution"
msgstr "Resolución"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2914
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2920
msgid "GhostScript pre-filtering"
msgstr "Prefiltrado GhostScript"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2923
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2929
msgid "One Sided"
msgstr "Una cara"
#. Translators: this is an option of "Two Sided"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2925
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2931
msgid "Long Edge (Standard)"
msgstr "Margen largo (estándar)"
#. Translators: this is an option of "Two Sided"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2927
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2933
msgid "Short Edge (Flip)"
msgstr "Margen corto (girar)"
#. Translators: this is an option of "Paper Source"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2929
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2931
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2939
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2935
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2937
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2945
msgid "Auto Select"
msgstr "Autoseleccionar"
#. Translators: this is an option of "Paper Source"
#. Translators: this is an option of "Resolution"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2933
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2935
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2937
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2939
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2941
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3429
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2943
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2947
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3435
msgid "Printer Default"
msgstr "Predeterminado de la impresora"
#. Translators: this is an option of "GhostScript"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2943
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2949
msgid "Embed GhostScript fonts only"
msgstr "Sólo empotrar tipografías GhostScript"
#. Translators: this is an option of "GhostScript"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2945
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2951
msgid "Convert to PS level 1"
msgstr "Convertir a PS de nivel 1"
#. Translators: this is an option of "GhostScript"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2947
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2953
msgid "Convert to PS level 2"
msgstr "Convertir a PS de nivel 2"
#. Translators: this is an option of "GhostScript"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2949
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2955
msgid "No pre-filtering"
msgstr "Sin prefiltrado"
#. Translators: "Miscellaneous" is the label for a button, that opens
#. up an extra panel of settings in a print dialog.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2958
#: ../modules/printbackends/cups/gtkprintbackendcups.c:2964
msgid "Miscellaneous"
msgstr "Miscelánea"
#. Translators: These strings name the possible values of the
#. * job priority option in the print dialog
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3681
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3687
msgid "Urgent"
msgstr "Urgente"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3681
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3687
msgid "High"
msgstr "Alta"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3681
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3687
msgid "Medium"
msgstr "Media"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3681
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3687
msgid "Low"
msgstr "Baja"
#. Translators, this string is used to label the job priority option
#. * in the print dialog
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3711
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3717
msgid "Job Priority"
msgstr "Prioridad del trabajo"
#. Translators, this string is used to label the billing info entry
#. * in the print dialog
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3722
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3728
msgid "Billing Info"
msgstr "Información de facturación"
@@ -4657,52 +4665,52 @@ msgstr "Información de facturación"
#. Translators, these strings are names for various 'standard' cover
#. * pages that the printing system may support.
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "None"
msgstr "Ninguna"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "Classified"
msgstr "Clasificado"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "Confidential"
msgstr "Confidencial"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "Secret"
msgstr "Secreto"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "Standard"
msgstr "Estándar"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "Top Secret"
msgstr "Alto secreto"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3737
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3743
msgid "Unclassified"
msgstr "Desclasificado"
#. Translators, this string is used to label the pages-per-sheet option
#. * in the print dialog
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3748
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3754
msgid "Pages per Sheet"
msgstr "Páginas por hoja"
#. Translators, this is the label used for the option in the print
#. * dialog that controls the front cover page.
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3808
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3814
msgid "Before"
msgstr "Antes"
#. Translators, this is the label used for the option in the print
#. * dialog that controls the back cover page.
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3823
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3829
msgid "After"
msgstr "Después"
@@ -4710,14 +4718,14 @@ msgstr "Después"
#. * a print job is printed. Possible values are 'now', a specified time,
#. * or 'on hold'
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3843
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3849
msgid "Print at"
msgstr "Imprimir en"
#. Translators: this is the name of the option that allows the user
#. * to specify a time when a print job will be printed.
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3854
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3860
msgid "Print at time"
msgstr "Imprimir a la hora"
@@ -4725,17 +4733,17 @@ msgstr "Imprimir a la hora"
#. * size. The two placeholders are replaced with the width and height
#. * in points. E.g: "Custom 230.4x142.9"
#.
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3889
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3895
#, c-format
msgid "Custom %sx%s"
msgstr "Personalizado %sx%s"
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3970
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3976
msgid "Printer Profile"
msgstr "Perfil de la impresora"
#. TRANSLATORS: this is when color profile information is unavailable
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3977
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3983
msgid "Unavailable"
msgstr "No disponible"
@@ -4835,6 +4843,12 @@ msgstr "salida-de-prueba.%s"
msgid "Print to Test Printer"
msgstr "Imprimir a la impresora de prueba"
#~ msgid "Rename..."
#~ msgstr "Renombrar…"
#~ msgid "Manage Custom Sizes..."
#~ msgstr "Gestión de tamaños personalizados…"
#~ msgid "Select a folder"
#~ msgstr "Seleccionar una carpeta"
@@ -4914,8 +4928,8 @@ msgstr "Imprimir a la impresora de prueba"
#~ msgid "different idatas found for symlinked '%s' and '%s'\n"
#~ msgstr ""
#~ "se encontraron diferentes idatas para el «%s» enlazado simbólicamente y «%"
#~ "s»\n"
#~ "se encontraron diferentes idatas para el «%s» enlazado simbólicamente y "
#~ "«%s»\n"
#~ msgid "_Add"
#~ msgstr "_Añadir"
@@ -5027,8 +5041,8 @@ msgstr "Imprimir a la impresora de prueba"
#~ "Internal error: Image loader module '%s' failed to complete an operation, "
#~ "but didn't give a reason for the failure"
#~ msgstr ""
#~ "Error interno: El módulo de carga de imágenes «%s» ha fallado al completar "
#~ "una operación, pero no ha dado ninguna razón del fallo"
#~ "Error interno: El módulo de carga de imágenes «%s» ha fallado al "
#~ "completar una operación, pero no ha dado ninguna razón del fallo"
#~ msgid "Incremental loading of image type '%s' is not supported"
#~ msgstr ""
@@ -5231,8 +5245,8 @@ msgstr "Imprimir a la impresora de prueba"
#~ "JPEG quality must be a value between 0 and 100; value '%s' could not be "
#~ "parsed."
#~ msgstr ""
#~ "La calidad de un JPEG debe ser un valor entre 0 y 100; el valor «%s» no se "
#~ "puede interpretar."
#~ "La calidad de un JPEG debe ser un valor entre 0 y 100; el valor «%s» no "
#~ "se puede interpretar."
#~ msgid ""
#~ "JPEG quality must be a value between 0 and 100; value '%d' is not allowed."
@@ -5329,15 +5343,15 @@ msgstr "Imprimir a la impresora de prueba"
#~ "PNG compression level must be a value between 0 and 9; value '%s' could "
#~ "not be parsed."
#~ msgstr ""
#~ "El nivel de compresión PNG debe ser un valor entre 0 y 9; el valor «%s» no "
#~ "se puede interpretar."
#~ "El nivel de compresión PNG debe ser un valor entre 0 y 9; el valor «%s» "
#~ "no se puede interpretar."
#~ msgid ""
#~ "PNG compression level must be a value between 0 and 9; value '%d' is not "
#~ "allowed."
#~ msgstr ""
#~ "El nivel de compresión PNG debe ser un valor entre 0 y 9; el valor «%d» no "
#~ "está permitido."
#~ "El nivel de compresión PNG debe ser un valor entre 0 y 9; el valor «%d» "
#~ "no está permitido."
#~ msgid ""
#~ "Value for PNG text chunk %s cannot be converted to ISO-8859-1 encoding."
@@ -5697,9 +5711,6 @@ msgstr "Imprimir a la impresora de prueba"
#~ msgid "Rename file \"%s\" to:"
#~ msgstr "Renombrar archivo «%s» a:"
#~ msgid "_Rename"
#~ msgstr "_Renombrar"
#~ msgid ""
#~ "The filename \"%s\" couldn't be converted to UTF-8. (try setting the "
#~ "environment variable G_FILENAME_ENCODING): %s"
+3 -3
View File
@@ -152,9 +152,9 @@ EXTRA_DIST += \
entry-progress-coloring.css \
entry-progress-coloring.ref.ui \
entry-progress-coloring.ui \
font-size-names.css \
font-size-names.ref.ui \
font-size-names.ui \
font-sizes-names.css \
font-sizes-names.ref.ui \
font-sizes-names.ui \
green-20x20.png \
grid-empty-with-spacing.ref.ui \
grid-empty-with-spacing.ui \
+3 -2
View File
@@ -396,7 +396,7 @@ create_calendar(void)
GtkSizeGroup *size;
GtkStyleContext *context;
const PangoFontDescription *font_desc;
PangoFontDescription *font_desc;
gchar *font;
gint i;
@@ -476,10 +476,11 @@ create_calendar(void)
size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
context = gtk_widget_get_style_context (calendar);
font_desc = gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL);
gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, &font_desc, NULL);
font = pango_font_description_to_string (font_desc);
button = gtk_font_button_new_with_font (font);
g_free (font);
pango_font_description_free (font_desc);
g_signal_connect (button, "font-set",
G_CALLBACK(calendar_select_font),