# HG changeset patch # User Christian Hammond # Date 1067040193 0 # Node ID 00a9ab26d607d178abf03ba5be558eb628f08964 # Parent 35e652831230dd22d2f209492d9b26ba221059a6 [gaim-migrate @ 7912] Added an option to remove the formatting toolbar, both globally and on a per-window basis. Patch by Nathan Fredrickson. committer: Tailor Script diff -r 35e652831230 -r 00a9ab26d607 ChangeLog --- a/ChangeLog Sat Oct 25 00:02:53 2003 +0000 +++ b/ChangeLog Sat Oct 25 00:03:13 2003 +0000 @@ -2,6 +2,8 @@ version 0.72 * Added a search feature to conversations. + * Added an option to remove the formatting toolbar, both globally and + on a per-window basis (Nathan Fredrickson) * Fixed a crash in the Add Chat dialog when selecting an account that doesn't support chats. Closes bug #821606. * Fixed a bug where new MSN accounts without buddies added wouldn't diff -r 35e652831230 -r 00a9ab26d607 src/gtkconv.c --- a/src/gtkconv.c Sat Oct 25 00:02:53 2003 +0000 +++ b/src/gtkconv.c Sat Oct 25 00:03:13 2003 +0000 @@ -929,6 +929,29 @@ } static void +menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) +{ + GaimConvWindow *win = (GaimConvWindow *)data; + GaimConversation *conv; + GaimGtkConversation *gtkconv; + + conv = gaim_conv_window_get_active_conversation(win); + + if (conv == NULL) + return; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + + gtkconv->show_formatting_toolbar = + gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); + + if (gtkconv->show_formatting_toolbar) + gtk_widget_show(gtkconv->toolbar.toolbar); + else + gtk_widget_hide(gtkconv->toolbar.toolbar); +} + +static void menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) { GaimConvWindow *win = (GaimConvWindow *)data; @@ -946,8 +969,6 @@ gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); } - - void im_cb(GtkWidget *widget, GaimConversation *conv) { @@ -2017,7 +2038,7 @@ GaimGtkWindow *gtkwin; GaimConnection *gc; GdkPixbuf *window_icon = NULL; - + win = (GaimConvWindow *)user_data; conv = gaim_conv_window_get_conversation_at(win, page_num); @@ -2074,7 +2095,7 @@ if (gtkwin->menu.send_as != NULL) g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); - + if (gtkconv->u.im->anim) { window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); g_object_ref(window_icon); @@ -2109,20 +2130,24 @@ gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); - + if (gtkwin->menu.send_as != NULL) g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); window_icon = get_tab_icon(conv); } - + update_typing_icon(conv); - + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), gaim_conversation_is_logging(conv)); - + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), gtkconv->make_sound); - + + gtk_check_menu_item_set_active( + GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), + gtkconv->show_formatting_toolbar); + gtk_widget_grab_focus(gtkconv->entry); gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); @@ -2954,6 +2979,7 @@ { N_("/_Options"), NULL, NULL, 0, "" }, { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "" }, { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "" }, + { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "" }, }; static const int menu_item_count = @@ -3048,6 +3074,9 @@ gtkwin->menu.sounds = gtk_item_factory_get_widget(gtkwin->menu.item_factory, N_("/Options/Enable Sounds")); + gtkwin->menu.show_formatting_toolbar = + gtk_item_factory_get_widget(gtkwin->menu.item_factory, + N_("/Options/Show Formatting Toolbar")); generate_send_as_items(win, NULL); @@ -3378,6 +3407,9 @@ gtk_widget_show_all(vbox); + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) + gtk_widget_hide(vbox); + return vbox; } @@ -4058,6 +4090,9 @@ gtkconv->make_sound = TRUE; + gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( + "/gaim/gtk/conversations/show_formatting_toolbar"); + g_signal_connect_swapped(G_OBJECT(pane), "focus", G_CALLBACK(gtk_widget_grab_focus), gtkconv->entry); @@ -4116,7 +4151,7 @@ if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) gaim_gtkconv_update_buddy_icon(conv); - + /* Add this pane to the conversations notebook. */ gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, menu_tabby); @@ -5006,7 +5041,7 @@ gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); - + if(conv == gaim_conv_window_get_active_conversation(win)) gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); } @@ -5029,7 +5064,7 @@ gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); - if (gaim_conv_window_get_active_conversation(win) == conv && gtkconv->u.im->anim == NULL) + if (gaim_conv_window_get_active_conversation(win) == conv && gtkconv->u.im->anim == NULL) gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); if(status) @@ -5961,6 +5996,39 @@ } static void +show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, + gpointer value, gpointer data) +{ + GList *l; + GaimConversation *conv; + GaimGtkConversation *gtkconv; + GaimConvWindow *win; + GaimGtkWindow *gtkwin; + + for (l = gaim_get_conversations(); l != NULL; l = l->next) + { + conv = (GaimConversation *)l->data; + + if (!GAIM_IS_GTK_CONVERSATION(conv)) + continue; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + win = gaim_conversation_get_window(conv); + gtkwin = GAIM_GTK_WINDOW(win); + + gtkconv->show_formatting_toolbar = (gboolean)value; + gtk_check_menu_item_set_active( + GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), + gtkconv->show_formatting_toolbar); + + if (gtkconv->show_formatting_toolbar) + gtk_widget_show(gtkconv->toolbar.toolbar); + else + gtk_widget_hide(gtkconv->toolbar.toolbar); + } +} + +static void im_button_type_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data) { @@ -6097,6 +6165,7 @@ gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); @@ -6139,6 +6208,8 @@ show_smileys_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", show_timestamps_pref_cb, NULL); + gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", + show_formatting_toolbar_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", spellcheck_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", diff -r 35e652831230 -r 00a9ab26d607 src/gtkconv.h --- a/src/gtkconv.h Sat Oct 25 00:02:53 2003 +0000 +++ b/src/gtkconv.h Sat Oct 25 00:03:13 2003 +0000 @@ -5,7 +5,7 @@ * gaim * * Copyright (C) 2002-2003 Christian Hammond - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -66,6 +66,7 @@ GtkWidget *logging; GtkWidget *sounds; + GtkWidget *show_formatting_toolbar; GtkWidget *send_as; @@ -126,6 +127,7 @@ struct _GaimGtkConversation { gboolean make_sound; + gboolean show_formatting_toolbar; gboolean has_font; char fontface[128]; GdkColor fg_color; diff -r 35e652831230 -r 00a9ab26d607 src/gtkprefs.c --- a/src/gtkprefs.c Sat Oct 25 00:02:53 2003 +0000 +++ b/src/gtkprefs.c Sat Oct 25 00:03:13 2003 +0000 @@ -891,6 +891,9 @@ prefs_checkbox(_("Send _URLs as Links"), "/core/conversations/send_urls_as_links", vbox); + prefs_checkbox(_("Show Formatting Toolbar"), + "/gaim/gtk/conversations/show_formatting_toolbar", vbox); + vbox = gaim_gtk_make_frame (ret, _("Tab Options")); label = prefs_dropdown(vbox, _("_Tab Placement:"), GAIM_PREF_INT,