diff options
author | Alan Fitton <ajf@eth0.org.uk> | 2012-01-26 17:25:27 +0000 |
---|---|---|
committer | Alan Fitton <ajf@eth0.org.uk> | 2012-01-26 17:25:27 +0000 |
commit | 88d71834ce69debc900973f61e1e45a91fc117c2 (patch) | |
tree | c5601f6024aba18faeb79fe08b83d62f2141817d | |
parent | 294b9f3bdcfd63a4bf571f4efd035a0c7551de4a (diff) |
statusbar fix: connection fail messages should be replaced by the connected message if a subsequent attempt succeeds
-rw-r--r-- | src/trg-client.c | 3 | ||||
-rw-r--r-- | src/trg-status-bar.c | 26 | ||||
-rw-r--r-- | src/win32-mailslot.c | 4 |
3 files changed, 21 insertions, 12 deletions
diff --git a/src/trg-client.c b/src/trg-client.c index 479c53c..a952347 100644 --- a/src/trg-client.c +++ b/src/trg-client.c @@ -347,8 +347,7 @@ void trg_client_status_change(TrgClient * tc, gboolean connected) JsonObject *trg_client_get_session(TrgClient * tc) { - TrgClientPrivate *priv = tc->priv; - return priv->session; + return tc->priv->session; } void diff --git a/src/trg-status-bar.c b/src/trg-status-bar.c index 1793a74..80de6bb 100644 --- a/src/trg-status-bar.c +++ b/src/trg-status-bar.c @@ -128,25 +128,34 @@ trg_status_bar_push_connection_msg(TrgStatusBar * sb, const gchar * msg) gtk_label_set_text(GTK_LABEL(priv->info_lbl), msg); } -void -trg_status_bar_connect(TrgStatusBar * sb, JsonObject * session, - TrgClient * client) +static void +trg_status_bar_set_connected_label(TrgStatusBar *sb, JsonObject * session, + TrgClient *client) { - TrgStatusBarPrivate *priv = TRG_STATUS_BAR_GET_PRIVATE(sb); TrgPrefs *prefs = trg_client_get_prefs(client); gdouble version = session_get_version(session); + gchar *profileName = trg_prefs_get_string(prefs, + TRG_PREFS_KEY_PROFILE_NAME, + TRG_PREFS_CONNECTION); gchar *statusMsg = g_strdup_printf(_("Connected: %s (Transmission %g)"), - trg_prefs_get_string(prefs, - TRG_PREFS_KEY_PROFILE_NAME, - TRG_PREFS_CONNECTION), + profileName, version); - g_message("%s", statusMsg); trg_status_bar_push_connection_msg(sb, statusMsg); + + g_free(profileName); g_free(statusMsg); +} + +void +trg_status_bar_connect(TrgStatusBar * sb, JsonObject * session, + TrgClient * client) +{ + TrgStatusBarPrivate *priv = TRG_STATUS_BAR_GET_PRIVATE(sb); + trg_status_bar_set_connected_label(sb, session, client); gtk_label_set_text(GTK_LABEL(priv->speed_lbl), _("Updating torrents...")); } @@ -237,6 +246,7 @@ trg_status_bar_update(TrgStatusBar * sb, trg_torrent_model_update_stats * stats, TrgClient * client) { + trg_status_bar_set_connected_label(sb, trg_client_get_session(client), client); trg_status_bar_update_speed(sb, stats, client); } diff --git a/src/win32-mailslot.c b/src/win32-mailslot.c index cca051f..6878b9c 100644 --- a/src/win32-mailslot.c +++ b/src/win32-mailslot.c @@ -73,13 +73,13 @@ static gpointer mailslot_recv_thread(gpointer data) if (INVALID_HANDLE_VALUE == hMailslot) { g_error("\nError occurred while creating the mailslot: %d", GetLastError()); - return NULL; //Error + return NULL; /* Error */ } while (1) { bResult = ReadFile(hMailslot, /* handle to mailslot */ szBuffer, /* buffer to receive data */ - sizeof(szBuffer), // size of buffer */ + sizeof(szBuffer), /* size of buffer */ &cbBytes, /* number of bytes read */ NULL); /* not overlapped I/O */ |