Mercurial > pidgin.yaz
comparison finch/libgnt/gntwindow.c @ 16731:3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Sat, 12 May 2007 23:58:11 +0000 |
parents | 0e3a8505ebbe |
children | 08776fc5c06f |
comparison
equal
deleted
inserted
replaced
16730:8eed567eee39 | 16731:3c3fc1432a01 |
---|---|
3 | 3 |
4 #include <string.h> | 4 #include <string.h> |
5 | 5 |
6 enum | 6 enum |
7 { | 7 { |
8 SIGS = 1, | 8 SIG_WORKSPACE_HIDE, |
9 SIG_WORKSPACE_SHOW, | |
10 SIGS, | |
9 }; | 11 }; |
12 | |
13 static guint signals[SIGS] = { 0 }; | |
10 | 14 |
11 static GntBoxClass *parent_class = NULL; | 15 static GntBoxClass *parent_class = NULL; |
12 | 16 |
13 static void (*org_destroy)(GntWidget *widget); | 17 static void (*org_destroy)(GntWidget *widget); |
14 | 18 |
39 GntWidgetClass *wid_class = GNT_WIDGET_CLASS(klass); | 43 GntWidgetClass *wid_class = GNT_WIDGET_CLASS(klass); |
40 parent_class = GNT_BOX_CLASS(klass); | 44 parent_class = GNT_BOX_CLASS(klass); |
41 | 45 |
42 org_destroy = wid_class->destroy; | 46 org_destroy = wid_class->destroy; |
43 wid_class->destroy = gnt_window_destroy; | 47 wid_class->destroy = gnt_window_destroy; |
48 | |
49 signals[SIG_WORKSPACE_HIDE] = | |
50 g_signal_new("workspace-hidden", | |
51 G_TYPE_FROM_CLASS(klass), | |
52 G_SIGNAL_RUN_LAST, | |
53 0, | |
54 NULL, NULL, | |
55 g_cclosure_marshal_VOID__VOID, | |
56 G_TYPE_NONE, 0); | |
57 | |
58 signals[SIG_WORKSPACE_SHOW] = | |
59 g_signal_new("workspace-shown", | |
60 G_TYPE_FROM_CLASS(klass), | |
61 G_SIGNAL_RUN_LAST, | |
62 0, | |
63 NULL, NULL, | |
64 g_cclosure_marshal_VOID__VOID, | |
65 G_TYPE_NONE, 0); | |
44 | 66 |
45 gnt_bindable_class_register_action(bindable, "show-menu", show_menu, | 67 gnt_bindable_class_register_action(bindable, "show-menu", show_menu, |
46 GNT_KEY_CTRL_O, NULL); | 68 GNT_KEY_CTRL_O, NULL); |
47 gnt_bindable_register_binding(bindable, "show-menu", GNT_KEY_F10, NULL); | 69 gnt_bindable_register_binding(bindable, "show-menu", GNT_KEY_F10, NULL); |
48 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); | 70 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); |
107 box->alignment = vert ? GNT_ALIGN_LEFT : GNT_ALIGN_MID; | 129 box->alignment = vert ? GNT_ALIGN_LEFT : GNT_ALIGN_MID; |
108 | 130 |
109 return wid; | 131 return wid; |
110 } | 132 } |
111 | 133 |
134 void | |
135 gnt_window_workspace_hiding(GntWindow *window) | |
136 { | |
137 if (window->menu) | |
138 gnt_widget_hide(GNT_WIDGET(window->menu)); | |
139 g_signal_emit(window, signals[SIG_WORKSPACE_HIDE], 0); | |
140 } | |
141 | |
142 void | |
143 gnt_window_workspace_showing(GntWindow *window) | |
144 { | |
145 g_signal_emit(window, signals[SIG_WORKSPACE_SHOW], 0); | |
146 } | |
147 | |
112 void gnt_window_set_menu(GntWindow *window, GntMenu *menu) | 148 void gnt_window_set_menu(GntWindow *window, GntMenu *menu) |
113 { | 149 { |
114 /* If a menu already existed, then destroy that first. */ | 150 /* If a menu already existed, then destroy that first. */ |
115 if (window->menu) | 151 if (window->menu) |
116 gnt_widget_destroy(GNT_WIDGET(window->menu)); | 152 gnt_widget_destroy(GNT_WIDGET(window->menu)); |