changeset 14705:05c34aabdcc3

[gaim-migrate @ 17458] I think we should let people know why we're not connecting... If someone can think of better (shorter) wording, feel free to change it committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 11 Oct 2006 03:13:33 +0000
parents c1a308cc63f7
children fadfb69e5818
files gtk/gtkconn.c gtk/gtkstatusbox.c gtk/gtkstatusbox.h libgaim/account.c
diffstat 4 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkconn.c	Tue Oct 10 17:58:40 2006 +0000
+++ b/gtk/gtkconn.c	Wed Oct 11 03:13:33 2006 +0000
@@ -194,9 +194,14 @@
 	}
 }
 
-static void gaim_gtk_connection_network_connected () 
+static void gaim_gtk_connection_network_connected ()
 {
 	GList *list = gaim_accounts_get_all_active();
+	GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
+
+	if(gtkblist)
+		gtk_gaim_status_box_set_network_available(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), TRUE);
+
 	while (list) {
 		GaimAccount *account = (GaimAccount*)list->data;
 		GaimAutoRecon *info = g_hash_table_lookup(hash, account);
@@ -204,12 +209,17 @@
 			free_auto_recon(info);
 		do_signon(account);
 		list = list->next;
- 	}
+	}
 }
 
-static void gaim_gtk_connection_network_disconnected () 
+static void gaim_gtk_connection_network_disconnected ()
 {
 	GList *l = gaim_accounts_get_all_active();
+	GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
+
+	if(gtkblist)
+		gtk_gaim_status_box_set_network_available(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), FALSE);
+
 	while (l) {
 		GaimAccount *a = (GaimAccount*)l->data;
 		gaim_account_disconnect(a);
--- a/gtk/gtkstatusbox.c	Tue Oct 10 17:58:40 2006 +0000
+++ b/gtk/gtkstatusbox.c	Wed Oct 11 03:13:33 2006 +0000
@@ -43,6 +43,7 @@
 
 #include "account.h"
 #include "internal.h"
+#include "network.h"
 #include "savedstatuses.h"
 #include "status.h"
 #include "debug.h"
@@ -553,6 +554,8 @@
 		secondary = g_strdup(_("Typing"));
 	else if (status_box->connecting)
 		secondary = g_strdup(_("Connecting"));
+	else if (!status_box->network_available)
+		secondary = g_strdup(_("Waiting for network connection"));
 	else if (gaim_savedstatus_is_transient(saved_status))
 		secondary = NULL;
 	else
@@ -1265,6 +1268,7 @@
 	GtkTextBuffer *buffer;
 
 	status_box->imhtml_visible = FALSE;
+	status_box->network_available = gaim_network_is_available();
 	status_box->connecting = FALSE;
 	status_box->typing = 0;
 	status_box->toggle_button = gtk_toggle_button_new();
@@ -1609,6 +1613,15 @@
 }
 
 void
+gtk_gaim_status_box_set_network_available(GtkGaimStatusBox *status_box, gboolean available)
+{
+	if (!status_box)
+		return;
+	status_box->network_available = available;
+	gtk_gaim_status_box_refresh(status_box);
+}
+
+void
 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting)
 {
 	if (!status_box)
--- a/gtk/gtkstatusbox.h	Tue Oct 10 17:58:40 2006 +0000
+++ b/gtk/gtkstatusbox.h	Wed Oct 11 03:13:33 2006 +0000
@@ -110,6 +110,7 @@
 	int typing_index;
 	GdkPixbuf *typing_pixbufs[4];
 
+	gboolean network_available;
 	gboolean connecting;
 	guint typing;
 
@@ -156,6 +157,9 @@
 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box);
 
 void
+gtk_gaim_status_box_set_network_available(GtkGaimStatusBox *status_box, gboolean available);
+
+void
 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting);
 
 void
--- a/libgaim/account.c	Tue Oct 10 17:58:40 2006 +0000
+++ b/libgaim/account.c	Wed Oct 11 03:13:33 2006 +0000
@@ -2246,7 +2246,7 @@
 	/* If we're not connected to the Internet right now, we bail on this */
 	if (!gaim_network_is_available())
 	{
-		fprintf(stderr, "Network not connected; skipping reconnect\n");
+		gaim_debug_info("account", "Network not connected; skipping reconnect\n");
 		return;
 	}