Пример #1
0
static gboolean plugin_load(PurplePlugin *plugin, GError **error) {
	purple_prefs_add_none("/plugins/gtk");
	purple_prefs_add_none("/plugins/gtk/win32");
	purple_prefs_add_none("/plugins/gtk/win32/winprefs");
	purple_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE);
	purple_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE);
	purple_prefs_add_int(PREF_DBLIST_HEIGHT, 0);
	purple_prefs_add_int(PREF_DBLIST_SIDE, 0);

	/* Convert old preferences */
	if(purple_prefs_exists(PREF_DBLIST_ON_TOP)) {
		gint blist_top = BLIST_TOP_NEVER;
		if(purple_prefs_get_bool(PREF_BLIST_ON_TOP))
			blist_top = BLIST_TOP_ALWAYS;
		else if(purple_prefs_get_bool(PREF_DBLIST_ON_TOP))
			blist_top = BLIST_TOP_DOCKED;
		purple_prefs_remove(PREF_BLIST_ON_TOP);
		purple_prefs_remove(PREF_DBLIST_ON_TOP);
		purple_prefs_add_int(PREF_BLIST_ON_TOP, blist_top);
	} else
		purple_prefs_add_int(PREF_BLIST_ON_TOP, BLIST_TOP_NEVER);
	purple_prefs_remove(PREF_CHAT_BLINK);

	handle = plugin;

	/* blist docking init */
	if(purple_blist_get_buddy_list() && PIDGIN_BLIST(purple_blist_get_buddy_list())
			&& PIDGIN_BLIST(purple_blist_get_buddy_list())->window) {
		blist_create_cb(purple_blist_get_buddy_list(), NULL);
	}

	/* This really shouldn't happen anymore generally, but if for some strange
	   reason, the blist is recreated, we need to set it up again. */
	purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created",
		plugin, PURPLE_CALLBACK(blist_create_cb), NULL);

	purple_signal_connect((void*)purple_get_core(), "quitting", plugin,
		PURPLE_CALLBACK(purple_quit_cb), NULL);

	purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP,
		winprefs_set_blist_ontop, NULL);
	purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE,
		winprefs_set_blist_dockable, NULL);

	return TRUE;
}
Пример #2
0
static gboolean plugin_load(PurplePlugin *plugin) {
	handle = plugin;

	/* blist docking init */
	if(purple_get_blist() && PIDGIN_BLIST(purple_get_blist())
			&& PIDGIN_BLIST(purple_get_blist())->window) {
		blist_create_cb(purple_get_blist(), NULL);
	}

	/* This really shouldn't happen anymore generally, but if for some strange
	   reason, the blist is recreated, we need to set it up again. */
	purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created",
		plugin, PURPLE_CALLBACK(blist_create_cb), NULL);

	purple_signal_connect((void*)purple_get_core(), "quitting", plugin,
		PURPLE_CALLBACK(purple_quit_cb), NULL);

	purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP,
		winprefs_set_blist_ontop, NULL);
	purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE,
		winprefs_set_blist_dockable, NULL);

	return TRUE;
}