comparison finch/libgnt/gntwindow.c @ 21454:d78e440584e0

Add maximize flags for windows.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 12 Nov 2007 17:13:44 +0000
parents b65f1bff6412
children 261fd722db1f
comparison
equal deleted inserted replaced
21453:93e69f29bc5f 21454:d78e440584e0
26 #include <string.h> 26 #include <string.h>
27 27
28 struct _GntWindowPriv 28 struct _GntWindowPriv
29 { 29 {
30 GHashTable *accels; /* key => menuitem-id */ 30 GHashTable *accels; /* key => menuitem-id */
31 GntWindowFlags flags;
31 }; 32 };
32 33
33 enum 34 enum
34 { 35 {
35 SIG_WORKSPACE_HIDE, 36 SIG_WORKSPACE_HIDE,
187 gnt_widget_destroy(GNT_WIDGET(window->menu)); 188 gnt_widget_destroy(GNT_WIDGET(window->menu));
188 window->menu = menu; 189 window->menu = menu;
189 if (name && window->priv) { 190 if (name && window->priv) {
190 if (!gnt_style_read_menu_accels(name, window->priv->accels)) { 191 if (!gnt_style_read_menu_accels(name, window->priv->accels)) {
191 g_hash_table_destroy(window->priv->accels); 192 g_hash_table_destroy(window->priv->accels);
192 g_free(window->priv); 193 window->priv->accels = NULL;
193 window->priv = NULL;
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 const char * gnt_window_get_accel_item(GntWindow *window, const char *key) 198 const char * gnt_window_get_accel_item(GntWindow *window, const char *key)
199 { 199 {
200 if (window->priv) 200 if (window->priv->accels)
201 return g_hash_table_lookup(window->priv->accels, key); 201 return g_hash_table_lookup(window->priv->accels, key);
202 return NULL; 202 return NULL;
203 } 203 }
204 204
205 void gnt_window_set_maximize(GntWindow *window, GntWindowFlags maximize)
206 {
207 if (maximize & GNT_WINDOW_MAXIMIZE_X)
208 window->priv->flags |= GNT_WINDOW_MAXIMIZE_X;
209 else
210 window->priv->flags &= ~GNT_WINDOW_MAXIMIZE_X;
211
212 if (maximize & GNT_WINDOW_MAXIMIZE_Y)
213 window->priv->flags |= GNT_WINDOW_MAXIMIZE_Y;
214 else
215 window->priv->flags &= ~GNT_WINDOW_MAXIMIZE_Y;
216 }
217
218 GntWindowFlags gnt_window_get_maximize(GntWindow *window)
219 {
220 return (window->priv->flags & (GNT_WINDOW_MAXIMIZE_X | GNT_WINDOW_MAXIMIZE_Y));
221 }
222