about summary refs log tree commit diff stats
path: root/config.def.h
blob: cca37dfc6d0045d04a5835cc316ab9e83555f6ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* See LICENSE file for copyright and license details. */

/* appearance */
static const char font[]            = "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[]     = "#cccccc";
static const char normfgcolor[]     = "#000000";
static const char selbordercolor[]  = "#0066ff";
static const char selbgcolor[]      = "#0066ff";
static const char selfgcolor[]      = "#ffffff";
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const Bool showbar           = True;     /* False means no bar */
static const Bool topbar            = True;     /* False means bottom bar */

/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };

static const Rule rules[] = {
	/* class      instance    title       tags mask     isfloating   monitor */
	{ "Gimp",     NULL,       NULL,       0,            True,        -1 },
	{ "Firefox",  NULL,       NULL,       1 << 8,       False,       -1 },
};

/* layout(s) */
static const float mfact      = 0.55; /* factor of master area size [0.05..0.95] */
static const Bool resizehints = True; /* False means respect size hints in tiled resizals */

static const Layout layouts[] = {
	/* symbol     arrange function */
	{ "[]=",      tile },    /* first entry is default */
	{ "><>",      NULL },    /* no layout function means floating behavior */
	{ "[M]",      monocle },
};

/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[]  = { "uxterm", NULL };

static Key keys[] = {
	/* modifier                     key        function        argument */
	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
	{ MODKEY,                       XK_b,      togglebar,      {0} },
	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
	{ MODKEY,                       XK_Return, zoom,           {0} },
	{ MODKEY,                       XK_Tab,    view,           {0} },
	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
	{ MODKEY,                       XK_space,  setlayout,      {0} },
	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
	TAGKEYS(                        XK_1,                      0)
	TAGKEYS(                        XK_2,                      1)
	TAGKEYS(                        XK_3,                      2)
	TAGKEYS(                        XK_4,                      3)
	TAGKEYS(                        XK_5,                      4)
	TAGKEYS(                        XK_6,                      5)
	TAGKEYS(                        XK_7,                      6)
	TAGKEYS(                        XK_8,                      7)
	TAGKEYS(                        XK_9,                      8)
	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
};

