| 98 static void *pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, |
99 static void *pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, |
| 99 const char **subjects, |
100 const char **subjects, |
| 100 const char **froms, const char **tos, |
101 const char **froms, const char **tos, |
| 101 const char **urls); |
102 const char **urls); |
| 102 |
103 |
| |
104 static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle); |
| |
105 |
| 103 static void |
106 static void |
| 104 message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
107 message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
| 105 { |
108 { |
| 106 purple_notify_close(PURPLE_NOTIFY_MESSAGE, widget); |
109 purple_notify_close(PURPLE_NOTIFY_MESSAGE, widget); |
| 107 } |
110 } |
| 142 |
145 |
| 143 if (id == GTK_RESPONSE_ACCEPT) |
146 if (id == GTK_RESPONSE_ACCEPT) |
| 144 purple_notify_uri(NULL, data->url); |
147 purple_notify_uri(NULL, data->url); |
| 145 |
148 |
| 146 gtk_tree_store_remove(dialog->treemodel, &iter); |
149 gtk_tree_store_remove(dialog->treemodel, &iter); |
| 147 purple_notify_close(PURPLE_NOTIFY_EMAILS, data); |
150 if (data->purple_has_handle) |
| |
151 purple_notify_close(PURPLE_NOTIFY_EMAILS, data); |
| |
152 else |
| |
153 pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); |
| 148 } |
154 } |
| 149 } |
155 } |
| 150 gtk_widget_destroy(dialog->dialog); |
156 gtk_widget_destroy(dialog->dialog); |
| 151 g_free(dialog); |
157 g_free(dialog); |
| 152 mail_dialog = NULL; |
158 mail_dialog = NULL; |
| 463 |
469 |
| 464 icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); |
470 icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); |
| 465 |
471 |
| 466 if (new_n) { |
472 if (new_n) { |
| 467 data = g_new0(PidginNotifyMailData, 1); |
473 data = g_new0(PidginNotifyMailData, 1); |
| |
474 data->purple_has_handle = TRUE; |
| 468 gtk_tree_store_append(treemodel, &iter, NULL); |
475 gtk_tree_store_append(treemodel, &iter, NULL); |
| 469 } |
476 } |
| 470 |
477 |
| 471 if (url != NULL) |
478 if (url != NULL) |
| 472 data->url = g_strdup(url); |
479 data->url = g_strdup(url); |
| 477 PIDGIN_MAIL_DATA, data, |
484 PIDGIN_MAIL_DATA, data, |
| 478 -1); |
485 -1); |
| 479 data->iter = iter; /* XXX: Do we use this for something? */ |
486 data->iter = iter; /* XXX: Do we use this for something? */ |
| 480 data->account = account; |
487 data->account = account; |
| 481 data->count = count; |
488 data->count = count; |
| |
489 |
| |
490 /* Why is this necessary?*/ |
| 482 gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter, |
491 gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter, |
| 483 PIDGIN_MAIL_DATA, &data, -1); |
492 PIDGIN_MAIL_DATA, &data, -1); |
| 484 if (icon) |
493 if (icon) |
| 485 g_object_unref(icon); |
494 g_object_unref(icon); |
| 486 return data; |
495 return data; |
| 538 #undef SAFE |
547 #undef SAFE |
| 539 g_free(to_text); |
548 g_free(to_text); |
| 540 g_free(from_text); |
549 g_free(from_text); |
| 541 g_free(subject_text); |
550 g_free(subject_text); |
| 542 |
551 |
| |
552 /* If we don't keep track of this, will leak "data" for each of the notifications except the last */ |
| |
553 if (data) |
| |
554 data->purple_has_handle = FALSE; |
| 543 data = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE); |
555 data = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE); |
| 544 g_free(notification); |
556 g_free(notification); |
| 545 |
557 |
| 546 if (urls != NULL) |
558 if (urls != NULL) |
| 547 urls++; |
559 urls++; |
| 586 if (pixbuf) |
598 if (pixbuf) |
| 587 g_object_unref(pixbuf); |
599 g_object_unref(pixbuf); |
| 588 } else if (!GTK_WIDGET_HAS_FOCUS(dialog)) |
600 } else if (!GTK_WIDGET_HAS_FOCUS(dialog)) |
| 589 pidgin_set_urgent(GTK_WINDOW(dialog), TRUE); |
601 pidgin_set_urgent(GTK_WINDOW(dialog), TRUE); |
| 590 |
602 |
| 591 return NULL; |
603 return data; |
| 592 } |
604 } |
| 593 |
605 |
| 594 static gboolean |
606 static gboolean |
| 595 formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) |
607 formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) |
| 596 { |
608 { |
| 805 col_types[0] = GDK_TYPE_PIXBUF; |
817 col_types[0] = GDK_TYPE_PIXBUF; |
| 806 for (i = 1; i < col_num; i++) { |
818 for (i = 1; i < col_num; i++) { |
| 807 col_types[i] = G_TYPE_STRING; |
819 col_types[i] = G_TYPE_STRING; |
| 808 } |
820 } |
| 809 model = gtk_list_store_newv(col_num, col_types); |
821 model = gtk_list_store_newv(col_num, col_types); |
| |
822 g_free(col_types); |
| 810 |
823 |
| 811 /* Setup the scrolled window containing the treeview */ |
824 /* Setup the scrolled window containing the treeview */ |
| 812 sw = gtk_scrolled_window_new(NULL, NULL); |
825 sw = gtk_scrolled_window_new(NULL, NULL); |
| 813 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
826 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
| 814 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
827 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |