annotate finch/libgnt/gntwindow.c @ 18712:c65c4caa817a

When we get a presence of type="error" from the server that corresponds to a Jabber chat, only destroy/free/close/leave the chat room if the error happened while joining (and we were therefore never in the room). This fixes the following bug: 1. Join a room 2. Try to change your nickname to something that's being used by someone else 3. The server gives you an error message, but you're not actually kicked out of the room 4. Pidgin thinks you've been kicked out and won't let you send messages to the room, etc.
author Mark Doliner <mark@kingant.net>
date Sun, 29 Jul 2007 07:01:13 +0000
parents 08776fc5c06f
children 44b4e8bd759b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18049
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
1 /**
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
2 * GNT - The GLib Ncurses Toolkit
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
3 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
4 * GNT is the legal property of its developers, whose names are too numerous
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
6 * source distribution.
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
7 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
8 * This library is free software; you can redistribute it and/or modify
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
9 * it under the terms of the GNU General Public License as published by
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
11 * (at your option) any later version.
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
12 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
13 * This program is distributed in the hope that it will be useful,
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
16 * GNU General Public License for more details.
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
17 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
18 * You should have received a copy of the GNU General Public License
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
19 * along with this program; if not, write to the Free Software
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
21 */
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15817
diff changeset
22
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "gntstyle.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "gntwindow.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include <string.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 enum
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 {
17707
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
30 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
31 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
32 SIGS,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
17707
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
35 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
36
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 static GntBoxClass *parent_class = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 static void (*org_destroy)(GntWidget *widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 show_menu(GntBindable *bind, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 GntWindow *win = GNT_WINDOW(bind);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 if (win->menu) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 gnt_screen_menu_show(win->menu);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 gnt_window_destroy(GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 GntWindow *window = GNT_WINDOW(widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 if (window->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 gnt_widget_destroy(GNT_WIDGET(window->menu));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 org_destroy(widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 gnt_window_class_init(GntWindowClass *klass)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 GntBindableClass *bindable = GNT_BINDABLE_CLASS(klass);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 GntWidgetClass *wid_class = GNT_WIDGET_CLASS(klass);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 parent_class = GNT_BOX_CLASS(klass);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 org_destroy = wid_class->destroy;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 wid_class->destroy = gnt_window_destroy;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
17707
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
71 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
72 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
73 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
74 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
75 0,
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
76 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
77 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
78 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
79
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
80 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
81 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
82 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
83 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
84 0,
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
85 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
86 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
87 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
88
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 gnt_bindable_class_register_action(bindable, "show-menu", show_menu,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 GNT_KEY_CTRL_O, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 gnt_bindable_register_binding(bindable, "show-menu", GNT_KEY_F10, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 GNTDEBUG;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 gnt_window_init(GTypeInstance *instance, gpointer class)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 GntWidget *widget = GNT_WIDGET(instance);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 GNTDEBUG;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 /******************************************************************************
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 * GntWindow API
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 *****************************************************************************/
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 GType
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 gnt_window_get_gtype(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 static GType type = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 if(type == 0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 static const GTypeInfo info = {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 sizeof(GntWindowClass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 NULL, /* base_init */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 NULL, /* base_finalize */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 (GClassInitFunc)gnt_window_class_init,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 NULL, /* class_finalize */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 NULL, /* class_data */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 sizeof(GntWindow),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 0, /* n_preallocs */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 gnt_window_init, /* instance_init */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 NULL /* value_table */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 type = g_type_register_static(GNT_TYPE_BOX,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 "GntWindow",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 &info, 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 return type;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 GntWidget *gnt_window_new()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 GntWidget *widget = g_object_new(GNT_TYPE_WINDOW, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 return widget;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 GntWidget *gnt_window_box_new(gboolean homo, gboolean vert)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 GntWidget *wid = gnt_window_new();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 GntBox *box = GNT_BOX(wid);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 box->homogeneous = homo;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 box->vertical = vert;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 box->alignment = vert ? GNT_ALIGN_LEFT : GNT_ALIGN_MID;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 return wid;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155
17707
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
156 void
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
157 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
158 {
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
159 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
160 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
161 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
162 }
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
163
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
164 void
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
165 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
166 {
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
167 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
168 }
3c3fc1432a01 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
169
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 void gnt_window_set_menu(GntWindow *window, GntMenu *menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 /* If a menu already existed, then destroy that first. */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 if (window->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 gnt_widget_destroy(GNT_WIDGET(window->menu));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 window->menu = menu;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177