Compare commits

...

11 Commits

Author SHA1 Message Date
be76b19300 st-entry: Set text-related CSS properties on the internal ClutterText
Call _st_set_text_from_style() when updating the entry's style, so
that CSS style properties such as text-decoration or letter-spacing
are applied over the internal ClutterText instance.
2018-04-18 00:14:05 +00:00
376d696b8b st-private: Add support for letter-spacing in ClutterText based StWidgets
Add support in _st_set_text_from_style(), so that this CSS property can
be used from any StWidget holding an internal ClutterText.
2018-04-18 00:14:05 +00:00
695d61968d st-theme-node: Add new getter st_theme_node_get_letter_spacing
This will be used by ClutterText-backed StWidgets to update their
list of PangoAttributes according to the letter-spacing property.
2018-04-18 00:14:04 +00:00
d6d09fd3c8 ui: Theme lookup should respect XDG_DATA_DIRS
Modes, extensions and other GNOME Shell assets are searched in appropriate
subdirectories of each directory in XDG_DATA_DIRS, falling back
to global.datadir.
However, this isn't the case for themes, which are currently always expected
in global.datadir, even when referenced by a mode in a different XDG_DATA_DIR.

The fix is to have the theme finding pattern follow the same logic as other
elements.
Fixes #167.
2018-04-16 19:09:14 +02:00
f1b1501f9b Update Croatian translation 2018-04-16 12:31:09 +00:00
cdbc99e992 popupMenu: Fix wrong call to clutter_actor_add_child()
Specify the horizontal alignment via the x_align property when creating
the StIcon, since this function expects one argument, not two.
2018-04-16 11:40:04 +00:00
69afe7785d remoteMenu: Support icons in app-menu
The HIG discourages the use of icons in menus except for "noun" items
(files, bookmarks, ...). While those should be rarely used in the
application menu, it still makes sense to support them in the few
cases where they are used.

https://bugzilla.gnome.org/show_bug.cgi?id=760985
2018-04-14 09:02:20 +00:00
b99e304f1e workspaceThumbnail: initialize porthole based on workArea
https://bugzilla.gnome.org/show_bug.cgi?id=792687
2018-04-13 16:59:51 -05:00
c29bd46e7a workspaceThumbnail: rebuild thumbnails if workareas size changed
https://bugzilla.gnome.org/show_bug.cgi?id=792687
2018-04-13 16:58:28 -05:00
5fcf40b973 workspaceThumbnail: only update _porthole if the overview is visible
Otherwise it happens that porthole is computed again after that the
overlay is hidden (triggered by a layout reallocation) and thus not
regenerated again afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=792687
2018-04-13 16:53:18 -05:00
a198dfe3d8 thunderbolt: capitalize Thunderbolt in a translatable string 2018-04-13 21:52:32 +02:00
10 changed files with 104 additions and 45 deletions

View File

@ -256,6 +256,14 @@ function _getStylesheet(name) {
if (stylesheet.query_exists(null))
return stylesheet;
let dataDirs = GLib.get_system_data_dirs();
for (let i = 0; i < dataDirs.length; i++) {
let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'theme', name]);
let stylesheet = Gio.file_new_for_path(path);
if (stylesheet.query_exists(null))
return stylesheet;
}
stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name);
if (stylesheet.query_exists(null))
return stylesheet;

View File

