comparison plugins/notify.c @ 7118:bf630f7dfdcd

[gaim-migrate @ 7685] Here's a commit that I think will make faceprint happy. GaimWindow -> GaimConvWindow, GaimIm -> GaimConvIm, GaimChat -> GaimConvChat, GaimBlistChat -> GaimChat, and updated the API functions as well. Plugin authors are going to hunt me down and murder me. I can feel it.. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 02 Oct 2003 02:54:07 +0000
parents 083d1e4a9c78
children b4285106f396
comparison
equal deleted inserted replaced
7117:943085b0ff8b 7118:bf630f7dfdcd
82 82
83 /* notification set/unset */ 83 /* notification set/unset */
84 static int notify(GaimConversation *conv, gboolean increment); 84 static int notify(GaimConversation *conv, gboolean increment);
85 static gboolean unnotify(GaimConversation *conv, gboolean reset); 85 static gboolean unnotify(GaimConversation *conv, gboolean reset);
86 static int unnotify_cb(GtkWidget *widget, GaimConversation *conv); 86 static int unnotify_cb(GtkWidget *widget, GaimConversation *conv);
87 static void renotify(GaimWindow *gaimwin); 87 static void renotify(GaimConvWindow *gaimwin);
88 88
89 /* gtk widget callbacks for prefs panel */ 89 /* gtk widget callbacks for prefs panel */
90 static void type_toggle_cb(GtkWidget *widget, gpointer data); 90 static void type_toggle_cb(GtkWidget *widget, gpointer data);
91 static void method_toggle_cb(GtkWidget *widget, gpointer data); 91 static void method_toggle_cb(GtkWidget *widget, gpointer data);
92 static void notify_toggle_cb(GtkWidget *widget, gpointer data); 92 static void notify_toggle_cb(GtkWidget *widget, gpointer data);
108 /****************************************/ 108 /****************************************/
109 109
110 static int 110 static int
111 notify(GaimConversation *conv, gboolean increment) 111 notify(GaimConversation *conv, gboolean increment)
112 { 112 {
113 GaimWindow *gaimwin = NULL; 113 GaimConvWindow *gaimwin = NULL;
114 GaimGtkWindow *gtkwin = NULL; 114 GaimGtkWindow *gtkwin = NULL;
115 /* 115 /*
116 Window focus_return; 116 Window focus_return;
117 */ 117 */
118 gint count; 118 gint count;
137 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); 137 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL);
138 138
139 /* TODO need to test these different levels of having focus 139 /* TODO need to test these different levels of having focus
140 * only still need to test the window has focus, but tab doesn't one */ 140 * only still need to test the window has focus, but tab doesn't one */
141 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || 141 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ||
142 (has_focus && gaim_window_get_active_conversation(gaimwin) != conv) || 142 (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) ||
143 !has_focus) { 143 !has_focus) {
144 if (increment) { 144 if (increment) {
145 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")); 145 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count"));
146 count++; 146 count++;
147 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count)); 147 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count));
165 static gboolean 165 static gboolean
166 unnotify(GaimConversation *conv, gboolean reset) 166 unnotify(GaimConversation *conv, gboolean reset)
167 { 167 {
168 GaimConversation *active_conv = NULL; 168 GaimConversation *active_conv = NULL;
169 GaimGtkWindow *gtkwin = NULL; 169 GaimGtkWindow *gtkwin = NULL;
170 GaimWindow *gaimwin = NULL; 170 GaimConvWindow *gaimwin = NULL;
171 gint count; 171 gint count;
172 172
173 if (conv == NULL) 173 if (conv == NULL)
174 return FALSE; 174 return FALSE;
175 175
176 gaimwin = gaim_conversation_get_window(conv); 176 gaimwin = gaim_conversation_get_window(conv);
177 gtkwin = GAIM_GTK_WINDOW(gaimwin); 177 gtkwin = GAIM_GTK_WINDOW(gaimwin);
178 active_conv = gaim_window_get_active_conversation(gaimwin); 178 active_conv = gaim_conv_window_get_active_conversation(gaimwin);
179 179
180 /* This should mean that there is no notification on the window */ 180 /* This should mean that there is no notification on the window */
181 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); 181 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count"));
182 if (count == 0) 182 if (count == 0)
183 return FALSE; 183 return FALSE;
209 209
210 return 0; 210 return 0;
211 } 211 }
212 212
213 static void 213 static void
214 renotify(GaimWindow *gaimwin) 214 renotify(GaimConvWindow *gaimwin)
215 { 215 {
216 GList *convs = NULL; 216 GList *convs = NULL;
217 217
218 218
219 for (convs = gaim_window_get_conversations(gaimwin); 219 for (convs = gaim_conv_window_get_conversations(gaimwin);
220 convs != NULL; convs = convs->next) { 220 convs != NULL; convs = convs->next) {
221 GaimGtkWindow *gtkwin = NULL; 221 GaimGtkWindow *gtkwin = NULL;
222 int count; 222 int count;
223 223
224 gtkwin = GAIM_GTK_WINDOW(gaimwin); 224 gtkwin = GAIM_GTK_WINDOW(gaimwin);
356 } 356 }
357 357
358 static void 358 static void
359 conv_created(GaimConversation *conv) 359 conv_created(GaimConversation *conv)
360 { 360 {
361 GaimWindow *gaimwin = NULL; 361 GaimConvWindow *gaimwin = NULL;
362 GaimGtkWindow *gtkwin = NULL; 362 GaimGtkWindow *gtkwin = NULL;
363 363
364 gaimwin = gaim_conversation_get_window(conv); 364 gaimwin = gaim_conversation_get_window(conv);
365 365
366 if (gaimwin == NULL) 366 if (gaimwin == NULL)
376 } 376 }
377 377
378 static void 378 static void
379 chat_join(GaimConversation *conv) 379 chat_join(GaimConversation *conv)
380 { 380 {
381 GaimWindow *gaimwin = NULL; 381 GaimConvWindow *gaimwin = NULL;
382 GaimGtkWindow *gtkwin = NULL; 382 GaimGtkWindow *gtkwin = NULL;
383 383
384 gaimwin = gaim_conversation_get_window(conv); 384 gaimwin = gaim_conversation_get_window(conv);
385 385
386 if (gaimwin == NULL) 386 if (gaimwin == NULL)
397 397
398 #if 0 398 #if 0
399 static void 399 static void
400 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) 400 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv)
401 { 401 {
402 GaimWindow *gaimwin = NULL; 402 GaimConvWindow *gaimwin = NULL;
403 GaimGtkWindow *gtkwin = NULL; 403 GaimGtkWindow *gtkwin = NULL;
404 /* 404 /*
405 gint count; 405 gint count;
406 */ 406 */
407 gaim_debug(GAIM_DEBUG_INFO, "notify", "conv_switch\n"); 407 gaim_debug(GAIM_DEBUG_INFO, "notify", "conv_switch\n");