summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/main.c9
-rw-r--r--src/trg-gtk-app.c11
-rw-r--r--src/trg-main-window.c25
-rw-r--r--src/trg-main-window.h3
5 files changed, 38 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 5e41aba..b3176d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,7 +96,7 @@ PKG_CHECK_MODULES([gthread], [gthread-2.0])
dnl PKG_CHECK_MODULES([gtk], [gtk+-3.0 >= 3.00], [
dnl if test x$with_libappindicator != xno; then
-dnl PKG_CHECK_MODULES([libappindicator], [appindicator3-0.1], AC_DEFINE(HAVE_LIBAPPINDICATOR, 1, [Define if libappindicator is available]), AC_MSG_WARN([Ubuntu Unity users should consider building with libappindicator]))
+dnl PKG_CHECK_MODULES([libappindicator], [appindicator3-0.1], AC_DEFINE(HAVE_LIBAPPINDICATOR, 1, [Define if libappindicator is available]), AC_MSG_WARN([Ubuntu Unity users should consider building with libappindicator]))
dnl fi
dnl ], [
dnl AC_MSG_WARN([gtk+-3.0 not found, trying gtk+-2.0])
diff --git a/src/main.c b/src/main.c
index 1bd21c4..5e521ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -130,7 +130,8 @@ static gint trg_libunique_init(TrgClient * client, int argc,
g_signal_connect(app, "message-received",
G_CALLBACK(message_received_cb), window);
- auto_connect_if_required(window, args);
+ trg_main_window_set_start_args(window, args);
+ auto_connect_if_required(window);
gtk_main();
}
@@ -163,7 +164,8 @@ static gint trg_simple_init(TrgClient * client, int argc, char *argv[],
{
TrgMainWindow *window =
trg_main_window_new(client, should_be_minimised(argc, argv));
- auto_connect_if_required(window, args);
+ trg_main_window_set_start_args(window, args);
+ auto_connect_if_required(window);
gtk_main();
return EXIT_SUCCESS;
@@ -191,7 +193,8 @@ static gint trg_win32_init(TrgClient * client, int argc, char *argv[],
if (!mailslot_send_message(args)) {
TrgMainWindow *window =
trg_main_window_new(client, should_be_minimised(argc, argv));
- auto_connect_if_required(window, args);
+ trg_main_window_set_start_args(window, args);
+ auto_connect_if_required(window);
mailslot_start_background_listener(window);
gtk_main();
}
diff --git a/src/trg-gtk-app.c b/src/trg-gtk-app.c
index 5652568..af4d4f5 100644
--- a/src/trg-gtk-app.c
+++ b/src/trg-gtk-app.c
@@ -99,9 +99,18 @@ trg_gtk_app_command_line(GApplication * application,
{
GList *windows =
gtk_application_get_windows(GTK_APPLICATION(application));
+ TrgMainWindow *window = TRG_MAIN_WINDOW(windows->data);
gchar **argv = g_application_command_line_get_arguments(cmdline, NULL);
- auto_connect_if_required(TRG_MAIN_WINDOW(windows->data), argv);
+ if (g_application_get_is_remote(application)) {
+ if (!argv[0])
+ gtk_window_present(GTK_WINDOW(window));
+ else
+ return trg_add_from_filename(window, argv);
+ } else {
+ trg_main_window_set_start_args(window, argv);
+ auto_connect_if_required(TRG_MAIN_WINDOW(windows->data));
+ }
return 0;
}
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index 1da4ca2..4fb5561 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -469,6 +469,11 @@ gint trg_add_from_filename(TrgMainWindow * win, gchar ** uris)
GSList *filesList = NULL;
int i;
+ if (!trg_client_is_connected(client)) {
+ g_strfreev(uris);
+ return EXIT_SUCCESS;
+ }
+
if (uris)
for (i = 0; uris[i]; i++)
if (uris[i])
@@ -1119,6 +1124,13 @@ static void update_whatever_statusicon(TrgMainWindow * win,
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
+#ifdef HAVE_LIBAPPINDICATOR
+ if (!priv->appIndicator)
+#else
+ if (!priv->statusIcon)
+#endif
+ return;
+
gtk_widget_set_visible(priv->iconSeedingItem, stats != NULL);
gtk_widget_set_visible(priv->iconDownloadingItem, stats != NULL);
gtk_widget_set_visible(priv->iconSepItem, stats != NULL);
@@ -2679,7 +2691,13 @@ static void trg_main_window_class_init(TrgMainWindowClass * klass)
G_PARAM_STATIC_BLURB));
}
-void auto_connect_if_required(TrgMainWindow * win, gchar ** args)
+void trg_main_window_set_start_args(TrgMainWindow * win, gchar ** args)
+{
+ TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
+ priv->args = args;
+}
+
+void auto_connect_if_required(TrgMainWindow * win)
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
TrgPrefs *prefs = trg_client_get_prefs(priv->client);
@@ -2692,14 +2710,9 @@ void auto_connect_if_required(TrgMainWindow * win, gchar ** args)
if (len > 0
&& trg_prefs_get_bool(prefs, TRG_PREFS_KEY_AUTO_CONNECT,
TRG_PREFS_PROFILE)) {
- priv->args = args;
connect_cb(NULL, win);
- return;
}
}
-
- if (args)
- g_strfreev(args);
}
TrgMainWindow *trg_main_window_new(TrgClient * tc, gboolean minonstart)
diff --git a/src/trg-main-window.h b/src/trg-main-window.h
index 9422cfd..0c51f67 100644
--- a/src/trg-main-window.h
+++ b/src/trg-main-window.h
@@ -60,7 +60,8 @@ GType trg_main_window_get_type(void);
gint trg_add_from_filename(TrgMainWindow * win, gchar ** uris);
gboolean on_session_set(gpointer data);
gboolean on_generic_interactive_action(gpointer data);
-void auto_connect_if_required(TrgMainWindow * win, gchar ** args);
+void auto_connect_if_required(TrgMainWindow * win);
+void trg_main_window_set_start_args(TrgMainWindow * win, gchar ** args);
TrgMainWindow *trg_main_window_new(TrgClient * tc, gboolean minonstart);
void trg_main_window_add_status_icon(TrgMainWindow * win);
void trg_main_window_remove_status_icon(TrgMainWindow * win);