Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 13147:21ee457d479c
[gaim-migrate @ 15510]
Part of SF Patch #1413778 from Sadrul
"It also makes the gtkconv the handle for the notify/
request dialogs, which I think makes more sense."
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 07 Feb 2006 02:33:17 +0000 |
parents | 05ef36447131 |
children | f09c6e8df82c |
comparison
equal
deleted
inserted
replaced
13146:a3c1112bb190 | 13147:21ee457d479c |
---|---|
738 else | 738 else |
739 return; | 739 return; |
740 | 740 |
741 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) | 741 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) |
742 { | 742 { |
743 gaim_notify_error(NULL, NULL, | 743 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL, |
744 _("That buddy is not on the same protocol as this " | 744 _("That buddy is not on the same protocol as this " |
745 "chat."), NULL); | 745 "chat."), NULL); |
746 } | 746 } |
747 else | 747 else |
748 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); | 748 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); |
758 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, | 758 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
759 &protocol, &username, NULL)) | 759 &protocol, &username, NULL)) |
760 { | 760 { |
761 if (account == NULL) | 761 if (account == NULL) |
762 { | 762 { |
763 gaim_notify_error(NULL, NULL, | 763 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL, |
764 _("You are not currently signed on with an account that " | 764 _("You are not currently signed on with an account that " |
765 "can invite that buddy."), NULL); | 765 "can invite that buddy."), NULL); |
766 } | 766 } |
767 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) | 767 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) |
768 { | 768 { |
769 gaim_notify_error(NULL, NULL, | 769 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL, |
770 _("That buddy is not on the same protocol as this " | 770 _("That buddy is not on the same protocol as this " |
771 "chat."), NULL); | 771 "chat."), NULL); |
772 } | 772 } |
773 else | 773 else |
774 { | 774 { |
940 FILE *fp; | 940 FILE *fp; |
941 const char *name; | 941 const char *name; |
942 gchar *text; | 942 gchar *text; |
943 | 943 |
944 if ((fp = g_fopen(filename, "w+")) == NULL) { | 944 if ((fp = g_fopen(filename, "w+")) == NULL) { |
945 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); | 945 gaim_notify_error(GAIM_GTK_CONVERSATION(conv), NULL, _("Unable to open file."), NULL); |
946 return; | 946 return; |
947 } | 947 } |
948 | 948 |
949 name = gaim_conversation_get_name(conv); | 949 name = gaim_conversation_get_name(conv); |
950 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name); | 950 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name); |
970 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); | 970 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); |
971 gchar *buf; | 971 gchar *buf; |
972 | 972 |
973 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | 973 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); |
974 | 974 |
975 gaim_request_file(conv, _("Save Conversation"), gaim_escape_filename(buf), | 975 gaim_request_file(GAIM_GTK_CONVERSATION(conv), _("Save Conversation"), |
976 gaim_escape_filename(buf), | |
976 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv); | 977 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv); |
977 | 978 |
978 g_free(buf); | 979 g_free(buf); |
979 } | 980 } |
980 | 981 |
2393 GaimBuddyIcon *icon; | 2394 GaimBuddyIcon *icon; |
2394 const void *data; | 2395 const void *data; |
2395 size_t len; | 2396 size_t len; |
2396 | 2397 |
2397 if ((fp = g_fopen(filename, "wb")) == NULL) { | 2398 if ((fp = g_fopen(filename, "wb")) == NULL) { |
2398 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); | 2399 gaim_notify_error(gtkconv, NULL, _("Unable to open file."), NULL); |
2399 return; | 2400 return; |
2400 } | 2401 } |
2401 | 2402 |
2402 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | 2403 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
2403 data = gaim_buddy_icon_get_data(icon, &len); | 2404 data = gaim_buddy_icon_get_data(icon, &len); |
2404 | 2405 |
2405 if ((len <= 0) || (data == NULL)) { | 2406 if ((len <= 0) || (data == NULL)) { |
2406 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); | 2407 gaim_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL); |
2407 return; | 2408 return; |
2408 } | 2409 } |
2409 | 2410 |
2410 fwrite(data, 1, len, fp); | 2411 fwrite(data, 1, len, fp); |
2411 fclose(fp); | 2412 fclose(fp); |
2424 if (ext == NULL) | 2425 if (ext == NULL) |
2425 ext = "icon"; | 2426 ext = "icon"; |
2426 | 2427 |
2427 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); | 2428 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); |
2428 | 2429 |
2429 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | 2430 gaim_request_file(gtkconv, _("Save Icon"), buf, TRUE, |
2430 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv); | 2431 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv); |
2431 | 2432 |
2432 g_free(buf); | 2433 g_free(buf); |
2433 } | 2434 } |
2434 | 2435 |
4196 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, | 4197 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
4197 &protocol, &username, NULL)) | 4198 &protocol, &username, NULL)) |
4198 { | 4199 { |
4199 if (account == NULL) | 4200 if (account == NULL) |
4200 { | 4201 { |
4201 gaim_notify_error(NULL, NULL, | 4202 gaim_notify_error(win, NULL, |
4202 _("You are not currently signed on with an account that " | 4203 _("You are not currently signed on with an account that " |
4203 "can add that buddy."), NULL); | 4204 "can add that buddy."), NULL); |
4204 } | 4205 } |
4205 else | 4206 else |
4206 { | 4207 { |
4445 return; | 4446 return; |
4446 | 4447 |
4447 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); | 4448 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
4448 | 4449 |
4449 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ | 4450 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4450 gaim_request_close_with_handle(conv); | 4451 gaim_request_close_with_handle(gtkconv); |
4452 gaim_notify_close_with_handle(gtkconv); | |
4451 | 4453 |
4452 gtk_widget_destroy(gtkconv->tab_cont); | 4454 gtk_widget_destroy(gtkconv->tab_cont); |
4453 g_object_unref(gtkconv->tab_cont); | 4455 g_object_unref(gtkconv->tab_cont); |
4454 | 4456 |
4455 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 4457 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
7429 } | 7431 } |
7430 gtk_widget_destroy(win->window); | 7432 gtk_widget_destroy(win->window); |
7431 | 7433 |
7432 g_object_unref(G_OBJECT(win->menu.item_factory)); | 7434 g_object_unref(G_OBJECT(win->menu.item_factory)); |
7433 | 7435 |
7436 gaim_notify_close_with_handle(win); | |
7437 | |
7434 g_free(win); | 7438 g_free(win); |
7435 } | 7439 } |
7436 | 7440 |
7437 void | 7441 void |
7438 gaim_gtk_conv_window_show(GaimGtkWindow *win) | 7442 gaim_gtk_conv_window_show(GaimGtkWindow *win) |