diff options
| author | Matthias Clasen <mclasen@redhat.com> | 2009-03-30 22:50:09 -0400 |
|---|---|---|
| committer | David Zeuthen <davidz@redhat.com> | 2009-03-31 16:15:24 -0400 |
| commit | e4c0df4af35c793c353dc5118af831566031c83d (patch) | |
| tree | b5dc877e18c23d2378c050cc514b8ac9bce6eb78 /src | |
| parent | e2f7ad927a17011a9bda9f8ee955d28137baac7a (diff) | |
| download | gnome-disk-utility-e4c0df4af35c793c353dc5118af831566031c83d.tar.gz gnome-disk-utility-e4c0df4af35c793c353dc5118af831566031c83d.tar.xz gnome-disk-utility-e4c0df4af35c793c353dc5118af831566031c83d.zip | |
unique application support
Make palimpsest a unique application, using libunique.
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/palimpsest/Makefile.am | 2 | ||||
| -rw-r--r-- | src/palimpsest/gdu-main.c | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/palimpsest/Makefile.am b/src/palimpsest/Makefile.am index 21322c8..0dca7ad 100644 --- a/src/palimpsest/Makefile.am +++ b/src/palimpsest/Makefile.am @@ -39,6 +39,7 @@ palimpsest_CFLAGS = \ $(GNOME_KEYRING_CFLAGS) \ $(GTK2_CFLAGS) \ $(LIBSEXY_CFLAGS) \ + $(UNIQUE_CFLAGS) \ $(WARN_CFLAGS) \ $(AM_CFLAGS) @@ -55,6 +56,7 @@ palimpsest_LDADD = \ $(GNOME_KEYRING_LIBS) \ $(GTK2_LIBS) \ $(LIBSEXY_LIBS) \ + $(UNIQUE_LIBS) \ $(INTLLIBS) \ $(top_builddir)/src/gdu/libgdu.la \ $(top_builddir)/src/gdu-gtk/libgdu-gtk.la diff --git a/src/palimpsest/gdu-main.c b/src/palimpsest/gdu-main.c index a1dfe15..ba31d7c 100644 --- a/src/palimpsest/gdu-main.c +++ b/src/palimpsest/gdu-main.c @@ -24,6 +24,7 @@ #include <string.h> #include <glib/gi18n.h> #include <polkit-gnome/polkit-gnome.h> +#include <unique/unique.h> #include "gdu-shell.h" @@ -56,16 +57,50 @@ show_nag_dialog (GtkWidget *toplevel) return ret; } +enum { + CMD_PRESENT_WINDOW = 1 +}; + +static UniqueResponse +message_received (UniqueApp *app, + gint command, + UniqueMessageData *message_data, + guint timestamp, + GduShell *shell) +{ + switch (command) { + case CMD_PRESENT_WINDOW: + gtk_window_present (GTK_WINDOW (gdu_shell_get_toplevel (shell))); + return UNIQUE_RESPONSE_OK; + default: + return UNIQUE_RESPONSE_PASSTHROUGH; + } +} + int main (int argc, char **argv) { GduShell *shell; + UniqueApp *unique_app; gtk_init (&argc, &argv); gtk_window_set_default_icon_name ("palimpsest"); + unique_app = unique_app_new_with_commands ("org.gnome.Palimpsest", + NULL, + "present_window", CMD_PRESENT_WINDOW, + NULL); + if (unique_app_is_running (unique_app)) { + unique_app_send_message (unique_app, CMD_PRESENT_WINDOW, NULL); + return 0; + } + shell = gdu_shell_new (); + + g_signal_connect (unique_app, "message-received", + G_CALLBACK (message_received), shell); + gtk_widget_show_all (gdu_shell_get_toplevel (shell)); gdu_shell_update (shell); |
