changeset 6751:35b01b371785

[gaim-migrate @ 7283] The accounts window now shows offline accounts as greyed out, and online accounts as colored, providing a better indication of what is online and what is not. We'll see what people think of this, but it's been useful for qpe-gaim. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 05 Sep 2003 07:11:01 +0000
parents e152a0283692
children 90fd056e755d
files ChangeLog src/gtkaccount.c
diffstat 2 files changed, 66 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 05 06:06:45 2003 +0000
+++ b/ChangeLog	Fri Sep 05 07:11:01 2003 +0000
@@ -5,6 +5,8 @@
 	* Updated MSN support to the MSN Protocol version 9.
 	* Yahoo now shows people using the java chat client (Tim Ringenbach)
 	* Yahoo chat and conference (Tim Rigenbach)
+	* The accounts window now shows offline accounts as greyed out, and
+	  online accounts as colored.
 	* Added support for gettext 0.12.x.
 	* Korean translation updated (Kyung-uk Son)
 	* Swedish translation updated (Tore Lundqvist (luntor))
--- a/src/gtkaccount.c	Fri Sep 05 06:06:45 2003 +0000
+++ b/src/gtkaccount.c	Fri Sep 05 07:11:01 2003 +0000
@@ -109,7 +109,7 @@
 	GtkWidget *buddy_icon_filesel;
 	GtkWidget *buddy_icon_preview;
 	GtkWidget *buddy_icon_text;
-	
+
 	/* Protocol Options */
 	GtkWidget *protocol_frame;
 
@@ -208,36 +208,49 @@
 
 }
 
-static void buddy_icon_filesel_delete_cb (GtkWidget *w, AccountPrefsDialog *dialog)
+static void
+buddy_icon_filesel_delete_cb(GtkWidget *w, AccountPrefsDialog *dialog)
 {
 	if (dialog->buddy_icon_filesel != NULL)
 		gtk_widget_destroy(dialog->buddy_icon_filesel);
+
 	dialog->buddy_icon_filesel = NULL;
 }
 
-static void buddy_icon_filesel_choose (GtkWidget *w, AccountPrefsDialog *dialog)
+static void
+buddy_icon_filesel_choose(GtkWidget *w, AccountPrefsDialog *dialog)
 {
-	const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel));
+	const char *filename;
+
+	filename = gtk_file_selection_get_filename(
+			GTK_FILE_SELECTION(dialog->buddy_icon_filesel));
 
 	/* If they typed in a directory, change there */
-	if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(dialog->buddy_icon_filesel)))
+	if (gaim_gtk_check_if_dir(filename,
+			GTK_FILE_SELECTION(dialog->buddy_icon_filesel)))
+	{
 		return;
+	}
 
-	if (dialog->account)
+	if (dialog->account != NULL)
 		gaim_account_set_buddy_icon(dialog->account, filename);
 
 	gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry), filename);
 	gtk_widget_destroy(dialog->buddy_icon_filesel);
 }
 
-static void buddy_icon_preview_change_cb(GtkTreeSelection *sel, AccountPrefsDialog *dialog)
+static void
+buddy_icon_preview_change_cb(GtkTreeSelection *sel, AccountPrefsDialog *dialog)
 {
 	GdkPixbuf *pixbuf, *scale;
 	int height, width;
 	char *basename, *markup, *size;
 	struct stat st;
+	const char *filename;
 
-	const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel));
+	filename = gtk_file_selection_get_filename(
+		GTK_FILE_SELECTION(dialog->buddy_icon_filesel));
+
 	if (!filename || stat(filename, &st))
 		return;
 
@@ -247,14 +260,18 @@
 		gtk_label_set_markup(GTK_LABEL(dialog->buddy_icon_text), "");
 		return;
 	}
-	
+
 	width = gdk_pixbuf_get_width(pixbuf);
 	height = gdk_pixbuf_get_height(pixbuf);
 	basename = g_path_get_basename(filename);
 	size = gaim_get_size_string(st.st_size);
