comparison src/gtkconv.c @ 10377:a7a4db67040c

[gaim-migrate @ 11602] Removed "Show formatting toolbar," making the conversation menu affect the global pref. Use this and let me know if it makes sense or not. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 15 Dec 2004 02:17:59 +0000
parents f608b72a7611
children 9f50c31a41f9
comparison
equal deleted inserted replaced
10376:7196933335d9 10377:a7a4db67040c
148 static gboolean 148 static gboolean
149 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) 149 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv)
150 { 150 {
151 GaimGtkConversation *gtkconv; 151 GaimGtkConversation *gtkconv;
152 GaimConvWindow *win = gaim_conversation_get_window(conv); 152 GaimConvWindow *win = gaim_conversation_get_window(conv);
153 gboolean saveheight; 153
154
155 if (!GTK_WIDGET_VISIBLE(w)) 154 if (!GTK_WIDGET_VISIBLE(w))
156 return FALSE; 155 return FALSE;
157 156
158 if (!GAIM_IS_GTK_CONVERSATION(conv)) 157 if (!GAIM_IS_GTK_CONVERSATION(conv))
159 return FALSE; 158 return FALSE;
160 159
161 gtkconv = GAIM_GTK_CONVERSATION(conv); 160 gtkconv = GAIM_GTK_CONVERSATION(conv);
162
163 /* we only save the new height if the formatting toolbar visibility matches the pref */
164 saveheight = (gtkconv->show_formatting_toolbar == gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"));
165 161
166 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar 162 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar
167 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one 163 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one
168 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ 164 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */
169 165
170 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) 166 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
171 { 167 {
172 if (w == gtkconv->imhtml && (gaim_conv_window_get_conversation_count(win) == 1)) 168 if (w == gtkconv->imhtml && (gaim_conv_window_get_conversation_count(win) == 1))
173 { 169 {
174 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); 170 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width);
175 if (saveheight) 171 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height);
176 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height);
177 } 172 }
178 if (w == gtkconv->entry) 173 if (w == gtkconv->entry)
179 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); 174 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height);
180 } 175 }
181 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) 176 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
182 { 177 {
183 if (w == gtkconv->imhtml && (gaim_conv_window_get_conversation_count(win) == 1)) 178 if (w == gtkconv->imhtml && (gaim_conv_window_get_conversation_count(win) == 1))
184 { 179 {
185 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); 180 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width);
186 if (saveheight) 181 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height);
187 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height);
188 } 182 }
189 if (w == gtkconv->entry) 183 if (w == gtkconv->entry)
190 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); 184 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height);
191 } 185 }
192 186
1198 if (conv == NULL) 1192 if (conv == NULL)
1199 return; 1193 return;
1200 1194
1201 gtkconv = GAIM_GTK_CONVERSATION(conv); 1195 gtkconv = GAIM_GTK_CONVERSATION(conv);
1202 1196
1203 gtkconv->show_formatting_toolbar = 1197 gaim_prefs_set_bool("/gaim/gtk/conversations/show_formatting_toolbar",
1204 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); 1198 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
1205
1206 if (gtkconv->show_formatting_toolbar)
1207 gtk_widget_show(gtkconv->toolbar);
1208 else
1209 gtk_widget_hide(gtkconv->toolbar);
1210 } 1199 }
1211 1200
1212 static void 1201 static void
1213 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) 1202 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget)
1214 { 1203 {
2853 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), 2842 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds),
2854 gtkconv->make_sound); 2843 gtkconv->make_sound);
2855 2844
2856 gtk_check_menu_item_set_active( 2845 gtk_check_menu_item_set_active(
2857 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), 2846 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar),
2858 gtkconv->show_formatting_toolbar); 2847 gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"));
2859 2848
2860 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), 2849 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps),
2861 gtkconv->show_timestamps); 2850 gtkconv->show_timestamps);
2862 2851
2863 /* 2852 /*
3537 3526
3538 /* Options */ 3527 /* Options */
3539 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, 3528 { N_("/_Options"), NULL, NULL, 0, "<Branch>" },
3540 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, 3529 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" },
3541 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, 3530 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" },
3542 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, 3531 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>" },
3543 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, 3532 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" },
3544 }; 3533 };
3545 3534
3546 static const int menu_item_count = 3535 static const int menu_item_count =
3547 sizeof(menu_items) / sizeof(*menu_items); 3536 sizeof(menu_items) / sizeof(*menu_items);
3645 gtkwin->menu.sounds = 3634 gtkwin->menu.sounds =
3646 gtk_item_factory_get_widget(gtkwin->menu.item_factory, 3635 gtk_item_factory_get_widget(gtkwin->menu.item_factory,
3647 N_("/Options/Enable Sounds")); 3636 N_("/Options/Enable Sounds"));
3648 gtkwin->menu.show_formatting_toolbar = 3637 gtkwin->menu.show_formatting_toolbar =
3649 gtk_item_factory_get_widget(gtkwin->menu.item_factory, 3638 gtk_item_factory_get_widget(gtkwin->menu.item_factory,
3650 N_("/Options/Show Formatting Toolbar")); 3639 N_("/Options/Show Formatting Toolbars"));
3651 gtkwin->menu.show_timestamps = 3640 gtkwin->menu.show_timestamps =
3652 gtk_item_factory_get_widget(gtkwin->menu.item_factory, 3641 gtk_item_factory_get_widget(gtkwin->menu.item_factory,
3653 N_("/Options/Show Timestamps")); 3642 N_("/Options/Show Timestamps"));
3654 3643
3655 generate_send_as_items(win, NULL); 3644 generate_send_as_items(win, NULL);
4359 4348
4360 new_ui = TRUE; 4349 new_ui = TRUE;
4361 4350
4362 gtkconv->make_sound = TRUE; 4351 gtkconv->make_sound = TRUE;
4363 4352
4364 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( 4353 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"))
4365 "/gaim/gtk/conversations/show_formatting_toolbar");
4366
4367 if (gtkconv->show_formatting_toolbar)
4368 gtk_widget_show(gtkconv->toolbar); 4354 gtk_widget_show(gtkconv->toolbar);
4369 else 4355 else
4370 gtk_widget_hide(gtkconv->toolbar); 4356 gtk_widget_hide(gtkconv->toolbar);
4371 4357
4372 gtkconv->show_timestamps = gaim_prefs_get_bool( 4358 gtkconv->show_timestamps = gaim_prefs_get_bool(
5768 5754
5769 gtkconv = GAIM_GTK_CONVERSATION(conv); 5755 gtkconv = GAIM_GTK_CONVERSATION(conv);
5770 win = gaim_conversation_get_window(conv); 5756 win = gaim_conversation_get_window(conv);
5771 gtkwin = GAIM_GTK_WINDOW(win); 5757 gtkwin = GAIM_GTK_WINDOW(win);
5772 5758
5773 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value);
5774 gtk_check_menu_item_set_active( 5759 gtk_check_menu_item_set_active(
5775 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), 5760 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar),
5776 gtkconv->show_formatting_toolbar); 5761 (gboolean)GPOINTER_TO_INT(value));
5777 5762
5778 if (gtkconv->show_formatting_toolbar) 5763 if ((gboolean)GPOINTER_TO_INT(value))
5779 gtk_widget_show(gtkconv->toolbar); 5764 gtk_widget_show(gtkconv->toolbar);
5780 else 5765 else
5781 gtk_widget_hide(gtkconv->toolbar); 5766 gtk_widget_hide(gtkconv->toolbar);
5782 } 5767 }
5783 } 5768 }