/pidgin/main: 6f7deddb8850: Move blist loading into purple_core_...

Elliott Sales de Andrade qulogic at pidgin.im
Fri Jan 18 04:31:03 EST 2013


Changeset: 6f7deddb885002f16e9ad9d312ee32356929bc7b
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-01-18 03:51 -0500
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/6f7deddb8850

Description:

Move blist loading into purple_core_init.

The comments say we want to move this into purple_blist_init, but that
seems like it would be problematic. We need the UI ops to be set, which
moves blist init after UI init. But stuff needs blist signals to be
registered before UI init, etc., etc. It seemed like a pain to work that
all out. I made purple_blist_boot for purple_core_init to call after the
UI init happened. It could have been called _load, but I didn't want
people to accidentally continue calling it.

diffstat:

 ChangeLog.API                              |   3 +++
 finch/finch.c                              |   4 ----
 libpurple/blist.c                          |  18 +++++++-----------
 libpurple/blist.h                          |  28 +++++++---------------------
 libpurple/core.c                           |   3 +++
 libpurple/example/nullclient.c             |   4 ----
 libpurple/plugins/perl/common/BuddyList.xs |  10 ----------
 pidgin/gtkmain.c                           |   4 ----
 8 files changed, 20 insertions(+), 54 deletions(-)

diffs (196 lines):

diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -164,6 +164,9 @@ version 3.0.0 (??/??/????):
 		* PidginConversation.sg
 		* purple_account_add_buddies_with_invite
 		* purple_account_add_buddy_with_invite
+		* purple_blist_load
+		* purple_blist_new
+		* purple_set_blist
 		* purple_blist_update_buddy_icon
 		* purple_buddy_get_local_alias
 		* purple_buddy_icons_has_custom_icon
diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -377,10 +377,6 @@ init_libpurple(int argc, char **argv)
 		abort();
 	}
 
-	/* TODO: Move blist loading into purple_blist_init() */
-	purple_set_blist(purple_blist_new());
-	purple_blist_load();
-
 	/* TODO: should this be moved into finch_prefs_init() ? */
 	finch_prefs_update_old();
 
diff --git a/libpurple/blist.c b/libpurple/blist.c
--- a/libpurple/blist.c
+++ b/libpurple/blist.c
@@ -597,9 +597,8 @@ parse_group(xmlnode *groupnode)
 	}
 }
 
-/* TODO: Make static and rename to load_blist */
-void
-purple_blist_load()
+static void
+load_blist(void)
 {
 	xmlnode *purple, *blist, *privacy;
 
@@ -721,7 +720,8 @@ purple_contact_compute_priority_buddy(Pu
  * Public API functions                                                      *
  *****************************************************************************/
 
-PurpleBuddyList *purple_blist_new()
+void
+purple_blist_boot(void)
 {
 	PurpleBlistUiOps *ui_ops;
 	GList *account;
@@ -749,13 +749,9 @@ PurpleBuddyList *purple_blist_new()
 	if (ui_ops != NULL && ui_ops->new_list != NULL)
 		ui_ops->new_list(gbl);
 
-	return gbl;
-}
-
-void
-purple_set_blist(PurpleBuddyList *list)
-{
-	purplebuddylist = list;
+	purplebuddylist = gbl;
+
+	load_blist();
 }
 
 PurpleBuddyList *
diff --git a/libpurple/blist.h b/libpurple/blist.h
--- a/libpurple/blist.h
+++ b/libpurple/blist.h
@@ -252,22 +252,6 @@ G_BEGIN_DECLS
 /*@{*/
 
 /**
- * Creates a new buddy list
- *
- * @return The new buddy list.
- * @deprecated In 3.0.0, this will be handled by purple_blist_init()
- */
-PurpleBuddyList *purple_blist_new(void);
-
-/**
- * Sets the main buddy list.
- *
- * @param blist The buddy list you want to use.
- * @deprecated In 3.0.0, this will be handled by purple_blist_init()
- */
-void purple_set_blist(PurpleBuddyList *blist);
-
-/**
  * Returns the main buddy list.
  *
  * @return The main buddy list.
@@ -1008,11 +992,6 @@ int purple_blist_get_group_online_count(
 /****************************************************************************************/
 
 /**
- * Loads the buddy list from ~/.purple/blist.xml.
- */
-void purple_blist_load(void);
-
-/**
  * Schedule a save of the blist.xml file.  This is used by the privacy
  * API whenever the privacy settings are changed.  If you make a change
  * to blist.xml using one of the functions in the buddy list API, then
@@ -1204,6 +1183,13 @@ void *purple_blist_get_handle(void);
 void purple_blist_init(void);
 
 /**
+ * Loads the buddy list.
+ *
+ * You shouldn't call this. purple_core_init() will do it for you.
+ */
+void purple_blist_boot(void);
+
+/**
  * Uninitializes the buddy list subsystem.
  */
 void purple_blist_uninit(void);
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -189,6 +189,9 @@ purple_core_init(const char *ui)
 	/* The UI may have registered some theme types, so refresh them */
 	purple_theme_manager_refresh();
 
+	/* Load the buddy list after UI init */
+	purple_blist_boot();
+
 	return TRUE;
 }
 
diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c
--- a/libpurple/example/nullclient.c
+++ b/libpurple/example/nullclient.c
@@ -214,10 +214,6 @@ init_libpurple(void)
 		abort();
 	}
 
-	/* Create and load the buddylist. */
-	purple_set_blist(purple_blist_new());
-	purple_blist_load();
-
 	/* Load the preferences. */
 	purple_prefs_load();
 
diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs
--- a/libpurple/plugins/perl/common/BuddyList.xs
+++ b/libpurple/plugins/perl/common/BuddyList.xs
@@ -35,10 +35,6 @@ BOOT:
 Purple::BuddyList
 purple_get_blist()
 
-void
-purple_set_blist(blist)
-	Purple::BuddyList blist
-
 MODULE = Purple::BuddyList  PACKAGE = Purple::Find  PREFIX = purple_find_
 PROTOTYPES: ENABLE
 
@@ -176,9 +172,6 @@ purple_blist_add_chat(chat, group, node)
 	Purple::BuddyList::Group  group
 	Purple::BuddyList::Node node
 
-Purple::BuddyList
-purple_blist_new()
-
 void
 purple_blist_show()
 
@@ -237,9 +230,6 @@ purple_blist_get_group_online_count(grou
 	Purple::BuddyList::Group  group
 
 void
-purple_blist_load()
-
-void
 purple_blist_schedule_save()
 
 void
diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c
--- a/pidgin/gtkmain.c
+++ b/pidgin/gtkmain.c
@@ -754,10 +754,6 @@ int main(int argc, char *argv[])
 		return 0;
 	}
 
-	/* TODO: Move blist loading into purple_blist_init() */
-	purple_set_blist(purple_blist_new());
-	purple_blist_load();
-
 	/* load plugins we had when we quit */
 	purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded");
 



More information about the Commits mailing list