finch/libgnt/gntws.c

Wed, 07 May 2014 11:07:45 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Wed, 07 May 2014 11:07:45 +0200
changeset 36002
31a8779e91d4
parent 35379
ea1a0327001e
parent 35992
34a67264df99
permissions
-rw-r--r--

Merge release-2.x.y

28938
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
1 /*
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
2 * GNT - The GLib Ncurses Toolkit
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
3 *
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
4 * GNT is the legal property of its developers, whose names are too numerous
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
6 * source distribution.
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
7 *
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
8 * This library is free software; you can redistribute it and/or modify
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
9 * it under the terms of the GNU General Public License as published by
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
11 * (at your option) any later version.
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
12 *
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
13 * This program is distributed in the hope that it will be useful,
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
16 * GNU General Public License for more details.
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
17 *
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
18 * You should have received a copy of the GNU General Public License
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
19 * along with this program; if not, write to the Free Software
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
21 */
44d8d49a9293 Add missing copyright headers.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28937
diff changeset
22
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
23 #include <gmodule.h>
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
24
28937
5f87e66597d9 Fix showing umlauts etc. on non-utf8 locales.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22907
diff changeset
25 #include "gntinternal.h"
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
26 #include "gntbox.h"
16779
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16523
diff changeset
27 #include "gntwidget.h"
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16523
diff changeset
28 #include "gntwindow.h"
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
29 #include "gntwm.h"
16779
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16523
diff changeset
30 #include "gntws.h"
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
31
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
32 static void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
33 widget_hide(gpointer data, gpointer nodes)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
34 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
35 GntWidget *widget = GNT_WIDGET(data);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
36 GntNode *node = g_hash_table_lookup(nodes, widget);
16779
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16523
diff changeset
37 if (GNT_IS_WINDOW(widget))
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16523
diff changeset
38 gnt_window_workspace_hiding(GNT_WINDOW(widget));
22907
8186478f9ec3 Fix a possible crash when creating a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21240
diff changeset
39 if (node)
8186478f9ec3 Fix a possible crash when creating a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21240
diff changeset
40 hide_panel(node->panel);
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
41 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
42
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
43 static void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
44 widget_show(gpointer data, gpointer nodes)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
45 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
46 GntNode *node = g_hash_table_lookup(nodes, data);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
47 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(data), GNT_WIDGET_INVISIBLE);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
48 if (node) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
49 show_panel(node->panel);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
50 gnt_wm_copy_win(GNT_WIDGET(data), node);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
51 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
52 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
53
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
54 void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
55 gnt_ws_draw_taskbar(GntWS *ws, gboolean reposition)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
56 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
57 static WINDOW *taskbar = NULL;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
58 GList *iter;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
59 int n, width = 0;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
60 int i;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
61
18599
7e31405a2cbb Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18567
diff changeset
62 if (gnt_is_refugee())
7e31405a2cbb Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18567
diff changeset
63 return;
7e31405a2cbb Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18567
diff changeset
64
35992
34a67264df99 Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 28938
diff changeset
65 g_return_if_fail(ws != NULL);
34a67264df99 Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 28938
diff changeset
66
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
67 if (taskbar == NULL) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
68 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
69 } else if (reposition) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
70 int Y_MAX = getmaxy(stdscr) - 1;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
71 mvwin(taskbar, Y_MAX, 0);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
72 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
73
21240
b78eaddaae02 Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18599
diff changeset
74 wbkgdset(taskbar, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
75 werase(taskbar);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
76
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
77 n = g_list_length(ws->list);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
78 if (n)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
79 width = getmaxx(stdscr) / n;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
80
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
81 for (i = 0, iter = ws->list; iter; iter = iter->next, i++) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
82 GntWidget *w = iter->data;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
83 int color;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
84 const char *title;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
85
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
86 if (w == ws->ordered->data) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
87 /* This is the current window in focus */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
88 color = GNT_COLOR_TITLE;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
89 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
90 /* This is a window with the URGENT hint set */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
91 color = GNT_COLOR_URGENT;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
92 } else {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
93 color = GNT_COLOR_NORMAL;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
94 }
21240
b78eaddaae02 Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18599
diff changeset
95 wbkgdset(taskbar, '\0' | gnt_color_pair(color));
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
96 if (iter->next)
21240
b78eaddaae02 Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18599
diff changeset
97 mvwhline(taskbar, 0, width * i, ' ' | gnt_color_pair(color), width);
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
98 else
21240
b78eaddaae02 Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18599
diff changeset
99 mvwhline(taskbar, 0, width * i, ' ' | gnt_color_pair(color), getmaxx(stdscr) - width * i);
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
100 title = GNT_BOX(w)->title;
28937
5f87e66597d9 Fix showing umlauts etc. on non-utf8 locales.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22907
diff changeset
101 mvwprintw(taskbar, 0, width * i, "%s", title ? C_(title) : "<gnt>");
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
102 if (i)
21240
b78eaddaae02 Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18599
diff changeset
103 mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | gnt_color_pair(GNT_COLOR_NORMAL));
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
104 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
105 wrefresh(taskbar);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
106 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
107
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
108 static void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
109 gnt_ws_init(GTypeInstance *instance, gpointer class)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
110 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
111 GntWS *ws = GNT_WS(instance);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
112 ws->list = NULL;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
113 ws->ordered = NULL;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
114 ws->name = NULL;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
115 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
116
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
117 void gnt_ws_add_widget(GntWS *ws, GntWidget* wid)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
118 {
18302
44267a021f2d Notify a window when it loses focus because another window was moved to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18137
diff changeset
119 GntWidget *oldfocus;
44267a021f2d Notify a window when it loses focus because another window was moved to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18137
diff changeset
120 oldfocus = ws->ordered ? ws->ordered->data : NULL;
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
121 ws->list = g_list_append(ws->list, wid);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
122 ws->ordered = g_list_prepend(ws->ordered, wid);
18302
44267a021f2d Notify a window when it loses focus because another window was moved to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18137
diff changeset
123 if (oldfocus)
44267a021f2d Notify a window when it loses focus because another window was moved to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18137
diff changeset
124 gnt_widget_set_focus(oldfocus, FALSE);
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
125 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
126
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
127 void gnt_ws_remove_widget(GntWS *ws, GntWidget* wid)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
128 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
129 ws->list = g_list_remove(ws->list, wid);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
130 ws->ordered = g_list_remove(ws->ordered, wid);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
131 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
132
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
133 void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
134 gnt_ws_set_name(GntWS *ws, const gchar *name)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
135 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
136 g_free(ws->name);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
137 ws->name = g_strdup(name);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
138 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
139
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
140 void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
141 gnt_ws_hide(GntWS *ws, GHashTable *nodes)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
142 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
143 g_list_foreach(ws->ordered, widget_hide, nodes);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
144 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
145
18567
8dd8eae7a1aa Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18302
diff changeset
146 void gnt_ws_widget_hide(GntWidget *widget, GHashTable *nodes)
8dd8eae7a1aa Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18302
diff changeset
147 {
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
148 widget_hide(widget, nodes);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
149 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
150
18567
8dd8eae7a1aa Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18302
diff changeset
151 void gnt_ws_widget_show(GntWidget *widget, GHashTable *nodes)
8dd8eae7a1aa Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18302
diff changeset
152 {
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
153 widget_show(widget, nodes);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
154 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
155
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
156 void
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
157 gnt_ws_show(GntWS *ws, GHashTable *nodes)
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
158 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
159 GList *l;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
160 for (l = g_list_last(ws->ordered); l; l = g_list_previous(l))
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
161 widget_show(l->data, nodes);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
162 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
163
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
164 GType
35379
ea1a0327001e Rename _get_gtype() functions in libgnt to _get_type()
Ankit Vani <a@nevitus.org>
parents: 28938
diff changeset
165 gnt_ws_get_type(void)
16520
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
166 {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
167 static GType type = 0;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
168
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
169 if(type == 0) {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
170 static const GTypeInfo info = {
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
171 sizeof(GntWSClass),
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
172 NULL, /* base_init */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
173 NULL, /* base_finalize */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
174 NULL,
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
175 /*(GClassInitFunc)gnt_ws_class_init,*/
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
176 NULL,
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
177 NULL, /* class_data */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
178 sizeof(GntWS),
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
179 0, /* n_preallocs */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
180 gnt_ws_init, /* instance_init */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
181 NULL /* value_table */
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
182 };
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
183
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
184 type = g_type_register_static(GNT_TYPE_BINDABLE,
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
185 "GntWS",
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
186 &info, 0);
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
187 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
188
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
189 return type;
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
190 }
18efc8fca905 Forgot these...
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
191
18137
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
192 GntWS *gnt_ws_new(const char *name)
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
193 {
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
194 GntWS *ws = GNT_WS(g_object_new(GNT_TYPE_WS, NULL));
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
195 ws->name = g_strdup(name ? name : "(noname)");
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
196 return ws;
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
197 }
a8c54ed05eee F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16779
diff changeset
198
16523
d774ca89d340 Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16520
diff changeset
199 const char * gnt_ws_get_name(GntWS *ws)
d774ca89d340 Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16520
diff changeset
200 {
d774ca89d340 Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16520
diff changeset
201 return ws->name;
d774ca89d340 Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16520
diff changeset
202 }
d774ca89d340 Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16520
diff changeset
203

mercurial