changeset 27756:9983576f3aa4

propagate from branch 'im.pidgin.pidgin' (head 4ee5892f234555949f9d4ee3a3fd14d49e642b64) to branch 'im.pidgin.pidgin.yaz' (head 0896433b90a3f6f22edda17067ba6645da7a0d42)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 07 Jan 2008 15:03:29 +0000
parents 9a60b9fab0ea (current diff) e8cb4df7b60a (diff)
children a8529c3dafe4
files
diffstat 4 files changed, 60 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntroomlist.c	Mon Jan 07 03:40:27 2008 +0000
+++ b/finch/gntroomlist.c	Mon Jan 07 15:03:29 2008 +0000
@@ -38,6 +38,8 @@
 
 #include "debug.h"
 
+#define PREF_ROOT "/finch/roomlist"
+
 /* Yes, just one roomlist at a time. Let's not get greedy. Aight? */
 struct _FinchRoomlist
 {
@@ -138,9 +140,13 @@
 			purple_roomlist_room_join(froomlist.roomlist, room);
 			break;
 		case PURPLE_ROOMLIST_ROOMTYPE_CATEGORY:
-			purple_roomlist_expand_category(froomlist.roomlist, room);
+			if (!room->expanded_once) {
+				purple_roomlist_expand_category(froomlist.roomlist, room);
+				room->expanded_once = TRUE;
+			}
 			break;
 	}
+	gnt_tree_set_expanded(GNT_TREE(widget), room, TRUE);
 }
 
 static void
@@ -191,8 +197,10 @@
 	}
 
 	if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) {
+		if (!first)
+			gnt_text_view_append_text_with_flags(tv, "\n", GNT_TEXT_FLAG_NORMAL);
 		gnt_text_view_append_text_with_flags(tv,
-				_("\nHit 'Enter' to find more rooms of this category."),
+				_("Hit 'Enter' to find more rooms of this category."),
 				GNT_TEXT_FLAG_NORMAL);
 	}
 }
@@ -238,6 +246,15 @@
 }
 
 static void
+size_changed_cb(GntWidget *widget, int oldw, int oldh)
+{
+	int w, h;
+	gnt_widget_get_size(widget, &w, &h);
+	purple_prefs_set_int(PREF_ROOT "/size/width", w);
+	purple_prefs_set_int(PREF_ROOT "/size/height", h);
+}
+
+static void
 setup_roomlist(PurpleAccount *account)
 {
 	GntWidget *window, *tree, *hbox, *accounts;
@@ -284,7 +301,7 @@
 	froomlist.details = gnt_text_view_new();
 	gnt_text_view_set_flag(GNT_TEXT_VIEW(froomlist.details), GNT_TEXT_VIEW_TOP_ALIGN);
 	gnt_box_add_widget(GNT_BOX(window), froomlist.details);
-	gnt_widget_set_size(froomlist.details, -1, 10);
+	gnt_widget_set_size(froomlist.details, -1, 8);
 
 	hbox = gnt_hbox_new(FALSE);
 	gnt_box_add_widget(GNT_BOX(window), hbox);
@@ -306,6 +323,13 @@
 fl_show_with_account(PurpleAccount *account)
 {
 	setup_roomlist(account);
+	g_signal_handlers_disconnect_matched(G_OBJECT(froomlist.window), G_SIGNAL_MATCH_FUNC,
+			0, 0, NULL, G_CALLBACK(size_changed_cb), NULL);
+	gnt_widget_show(froomlist.window);
+	gnt_screen_resize_widget(froomlist.window,
+			purple_prefs_get_int(PREF_ROOT "/size/width"),
+			purple_prefs_get_int(PREF_ROOT "/size/height"));
+	g_signal_connect(G_OBJECT(froomlist.window), "size_changed", G_CALLBACK(size_changed_cb), NULL);
 	gnt_window_present(froomlist.window);
 }
 
@@ -325,15 +349,18 @@
 static void
 fl_add_room(PurpleRoomlist *roomlist, PurpleRoomlistRoom *room)
 {
+	gboolean category;
 	if (froomlist.roomlist != roomlist)
 		return;
 
+	category = (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY);
 	gnt_tree_remove(GNT_TREE(froomlist.tree), room);
 	gnt_tree_add_row_after(GNT_TREE(froomlist.tree), room,
 			gnt_tree_create_row(GNT_TREE(froomlist.tree),
 				purple_roomlist_room_get_name(room),
-				purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY ? "<" : ""),
+				category ? "<" : ""),
 			purple_roomlist_room_get_parent(room), NULL);
+	gnt_tree_set_expanded(GNT_TREE(froomlist.tree), room, !category);
 }
 
 static void
@@ -363,6 +390,7 @@
 	NULL, /* void (*_purple_reserved3)(void); */
 	NULL /* void (*_purple_reserved4)(void); */
 };
+
 PurpleRoomlistUiOps *finch_roomlist_get_ui_ops(void)
 {
 	return &ui_ops;
@@ -373,3 +401,15 @@
 	purple_roomlist_show_with_account(NULL);
 }
 
+void finch_roomlist_init(void)
+{
+	purple_prefs_add_none(PREF_ROOT);
+	purple_prefs_add_none(PREF_ROOT "/size");
+	purple_prefs_add_int(PREF_ROOT "/size/width", 60);
+	purple_prefs_add_int(PREF_ROOT "/size/height", 15);
+}
+
+void finch_roomlist_uninit(void)
+{
+}
+
--- a/finch/gntroomlist.h	Mon Jan 07 03:40:27 2008 +0000
+++ b/finch/gntroomlist.h	Mon Jan 07 15:03:29 2008 +0000
@@ -34,6 +34,11 @@
 /*@{*/
 
 /**
+ * Initialize the roomlist subsystem.
+ */
+void finch_roomlist_init(void);
+
+/**
  * Get the ui-functions.
  *
  * @return The PurpleRoomlistUiOps structure populated with the appropriate functions.
@@ -45,6 +50,11 @@
  */
 void finch_roomlist_show_all(void);
 
+/**
+ * Uninitialize the roomlist subsystem.
+ */
+void finch_roomlist_uninit(void);
+
 /*@}*/
 
 #endif
--- a/finch/gntui.c	Mon Jan 07 03:40:27 2008 +0000
+++ b/finch/gntui.c	Mon Jan 07 15:03:29 2008 +0000
@@ -84,6 +84,7 @@
 	purple_xfers_set_ui_ops(finch_xfers_get_ui_ops());
 
 	/* Roomlist */
+	finch_roomlist_init();
 	purple_roomlist_set_ui_ops(finch_roomlist_get_ui_ops());
 
 	gnt_register_action(_("Accounts"), finch_accounts_show_all);
@@ -126,6 +127,9 @@
 	finch_xfers_uninit();
 	purple_xfers_set_ui_ops(NULL);
 
+	finch_roomlist_uninit();
+	purple_roomlist_set_ui_ops(NULL);
+
 	gnt_quit();
 #endif
 }
--- a/libpurple/buddyicon.c	Mon Jan 07 03:40:27 2008 +0000
+++ b/libpurple/buddyicon.c	Mon Jan 07 15:03:29 2008 +0000
@@ -49,6 +49,8 @@
 static GHashTable *icon_data_cache = NULL;
 static GHashTable *icon_file_cache = NULL;
 
+static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name);
+
 /* This one is used for both custom buddy icons
  * on PurpleContacts and account icons. */
 static GHashTable *pointer_icon_cache = NULL;