/usr/share/gtk-doc/html/unique-3.0/UniqueApp.html is in libunique-3.0-doc 3.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>UniqueApp</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Unique 3.0.2 Reference Manual">
<link rel="up" href="unique-overview.html" title="Unique Overview">
<link rel="prev" href="unique-overview.html" title="Unique Overview">
<link rel="next" href="unique-Message-Data.html" title="Message Data">
<meta name="generator" content="GTK-Doc V1.16.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="unique-overview.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="unique-overview.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Unique 3.0.2
Reference Manual</th>
<td><a accesskey="n" href="unique-Message-Data.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#UniqueApp.synopsis" class="shortcut">Top</a>
|
<a href="#UniqueApp.description" class="shortcut">Description</a>
|
<a href="#UniqueApp.object-hierarchy" class="shortcut">Object Hierarchy</a>
|
<a href="#UniqueApp.properties" class="shortcut">Properties</a>
|
<a href="#UniqueApp.signals" class="shortcut">Signals</a>
</td></tr>
</table>
<div class="refentry">
<a name="UniqueApp"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="UniqueApp.top_of_page"></a>UniqueApp</span></h2>
<p>UniqueApp — Base class for singleton applications</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="UniqueApp.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">enum <a class="link" href="UniqueApp.html#UniqueCommand" title="enum UniqueCommand">UniqueCommand</a>;
struct <a class="link" href="UniqueApp.html#UniqueApp-struct" title="struct UniqueApp">UniqueApp</a>;
struct <a class="link" href="UniqueApp.html#UniqueAppClass" title="struct UniqueAppClass">UniqueAppClass</a>;
<a class="link" href="UniqueApp.html" title="UniqueApp"><span class="returnvalue">UniqueApp</span></a> * <a class="link" href="UniqueApp.html#unique-app-new" title="unique_app_new ()">unique_app_new</a> (<em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *startup_id</code></em>);
<a class="link" href="UniqueApp.html" title="UniqueApp"><span class="returnvalue">UniqueApp</span></a> * <a class="link" href="UniqueApp.html#unique-app-new-with-commands" title="unique_app_new_with_commands ()">unique_app_new_with_commands</a> (<em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *startup_id</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *first_command_name</code></em>,
<em class="parameter"><code>...</code></em>);
<span class="returnvalue">void</span> <a class="link" href="UniqueApp.html#unique-app-add-command" title="unique_app_add_command ()">unique_app_add_command</a> (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *command_name</code></em>,
<em class="parameter"><code><span class="type">gint</span> command_id</code></em>);
<span class="returnvalue">void</span> <a class="link" href="UniqueApp.html#unique-app-watch-window" title="unique_app_watch_window ()">unique_app_watch_window</a> (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>,
<em class="parameter"><code><span class="type">GtkWindow</span> *window</code></em>);
<span class="returnvalue">gboolean</span> <a class="link" href="UniqueApp.html#unique-app-is-running" title="unique_app_is_running ()">unique_app_is_running</a> (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>);
enum <a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse">UniqueResponse</a>;
<a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="returnvalue">UniqueResponse</span></a> <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()">unique_app_send_message</a> (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>,
<em class="parameter"><code><span class="type">gint</span> command_id</code></em>,
<em class="parameter"><code><a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a> *message_data</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="UniqueApp.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
GObject
+----UniqueApp
</pre>
</div>
<div class="refsect1">
<a name="UniqueApp.properties"></a><h2>Properties</h2>
<pre class="synopsis">
"<a class="link" href="UniqueApp.html#UniqueApp--is-running" title='The "is-running" property'>is-running</a>" <span class="type">gboolean</span> : Read
"<a class="link" href="UniqueApp.html#UniqueApp--name" title='The "name" property'>name</a>" <span class="type">gchar</span>* : Read / Write / Construct Only
"<a class="link" href="UniqueApp.html#UniqueApp--screen" title='The "screen" property'>screen</a>" <span class="type">GdkScreen</span>* : Read / Write / Construct
"<a class="link" href="UniqueApp.html#UniqueApp--startup-id" title='The "startup-id" property'>startup-id</a>" <span class="type">gchar</span>* : Read / Write / Construct Only
</pre>
</div>
<div class="refsect1">
<a name="UniqueApp.signals"></a><h2>Signals</h2>
<pre class="synopsis">
"<a class="link" href="UniqueApp.html#UniqueApp-message-received" title='The "message-received" signal'>message-received</a>" : <code class="literal">No Hooks</code>
</pre>
</div>
<div class="refsect1">
<a name="UniqueApp.description"></a><h2>Description</h2>
<p>
<a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> is the base class for single instance applications. You
can either create an instance of <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> via <a class="link" href="UniqueApp.html#unique-app-new" title="unique_app_new ()"><code class="function">unique_app_new()</code></a>
and <a class="link" href="UniqueApp.html#unique-app-new-with-commands" title="unique_app_new_with_commands ()"><code class="function">unique_app_new_with_commands()</code></a>; or you can subclass <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a>
with your own application class.
</p>
<p>
A <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance is guaranteed to either be the first running
at the time of creation or be able to send messages to the currently
running instance; there is no race possible between the creation
of the <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance and the call to <a class="link" href="UniqueApp.html#unique-app-is-running" title="unique_app_is_running ()"><code class="function">unique_app_is_running()</code></a>.
</p>
<p>
The usual method for using the <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> API is to create a new
instance, passing an application-dependent name as construction-only
property; the UniqueApp:name property is required, and should be in the
form of a domain name, like <code class="literal">org.gnome.YourApplication</code>.
</p>
<p>
After the creation, you should check whether an instance of your
application is already running, using <a class="link" href="UniqueApp.html#unique-app-is-running" title="unique_app_is_running ()"><code class="function">unique_app_is_running()</code></a>; if this
method returns <code class="literal">FALSE</code> the usual application construction sequence can
continue; if it returns <code class="literal">TRUE</code> you can either exit or send a message using
<a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a> and <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()"><code class="function">unique_app_send_message()</code></a>.
</p>
<p>
You can define custom commands using <a class="link" href="UniqueApp.html#unique-app-add-command" title="unique_app_add_command ()"><code class="function">unique_app_add_command()</code></a>: you
need to provide an arbitrary integer and a string for the command.
</p>
<p>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>You need to initialize GTK+ in order to use UniqueApp.</div>
<p>
</p>
</div>
<div class="refsect1">
<a name="UniqueApp.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="UniqueCommand"></a><h3>enum UniqueCommand</h3>
<pre class="programlisting">typedef enum { /*< prefix=UNIQUE >*/
UNIQUE_INVALID = 0,
UNIQUE_ACTIVATE = -1,
UNIQUE_NEW = -2,
UNIQUE_OPEN = -3,
UNIQUE_CLOSE = -4
} UniqueCommand;
</pre>
<p>
Command to send to a currently active instance. User defined commands
should be positive integers, and should be added using the
<a class="link" href="UniqueApp.html#unique-app-add-command" title="unique_app_add_command ()"><code class="function">unique_app_add_command()</code></a> function after creating a <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="UNIQUE-INVALID:CAPS"></a><span class="term"><code class="literal">UNIQUE_INVALID</code></span></p></td>
<td>used internally
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-ACTIVATE:CAPS"></a><span class="term"><code class="literal">UNIQUE_ACTIVATE</code></span></p></td>
<td>request to activate a currently active instance; this
usually means calling <code class="function">gtk_window_present()</code> on the application window.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-NEW:CAPS"></a><span class="term"><code class="literal">UNIQUE_NEW</code></span></p></td>
<td>request to create a new file.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-OPEN:CAPS"></a><span class="term"><code class="literal">UNIQUE_OPEN</code></span></p></td>
<td>request to open a file.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-CLOSE:CAPS"></a><span class="term"><code class="literal">UNIQUE_CLOSE</code></span></p></td>
<td>requests to close the currently running instance.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="UniqueApp-struct"></a><h3>struct UniqueApp</h3>
<pre class="programlisting">struct UniqueApp;</pre>
<p>
The base class for every single instance application. The <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a>
structure contains only private data and should be manipulated only
with the provided functions.
</p>
</div>
<hr>
<div class="refsect2">
<a name="UniqueAppClass"></a><h3>struct UniqueAppClass</h3>
<pre class="programlisting">struct UniqueAppClass {
UniqueResponse (* message_received) (UniqueApp *app,
gint command,
UniqueMessageData *message_data,
guint time_);
};
</pre>
<p>
Base class for every single instance application.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="structfield"><code><a name="UniqueAppClass.message-received"></a>message_received</code></em> ()</span></p></td>
<td>Signal class closure for the UniqueApp::message_received
signal.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="unique-app-new"></a><h3>unique_app_new ()</h3>
<pre class="programlisting"><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="returnvalue">UniqueApp</span></a> * unique_app_new (<em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *startup_id</code></em>);</pre>
<p>
Creates a new <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance for <em class="parameter"><code>name</code></em> passing a start-up notification
id <em class="parameter"><code>startup_id</code></em>. The name must be a unique identifier for the application,
and it must be in form of a domain name, like
<code class="literal">org.gnome.YourApplication</code>.
</p>
<p>
If <em class="parameter"><code>startup_id</code></em> is <code class="literal">NULL</code> the <code class="literal">DESKTOP_STARTUP_ID</code>
environment variable will be check, and if that fails a "fake" startup
notification id will be created.
</p>
<p>
Once you have created a <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance, you should check if
any other instance is running, using <a class="link" href="UniqueApp.html#unique-app-is-running" title="unique_app_is_running ()"><code class="function">unique_app_is_running()</code></a>.
If another instance is running you can send a command to it, using
the <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()"><code class="function">unique_app_send_message()</code></a> function; after that, the second instance
should quit. If no other instance is running, the usual logic for
creating the application can follow.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
<td>the name of the application's instance</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>startup_id</code></em> :</span></p></td>
<td>the startup notification id, or <code class="literal">NULL</code>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the newly created <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="unique-app-new-with-commands"></a><h3>unique_app_new_with_commands ()</h3>
<pre class="programlisting"><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="returnvalue">UniqueApp</span></a> * unique_app_new_with_commands (<em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *startup_id</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *first_command_name</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>
Creates a new <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance, with <em class="parameter"><code>name</code></em> and <em class="parameter"><code>startup_id</code></em>,
and registers a list of custom commands. See <a class="link" href="UniqueApp.html#unique-app-new" title="unique_app_new ()"><code class="function">unique_app_new()</code></a> and
<a class="link" href="UniqueApp.html#unique-app-add-command" title="unique_app_add_command ()"><code class="function">unique_app_add_command()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
<td>the name of the application</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>startup_id</code></em> :</span></p></td>
<td>startup notification id, or <code class="literal">NULL</code>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_command_name</code></em> :</span></p></td>
<td>first custom command</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>
<code class="literal">NULL</code> terminated list of command names and command ids</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the newly created <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> instance.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="unique-app-add-command"></a><h3>unique_app_add_command ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> unique_app_add_command (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *command_name</code></em>,
<em class="parameter"><code><span class="type">gint</span> command_id</code></em>);</pre>
<p>
Adds <em class="parameter"><code>command_name</code></em> as a custom command that can be used by <em class="parameter"><code>app</code></em>. You
must call <a class="link" href="UniqueApp.html#unique-app-add-command" title="unique_app_add_command ()"><code class="function">unique_app_add_command()</code></a> before <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()"><code class="function">unique_app_send_message()</code></a> in
order to use the newly added command.
</p>
<p>
The command name is used internally: you need to use the command's logical
id in <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()"><code class="function">unique_app_send_message()</code></a> and inside the UniqueApp::message-received
signal.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td>
<td>a <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_name</code></em> :</span></p></td>
<td>command name</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_id</code></em> :</span></p></td>
<td>command logical id</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="unique-app-watch-window"></a><h3>unique_app_watch_window ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> unique_app_watch_window (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>,
<em class="parameter"><code><span class="type">GtkWindow</span> *window</code></em>);</pre>
<p>
Makes <em class="parameter"><code>app</code></em> "watch" a window. Every watched window will receive
startup notification changes automatically.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td>
<td>a <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>window</code></em> :</span></p></td>
<td>the <span class="type">GtkWindow</span> to watch</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="unique-app-is-running"></a><h3>unique_app_is_running ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span> unique_app_is_running (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>);</pre>
<p>
Checks whether another instance of <em class="parameter"><code>app</code></em> is running.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td>
<td>a <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<code class="literal">TRUE</code> if there already is an instance running</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="UniqueResponse"></a><h3>enum UniqueResponse</h3>
<pre class="programlisting">typedef enum { /*< prefix=UNIQUE_RESPONSE >*/
UNIQUE_RESPONSE_INVALID = 0,
UNIQUE_RESPONSE_OK,
UNIQUE_RESPONSE_CANCEL,
UNIQUE_RESPONSE_FAIL,
UNIQUE_RESPONSE_PASSTHROUGH
} UniqueResponse;
</pre>
<p>
Response that a currently active instance of the application should
return to the caller which sent a command.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="UNIQUE-RESPONSE-INVALID:CAPS"></a><span class="term"><code class="literal">UNIQUE_RESPONSE_INVALID</code></span></p></td>
<td>Internal error code, should never be used.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-RESPONSE-OK:CAPS"></a><span class="term"><code class="literal">UNIQUE_RESPONSE_OK</code></span></p></td>
<td>The command was successfully executed.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-RESPONSE-CANCEL:CAPS"></a><span class="term"><code class="literal">UNIQUE_RESPONSE_CANCEL</code></span></p></td>
<td>The command was cancelled by the user.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-RESPONSE-FAIL:CAPS"></a><span class="term"><code class="literal">UNIQUE_RESPONSE_FAIL</code></span></p></td>
<td>The command failed due to a IPC failure.
</td>
</tr>
<tr>
<td><p><a name="UNIQUE-RESPONSE-PASSTHROUGH:CAPS"></a><span class="term"><code class="literal">UNIQUE_RESPONSE_PASSTHROUGH</code></span></p></td>
<td>The command was not handled
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="unique-app-send-message"></a><h3>unique_app_send_message ()</h3>
<pre class="programlisting"><a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="returnvalue">UniqueResponse</span></a> unique_app_send_message (<em class="parameter"><code><a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app</code></em>,
<em class="parameter"><code><span class="type">gint</span> command_id</code></em>,
<em class="parameter"><code><a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a> *message_data</code></em>);</pre>
<p>
Sends <em class="parameter"><code>command</code></em> to a running instance of <em class="parameter"><code>app</code></em>. If you need to pass data
to the instance, you should create a <a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a> object using
<a class="link" href="unique-Message-Data.html#unique-message-data-new" title="unique_message_data_new ()"><code class="function">unique_message_data_new()</code></a> and then fill it with the data you intend to
pass.
</p>
<p>
The running application will receive a UniqueApp::message-received signal
and will call the various signal handlers attach to it. If any handler
returns a <a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="type">UniqueResponse</span></a> different than <a class="link" href="UniqueApp.html#UNIQUE-RESPONSE-OK:CAPS"><code class="literal">UNIQUE_RESPONSE_OK</code></a>, the emission
will stop.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td>
<td>a <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_id</code></em> :</span></p></td>
<td>command to send</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message_data</code></em> :</span></p></td>
<td>
<a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a>, or <code class="literal">NULL</code>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The <a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="type">UniqueResponse</span></a> returned by the running instance</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1">
<a name="UniqueApp.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="UniqueApp--is-running"></a><h3>The <code class="literal">"is-running"</code> property</h3>
<pre class="programlisting"> "is-running" <span class="type">gboolean</span> : Read</pre>
<p>
Whether another instance of the application is running.
</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="UniqueApp--name"></a><h3>The <code class="literal">"name"</code> property</h3>
<pre class="programlisting"> "name" <span class="type">gchar</span>* : Read / Write / Construct Only</pre>
<p>
The unique name of the application. It must be in form of
a domain-like string, like <code class="literal">org.gnome.MyApplication</code>.
</p>
<p>Default value: NULL</p>
</div>
<hr>
<div class="refsect2">
<a name="UniqueApp--screen"></a><h3>The <code class="literal">"screen"</code> property</h3>
<pre class="programlisting"> "screen" <span class="type">GdkScreen</span>* : Read / Write / Construct</pre>
<p>
The <span class="type">GdkScreen</span> of the application.
</p>
</div>
<hr>
<div class="refsect2">
<a name="UniqueApp--startup-id"></a><h3>The <code class="literal">"startup-id"</code> property</h3>
<pre class="programlisting"> "startup-id" <span class="type">gchar</span>* : Read / Write / Construct Only</pre>
<p>
The startup notification id, needed to complete the startup
notification sequence. If not set, a default id will be
automatically given.
</p>
<p>Default value: NULL</p>
</div>
</div>
<div class="refsect1">
<a name="UniqueApp.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="UniqueApp-message-received"></a><h3>The <code class="literal">"message-received"</code> signal</h3>
<pre class="programlisting"><a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="returnvalue">UniqueResponse</span></a> user_function (<a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> *app,
<span class="type">gint</span> command,
<a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a> *message_data,
<span class="type">guint</span> time_,
<span class="type">gpointer</span> user_data) : <code class="literal">No Hooks</code></pre>
<p>
The ::message-received signal is emitted each time a second instance
of <a class="link" href="UniqueApp.html" title="UniqueApp"><span class="type">UniqueApp</span></a> with the same name as <em class="parameter"><code>app</code></em> is launched and sends a
message using <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()"><code class="function">unique_app_send_message()</code></a>. The currently running instance
should check <em class="parameter"><code>command</code></em> for the action to execute and <em class="parameter"><code>message_data</code></em> for
eventual other parameters (see <a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData"><span class="type">UniqueMessageData</span></a>).
</p>
<p>
The signal handler should return a <a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="type">UniqueResponse</span></a> value depending on
whether the command was successfully completed or not. If the
<a class="link" href="UniqueApp.html#UNIQUE-RESPONSE-PASSTHROUGH:CAPS"><code class="literal">UNIQUE_RESPONSE_PASSTHROUGH</code></a> return value is used, the signal
emission chain will continue until another handler will return another
response code.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td>
<td>the object which received the signal</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>command</code></em> :</span></p></td>
<td>command received</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message_data</code></em> :</span></p></td>
<td>message data</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td>
<td>timestamp of the command</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse"><span class="type">UniqueResponse</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.16.1</div>
</body>
</html>
|