@ -394,8 +394,9 @@ var PopupImageMenuItem = new Lang.Class({
_init(text, icon, params) {
this.parent(params);
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
this.actor.add_child(this._icon, { align: St.Align.END });
this._icon = new St.Icon({ style_class: 'popup-menu-icon',
x_align: Clutter.ActorAlign.END });
this.actor.add_child(this._icon);
this.label = new St.Label({ text: text });
this.actor.add_child(this.label);
this.actor.label_actor = this.label;

View File

@ -119,6 +119,9 @@ var RemoteMenuItemMapper = new Lang.Class({
this._trackerItem = trackerItem;
this.menuItem = new PopupMenu.PopupBaseMenuItem();
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
this.menuItem.actor.add_child(this._icon);
this._label = new St.Label();
this.menuItem.actor.add_child(this._label);
this.menuItem.actor.label_actor = this._label;
@ -129,11 +132,13 @@ var RemoteMenuItemMapper = new Lang.Class({
this._trackerItem.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
this._trackerItem.connect('notify::icon', this._updateIcon.bind(this));
this._trackerItem.connect('notify::label', this._updateLabel.bind(this));
this._trackerItem.connect('notify::sensitive', this._updateSensitivity.bind(this));
this._trackerItem.connect('notify::role', this._updateRole.bind(this));
this._trackerItem.connect('notify::toggled', this._updateDecoration.bind(this));
this._updateIcon();
this._updateLabel();
this._updateSensitivity();
this._updateRole();
@ -143,6 +148,11 @@ var RemoteMenuItemMapper = new Lang.Class({
});
},
_updateIcon() {
this._icon.gicon = this._trackerItem.icon;
this._icon.visible = (this._icon.gicon != null);
},
_updateLabel() {
this._label.text = stripMnemonics(this._trackerItem.label);
},

View File

@ -354,7 +354,7 @@ var Indicator = new Lang.Class({
_onEnrollFailed(obj, device, error) {
const title = _('Thunderbolt authorization error');
const body = _('Could not authorize the thunderbolt device: %s'.format(error.message));
const body = _('Could not authorize the Thunderbolt device: %s'.format(error.message));
this._notify(title, body);
}

View File

@ -275,8 +275,8 @@ var WorkspaceThumbnail = new Lang.Class({
this._createBackground();
let monitor = Main.layoutManager.primaryMonitor;
this.setPorthole(monitor.x, monitor.y, monitor.width, monitor.height);
let workArea = Main.layoutManager.getWorkAreaForMonitor(this.monitorIndex);
this.setPorthole(workArea.x, workArea.y, workArea.width, workArea.height);
let windows = global.get_window_actors().filter(actor => {
let win = actor.meta_window;
@ -321,8 +321,6 @@ var WorkspaceThumbnail = new Lang.Class({
},
setPorthole(x, y, width, height) {
this._portholeX = x;
this._portholeY = y;
this.actor.set_size(width, height);
this._contents.set_position(-x, -y);
},
@ -675,11 +673,7 @@ var ThumbnailsBox = new Lang.Class({
this._settings.connect('changed::dynamic-workspaces',
this._updateSwitcherVisibility.bind(this));
Main.layoutManager.connect('monitors-changed', () => {
this._destroyThumbnails();
if (Main.overview.visible)
this._createThumbnails();
});
Main.layoutManager.connect('monitors-changed', this._rebuildThumbnails.bind(this));
},
_updateSwitcherVisibility() {
@ -872,6 +866,9 @@ var ThumbnailsBox = new Lang.Class({
Main.overview.connect('windows-restacked',
this._syncStacking.bind(this));
this._workareasChangedId =
global.screen.connect('workareas-changed', this._rebuildThumbnails.bind(this));
this._targetScale = 0;
this._scale = 0;
this._pendingScaleUpdate = false;
@ -901,12 +898,24 @@ var ThumbnailsBox = new Lang.Class({
this._syncStackingId = 0;
}
if (this._workareasChangedId > 0) {
global.screen.disconnect(this._workareasChangedId);
this._workareasChangedId = 0;
}
for (let w = 0; w < this._thumbnails.length; w++)
this._thumbnails[w].destroy();
this._thumbnails = [];
this._porthole = null;
},
_rebuildThumbnails() {
this._destroyThumbnails();
if (Main.overview.visible)
this._createThumbnails();
},
_workspacesChanged() {
let validThumbnails =
this._thumbnails.filter(t => t.state <= ThumbnailState.NORMAL);
@ -1159,7 +1168,7 @@ var ThumbnailsBox = new Lang.Class({
// The "porthole" is the portion of the screen that we show in the
// workspaces
_ensurePorthole() {
if (!Main.layoutManager.primaryMonitor)
if (!Main.layoutManager.primaryMonitor || !Main.overview.visible)
return false;
if (!this._porthole)

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gnome-shell master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-shell/issues\n"
"POT-Creation-Date: 2018-02-26 17:00+0000\n"
"PO-Revision-Date: 2018-03-07 22:46+0100\n"
"POT-Creation-Date: 2018-04-13 19:54+0000\n"
"PO-Revision-Date: 2018-04-16 14:30+0200\n"
"Last-Translator: gogo <trebelnik2@gmail.com>\n"
"Language-Team: Croatian <hr@li.org>\n"
"Language: hr\n"
@ -337,7 +337,7 @@ msgid "There was an error loading the preferences dialog for %s:"
msgstr "Dogodila se greška učitavanja dijaloga osobitosti za %s:"
#: js/gdm/authPrompt.js:147 js/ui/audioDeviceSelection.js:71
#: js/ui/components/networkAgent.js:117 js/ui/components/polkitAgent.js:148
#: js/ui/components/networkAgent.js:117 js/ui/components/polkitAgent.js:153
#: js/ui/endSessionDialog.js:482 js/ui/extensionDownloader.js:197
#: js/ui/shellMountOperation.js:343 js/ui/status/network.js:919
msgid "Cancel"
@ -663,12 +663,12 @@ msgstr "Dodaj u omiljene"
msgid "Show Details"
msgstr "Prikaži pojedinosti"
#: js/ui/appFavorites.js:138
#: js/ui/appFavorites.js:140
#, javascript-format
msgid "%s has been added to your favorites."
msgstr "%s je dodan u omiljene."
#: js/ui/appFavorites.js:172
#: js/ui/appFavorites.js:174
#, javascript-format
msgid "%s has been removed from your favorites."
msgstr "%s je uklonjen iz omiljenih."
@ -863,7 +863,7 @@ msgstr "Vanjski uređaj odspojen"
msgid "Open with %s"
msgstr "Otvori s(a) %s"
#: js/ui/components/keyring.js:107 js/ui/components/polkitAgent.js:284
#: js/ui/components/keyring.js:107 js/ui/components/polkitAgent.js:295
msgid "Password:"
msgstr "Lozinka:"
@ -950,15 +950,15 @@ msgstr "Potrebna je lozinka za povezivanje s “%s”."
msgid "Network Manager"
msgstr "Mrežni upravitelj"
#: js/ui/components/polkitAgent.js:43
#: js/ui/components/polkitAgent.js:48
msgid "Authentication Required"
msgstr "Potrebna je ovjera"
#: js/ui/components/polkitAgent.js:71
#: js/ui/components/polkitAgent.js:76
msgid "Administrator"
msgstr "Administrator"
#: js/ui/components/polkitAgent.js:151
#: js/ui/components/polkitAgent.js:156
msgid "Authenticate"
msgstr "Ovjeri"
@ -966,7 +966,7 @@ msgstr "Ovjeri"
#. * requested authentication was not gained; this can happen
#. * because of an authentication error (like invalid password),
#. * for instance.
#: js/ui/components/polkitAgent.js:270 js/ui/shellMountOperation.js:327
#: js/ui/components/polkitAgent.js:281 js/ui/shellMountOperation.js:327
msgid "Sorry, that didnt work. Please try again."
msgstr "Nažalost, to ne radi. Pokušajte ponovno."
@ -1014,7 +1014,7 @@ msgstr "Dodaj satove iz svijeta…"
msgid "World Clocks"
msgstr "Svjetski satovi"
#: js/ui/dateMenu.js:225
#: js/ui/dateMenu.js:227
msgid "Weather"
msgstr "Vrijeme"
@ -1022,7 +1022,7 @@ msgstr "Vrijeme"
#. libgweather for the possible condition strings. If at all
#. possible, the sentence should match the grammatical case etc. of
#. the inserted conditions.
#: js/ui/dateMenu.js:289
#: js/ui/dateMenu.js:291
#, javascript-format
msgid "%s all day."
msgstr "%s cijeli dan."
@ -1031,7 +1031,7 @@ msgstr "%s cijeli dan."
#. libgweather for the possible condition strings. If at all
#. possible, the sentence should match the grammatical case etc. of
#. the inserted conditions.
#: js/ui/dateMenu.js:295
#: js/ui/dateMenu.js:297
#, javascript-format
msgid "%s, then %s later."
msgstr "%s, zatim %s kasnije."
@ -1040,30 +1040,30 @@ msgstr "%s, zatim %s kasnije."
#. libgweather for the possible condition strings. If at all
#. possible, the sentence should match the grammatical case etc. of
#. the inserted conditions.
#: js/ui/dateMenu.js:301
#: js/ui/dateMenu.js:303
#, javascript-format
msgid "%s, then %s, followed by %s later."
msgstr "%s, zatim %s, praćena s %s kasnije."
#: js/ui/dateMenu.js:312
#: js/ui/dateMenu.js:314
msgid "Select a location…"
msgstr "Odaberi lokaciju…"
#: js/ui/dateMenu.js:315
#: js/ui/dateMenu.js:317
msgid "Loading…"
msgstr "Pretraživanje…"
#. Translators: %s is a temperature with unit, e.g. "23℃"
#: js/ui/dateMenu.js:321
#: js/ui/dateMenu.js:323
#, javascript-format
msgid "Feels like %s."
msgstr "Kao da je %s."
#: js/ui/dateMenu.js:324
#: js/ui/dateMenu.js:326
msgid "Go online for weather information"
msgstr "Posjetite za opširnije vremenske informacije"
#: js/ui/dateMenu.js:326
#: js/ui/dateMenu.js:328
msgid "Weather information is currently unavailable"
msgstr "Vremenske informacije su trenutno nedostupne"
@ -1977,16 +1977,16 @@ msgstr "Suspendiraj"
msgid "Power Off"
msgstr "Isključivanje"
#: js/ui/status/thunderbolt.js:272
#: js/ui/status/thunderbolt.js:294
msgid "Thunderbolt"
msgstr "Thunderbolt"
#. we are done
#: js/ui/status/thunderbolt.js:328
#: js/ui/status/thunderbolt.js:350
msgid "Unknown Thunderbolt device"
msgstr "Nepoznati Thunderbolt uređaj"
#: js/ui/status/thunderbolt.js:329
#: js/ui/status/thunderbolt.js:351
msgid ""
"New device has been detected while you were away. Please disconnect and "
"reconnect the device to start using it."
@ -1994,14 +1994,14 @@ msgstr ""
"Otkriven je novi uređaj dok ste bili odsutni. Odspojite i ponovno spojite "
"uređaj kako bi ga mogli koristiti."
#: js/ui/status/thunderbolt.js:334
#: js/ui/status/thunderbolt.js:356
msgid "Thunderbolt authorization error"
msgstr "Greška Thunderbolt ovjere"
msgstr "Greška Thunderbolt odobravanja"
#: js/ui/status/thunderbolt.js:335
#: js/ui/status/thunderbolt.js:357
#, javascript-format
msgid "Could not authorize the thunderbolt device: %s"
msgstr "Nemoguća ovjera Thunderbolt uređaja: %s"
msgid "Could not authorize the Thunderbolt device: %s"
msgstr "Nemoguće odobravanje Thunderbolt uređaja: %s"
#: js/ui/status/volume.js:128
msgid "Volume changed"

View File

@ -308,9 +308,8 @@ st_entry_style_changed (StWidget *self)
}
theme_node = st_widget_get_theme_node (self);
st_theme_node_get_foreground_color (theme_node, &color);
clutter_text_set_color (CLUTTER_TEXT (priv->entry), &color);
_st_set_text_from_style (CLUTTER_TEXT (priv->entry), theme_node);
if (st_theme_node_lookup_length (theme_node, "caret-size", TRUE, &size))
clutter_text_set_cursor_size (CLUTTER_TEXT (priv->entry), (int)(.5 + size));

View File

@ -116,6 +116,7 @@ _st_set_text_from_style (ClutterText *text,
PangoAttrList *attribs = NULL;
const PangoFontDescription *font;
StTextAlign align;
gdouble spacing;
st_theme_node_get_foreground_color (theme_node, &color);
clutter_text_set_color (text, &color);
@ -123,11 +124,11 @@ _st_set_text_from_style (ClutterText *text,
font = st_theme_node_get_font (theme_node);
clutter_text_set_font_description (text, (PangoFontDescription *) font);
attribs = pango_attr_list_new ();
decoration = st_theme_node_get_text_decoration (theme_node);
if (decoration)
{
attribs = pango_attr_list_new ();
if (decoration & ST_TEXT_DECORATION_UNDERLINE)
{
PangoAttribute *underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
@ -143,6 +144,13 @@ _st_set_text_from_style (ClutterText *text,
*/
}
spacing = st_theme_node_get_letter_spacing (theme_node);
if (spacing)
{
PangoAttribute *letter_spacing = pango_attr_letter_spacing_new ((int)(.5 + spacing) * PANGO_SCALE);
pango_attr_list_insert (attribs, letter_spacing);
}
clutter_text_set_attributes (text, attribs);
if (attribs)

View File

@ -2545,6 +2545,28 @@ st_theme_node_get_text_align(StThemeNode *node)
return ST_TEXT_ALIGN_LEFT;
}
/**
* st_theme_node_get_letter_spacing:
* @node: a #StThemeNode
*
* Gets the value for the letter-spacing style property, in pixels.
*
* Return value: the value of the letter-spacing property, if
* found, or zero if such property has not been found.
*/
gdouble
st_theme_node_get_letter_spacing (StThemeNode *node)
{
gdouble spacing = 0.;
g_return_val_if_fail (ST_IS_THEME_NODE (node), spacing);
ensure_properties (node);
st_theme_node_lookup_length (node, "letter-spacing", FALSE, &spacing);
return spacing;
}
static gboolean
font_family_from_terms (CRTerm *term,
char **family)

View File

@ -223,6 +223,8 @@ StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node);
StTextAlign st_theme_node_get_text_align (StThemeNode *node);
double st_theme_node_get_letter_spacing (StThemeNode *node);
/* Font rule processing is pretty complicated, so we just hardcode it
* under the standard font/font-family/font-size/etc names. This means
* you can't have multiple separate styled fonts for a single item,