/usr/share/gtk-doc/html/unique/UniqueApp.html is in libunique-doc 1.1.6-4ubuntu2.
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 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | <!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.75.2">
<link rel="home" href="index.html" title="Unique 1.1.6 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.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="unique-overview.html" title="Unique Overview">
<link rel="index" href="ix01.html" title="Index">
<link rel="appendix" href="license.html" title="Appendix A. License">
</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 1.1.6
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" title="UniqueApp">
<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" title="Synopsis">
<a name="UniqueApp.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
enum <a class="link" href="UniqueApp.html#UniqueCommand" title="enum UniqueCommand">UniqueCommand</a>;
<a class="link" href="UniqueApp.html#UniqueApp-struct" title="UniqueApp">UniqueApp</a>;
<a class="link" href="UniqueApp.html#UniqueAppClass" title="UniqueAppClass">UniqueAppClass</a>;
<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> * <a class="link" href="UniqueApp.html#unique-app-new" title="unique_app_new ()">unique_app_new</a> (const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *name,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *startup_id);
<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> * <a class="link" href="UniqueApp.html#unique-app-new-with-commands" title="unique_app_new_with_commands ()">unique_app_new_with_commands</a> (const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *name,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *startup_id,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *first_command_name,
...);
void <a class="link" href="UniqueApp.html#unique-app-add-command" title="unique_app_add_command ()">unique_app_add_command</a> (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *command_name,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> command_id);
void <a class="link" href="UniqueApp.html#unique-app-watch-window" title="unique_app_watch_window ()">unique_app_watch_window</a> (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
<a
href="http://library.gnome.org/devel/gtk/unstable/GtkWindow.html"
>GtkWindow</a> *window);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> <a class="link" href="UniqueApp.html#unique-app-is-running" title="unique_app_is_running ()">unique_app_is_running</a> (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app);
enum <a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse">UniqueResponse</a>;
<a class="link" href="UniqueApp.html#UniqueResponse" title="enum UniqueResponse">UniqueResponse</a> <a class="link" href="UniqueApp.html#unique-app-send-message" title="unique_app_send_message ()">unique_app_send_message</a> (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> command_id,
<a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData">UniqueMessageData</a> *message_data);
</pre>
</div>
<div class="refsect1" title="Object Hierarchy">
<a name="UniqueApp.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
<a
href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
+----UniqueApp
</pre>
</div>
<div class="refsect1" title="Properties">
<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>" <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read
"<a class="link" href="UniqueApp.html#UniqueApp--name" title='The "name" property'>name</a>" <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a>* : Read / Write / Construct Only
"<a class="link" href="UniqueApp.html#UniqueApp--screen" title='The "screen" property'>screen</a>" <a
href="http://library.gnome.org/devel/gdk/unstable/GdkScreen.html"
>GdkScreen</a>* : Read / Write / Construct
"<a class="link" href="UniqueApp.html#UniqueApp--startup-id" title='The "startup-id" property'>startup-id</a>" <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a>* : Read / Write / Construct Only
</pre>
</div>
<div class="refsect1" title="Signals">
<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>" : Run Last / No Recursion / No Hooks
</pre>
</div>
<div class="refsect1" title="Description">
<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 <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> the usual application construction sequence can
continue; if it returns <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a> 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" title="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" title="Details">
<a name="UniqueApp.details"></a><h2>Details</h2>
<div class="refsect2" title="enum UniqueCommand">
<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>
<p>
</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 <a
href="http://library.gnome.org/devel/gtk/unstable/GtkWindow.html#gtk-window-present"
><code class="function">gtk_window_present()</code></a> 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" title="UniqueApp">
<a name="UniqueApp-struct"></a><h3>UniqueApp</h3>
<pre class="programlisting">typedef struct _UniqueApp 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>
<p>
</p>
</div>
<hr>
<div class="refsect2" title="UniqueAppClass">
<a name="UniqueAppClass"></a><h3>UniqueAppClass</h3>
<pre class="programlisting">typedef struct {
UniqueResponse (* message_received) (UniqueApp *app,
gint command,
UniqueMessageData *message_data,
guint time_);
} UniqueAppClass;
</pre>
<p>
Base class for every single instance application.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="structfield"><code>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" title="unique_app_new ()">
<a name="unique-app-new"></a><h3>unique_app_new ()</h3>
<pre class="programlisting"><a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> * unique_app_new (const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *name,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *startup_id);</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 <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> 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>
<p>
</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 <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</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" title="unique_app_new_with_commands ()">
<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">UniqueApp</a> * unique_app_new_with_commands (const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *name,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *startup_id,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *first_command_name,
...);</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>
<p>
</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 <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</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> <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> 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" title="unique_app_add_command ()">
<a name="unique-app-add-command"></a><h3>unique_app_add_command ()</h3>
<pre class="programlisting">void unique_app_add_command (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
const <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a> *command_name,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> command_id);</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>
<p>
</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" title="unique_app_watch_window ()">
<a name="unique-app-watch-window"></a><h3>unique_app_watch_window ()</h3>
<pre class="programlisting">void unique_app_watch_window (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
<a
href="http://library.gnome.org/devel/gtk/unstable/GtkWindow.html"
>GtkWindow</a> *window);</pre>
<p>
Makes <em class="parameter"><code>app</code></em> "watch" a window. Every watched window will receive
startup notification changes automatically.</p>
<p>
</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 <a
href="http://library.gnome.org/devel/gtk/unstable/GtkWindow.html"
><span class="type">GtkWindow</span></a> to watch
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="unique_app_is_running ()">
<a name="unique-app-is-running"></a><h3>unique_app_is_running ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> unique_app_is_running (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app);</pre>
<p>
Checks whether another instance of <em class="parameter"><code>app</code></em> is running.</p>
<p>
</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> <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a> if there already is an instance running
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enum UniqueResponse">
<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>
<p>
</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" title="unique_app_send_message ()">
<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">UniqueResponse</a> unique_app_send_message (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> command_id,
<a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData">UniqueMessageData</a> *message_data);</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>
<p>
</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 <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</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" title="Property Details">
<a name="UniqueApp.property-details"></a><h2>Property Details</h2>
<div class="refsect2" title='The "is-running" property'>
<a name="UniqueApp--is-running"></a><h3>The <code class="literal">"is-running"</code> property</h3>
<pre class="programlisting"> "is-running" <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read</pre>
<p>
Whether another instance of the application is running.</p>
<p>
</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2" title='The "name" property'>
<a name="UniqueApp--name"></a><h3>The <code class="literal">"name"</code> property</h3>
<pre class="programlisting"> "name" <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a>* : 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>
</p>
<p>Default value: NULL</p>
</div>
<hr>
<div class="refsect2" title='The "screen" property'>
<a name="UniqueApp--screen"></a><h3>The <code class="literal">"screen"</code> property</h3>
<pre class="programlisting"> "screen" <a
href="http://library.gnome.org/devel/gdk/unstable/GdkScreen.html"
>GdkScreen</a>* : Read / Write / Construct</pre>
<p>
The <a
href="http://library.gnome.org/devel/gdk/unstable/GdkScreen.html"
><span class="type">GdkScreen</span></a> of the application.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" title='The "startup-id" property'>
<a name="UniqueApp--startup-id"></a><h3>The <code class="literal">"startup-id"</code> property</h3>
<pre class="programlisting"> "startup-id" <a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
>gchar</a>* : 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>
</p>
<p>Default value: NULL</p>
</div>
</div>
<div class="refsect1" title="Signal Details">
<a name="UniqueApp.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2" title='The "message-received" signal'>
<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">UniqueResponse</a> user_function (<a class="link" href="UniqueApp.html" title="UniqueApp">UniqueApp</a> *app,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> command,
<a class="link" href="unique-Message-Data.html#UniqueMessageData" title="UniqueMessageData">UniqueMessageData</a> *message_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> time_,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run Last / No Recursion / No Hooks</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>
<p>
</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>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>
|