/* button definitions */
/* click can be a tag number (starting at 0),
 * ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
	/* click                event mask      button          function        argument */
	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
	{ ClkTagBar,            0,              Button1,        view,           {0} },
	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
};
_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; if (g_strcmp0(chatwin->barejid, barejid) == 0) { g_list_free(values); return chatwin; } } curr = g_list_next(curr); } g_list_free(values); return NULL; } ProfMucConfWin * wins_get_muc_conf(const char * const roomjid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (window->type == WIN_MUC_CONFIG) { ProfMucConfWin *confwin = (ProfMucConfWin*)window; if (g_strcmp0(confwin->roomjid, roomjid) == 0) { g_list_free(values); return confwin; } } curr = g_list_next(curr); } g_list_free(values); return NULL; } ProfMucWin * wins_get_muc(const char * const roomjid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*)window; if (g_strcmp0(mucwin->roomjid, roomjid) == 0) { g_list_free(values); return mucwin; } } curr = g_list_next(curr); } g_list_free(values); return NULL; } ProfPrivateWin * wins_get_private(const char * const fulljid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (window->type == WIN_PRIVATE) { ProfPrivateWin *privatewin = (ProfPrivateWin*)window; if (g_strcmp0(privatewin->fulljid, fulljid) == 0) { g_list_free(values); return privatewin; } } curr = g_list_next(curr); } g_list_free(values); return NULL; } ProfWin * wins_get_current(void) { if (windows != NULL) { return g_hash_table_lookup(windows, GINT_TO_POINTER(current)); } else { return NULL; } } ProfChatWin * wins_get_current_chat(void) { if (windows) { ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current)); if (window) { ProfChatWin *chatwin = (ProfChatWin*)window; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); return chatwin; } else { return NULL; } } else { return NULL; } } ProfMucWin * wins_get_current_muc(void) { if (windows) { ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current)); if (window) { ProfMucWin *mucwin = (ProfMucWin*)window; assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); return mucwin; } else { return NULL; } } else { return NULL; } } ProfPrivateWin * wins_get_current_private(void) { if (windows) { ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current)); if (window) { ProfPrivateWin *privatewin = (ProfPrivateWin*)window; assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK); return privatewin; } else { return NULL; } } else { return NULL; } } ProfMucConfWin * wins_get_current_muc_conf(void) { if (windows) { ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current)); if (window) { ProfMucConfWin *confwin = (ProfMucConfWin*)window; assert(confwin->memcheck == PROFCONFWIN_MEMCHECK); return confwin; } else { return NULL; } } else { return NULL; } } GList * wins_get_nums(void) { return g_hash_table_get_keys(windows); } void wins_set_current_by_num(int i) { ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(i)); if (window) { current = i; if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*) window; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); chatwin->unread = 0; } else if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*) window; assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); mucwin->unread = 0; } else if (window->type == WIN_PRIVATE) { ProfPrivateWin *privatewin = (ProfPrivateWin*) window; privatewin->unread = 0; } } } ProfWin * wins_get_by_num(int i) { return g_hash_table_lookup(windows, GINT_TO_POINTER(i)); } ProfWin * wins_get_next(void) { // get and sort win nums GList *keys = g_hash_table_get_keys(windows); keys = g_list_sort(keys, cmp_win_num); GList *curr = keys; // find our place in the list while (curr != NULL) { if (current == GPOINTER_TO_INT(curr->data)) { break; } curr = g_list_next(curr); } // if there is a next window return it curr = g_list_next(curr); if (curr != NULL) { int next = GPOINTER_TO_INT(curr->data); g_list_free(keys); return wins_get_by_num(next); // otherwise return the first window (console) } else { g_list_free(keys); return wins_get_console(); } } ProfWin * wins_get_previous(void) { // get and sort win nums GList *keys = g_hash_table_get_keys(windows); keys = g_list_sort(keys, cmp_win_num); GList *curr = keys; // find our place in the list while (curr != NULL) { if (current == GPOINTER_TO_INT(curr->data)) { break; } curr = g_list_next(curr); } // if there is a previous window return it curr = g_list_previous(curr); if (curr != NULL) { int previous = GPOINTER_TO_INT(curr->data); g_list_free(keys); return wins_get_by_num(previous); // otherwise return the last window } else { int new_num = GPOINTER_TO_INT(g_list_last(keys)->data); g_list_free(keys); return wins_get_by_num(new_num); } } int wins_get_num(ProfWin *window) { GList *keys = g_hash_table_get_keys(windows); GList *curr = keys; while (curr != NULL) { gconstpointer num_p = curr->data; ProfWin *curr_win = g_hash_table_lookup(windows, num_p); if (curr_win == window) { g_list_free(keys); return GPOINTER_TO_INT(num_p); } curr = g_list_next(curr); } g_list_free(keys); return -1; } int wins_get_current_num(void) { return current; } void wins_close_current(void) { wins_close_by_num(current); } void wins_close_by_num(int i) { // console cannot be closed if (i != 1) { // go to console if closing current window if (i == current) { current = 1; ProfWin *window = wins_get_current(); win_update_virtual(window); } g_hash_table_remove(windows, GINT_TO_POINTER(i)); status_bar_inactive(i); } } void wins_clear_current(void) { ProfWin *window = wins_get_current(); werase(window->layout->win); win_update_virtual(window); } gboolean wins_is_current(ProfWin *window) { ProfWin *current_window = wins_get_current(); if (current_window == window) { return TRUE; } else { return FALSE; } } ProfWin * wins_new_xmlconsole(void) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); g_list_free(keys); ProfWin *newwin = win_create_xmlconsole(); g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin); return newwin; } ProfWin * wins_new_chat(const char * const barejid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); g_list_free(keys); ProfWin *newwin = win_create_chat(barejid); g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin); return newwin; } ProfWin * wins_new_muc(const char * const roomjid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); g_list_free(keys); ProfWin *newwin = win_create_muc(roomjid); g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin); return newwin; } ProfWin * wins_new_muc_config(const char * const roomjid, DataForm *form) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); g_list_free(keys); ProfWin *newwin = win_create_muc_config(roomjid, form); g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin); return newwin; } ProfWin * wins_new_private(const char * const fulljid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); g_list_free(keys); ProfWin *newwin = win_create_private(fulljid); g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin); return newwin; } int wins_get_total_unread(void) { int result = 0; GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; result += win_unread(window); curr = g_list_next(curr); } g_list_free(values); return result; } void wins_resize_all(void) { int cols = getmaxx(stdscr); GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; int subwin_cols = 0; if (window->layout->type == LAYOUT_SPLIT) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; if (layout->subwin) { if (window->type == WIN_CONSOLE) { subwin_cols = win_roster_cols(); } else if (window->type == WIN_MUC) { subwin_cols = win_occpuants_cols(); } wresize(layout->base.win, PAD_SIZE, cols - subwin_cols); wresize(layout->subwin, PAD_SIZE, subwin_cols); rosterwin_roster(); } else { wresize(layout->base.win, PAD_SIZE, cols); } } else { wresize(window->layout->win, PAD_SIZE, cols); } win_redraw(window); curr = g_list_next(curr); } g_list_free(values); ProfWin *current_win = wins_get_current(); win_update_virtual(current_win); } void wins_hide_subwin(ProfWin *window) { int rows, cols; getmaxyx(stdscr, rows, cols); win_hide_subwin(window); ProfWin *current_win = wins_get_current(); if ((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) { pnoutrefresh(current_win->layout->win, current_win->layout->y_pos, 0, 1, 0, rows-3, cols-1); } } void wins_show_subwin(ProfWin *window) { int rows, cols; getmaxyx(stdscr, rows, cols); int subwin_cols = 0; win_show_subwin(window); ProfWin *current_win = wins_get_current(); if (current_win->type == WIN_MUC) { ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout; subwin_cols = win_occpuants_cols(); pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); } else if (current_win->type == WIN_CONSOLE) { ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout; subwin_cols = win_roster_cols(); pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); } } ProfXMLWin * wins_get_xmlconsole(void) { GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (window->type == WIN_XML) { ProfXMLWin *xmlwin = (ProfXMLWin*)window; assert(xmlwin->memcheck == PROFXMLWIN_MEMCHECK); g_list_free(values); return xmlwin; } curr = g_list_next(curr); } g_list_free(values); return NULL; } GSList * wins_get_chat_recipients(void) { GSList *result = NULL; GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; result = g_slist_append(result, chatwin->barejid); } curr = g_list_next(curr); } g_list_free(values); return result; } GSList * wins_get_prune_wins(void) { GSList *result = NULL; GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (win_unread(window) == 0 && window->type != WIN_MUC && window->type != WIN_MUC_CONFIG && window->type != WIN_XML && window->type != WIN_CONSOLE) { result = g_slist_append(result, window); } curr = g_list_next(curr); } g_list_free(values); return result; } void wins_lost_connection(void) { GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; if (window->type != WIN_CONSOLE) { win_save_print(window, '-', NULL, 0, THEME_ERROR, "", "Lost connection."); // if current win, set current_win_dirty if (wins_is_current(window)) { win_update_virtual(window); } } curr = g_list_next(curr); } g_list_free(values); } gboolean wins_swap(int source_win, int target_win) { ProfWin *source = g_hash_table_lookup(windows, GINT_TO_POINTER(source_win)); if (source != NULL) { ProfWin *target = g_hash_table_lookup(windows, GINT_TO_POINTER(target_win)); // target window empty if (target == NULL) { g_hash_table_steal(windows, GINT_TO_POINTER(source_win)); status_bar_inactive(source_win); g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source); if (win_unread(source) > 0) { status_bar_new(target_win); } else { status_bar_active(target_win); } if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) { ui_switch_win(1); } return TRUE; // target window occupied } else { g_hash_table_steal(windows, GINT_TO_POINTER(source_win)); g_hash_table_steal(windows, GINT_TO_POINTER(target_win)); g_hash_table_insert(windows, GINT_TO_POINTER(source_win), target); g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source); if (win_unread(source) > 0) { status_bar_new(target_win); } else { status_bar_active(target_win); } if (win_unread(target) > 0) { status_bar_new(source_win); } else { status_bar_active(source_win); } if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) { ui_switch_win(1); } return TRUE; } } else { return FALSE; } } gboolean wins_tidy(void) { gboolean tidy_required = FALSE; // check for gaps GList *keys = g_hash_table_get_keys(windows); keys = g_list_sort(keys, cmp_win_num); // get last used GList *last = g_list_last(keys); int last_num = GPOINTER_TO_INT(last->data); // find first free num TODO - Will sort again int next_available = get_next_available_win_num(keys); // found gap (next available before last window) if (cmp_win_num(GINT_TO_POINTER(next_available), GINT_TO_POINTER(last_num)) < 0) { tidy_required = TRUE; } if (tidy_required) { status_bar_set_all_inactive(); GHashTable *new_windows = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)win_free); int num = 1; GList *curr = keys; while (curr != NULL) { ProfWin *window = g_hash_table_lookup(windows, curr->data); if (num == 10) { g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window); if (win_unread(window) > 0) { status_bar_new(0); } else { status_bar_active(0); } } else { g_hash_table_insert(new_windows, GINT_TO_POINTER(num), window); if (win_unread(window) > 0) { status_bar_new(num); } else { status_bar_active(num); } } num++; curr = g_list_next(curr); } windows = new_windows; current = 1; ui_switch_win(1); g_list_free(keys); return TRUE; } else { g_list_free(keys); return FALSE; } } GSList * wins_create_summary(void) { GSList *result = NULL; GList *keys = g_hash_table_get_keys(windows); keys = g_list_sort(keys, cmp_win_num); GList *curr = keys; while (curr != NULL) { ProfWin *window = g_hash_table_lookup(windows, curr->data); int ui_index = GPOINTER_TO_INT(curr->data); GString *chat_string; GString *priv_string; GString *muc_string; GString *muc_config_string; GString *xml_string; switch (window->type) { case WIN_CONSOLE: result = g_slist_append(result, strdup("1: Console")); break; case WIN_CHAT: chat_string = g_string_new(""); ProfChatWin *chatwin = (ProfChatWin*)window; PContact contact = roster_get_contact(chatwin->barejid); if (contact == NULL) { g_string_printf(chat_string, "%d: Chat %s", ui_index, chatwin->barejid); } else { const char *display_name = p_contact_name_or_jid(contact); g_string_printf(chat_string, "%d: Chat %s", ui_index, display_name); GString *chat_presence = g_string_new(""); g_string_printf(chat_presence, " - %s", p_contact_presence(contact)); g_string_append(chat_string, chat_presence->str); g_string_free(chat_presence, TRUE); } if (chatwin->unread > 0) { GString *chat_unread = g_string_new(""); g_string_printf(chat_unread, ", %d unread", chatwin->unread); g_string_append(chat_string, chat_unread->str); g_string_free(chat_unread, TRUE); } result = g_slist_append(result, strdup(chat_string->str)); g_string_free(chat_string, TRUE); break; case WIN_PRIVATE: priv_string = g_string_new(""); ProfPrivateWin *privatewin = (ProfPrivateWin*)window; g_string_printf(priv_string, "%d: Private %s", ui_index, privatewin->fulljid); if (privatewin->unread > 0) { GString *priv_unread = g_string_new(""); g_string_printf(priv_unread, ", %d unread", privatewin->unread); g_string_append(priv_string, priv_unread->str); g_string_free(priv_unread, TRUE); } result = g_slist_append(result, strdup(priv_string->str)); g_string_free(priv_string, TRUE); break; case WIN_MUC: muc_string = g_string_new(""); ProfMucWin *mucwin = (ProfMucWin*)window; g_string_printf(muc_string, "%d: Room %s", ui_index, mucwin->roomjid); if (mucwin->unread > 0) { GString *muc_unread = g_string_new(""); g_string_printf(muc_unread, ", %d unread", mucwin->unread); g_string_append(muc_string, muc_unread->str); g_string_free(muc_unread, TRUE); } result = g_slist_append(result, strdup(muc_string->str)); g_string_free(muc_string, TRUE); break; case WIN_MUC_CONFIG: muc_config_string = g_string_new(""); char *title = win_get_title(window); g_string_printf(muc_config_string, "%d: %s", ui_index, title); result = g_slist_append(result, strdup(muc_config_string->str)); g_string_free(muc_config_string, TRUE); free(title); break; case WIN_XML: xml_string = g_string_new(""); g_string_printf(xml_string, "%d: XML console", ui_index); result = g_slist_append(result, strdup(xml_string->str)); g_string_free(xml_string, TRUE); break; default: break; } curr = g_list_next(curr); } g_list_free(keys); return result; } void wins_destroy(void) { g_hash_table_destroy(windows); }