Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 12836:339d61ebca8a
[gaim-migrate @ 15184]
Revert the extra portion of my last commit that snuck in because I committed from the wrong tree.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 11 Jan 2006 23:18:52 +0000 |
parents | cb2d493e1925 |
children | 778d08e87ad0 |
comparison
equal
deleted
inserted
replaced
12835:6a81da55d4d4 | 12836:339d61ebca8a |
---|---|
807 | 807 |
808 gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml); | 808 gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml); |
809 | 809 |
810 } | 810 } |
811 | 811 |
812 static void fix_popup_menu_item_cb(GtkWidget *widget, gpointer data) | 812 |
813 { | |
814 gpointer *more_data = data; | |
815 int *count = more_data[0]; | |
816 GtkIMHtml *imhtml = more_data[1]; | |
817 | |
818 /* Destroy all items except Copy and Select All, if the text isn't editable. */ | |
819 if (!imhtml->editable && *count != 1 && *count != 5) | |
820 { | |
821 gtk_widget_destroy(widget); | |
822 } | |
823 else if (*count == 5 && gtk_text_buffer_get_char_count(imhtml->text_buffer) == 0) | |
824 { | |
825 /* There is no text in the buffer, so Select All should be insensitive. */ | |
826 gtk_widget_set_sensitive(widget, FALSE); | |
827 } | |
828 | |
829 (*count)++; | |
830 } | |
831 | 813 |
832 static void hijack_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data) | 814 static void hijack_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data) |
833 { | 815 { |
834 int count = 0; | |
835 gpointer more_data[2] = {&count, imhtml}; | |
836 GtkWidget *menuitem; | 816 GtkWidget *menuitem; |
837 | |
838 gtk_container_foreach(GTK_CONTAINER(menu), fix_popup_menu_item_cb, more_data); | |
839 | |
840 if (!imhtml->editable) | |
841 return; | |
842 | 817 |
843 menuitem = gtk_menu_item_new_with_mnemonic(_("Paste as Plain _Text")); | 818 menuitem = gtk_menu_item_new_with_mnemonic(_("Paste as Plain _Text")); |
844 gtk_widget_show(menuitem); | 819 gtk_widget_show(menuitem); |
845 gtk_widget_set_sensitive(menuitem, | 820 gtk_widget_set_sensitive(menuitem, |
846 (gtk_clipboard_wait_is_text_available( | 821 (imhtml->editable && |
847 gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_CLIPBOARD)))); | 822 gtk_clipboard_wait_is_text_available( |
823 gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_CLIPBOARD)))); | |
848 /* put it after "Paste" */ | 824 /* put it after "Paste" */ |
849 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 3); | 825 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 3); |
850 | 826 |
851 g_signal_connect(G_OBJECT(menuitem), "activate", | 827 g_signal_connect(G_OBJECT(menuitem), "activate", |
852 G_CALLBACK(paste_unformatted_cb), imhtml); | 828 G_CALLBACK(paste_unformatted_cb), imhtml); |