Esempio n. 1
0
static void blist_create_cb(PurpleBuddyList *purple_blist, void *data) {
	purple_debug_info(WINPREFS_PLUGIN_ID, "buddy list created\n");

	blist = PIDGIN_BLIST(purple_blist)->window;

	if(purple_prefs_get_bool(PREF_DBLIST_DOCKABLE)) {
		blist_set_dockable(TRUE);
		if(purple_prefs_get_bool(PREF_DBLIST_DOCKED)) {
			blist_ab->undocked_height = purple_prefs_get_int(PREF_DBLIST_HEIGHT);
			if(!(gdk_window_get_state(gtk_widget_get_window(blist))
					& GDK_WINDOW_STATE_WITHDRAWN)) {
				gtk_appbar_dock(blist_ab,
					purple_prefs_get_int(PREF_DBLIST_SIDE));
				if(purple_prefs_get_int(PREF_BLIST_ON_TOP)
						== BLIST_TOP_DOCKED)
					blist_set_ontop(TRUE);
			} else {
				g_idle_add(listen_for_blist_visible_cb, NULL);
			}
		}
	}

	if(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
		blist_set_ontop(TRUE);

}
Esempio n. 2
0
static void blist_dock_cb(gboolean val) {
	if(val) {
		purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Docking...\n");
		if(purple_prefs_get_int(PREF_BLIST_ON_TOP) != BLIST_TOP_NEVER)
			blist_set_ontop(TRUE);
	} else {
		purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking...\n");
		blist_set_ontop(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS);
	}
}
Esempio n. 3
0
static void
winprefs_set_blist_ontop(const char *pref, PurplePrefType type,
		gconstpointer value, gpointer user_data)
{
	gint setting = purple_prefs_get_int(PREF_BLIST_ON_TOP);
	if((setting == BLIST_TOP_DOCKED && blist_ab && blist_ab->docked)
		|| setting == BLIST_TOP_ALWAYS)
		blist_set_ontop(TRUE);
	else
		blist_set_ontop(FALSE);
}
Esempio n. 4
0
static gboolean plugin_unload(PurplePlugin *plugin, GError **error) {
	blist_set_dockable(FALSE);
	blist_set_ontop(FALSE);

	handle = NULL;

	return TRUE;
}
Esempio n. 5
0
static void blist_set_dockable(gboolean val) {
	if(val) {
		if(blist_ab == NULL && blist != NULL) {
			blist_ab = gtk_appbar_add(blist);
			gtk_appbar_add_dock_cb(blist_ab, blist_dock_cb);
		}
	} else {
		if(blist_ab != NULL) {
			gtk_appbar_remove(blist_ab);
			blist_ab = NULL;
		}

		if(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
			blist_set_ontop(TRUE);
		else
			blist_set_ontop(FALSE);
	}
}
Esempio n. 6
0
/* Listen for the first time the window stops being withdrawn */
static void blist_visible_cb(const char *pref, PurplePrefType type,
		gconstpointer value, gpointer user_data) {
	if(purple_prefs_get_bool(pref)) {
		gtk_appbar_dock(blist_ab,
			purple_prefs_get_int(PREF_DBLIST_SIDE));

		if(purple_prefs_get_int(PREF_BLIST_ON_TOP)
				== BLIST_TOP_DOCKED)
			blist_set_ontop(TRUE);

		/* We only need to be notified about this once */
		purple_prefs_disconnect_callback(blist_visible_cb_id);
	}
}