im.pidgin.pidgin: d11aaeee05a52eb367ad7d81f82a36b7a0501bcf
sadrul at pidgin.im
sadrul at pidgin.im
Mon Jan 7 01:15:44 EST 2008
-----------------------------------------------------------------
Revision: d11aaeee05a52eb367ad7d81f82a36b7a0501bcf
Ancestor: db834f1393369626f9e8c29b2ed9679ed8999f35
Author: sadrul at pidgin.im
Date: 2008-01-07T06:16:46
Branch: im.pidgin.pidgin
Modified files:
finch/gntroomlist.c finch/gntroomlist.h finch/gntui.c
ChangeLog:
Remember the size of the roomlist window. Handle the categories better.
-------------- next part --------------
============================================================
--- finch/gntroomlist.c 506db9155959aa5b9cd0e798241006f2b13bfc81
+++ finch/gntroomlist.c 9fdd57d258902d6115b82b302b0ead0002d80132
@@ -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 @@ roomlist_activated(GntWidget *widget)
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 @@ roomlist_selection_changed(GntWidget *wi
}
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
}
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 @@ setup_roomlist(PurpleAccount *account)
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 *acco
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 @@ fl_add_room(PurpleRoomlist *roomlist, Pu
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 @@ static PurpleRoomlistUiOps ui_ops =
NULL, /* void (*_purple_reserved3)(void); */
NULL /* void (*_purple_reserved4)(void); */
};
+
PurpleRoomlistUiOps *finch_roomlist_get_ui_ops(void)
{
return &ui_ops;
@@ -373,3 +401,15 @@ void finch_roomlist_show_all(void)
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)
+{
+}
+
============================================================
--- finch/gntroomlist.h 1a878d9ba45fd0733dcfdd7e84d37d93b4e85f8b
+++ finch/gntroomlist.h ba43430a0bfa029f8c57597a30e18fcf266e0c32
@@ -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);
*/
void finch_roomlist_show_all(void);
+/**
+ * Uninitialize the roomlist subsystem.
+ */
+void finch_roomlist_uninit(void);
+
/*@}*/
#endif
============================================================
--- finch/gntui.c 7ff25ed3984fa1061440cc47f55129f607730ff5
+++ finch/gntui.c ec865b97d1966ecfa5067bb27dbe4ed9dd570197
@@ -84,6 +84,7 @@ void gnt_ui_init()
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 @@ void gnt_ui_uninit()
finch_xfers_uninit();
purple_xfers_set_ui_ops(NULL);
+ finch_roomlist_uninit();
+ purple_roomlist_set_ui_ops(NULL);
+
gnt_quit();
#endif
}
More information about the Commits
mailing list