summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-07 10:26:09 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-07 10:26:09 +0000
commit13fb8f29b209e9b948375f6d7888fb8c637c2cd4 (patch)
tree8d444f76f5a3f7bf147465de331f7dde0d340980 /src/main.c
parent8d77cf1f3f90bad05ad97802febd3fe3c34391fc (diff)
use #ifdef HAVE_LIBUNIQUE in main.c to make libunique more optional, will be useful for windows support.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 8f9ac54..e41b3c7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,12 +30,15 @@
#include <glib-object.h>
#include <gtk/gtk.h>
#include <json-glib/json-glib.h>
+#ifdef HAVE_LIBUNIQUE
#include <unique/unique.h>
+#endif
#include "http.h"
#include "trg-main-window.h"
#include "trg-client.h"
+#ifdef HAVE_LIBUNIQUE
enum {
COMMAND_0,
COMMAND_ADD
@@ -74,14 +77,17 @@ message_received_cb(UniqueApp * app G_GNUC_UNUSED,
return res;
}
+#endif
int main(int argc, char *argv[])
{
int returnValue = EXIT_SUCCESS;
+#ifdef HAVE_LIBUNIQUE
UniqueApp *app = NULL;
+ gboolean withUnique;
+#endif
TrgMainWindow *window;
TrgClient *client;
- gboolean withUnique;
g_type_init();
g_thread_init(NULL);
@@ -94,6 +100,7 @@ int main(int argc, char *argv[])
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
+#ifdef HAVE_LIBUNIQUE
if ((withUnique = g_getenv("TRG_NOUNIQUE") == NULL))
app = unique_app_new_with_commands("uk.org.eth0.trg", NULL,
"add", COMMAND_ADD, NULL);
@@ -127,17 +134,20 @@ int main(int argc, char *argv[])
if (response != UNIQUE_RESPONSE_OK)
returnValue = EXIT_FAILURE;
} else {
+#endif
client = trg_client_new();
curl_global_init(CURL_GLOBAL_ALL);
window = trg_main_window_new(client);
+#ifdef HAVE_LIBUNIQUE
if (withUnique) {
unique_app_watch_window(app, GTK_WINDOW(window));
g_signal_connect(app, "message-received",
G_CALLBACK(message_received_cb), window);
}
+#endif
gtk_widget_show_all(GTK_WIDGET(window));
@@ -145,10 +155,12 @@ int main(int argc, char *argv[])
gtk_main();
curl_global_cleanup();
+#ifdef HAVE_LIBUNIQUE
}
if (withUnique)
g_object_unref(app);
+#endif
return returnValue;
}