Exemplo n.º 1
0
void windows_layout_save(void)
{
	CONFIG_NODE *node;
	GSList *sorted;

	iconfig_set_str(NULL, "windows", NULL);
	node = iconfig_node_traverse("windows", TRUE);

	sorted = windows_get_sorted();
	g_slist_foreach(sorted, (GFunc) window_save, node);
	g_slist_free(sorted);
	signal_emit("layout save", 0);

	printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
		    TXT_WINDOWS_LAYOUT_SAVED);
}
Exemplo n.º 2
0
/* SYNTAX: WINDOW LIST */
static void cmd_window_list(void)
{
	GSList *tmp, *sorted;
	char *levelstr;

	sorted = windows_get_sorted();
	printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_HEADER);
	for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
		WINDOW_REC *rec = tmp->data;

		levelstr = bits2level(rec->level);
		printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_LINE,
			    rec->refnum, rec->name == NULL ? "" : rec->name,
			    rec->active == NULL ? "" : rec->active->visible_name,
			    rec->active_server == NULL ? "" : ((SERVER_REC *) rec->active_server)->tag,
			    levelstr);
		g_free(levelstr);
	}
	g_slist_free(sorted);
        printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_FOOTER);
}
Exemplo n.º 3
0
void window_item_create(WI_ITEM_REC *item, int automatic)
{
	WINDOW_REC *window;
        WINDOW_BIND_REC *bind;
	GSList *tmp, *sorted;
	int clear_waiting, reuse_unused_windows;

	g_return_if_fail(item != NULL);

	reuse_unused_windows = settings_get_bool("reuse_unused_windows");

	clear_waiting = TRUE;
	window = NULL;
        sorted = windows_get_sorted();
	for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
		WINDOW_REC *rec = tmp->data;

                /* is item bound to this window? */
		if (item->server != NULL) {
			bind = window_bind_find(rec, item->server->tag,
						item->visible_name);
			if (bind != NULL) {
                                if (!bind->sticky)
					window_bind_destroy(rec, bind);
				window = rec;
				clear_waiting = FALSE;
				break;
			}
		}

		/* use this window IF:
		     - reuse_unused_windows is ON
		     - window has no existing items
		     - window has no name
		     - window has no sticky binds (/LAYOUT SAVEd)
		     - we already haven't found "good enough" window,
		       except if
                         - this is the active window
                         - old window had some temporary bounds and this
			   one doesn't
		     */
		if (reuse_unused_windows && rec->items == NULL &&
		    rec->name == NULL && !window_bind_has_sticky(rec) &&
		    (window == NULL || rec == active_win ||
		     window->bound_items != NULL))
			window = rec;
	}
        g_slist_free(sorted);

        if (window == NULL && !settings_get_bool("autocreate_windows")) {
                /* never create new windows automatically */
                window = active_win;
        }

	if (window == NULL) {
		/* create new window to use */
		if (settings_get_bool("autocreate_split_windows")) {
			signal_emit("gui window create override", 1,
				    GINT_TO_POINTER(0));
		}
		window = window_create(item, automatic);
	} else {
		/* use existing window */
		window_item_add(window, item, automatic);
	}

	if (clear_waiting)
                window_bind_remove_unsticky(window);
}