Mercurial > pidgin.yaz
comparison pidgin/gtkwhiteboard.c @ 31637:f2e0b8f38e14
propagate from branch 'im.pidgin.pidgin' (head 69fbc32fd3dfe8ca0979e1c486c3d51eb06088cf)
to branch 'im.pidgin.pidgin.openq' (head 0a02249008d0dad085b600dd65c45a347d1c84aa)
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Sun, 07 Nov 2010 04:48:56 +0000 |
parents | 2b9db39bd7ed |
children | 6ea43032df70 |
comparison
equal
deleted
inserted
replaced
31636:35224e759210 | 31637:f2e0b8f38e14 |
---|---|
736 | 736 |
737 static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data) | 737 static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data) |
738 { | 738 { |
739 PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); | 739 PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); |
740 | 740 |
741 pidgin_whiteboard_clear(gtkwb->wb); | 741 /* Confirm whether the user really wants to clear */ |
742 | 742 GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(gtkwb->window), |
743 pidgin_whiteboard_set_canvas_as_icon(gtkwb); | 743 GTK_DIALOG_DESTROY_WITH_PARENT, |
744 | 744 GTK_MESSAGE_QUESTION, |
745 /* Do protocol specific clearing procedures */ | 745 GTK_BUTTONS_YES_NO, |
746 purple_whiteboard_send_clear(gtkwb->wb); | 746 _("Do you really want to clear?")); |
747 gint response = gtk_dialog_run(GTK_DIALOG(dialog)); | |
748 gtk_widget_destroy(dialog); | |
749 | |
750 if (response == GTK_RESPONSE_YES) | |
751 { | |
752 pidgin_whiteboard_clear(gtkwb->wb); | |
753 | |
754 pidgin_whiteboard_set_canvas_as_icon(gtkwb); | |
755 | |
756 /* Do protocol specific clearing procedures */ | |
757 purple_whiteboard_send_clear(gtkwb->wb); | |
758 } | |
747 } | 759 } |
748 | 760 |
749 static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data) | 761 static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data) |
750 { | 762 { |
751 PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); | 763 PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); |
753 | 765 |
754 GtkWidget *dialog; | 766 GtkWidget *dialog; |
755 | 767 |
756 int result; | 768 int result; |
757 | 769 |
758 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
759 dialog = gtk_file_chooser_dialog_new (_("Save File"), | 770 dialog = gtk_file_chooser_dialog_new (_("Save File"), |
760 GTK_WINDOW(gtkwb->window), | 771 GTK_WINDOW(gtkwb->window), |
761 GTK_FILE_CHOOSER_ACTION_SAVE, | 772 GTK_FILE_CHOOSER_ACTION_SAVE, |
762 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | 773 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
763 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, | 774 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, |
772 } | 783 } |
773 /* | 784 /* |
774 else | 785 else |
775 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document); | 786 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document); |
776 */ | 787 */ |
777 #else | 788 |
778 dialog = gtk_file_selection_new(_("Save File")); | |
779 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), "whiteboard.jpg"); | |
780 #endif | |
781 result = gtk_dialog_run(GTK_DIALOG(dialog)); | 789 result = gtk_dialog_run(GTK_DIALOG(dialog)); |
782 | 790 |
783 if(result == GTK_RESPONSE_ACCEPT) | 791 if(result == GTK_RESPONSE_ACCEPT) |
784 { | 792 { |
785 char *filename; | 793 char *filename; |
786 | 794 |
787 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
788 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | 795 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); |
789 #else | 796 |
790 filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog))); | |
791 #endif | |
792 gtk_widget_destroy(dialog); | 797 gtk_widget_destroy(dialog); |
793 | 798 |
794 /* Makes an icon from the whiteboard's canvas 'image' */ | 799 /* Makes an icon from the whiteboard's canvas 'image' */ |
795 pixbuf = gdk_pixbuf_get_from_drawable(NULL, | 800 pixbuf = gdk_pixbuf_get_from_drawable(NULL, |
796 (GdkDrawable*)(gtkwb->pixmap), | 801 (GdkDrawable*)(gtkwb->pixmap), |