1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>shell-util</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7
<link rel="home" href="index.html" title="Shell Reference Manual">
8
<link rel="up" href="ch06.html" title="Integration helpers and utilities">
9
<link rel="prev" href="shell-shell-xfixes-cursor.html" title="shell-xfixes-cursor">
10
<link rel="next" href="ShellMountOperation.html" title="ShellMountOperation">
11
<meta name="generator" content="GTK-Doc V1.18.1 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17
<td><a accesskey="p" href="shell-shell-xfixes-cursor.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
<td><a accesskey="u" href="ch06.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20
<th width="100%" align="center">Shell Reference Manual</th>
21
<td><a accesskey="n" href="ShellMountOperation.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23
<tr><td colspan="5" class="shortcuts">
24
<a href="#shell-shell-util.synopsis" class="shortcut">Top</a>
26
<a href="#shell-shell-util.description" class="shortcut">Description</a>
29
<div class="refentry">
30
<a name="shell-shell-util"></a><div class="titlepage"></div>
31
<div class="refnamediv"><table width="100%"><tr>
33
<h2><span class="refentrytitle"><a name="shell-shell-util.top_of_page"></a>shell-util</span></h2>
36
<td valign="top" align="right"></td>
38
<div class="refsynopsisdiv">
39
<a name="shell-shell-util.synopsis"></a><h2>Synopsis</h2>
40
<pre class="synopsis"><span class="returnvalue">ClutterModifierType</span> <a class="link" href="shell-shell-util.html#shell-get-event-state" title="shell_get_event_state ()">shell_get_event_state</a> (<em class="parameter"><code><span class="type">ClutterEvent</span> *event</code></em>);
41
<span class="returnvalue">char</span> * <a class="link" href="shell-shell-util.html#shell-get-file-contents-utf8-sync" title="shell_get_file_contents_utf8_sync ()">shell_get_file_contents_utf8_sync</a> (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
42
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);
43
<span class="returnvalue">gboolean</span> <a class="link" href="shell-shell-util.html#shell-parse-search-provider" title="shell_parse_search_provider ()">shell_parse_search_provider</a> (<em class="parameter"><code>const <span class="type">char</span> *data</code></em>,
44
<em class="parameter"><code><span class="type">char</span> **name</code></em>,
45
<em class="parameter"><code><span class="type">char</span> **url</code></em>,
46
<em class="parameter"><code><span class="type">GList</span> **langs</code></em>,
47
<em class="parameter"><code><span class="type">char</span> **icon_data_uri</code></em>,
48
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);
49
<span class="returnvalue">gboolean</span> <a class="link" href="shell-shell-util.html#shell-session-is-active-for-systemd" title="shell_session_is_active_for_systemd ()">shell_session_is_active_for_systemd</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
50
<span class="returnvalue">void</span> <a class="link" href="shell-shell-util.html#shell-shader-effect-set-double-uniform" title="shell_shader_effect_set_double_uniform ()">shell_shader_effect_set_double_uniform</a>
51
(<em class="parameter"><code><span class="type">ClutterShaderEffect</span> *effect</code></em>,
52
<em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
53
<em class="parameter"><code><span class="type">gdouble</span> value</code></em>);
54
<span class="returnvalue">char</span> * <a class="link" href="shell-shell-util.html#shell-util-format-date" title="shell_util_format_date ()">shell_util_format_date</a> (<em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
55
<em class="parameter"><code><span class="type">gint64</span> time_ms</code></em>);
56
<span class="returnvalue">GIcon</span> * <a class="link" href="shell-shell-util.html#shell-util-get-icon-for-uri" title="shell_util_get_icon_for_uri ()">shell_util_get_icon_for_uri</a> (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);
57
<span class="returnvalue">char</span> * <a class="link" href="shell-shell-util.html#shell-util-get-label-for-uri" title="shell_util_get_label_for_uri ()">shell_util_get_label_for_uri</a> (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);
58
<span class="returnvalue">void</span> <a class="link" href="shell-shell-util.html#shell-util-get-transformed-allocation" title="shell_util_get_transformed_allocation ()">shell_util_get_transformed_allocation</a>
59
(<em class="parameter"><code><span class="type">ClutterActor</span> *actor</code></em>,
60
<em class="parameter"><code><span class="type">ClutterActorBox</span> *box</code></em>);
61
<span class="returnvalue">int</span> <a class="link" href="shell-shell-util.html#shell-util-get-week-start" title="shell_util_get_week_start ()">shell_util_get_week_start</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
62
<span class="returnvalue">char</span> * <a class="link" href="shell-shell-util.html#shell-util-normalize-and-casefold" title="shell_util_normalize_and_casefold ()">shell_util_normalize_and_casefold</a> (<em class="parameter"><code>const <span class="type">char</span> *str</code></em>);
63
<span class="returnvalue">void</span> <a class="link" href="shell-shell-util.html#shell-util-set-hidden-from-pick" title="shell_util_set_hidden_from_pick ()">shell_util_set_hidden_from_pick</a> (<em class="parameter"><code><span class="type">ClutterActor</span> *actor</code></em>,
64
<em class="parameter"><code><span class="type">gboolean</span> hidden</code></em>);
65
<span class="returnvalue">gboolean</span> <a class="link" href="shell-shell-util.html#shell-util-wifexited" title="shell_util_wifexited ()">shell_util_wifexited</a> (<em class="parameter"><code><span class="type">int</span> status</code></em>,
66
<em class="parameter"><code><span class="type">int</span> *exit</code></em>);
67
<span class="returnvalue">void</span> <a class="link" href="shell-shell-util.html#shell-write-soup-message-to-stream" title="shell_write_soup_message_to_stream ()">shell_write_soup_message_to_stream</a> (<em class="parameter"><code><span class="type">GOutputStream</span> *stream</code></em>,
68
<em class="parameter"><code><span class="type">SoupMessage</span> *message</code></em>,
69
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);
70
<span class="returnvalue">gboolean</span> <a class="link" href="shell-shell-util.html#shell-write-string-to-stream" title="shell_write_string_to_stream ()">shell_write_string_to_stream</a> (<em class="parameter"><code><span class="type">GOutputStream</span> *stream</code></em>,
71
<em class="parameter"><code>const <span class="type">char</span> *str</code></em>,
72
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);
75
<div class="refsect1">
76
<a name="shell-shell-util.description"></a><h2>Description</h2>
78
<div class="refsect1">
79
<a name="shell-shell-util.details"></a><h2>Details</h2>
80
<div class="refsect2">
81
<a name="shell-get-event-state"></a><h3>shell_get_event_state ()</h3>
82
<pre class="programlisting"><span class="returnvalue">ClutterModifierType</span> shell_get_event_state (<em class="parameter"><code><span class="type">ClutterEvent</span> *event</code></em>);</pre>
84
Gets the current state of the event (the set of modifier keys that
85
are pressed down). Thhis is a wrapper around
86
<code class="function">clutter_event_get_state()</code> that strips out any un-declared modifier
87
flags, to make gjs happy; see
88
https://bugzilla.gnome.org/show_bug.cgi?id=597292.
90
<div class="variablelist"><table border="0">
91
<col align="left" valign="top">
94
<td><p><span class="term"><em class="parameter"><code>event</code></em> :</span></p></td>
95
<td>a <span class="type">ClutterEvent</span>
99
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
100
<td>the state from the event</td>
106
<div class="refsect2">
107
<a name="shell-get-file-contents-utf8-sync"></a><h3>shell_get_file_contents_utf8_sync ()</h3>
108
<pre class="programlisting"><span class="returnvalue">char</span> * shell_get_file_contents_utf8_sync (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
109
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
111
Synchronously load the contents of a file as a NUL terminated
112
string, validating it as UTF-8. Embedded NUL characters count as
115
<div class="variablelist"><table border="0">
116
<col align="left" valign="top">
119
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
120
<td>UTF-8 encoded filename path</td>
123
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
124
<td>a <span class="type">GError</span>
128
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
129
<td>File contents. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
136
<div class="refsect2">
137
<a name="shell-parse-search-provider"></a><h3>shell_parse_search_provider ()</h3>
138
<pre class="programlisting"><span class="returnvalue">gboolean</span> shell_parse_search_provider (<em class="parameter"><code>const <span class="type">char</span> *data</code></em>,
139
<em class="parameter"><code><span class="type">char</span> **name</code></em>,
140
<em class="parameter"><code><span class="type">char</span> **url</code></em>,
141
<em class="parameter"><code><span class="type">GList</span> **langs</code></em>,
142
<em class="parameter"><code><span class="type">char</span> **icon_data_uri</code></em>,
143
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
144
<div class="variablelist"><table border="0">
145
<col align="left" valign="top">
148
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
149
<td>description of provider</td>
152
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
153
<td>location to store a display name. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
157
<td><p><span class="term"><em class="parameter"><code>url</code></em> :</span></p></td>
158
<td>location to store template of url. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
162
<td><p><span class="term"><em class="parameter"><code>langs</code></em> :</span></p></td>
163
<td>list of supported languages. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span>
167
<td><p><span class="term"><em class="parameter"><code>icon_data_uri</code></em> :</span></p></td>
168
<td>location to store uri. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
172
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
173
<td>location to store GError</td>
176
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
178
<code class="literal">TRUE</code> on success</td>
184
<div class="refsect2">
185
<a name="shell-session-is-active-for-systemd"></a><h3>shell_session_is_active_for_systemd ()</h3>
186
<pre class="programlisting"><span class="returnvalue">gboolean</span> shell_session_is_active_for_systemd (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
188
Checks whether the session we are running in is currently active,
189
i.e. in the foreground and ready for user input.
191
<div class="variablelist"><table border="0">
192
<col align="left" valign="top">
194
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
195
<td>TRUE if session is active</td>
200
<div class="refsect2">
201
<a name="shell-shader-effect-set-double-uniform"></a><h3>shell_shader_effect_set_double_uniform ()</h3>
202
<pre class="programlisting"><span class="returnvalue">void</span> shell_shader_effect_set_double_uniform
203
(<em class="parameter"><code><span class="type">ClutterShaderEffect</span> *effect</code></em>,
204
<em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
205
<em class="parameter"><code><span class="type">gdouble</span> value</code></em>);</pre>
207
Set a double uniform on a ClutterShaderEffect.
210
The problem here is that JavaScript doesn't have more than
211
one number type, and gjs tries to automatically guess what
212
type we want to set a GValue to. If the number is "1.0" or
213
something, it will use an integer, which will cause errors
216
<div class="variablelist"><table border="0">
217
<col align="left" valign="top">
220
<td><p><span class="term"><em class="parameter"><code>effect</code></em> :</span></p></td>
221
<td>The <span class="type">ClutterShaderEffect</span>
225
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
226
<td>The name of the uniform</td>
229
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
230
<td>The value to set it to.</td>
236
<div class="refsect2">
237
<a name="shell-util-format-date"></a><h3>shell_util_format_date ()</h3>
238
<pre class="programlisting"><span class="returnvalue">char</span> * shell_util_format_date (<em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
239
<em class="parameter"><code><span class="type">gint64</span> time_ms</code></em>);</pre>
241
Formats a date for the current locale. This should be
242
used instead of the Spidermonkey Date.toLocaleFormat()
243
extension because Date.toLocaleFormat() is buggy for
244
Unicode format strings:
245
https://bugzilla.mozilla.org/show_bug.cgi?id=508783
247
<div class="variablelist"><table border="0">
248
<col align="left" valign="top">
251
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
252
<td>a strftime-style string format, as parsed by
253
<code class="function">g_date_time_format()</code>
257
<td><p><span class="term"><em class="parameter"><code>time_ms</code></em> :</span></p></td>
258
<td>milliseconds since 1970-01-01 00:00:00 UTC; the
259
value returned by Date.getTime()</td>
262
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
263
<td>the formatted date. If the date is
264
outside of the range of a GDateTime (which contains
265
any plausible dates we actually care about), will
266
return an empty string.</td>
272
<div class="refsect2">
273
<a name="shell-util-get-icon-for-uri"></a><h3>shell_util_get_icon_for_uri ()</h3>
274
<pre class="programlisting"><span class="returnvalue">GIcon</span> * shell_util_get_icon_for_uri (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);</pre>
276
Look up the icon that should be associated with a given URI. Handles
277
various special GNOME-internal cases like x-nautilus-search, etc.
279
<div class="variablelist"><table border="0">
280
<col align="left" valign="top">
283
<td><p><span class="term"><em class="parameter"><code>text_uri</code></em> :</span></p></td>
287
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
288
<td>A new <span class="type">GIcon</span>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
295
<div class="refsect2">
296
<a name="shell-util-get-label-for-uri"></a><h3>shell_util_get_label_for_uri ()</h3>
297
<pre class="programlisting"><span class="returnvalue">char</span> * shell_util_get_label_for_uri (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);</pre>
300
<div class="refsect2">
301
<a name="shell-util-get-transformed-allocation"></a><h3>shell_util_get_transformed_allocation ()</h3>
302
<pre class="programlisting"><span class="returnvalue">void</span> shell_util_get_transformed_allocation
303
(<em class="parameter"><code><span class="type">ClutterActor</span> *actor</code></em>,
304
<em class="parameter"><code><span class="type">ClutterActorBox</span> *box</code></em>);</pre>
306
This function is similar to a combination of <code class="function">clutter_actor_get_transformed_position()</code>,
307
and <code class="function">clutter_actor_get_transformed_size()</code>, but unlike
308
<code class="function">clutter_actor_get_transformed_size()</code>, it always returns a transform
309
of the current allocation, while <code class="function">clutter_actor_get_transformed_size()</code> returns
310
bad values (the transform of the requested size) if a relayout has been
314
This function is more convenient to use than
315
<code class="function">clutter_actor_get_abs_allocation_vertices()</code> if no transformation is in effect
316
and also works around limitations in the GJS binding of arrays.
318
<div class="variablelist"><table border="0">
319
<col align="left" valign="top">
322
<td><p><span class="term"><em class="parameter"><code>actor</code></em> :</span></p></td>
323
<td>a <span class="type">ClutterActor</span>
327
<td><p><span class="term"><em class="parameter"><code>box</code></em> :</span></p></td>
328
<td>location to store returned box in stage coordinates. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
335
<div class="refsect2">
336
<a name="shell-util-get-week-start"></a><h3>shell_util_get_week_start ()</h3>
337
<pre class="programlisting"><span class="returnvalue">int</span> shell_util_get_week_start (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
339
Gets the first week day for the current locale, expressed as a
340
number in the range 0..6, representing week days from Sunday to
343
<div class="variablelist"><table border="0">
344
<col align="left" valign="top">
346
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
347
<td>A number representing the first week day for the current
353
<div class="refsect2">
354
<a name="shell-util-normalize-and-casefold"></a><h3>shell_util_normalize_and_casefold ()</h3>
355
<pre class="programlisting"><span class="returnvalue">char</span> * shell_util_normalize_and_casefold (<em class="parameter"><code>const <span class="type">char</span> *str</code></em>);</pre>
358
<div class="refsect2">
359
<a name="shell-util-set-hidden-from-pick"></a><h3>shell_util_set_hidden_from_pick ()</h3>
360
<pre class="programlisting"><span class="returnvalue">void</span> shell_util_set_hidden_from_pick (<em class="parameter"><code><span class="type">ClutterActor</span> *actor</code></em>,
361
<em class="parameter"><code><span class="type">gboolean</span> hidden</code></em>);</pre>
363
If <em class="parameter"><code>hidden</code></em> is <code class="literal">TRUE</code>, hide <em class="parameter"><code>actor</code></em> from pick even with a mode of
364
<code class="literal">CLUTTER_PICK_ALL</code>; if <em class="parameter"><code>hidden</code></em> is <code class="literal">FALSE</code>, unhide <em class="parameter"><code>actor</code></em>.
366
<div class="variablelist"><table border="0">
367
<col align="left" valign="top">
370
<td><p><span class="term"><em class="parameter"><code>actor</code></em> :</span></p></td>
371
<td>A <span class="type">ClutterActor</span>
375
<td><p><span class="term"><em class="parameter"><code>hidden</code></em> :</span></p></td>
376
<td>Whether <em class="parameter"><code>actor</code></em> should be hidden from pick</td>
382
<div class="refsect2">
383
<a name="shell-util-wifexited"></a><h3>shell_util_wifexited ()</h3>
384
<pre class="programlisting"><span class="returnvalue">gboolean</span> shell_util_wifexited (<em class="parameter"><code><span class="type">int</span> status</code></em>,
385
<em class="parameter"><code><span class="type">int</span> *exit</code></em>);</pre>
387
Implements libc standard WIFEXITED, that cannot be used JS
390
<div class="variablelist"><table border="0">
391
<col align="left" valign="top">
394
<td><p><span class="term"><em class="parameter"><code>status</code></em> :</span></p></td>
395
<td>the status returned by <code class="function">wait()</code> or <code class="function">waitpid()</code>
399
<td><p><span class="term"><em class="parameter"><code>exit</code></em> :</span></p></td>
400
<td>the actual exit status of the process. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
404
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
405
<td>TRUE if the process exited normally, FALSE otherwise</td>
411
<div class="refsect2">
412
<a name="shell-write-soup-message-to-stream"></a><h3>shell_write_soup_message_to_stream ()</h3>
413
<pre class="programlisting"><span class="returnvalue">void</span> shell_write_soup_message_to_stream (<em class="parameter"><code><span class="type">GOutputStream</span> *stream</code></em>,
414
<em class="parameter"><code><span class="type">SoupMessage</span> *message</code></em>,
415
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
417
Write a string to a GOutputStream as binary data. This is a
418
workaround for the lack of proper binary strings in GJS.
420
<div class="variablelist"><table border="0">
421
<col align="left" valign="top">
424
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
425
<td>a <span class="type">GOutputStream</span>
429
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
430
<td>a <span class="type">SoupMessage</span>
434
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
435
<td>location to store GError</td>
441
<div class="refsect2">
442
<a name="shell-write-string-to-stream"></a><h3>shell_write_string_to_stream ()</h3>
443
<pre class="programlisting"><span class="returnvalue">gboolean</span> shell_write_string_to_stream (<em class="parameter"><code><span class="type">GOutputStream</span> *stream</code></em>,
444
<em class="parameter"><code>const <span class="type">char</span> *str</code></em>,
445
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
447
Write a string to a GOutputStream as UTF-8. This is a workaround
448
for not having binary buffers in GJS.
450
<div class="variablelist"><table border="0">
451
<col align="left" valign="top">
454
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
455
<td>a <span class="type">GOutputStream</span>
459
<td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td>
460
<td>a UTF-8 string to write to <em class="parameter"><code>stream</code></em>
464
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
465
<td>location to store GError</td>
468
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
470
<code class="literal">TRUE</code> if write succeeded</td>
479
Generated by GTK-Doc V1.18.1</div>
b'\\ No newline at end of file'