Mercurial > pidgin
annotate finch/libgnt/gntwindow.c @ 32365:04f76a6d8888
Fix minor typo in ChangeLog.API
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 28 Nov 2011 08:33:30 +0000 |
parents | 88d889b54df4 |
children |
rev | line source |
---|---|
17928
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
1 /** |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
2 * GNT - The GLib Ncurses Toolkit |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
3 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
4 * GNT is the legal property of its developers, whose names are too numerous |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
6 * source distribution. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
7 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
8 * This library is free software; you can redistribute it and/or modify |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
11 * (at your option) any later version. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
12 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
16 * GNU General Public License for more details. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
17 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18069
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
17928
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
21 */ |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15817
diff
changeset
|
22 |
28836
88d889b54df4
Fix building finch & libgnt using older gcc or non-gcc compilers that do
Stu Tomlinson <stu@nosnilmot.com>
parents:
24921
diff
changeset
|
23 #include "gntinternal.h" |
15817 | 24 #include "gntstyle.h" |
25 #include "gntwindow.h" | |
26 | |
27 #include <string.h> | |
28 | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
29 struct _GntWindowPriv |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
30 { |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
31 GHashTable *accels; /* key => menuitem-id */ |
21454
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
32 GntWindowFlags flags; |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
33 }; |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
34 |
15817 | 35 enum |
36 { | |
17707
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
37 SIG_WORKSPACE_HIDE, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
38 SIG_WORKSPACE_SHOW, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
39 SIGS, |
15817 | 40 }; |
41 | |
17707
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
42 static guint signals[SIGS] = { 0 }; |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
43 |
15817 | 44 static GntBoxClass *parent_class = NULL; |
45 | |
46 static void (*org_destroy)(GntWidget *widget); | |
47 | |
48 static gboolean | |
49 show_menu(GntBindable *bind, GList *null) | |
50 { | |
51 GntWindow *win = GNT_WINDOW(bind); | |
52 if (win->menu) { | |
24921
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
53 GntMenu *menu = win->menu; |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
54 |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
55 gnt_screen_menu_show(menu); |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
56 if (menu->type == GNT_MENU_TOPLEVEL) { |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
57 GntMenuItem *item; |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
58 item = g_list_nth_data(menu->list, menu->selected); |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
59 if (item && gnt_menuitem_get_submenu(item)) { |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
60 gnt_widget_activate(GNT_WIDGET(menu)); |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
61 } |
253e5d3988ca
Show the submenu for the toplevel menu without requiring a keypress from the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21681
diff
changeset
|
62 } |
15817 | 63 return TRUE; |
64 } | |
65 return FALSE; | |
66 } | |
67 | |
68 static void | |
69 gnt_window_destroy(GntWidget *widget) | |
70 { | |
71 GntWindow *window = GNT_WINDOW(widget); | |
72 if (window->menu) | |
73 gnt_widget_destroy(GNT_WIDGET(window->menu)); | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
74 if (window->priv) { |
21681 | 75 if (window->priv->accels) |
76 g_hash_table_destroy(window->priv->accels); | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
77 g_free(window->priv); |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
78 } |
15817 | 79 org_destroy(widget); |
80 } | |
81 | |
82 static void | |
83 gnt_window_class_init(GntWindowClass *klass) | |
84 { | |
85 GntBindableClass *bindable = GNT_BINDABLE_CLASS(klass); | |
86 GntWidgetClass *wid_class = GNT_WIDGET_CLASS(klass); | |
87 parent_class = GNT_BOX_CLASS(klass); | |
88 | |
89 org_destroy = wid_class->destroy; | |
90 wid_class->destroy = gnt_window_destroy; | |
91 | |
17707
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
92 signals[SIG_WORKSPACE_HIDE] = |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
93 g_signal_new("workspace-hidden", |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
94 G_TYPE_FROM_CLASS(klass), |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
95 G_SIGNAL_RUN_LAST, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
96 0, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
97 NULL, NULL, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
98 g_cclosure_marshal_VOID__VOID, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
99 G_TYPE_NONE, 0); |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
100 |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
101 signals[SIG_WORKSPACE_SHOW] = |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
102 g_signal_new("workspace-shown", |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
103 G_TYPE_FROM_CLASS(klass), |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
104 G_SIGNAL_RUN_LAST, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
105 0, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
106 NULL, NULL, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
107 g_cclosure_marshal_VOID__VOID, |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
108 G_TYPE_NONE, 0); |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
109 |
15817 | 110 gnt_bindable_class_register_action(bindable, "show-menu", show_menu, |
111 GNT_KEY_CTRL_O, NULL); | |
112 gnt_bindable_register_binding(bindable, "show-menu", GNT_KEY_F10, NULL); | |
113 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); | |
114 | |
115 GNTDEBUG; | |
116 } | |
117 | |
118 static void | |
119 gnt_window_init(GTypeInstance *instance, gpointer class) | |
120 { | |
121 GntWidget *widget = GNT_WIDGET(instance); | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
122 GntWindow *win = GNT_WINDOW(widget); |
15817 | 123 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
124 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
125 win->priv = g_new0(GntWindowPriv, 1); |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
126 win->priv->accels = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
15817 | 127 GNTDEBUG; |
128 } | |
129 | |
130 /****************************************************************************** | |
131 * GntWindow API | |
132 *****************************************************************************/ | |
133 GType | |
134 gnt_window_get_gtype(void) | |
135 { | |
136 static GType type = 0; | |
137 | |
138 if(type == 0) | |
139 { | |
140 static const GTypeInfo info = { | |
141 sizeof(GntWindowClass), | |
142 NULL, /* base_init */ | |
143 NULL, /* base_finalize */ | |
144 (GClassInitFunc)gnt_window_class_init, | |
145 NULL, /* class_finalize */ | |
146 NULL, /* class_data */ | |
147 sizeof(GntWindow), | |
148 0, /* n_preallocs */ | |
149 gnt_window_init, /* instance_init */ | |
150 NULL /* value_table */ | |
151 }; | |
152 | |
153 type = g_type_register_static(GNT_TYPE_BOX, | |
154 "GntWindow", | |
155 &info, 0); | |
156 } | |
157 | |
158 return type; | |
159 } | |
160 | |
161 GntWidget *gnt_window_new() | |
162 { | |
163 GntWidget *widget = g_object_new(GNT_TYPE_WINDOW, NULL); | |
164 | |
165 return widget; | |
166 } | |
167 | |
168 GntWidget *gnt_window_box_new(gboolean homo, gboolean vert) | |
169 { | |
170 GntWidget *wid = gnt_window_new(); | |
171 GntBox *box = GNT_BOX(wid); | |
172 | |
173 box->homogeneous = homo; | |
174 box->vertical = vert; | |
175 box->alignment = vert ? GNT_ALIGN_LEFT : GNT_ALIGN_MID; | |
176 | |
177 return wid; | |
178 } | |
179 | |
17707
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
180 void |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
181 gnt_window_workspace_hiding(GntWindow *window) |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
182 { |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
183 if (window->menu) |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
184 gnt_widget_hide(GNT_WIDGET(window->menu)); |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
185 g_signal_emit(window, signals[SIG_WORKSPACE_HIDE], 0); |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
186 } |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
187 |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
188 void |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
189 gnt_window_workspace_showing(GntWindow *window) |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
190 { |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
191 g_signal_emit(window, signals[SIG_WORKSPACE_SHOW], 0); |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
192 } |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
15817
diff
changeset
|
193 |
15817 | 194 void gnt_window_set_menu(GntWindow *window, GntMenu *menu) |
195 { | |
196 /* If a menu already existed, then destroy that first. */ | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
197 const char *name = gnt_widget_get_name(GNT_WIDGET(window)); |
15817 | 198 if (window->menu) |
199 gnt_widget_destroy(GNT_WIDGET(window->menu)); | |
200 window->menu = menu; | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
201 if (name && window->priv) { |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
202 if (!gnt_style_read_menu_accels(name, window->priv->accels)) { |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
203 g_hash_table_destroy(window->priv->accels); |
21454
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
204 window->priv->accels = NULL; |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
205 } |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
206 } |
15817 | 207 } |
208 | |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
209 const char * gnt_window_get_accel_item(GntWindow *window, const char *key) |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
210 { |
21454
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
211 if (window->priv->accels) |
21212
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
212 return g_hash_table_lookup(window->priv->accels, key); |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
213 return NULL; |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
214 } |
b65f1bff6412
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
215 |
21454
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
216 void gnt_window_set_maximize(GntWindow *window, GntWindowFlags maximize) |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
217 { |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
218 if (maximize & GNT_WINDOW_MAXIMIZE_X) |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
219 window->priv->flags |= GNT_WINDOW_MAXIMIZE_X; |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
220 else |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
221 window->priv->flags &= ~GNT_WINDOW_MAXIMIZE_X; |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
222 |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
223 if (maximize & GNT_WINDOW_MAXIMIZE_Y) |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
224 window->priv->flags |= GNT_WINDOW_MAXIMIZE_Y; |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
225 else |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
226 window->priv->flags &= ~GNT_WINDOW_MAXIMIZE_Y; |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
227 } |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
228 |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
229 GntWindowFlags gnt_window_get_maximize(GntWindow *window) |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
230 { |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
231 return (window->priv->flags & (GNT_WINDOW_MAXIMIZE_X | GNT_WINDOW_MAXIMIZE_Y)); |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
232 } |
d78e440584e0
Add maximize flags for windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21212
diff
changeset
|
233 |