-	markup = g_strdup_printf(_("<b>File:</b> %s\n<b>File size:</b> %s\n<b>Image size:</b> %dx%d"),
-				 basename, size, width, height);
-	scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height, 50, GDK_INTERP_BILINEAR);
+	markup = g_strdup_printf(_("<b>File:</b> %s\n"
+							   "<b>File size:</b> %s\n"
+							   "<b>Image size:</b> %dx%d"),
+							 basename, size, width, height);
+
+	scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height,
+									50, GDK_INTERP_BILINEAR);
 	gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->buddy_icon_preview), scale);
 	gtk_label_set_markup(GTK_LABEL(dialog->buddy_icon_text), markup);
 
@@ -265,13 +282,15 @@
 	g_free(markup);
 }
 
-static void buddy_icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog)
+static void
+buddy_icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog)
 {
 	GtkWidget *hbox;
 	GtkWidget *tv;
 	GtkTreeSelection *sel;
 
-	if (dialog->buddy_icon_filesel) {
+	if (dialog->buddy_icon_filesel)
+	{
 		gtk_widget_show(GTK_WIDGET(dialog->buddy_icon_filesel));
 		gdk_window_raise(GDK_WINDOW(dialog->buddy_icon_filesel->window));
 		return;
@@ -299,14 +318,15 @@
 
 	gtk_widget_show_all(GTK_WIDGET(dialog->buddy_icon_filesel));
 	if (dialog->account && (gaim_account_get_buddy_icon(dialog->account) != NULL)) {
-		gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel), 
+		gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog->buddy_icon_filesel),
 						gaim_account_get_buddy_icon(dialog->account));
 		buddy_icon_preview_change_cb(NULL, dialog);
 	}
 
 }
 
-static void buddy_icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog)
+static void
+buddy_icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog)
 {
 	gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry), "");
 	if (dialog->account)
@@ -348,9 +368,9 @@
 
 	/* Screen Name */
 	dialog->screenname_entry = gtk_entry_new();
-	
+
 	add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry);
-	
+
 	g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed",
 			 G_CALLBACK(screenname_changed_cb), dialog);
 
@@ -518,8 +538,8 @@
 
 	button = gtk_button_new_with_mnemonic(_("_Browse"));
 	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-       	g_signal_connect(G_OBJECT(button), "clicked",
-			 G_CALLBACK(buddy_icon_select_cb), dialog);
+	g_signal_connect(G_OBJECT(button), "clicked",
+					 G_CALLBACK(buddy_icon_select_cb), dialog);
 	gtk_widget_show(button);
 
 	button = gtk_button_new_with_mnemonic(_("_Reset"));
@@ -1268,12 +1288,29 @@
 	GaimAccount *account = gaim_connection_get_account(gc);
 	GtkTreeModel *model = GTK_TREE_MODEL(dialog->model);
 	GtkTreeIter iter;
+	GdkPixbuf *pixbuf, *scale = NULL;
 	size_t index = g_list_index(gaim_accounts_get_all(), account);
 
-	if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) {
+	if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index))
+	{
+		pixbuf = create_prpl_icon(account);
+
+		if (pixbuf != NULL)
+		{
+			scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
+											GDK_INTERP_BILINEAR);
+
+			if (!gaim_account_is_connected(account))
+				gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
+		}
+
 		gtk_list_store_set(dialog->model, &iter,
+						   COLUMN_ICON, scale,
 						   COLUMN_ONLINE, gaim_account_is_connected(account),
 						   -1);
+
+		if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf));
+		if (scale  != NULL) g_object_unref(G_OBJECT(scale));
 	}
 }
 
@@ -1601,7 +1638,7 @@
 
 	g_signal_connect(G_OBJECT(renderer), "toggled",
 			 G_CALLBACK(online_cb), dialog);
-	
+
 	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
 						    -1, _("Online"),
 						    renderer,
@@ -1641,8 +1678,13 @@
 	pixbuf = create_prpl_icon(account);
 
 	if (pixbuf != NULL)
+	{
 		scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
 
+		if (!gaim_account_is_connected(account))
+			gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
+	}
+
 	gtk_list_store_set(store, iter,
 			COLUMN_ICON, scale,
 			COLUMN_SCREENNAME, gaim_account_get_username(account),