# HG changeset patch # User Stu Tomlinson # Date 1182103847 0 # Node ID b8b475f310088504d6faca6152aff99620823697 # Parent afeb352056693b673a21b7e15f9b9432aae8085a Fix setting the sensitivity of the toolbar items in a number of places diff -r afeb35205669 -r b8b475f31008 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sun Jun 17 16:55:45 2007 +0000 +++ b/pidgin/gtkconv.c Sun Jun 17 18:10:47 2007 +0000 @@ -5981,8 +5981,10 @@ buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; } - if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || - conv->features & PURPLE_CONNECTION_NO_IMAGES) + if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) + conv->features |= PURPLE_CONNECTION_NO_IMAGES; + + if(conv->features & PURPLE_CONNECTION_NO_IMAGES) buttons &= ~GTK_IMHTML_IMAGE; gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); @@ -5995,7 +5997,7 @@ gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); - gtk_widget_set_sensitive(win->menu.insert_image, (prpl_info->options & OPT_PROTO_IM_IMAGE) && !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); + gtk_widget_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { diff -r afeb35205669 -r b8b475f31008 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Sun Jun 17 16:55:45 2007 +0000 +++ b/pidgin/gtkimhtml.c Sun Jun 17 18:10:47 2007 +0000 @@ -5036,10 +5036,24 @@ void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags) { + GtkIMHtmlButtons buttons; + if (flags & PURPLE_CONNECTION_HTML) { char color[8]; GdkColor fg_color, bg_color; + buttons = GTK_IMHTML_ALL; + + if (flags & PURPLE_CONNECTION_NO_BGCOLOR) + buttons &= ~GTK_IMHTML_BACKCOLOR; + if (flags & PURPLE_CONNECTION_NO_FONTSIZE) + { + buttons &= ~GTK_IMHTML_GROW; + buttons &= ~GTK_IMHTML_SHRINK; + } + if (flags & PURPLE_CONNECTION_NO_URLDESC) + buttons &= ~GTK_IMHTML_LINKDESC; + gtk_imhtml_set_format_functions(imhtml, GTK_IMHTML_ALL); if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != imhtml->edit.bold) gtk_imhtml_toggle_bold(imhtml); @@ -5094,9 +5108,14 @@ else gtk_imhtml_set_whole_buffer_formatting_only(imhtml, FALSE); } else { + buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; imhtml_clear_formatting(imhtml); - gtk_imhtml_set_format_functions(imhtml, 0); } + + if (flags & PURPLE_CONNECTION_NO_IMAGES) + buttons &= ~GTK_IMHTML_IMAGE; + + gtk_imhtml_set_format_functions(imhtml, buttons); } diff -r afeb35205669 -r b8b475f31008 pidgin/gtkimhtmltoolbar.c --- a/pidgin/gtkimhtmltoolbar.c Sun Jun 17 16:55:45 2007 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Sun Jun 17 18:10:47 2007 +0000 @@ -1035,6 +1035,7 @@ GtkWidget *font_button; GtkWidget *font_menu; GtkWidget *insert_menu; + GtkWidget *menuitem; GtkWidget *button; GtkWidget *sep; int i; @@ -1088,7 +1089,7 @@ for (i = 0; buttons[i].label; i++) { GtkWidget *old = *buttons[i].button; - GtkWidget *menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label); + menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label); g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), old); g_signal_connect_after(G_OBJECT(old), "toggled", @@ -1140,17 +1141,23 @@ insert_menu = gtk_menu_new(); - button = gtk_menu_item_new_with_mnemonic(_("_Smiley")); - g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->smiley); - gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), button); + menuitem = gtk_menu_item_new_with_mnemonic(_("_Smiley")); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->smiley); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + g_signal_connect(G_OBJECT(toolbar->smiley), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), menuitem); - button = gtk_menu_item_new_with_mnemonic(_("_Image")); - g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image); - gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), button); + menuitem = gtk_menu_item_new_with_mnemonic(_("_Image")); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + g_signal_connect(G_OBJECT(toolbar->image), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), menuitem); - button = gtk_menu_item_new_with_mnemonic(_("_Link")); - g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link); - gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), button); + menuitem = gtk_menu_item_new_with_mnemonic(_("_Link")); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + g_signal_connect(G_OBJECT(toolbar->link), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), menuitem); g_signal_connect(G_OBJECT(insert_button), "clicked", G_CALLBACK(pidgin_menu_clicked), insert_menu); g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button);