comparison plugins/gestures/gestures.c @ 5676:dae79aefac8d

[gaim-migrate @ 6094] I've been meaning to do this for a LONG time. The conversation API now follows the naming convention of the rest of the new APIs. I'll get some g_return_*_if_fail() checks in there soon. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 02 Jun 2003 21:51:06 +0000
parents 2c4c975620f0
children c97d9ca044a7
comparison
equal deleted inserted replaced
5675:17e345ffeddb 5676:dae79aefac8d
28 #define GESTURES_PLUGIN_ID "gtk-gestures" 28 #define GESTURES_PLUGIN_ID "gtk-gestures"
29 29
30 static void 30 static void
31 stroke_close(GtkWidget *widget, void *data) 31 stroke_close(GtkWidget *widget, void *data)
32 { 32 {
33 struct gaim_conversation *conv; 33 GaimConversation *conv;
34 struct gaim_gtk_conversation *gtkconv; 34 GaimGtkConversation *gtkconv;
35 35
36 conv = (struct gaim_conversation *)data; 36 conv = (GaimConversation *)data;
37 37
38 /* Double-check */ 38 /* Double-check */
39 if (!GAIM_IS_GTK_CONVERSATION(conv)) 39 if (!GAIM_IS_GTK_CONVERSATION(conv))
40 return; 40 return;
41 41
46 } 46 }
47 47
48 static void 48 static void
49 stroke_prev_tab(GtkWidget *widget, void *data) 49 stroke_prev_tab(GtkWidget *widget, void *data)
50 { 50 {
51 struct gaim_conversation *conv; 51 GaimConversation *conv;
52 struct gaim_window *win; 52 GaimWindow *win;
53 unsigned int index; 53 unsigned int index;
54 54
55 conv = (struct gaim_conversation *)data; 55 conv = (GaimConversation *)data;
56 win = gaim_conversation_get_window(conv); 56 win = gaim_conversation_get_window(conv);
57 index = gaim_conversation_get_index(conv); 57 index = gaim_conversation_get_index(conv);
58 58
59 if (index == 0) 59 if (index == 0)
60 index = gaim_window_get_conversation_count(win) - 1; 60 index = gaim_window_get_conversation_count(win) - 1;
65 } 65 }
66 66
67 static void 67 static void
68 stroke_next_tab(GtkWidget *widget, void *data) 68 stroke_next_tab(GtkWidget *widget, void *data)
69 { 69 {
70 struct gaim_conversation *conv; 70 GaimConversation *conv;
71 struct gaim_window *win; 71 GaimWindow *win;
72 unsigned int index; 72 unsigned int index;
73 73
74 conv = (struct gaim_conversation *)data; 74 conv = (GaimConversation *)data;
75 win = gaim_conversation_get_window(conv); 75 win = gaim_conversation_get_window(conv);
76 index = gaim_conversation_get_index(conv); 76 index = gaim_conversation_get_index(conv);
77 77
78 if (index == gaim_window_get_conversation_count(win) - 1) 78 if (index == gaim_window_get_conversation_count(win) - 1)
79 index = 0; 79 index = 0;
84 } 84 }
85 85
86 void 86 void
87 stroke_new_win(GtkWidget *widget, void *data) 87 stroke_new_win(GtkWidget *widget, void *data)
88 { 88 {
89 struct gaim_window *new_win, *old_win; 89 GaimWindow *new_win, *old_win;
90 struct gaim_conversation *conv; 90 GaimConversation *conv;
91 91
92 conv = (struct gaim_conversation *)data; 92 conv = (GaimConversation *)data;
93 old_win = gaim_conversation_get_window(conv); 93 old_win = gaim_conversation_get_window(conv);
94 94
95 if (gaim_window_get_conversation_count(old_win) <= 1) 95 if (gaim_window_get_conversation_count(old_win) <= 1)
96 return; 96 return;
97 97
102 102
103 gaim_window_show(new_win); 103 gaim_window_show(new_win);
104 } 104 }
105 105
106 static void 106 static void
107 attach_signals(struct gaim_conversation *conv) 107 attach_signals(GaimConversation *conv)
108 { 108 {
109 struct gaim_gtk_conversation *gtkconv; 109 GaimGtkConversation *gtkconv;
110 110
111 gtkconv = GAIM_GTK_CONVERSATION(conv); 111 gtkconv = GAIM_GTK_CONVERSATION(conv);
112 112
113 gstroke_enable(gtkconv->imhtml); 113 gstroke_enable(gtkconv->imhtml);
114 gstroke_signal_connect(gtkconv->imhtml, "14789", stroke_close, conv); 114 gstroke_signal_connect(gtkconv->imhtml, "14789", stroke_close, conv);
122 } 122 }
123 123
124 static void 124 static void
125 new_conv_cb(char *who) 125 new_conv_cb(char *who)
126 { 126 {
127 struct gaim_conversation *conv; 127 GaimConversation *conv;
128 128
129 conv = gaim_find_conversation(who); 129 conv = gaim_find_conversation(who);
130 130
131 if (conv == NULL || !GAIM_IS_GTK_CONVERSATION(conv)) 131 if (conv == NULL || !GAIM_IS_GTK_CONVERSATION(conv))
132 return; 132 return;
151 } 151 }
152 152
153 static gboolean 153 static gboolean
154 plugin_load(GaimPlugin *plugin) 154 plugin_load(GaimPlugin *plugin)
155 { 155 {
156 struct gaim_conversation *conv; 156 GaimConversation *conv;
157 GList *l; 157 GList *l;
158 158
159 for (l = gaim_get_conversations(); l != NULL; l = l->next) { 159 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
160 conv = (struct gaim_conversation *)l->data; 160 conv = (GaimConversation *)l->data;
161 161
162 if (!GAIM_IS_GTK_CONVERSATION(conv)) 162 if (!GAIM_IS_GTK_CONVERSATION(conv))
163 continue; 163 continue;
164 164
165 attach_signals(conv); 165 attach_signals(conv);
171 } 171 }
172 172
173 static gboolean 173 static gboolean
174 plugin_unload(GaimPlugin *plugin) 174 plugin_unload(GaimPlugin *plugin)
175 { 175 {
176 struct gaim_conversation *conv; 176 GaimConversation *conv;
177 struct gaim_gtk_conversation *gtkconv; 177 GaimGtkConversation *gtkconv;
178 GList *l; 178 GList *l;
179 179
180 for (l = gaim_get_conversations(); l != NULL; l = l->next) { 180 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
181 conv = (struct gaim_conversation *)l->data; 181 conv = (GaimConversation *)l->data;
182 182
183 if (!GAIM_IS_GTK_CONVERSATION(conv)) 183 if (!GAIM_IS_GTK_CONVERSATION(conv))
184 continue; 184 continue;
185 185
186 gtkconv = GAIM_GTK_CONVERSATION(conv); 186 gtkconv = GAIM_GTK_CONVERSATION(conv);