Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 5675:17e345ffeddb
[gaim-migrate @ 6093]
Fixed a GTK warning when changing the chat button styles, and fixed another
bug where the buttons were moving out of place. Also added more callbacks.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 21:14:50 +0000 |
parents | 2d86a5fa6fef |
children | dae79aefac8d |
comparison
equal
deleted
inserted
replaced
5674:2d86a5fa6fef | 5675:17e345ffeddb |
---|---|
4895 | 4895 |
4896 strncpy(gtkconv->fontface, fontface, 128); | 4896 strncpy(gtkconv->fontface, fontface, 128); |
4897 } | 4897 } |
4898 | 4898 |
4899 void | 4899 void |
4900 gaim_gtkconv_update_tabs(void) | |
4901 { | |
4902 GList *l; | |
4903 GtkPositionType pos; | |
4904 struct gaim_window *win; | |
4905 struct gaim_gtk_window *gtkwin; | |
4906 | |
4907 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); | |
4908 | |
4909 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
4910 win = (struct gaim_window *)l->data; | |
4911 | |
4912 if (!GAIM_IS_GTK_WINDOW(win)) | |
4913 continue; | |
4914 | |
4915 gtkwin = GAIM_GTK_WINDOW(win); | |
4916 | |
4917 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4918 } | |
4919 } | |
4920 | |
4921 void | |
4922 gaim_gtkconv_update_chat_button_style() | |
4923 { | |
4924 GList *l; | |
4925 GaimConnection *g; | |
4926 GtkWidget *parent; | |
4927 GaimConversationType type = GAIM_CONV_CHAT; | |
4928 | |
4929 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { | |
4930 GSList *bcs; | |
4931 struct gaim_conversation *conv; | |
4932 struct gaim_gtk_conversation *gtkconv; | |
4933 struct gaim_gtk_window *gtkwin; | |
4934 | |
4935 g = (GaimConnection *)l->data; | |
4936 | |
4937 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { | |
4938 conv = (struct gaim_conversation *)bcs->data; | |
4939 | |
4940 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) | |
4941 continue; | |
4942 | |
4943 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
4944 continue; | |
4945 | |
4946 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4947 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
4948 parent = gtk_widget_get_parent(gtkconv->send); | |
4949 | |
4950 gtkconv->send = | |
4951 gaim_gtk_change_text(_("Send"), | |
4952 gtkconv->send, GAIM_STOCK_SEND, type); | |
4953 gtkconv->u.chat->invite = | |
4954 gaim_gtk_change_text(_("Invite"), | |
4955 gtkconv->u.chat->invite, | |
4956 GAIM_STOCK_INVITE, type); | |
4957 | |
4958 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, | |
4959 type); | |
4960 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, | |
4961 FALSE, FALSE, 0); | |
4962 | |
4963 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
4964 G_CALLBACK(send_cb), conv); | |
4965 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", | |
4966 G_CALLBACK(invite_cb), conv); | |
4967 | |
4968 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), | |
4969 GTK_RELIEF_NONE); | |
4970 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), | |
4971 GTK_RELIEF_NONE); | |
4972 | |
4973 gaim_gtkconv_update_buttons_by_protocol(conv); | |
4974 } | |
4975 } | |
4976 } | |
4977 | |
4978 void | |
4979 gaim_gtkconv_update_im_button_style() | |
4980 { | |
4981 GList *l; | |
4982 struct gaim_conversation *conv; | |
4983 struct gaim_gtk_conversation *gtkconv; | |
4984 | |
4985 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
4986 conv = (struct gaim_conversation *)l->data; | |
4987 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4988 | |
4989 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
4990 } | |
4991 } | |
4992 | |
4993 void | |
4994 gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv) | 4900 gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv) |
4995 { | 4901 { |
4996 GaimPluginProtocolInfo *prpl_info = NULL; | 4902 GaimPluginProtocolInfo *prpl_info = NULL; |
4997 struct gaim_window *win; | 4903 struct gaim_window *win; |
4998 struct gaim_gtk_window *gtkwin = NULL; | 4904 struct gaim_gtk_window *gtkwin = NULL; |
5018 } | 4924 } |
5019 else { | 4925 else { |
5020 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 4926 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
5021 | 4927 |
5022 gtk_widget_set_sensitive(gtkconv->send, TRUE); | 4928 gtk_widget_set_sensitive(gtkconv->send, TRUE); |
5023 if (win != NULL) { | 4929 |
4930 if (win != NULL) | |
5024 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); | 4931 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
5025 } | |
5026 } | 4932 } |
5027 | 4933 |
5028 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | 4934 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
5029 if (gc == NULL) { | 4935 if (gc == NULL) { |
5030 gtk_widget_set_sensitive(gtkconv->info, FALSE); | 4936 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
5060 | 4966 |
5061 update_convo_add_button(conv); | 4967 update_convo_add_button(conv); |
5062 } | 4968 } |
5063 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | 4969 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
5064 if (gc == NULL) { | 4970 if (gc == NULL) { |
5065 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, FALSE); | 4971 if (gtkconv->u.chat->whisper != NULL) |
4972 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, FALSE); | |
4973 | |
5066 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | 4974 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); |
5067 | 4975 |
5068 return; | 4976 return; |
5069 } | 4977 } |
5070 | 4978 |
5071 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | 4979 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); |
5072 | 4980 |
5073 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); | 4981 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
5074 /* gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); */ | 4982 /* gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); */ |
5075 | 4983 |
5076 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, | 4984 if (gtkconv->u.chat->whisper != NULL) |
5077 (prpl_info->chat_whisper != NULL)); | 4985 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, |
4986 (prpl_info->chat_whisper != NULL)); | |
5078 | 4987 |
5079 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | 4988 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
5080 (prpl_info->chat_invite != NULL)); | 4989 (prpl_info->chat_invite != NULL)); |
5081 } | 4990 } |
5082 } | 4991 } |
5328 gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); | 5237 gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); |
5329 } | 5238 } |
5330 } | 5239 } |
5331 | 5240 |
5332 static void | 5241 static void |
5333 show_buddy_icons_pref_cb(const char *name, GaimPrefType type, gpointer value, | 5242 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
5334 gpointer data) | 5243 gpointer data) |
5335 { | 5244 { |
5336 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); | 5245 GList *l; |
5246 GtkPositionType pos; | |
5247 struct gaim_window *win; | |
5248 struct gaim_gtk_window *gtkwin; | |
5249 | |
5250 pos = GPOINTER_TO_INT(value); | |
5251 | |
5252 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5253 win = (struct gaim_window *)l->data; | |
5254 | |
5255 if (!GAIM_IS_GTK_WINDOW(win)) | |
5256 continue; | |
5257 | |
5258 gtkwin = GAIM_GTK_WINDOW(win); | |
5259 | |
5260 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
5261 } | |
5262 } | |
5263 | |
5264 static void | |
5265 im_button_type_pref_cb(const char *name, GaimPrefType type, | |
5266 gpointer value, gpointer data) | |
5267 { | |
5268 GList *l; | |
5269 struct gaim_conversation *conv; | |
5270 struct gaim_gtk_conversation *gtkconv; | |
5271 | |
5272 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5273 conv = (struct gaim_conversation *)l->data; | |
5274 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5275 | |
5276 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
5277 } | |
5337 } | 5278 } |
5338 | 5279 |
5339 static void | 5280 static void |
5340 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, | 5281 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
5341 gpointer value, gpointer data) | 5282 gpointer value, gpointer data) |
5350 start_anim(NULL, (struct gaim_conversation *)l->data); | 5291 start_anim(NULL, (struct gaim_conversation *)l->data); |
5351 } | 5292 } |
5352 else { | 5293 else { |
5353 for (l = gaim_get_ims(); l != NULL; l = l->next) | 5294 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5354 stop_anim(NULL, (struct gaim_conversation *)l->data); | 5295 stop_anim(NULL, (struct gaim_conversation *)l->data); |
5296 } | |
5297 } | |
5298 | |
5299 static void | |
5300 show_buddy_icons_pref_cb(const char *name, GaimPrefType type, gpointer value, | |
5301 gpointer data) | |
5302 { | |
5303 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); | |
5304 } | |
5305 | |
5306 void | |
5307 chat_button_type_pref_cb(const char *name, GaimPrefType type, gpointer value, | |
5308 gpointer data) | |
5309 { | |
5310 GList *l; | |
5311 GaimConnection *g; | |
5312 GtkWidget *parent; | |
5313 GaimConversationType conv_type = GAIM_CONV_CHAT; | |
5314 GSList *bcs; | |
5315 struct gaim_conversation *conv; | |
5316 struct gaim_gtk_conversation *gtkconv; | |
5317 struct gaim_gtk_window *gtkwin; | |
5318 | |
5319 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { | |
5320 | |
5321 g = (GaimConnection *)l->data; | |
5322 | |
5323 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { | |
5324 conv = (struct gaim_conversation *)bcs->data; | |
5325 | |
5326 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) | |
5327 continue; | |
5328 | |
5329 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
5330 continue; | |
5331 | |
5332 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5333 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
5334 parent = gtk_widget_get_parent(gtkconv->send); | |
5335 | |
5336 gtkconv->send = | |
5337 gaim_gtk_change_text(_("Send"), | |
5338 gtkconv->send, GAIM_STOCK_SEND, conv_type); | |
5339 gtkconv->u.chat->invite = | |
5340 gaim_gtk_change_text(_("Invite"), | |
5341 gtkconv->u.chat->invite, | |
5342 GAIM_STOCK_INVITE, conv_type); | |
5343 | |
5344 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, | |
5345 conv_type); | |
5346 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, | |
5347 FALSE, FALSE, 0); | |
5348 | |
5349 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->send, 0); | |
5350 | |
5351 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
5352 G_CALLBACK(send_cb), conv); | |
5353 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", | |
5354 G_CALLBACK(invite_cb), conv); | |
5355 | |
5356 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), | |
5357 GTK_RELIEF_NONE); | |
5358 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), | |
5359 GTK_RELIEF_NONE); | |
5360 | |
5361 gaim_gtkconv_update_buttons_by_protocol(conv); | |
5362 } | |
5355 } | 5363 } |
5356 } | 5364 } |
5357 | 5365 |
5358 void | 5366 void |
5359 gaim_gtk_conversation_init(void) | 5367 gaim_gtk_conversation_init(void) |
5422 show_smileys_pref_cb, NULL); | 5430 show_smileys_pref_cb, NULL); |
5423 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", | 5431 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
5424 show_timestamps_pref_cb, NULL); | 5432 show_timestamps_pref_cb, NULL); |
5425 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", | 5433 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
5426 spellcheck_pref_cb, NULL); | 5434 spellcheck_pref_cb, NULL); |
5427 | 5435 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
5436 tab_side_pref_cb, NULL); | |
5437 | |
5438 | |
5439 /* IM callbacks */ | |
5440 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", | |
5441 im_button_type_pref_cb, NULL); | |
5428 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", | 5442 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
5429 animate_buddy_icons_pref_cb, NULL); | 5443 animate_buddy_icons_pref_cb, NULL); |
5430 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", | 5444 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
5431 show_buddy_icons_pref_cb, NULL); | 5445 show_buddy_icons_pref_cb, NULL); |
5432 } | 5446 |
5433 | 5447 |
5448 /* Chat callbacks */ | |
5449 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", | |
5450 chat_button_type_pref_cb, NULL); | |
5451 } | |
5452 |