| 1107 gdk_window_set_cursor(gtkblist->window->window, NULL); |
1108 gdk_window_set_cursor(gtkblist->window->window, NULL); |
| 1108 gdk_window_set_cursor(win->window->window, NULL); |
1109 gdk_window_set_cursor(win->window->window, NULL); |
| 1109 } |
1110 } |
| 1110 |
1111 |
| 1111 static void |
1112 static void |
| 1112 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) |
1113 menu_clear_cb(GtkAction *action, gpointer data) |
| 1113 { |
1114 { |
| 1114 PidginWindow *win = data; |
1115 PidginWindow *win = data; |
| 1115 PurpleConversation *conv; |
1116 PurpleConversation *conv; |
| 1116 |
1117 |
| 1117 conv = pidgin_conv_window_get_active_conversation(win); |
1118 conv = pidgin_conv_window_get_active_conversation(win); |
| 1118 clear_conversation_scrollback(conv); |
1119 clear_conversation_scrollback(conv); |
| 1119 } |
1120 } |
| 1120 |
1121 |
| 1121 static void |
1122 static void |
| 1122 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
1123 menu_find_cb(GtkAction *action, gpointer data) |
| 1123 { |
1124 { |
| 1124 PidginWindow *gtkwin = data; |
1125 PidginWindow *gtkwin = data; |
| 1125 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(gtkwin); |
1126 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(gtkwin); |
| 1126 gtk_widget_show_all(gtkconv->quickfind.container); |
1127 gtk_widget_show_all(gtkconv->quickfind.container); |
| 1127 gtk_widget_grab_focus(gtkconv->quickfind.entry); |
1128 gtk_widget_grab_focus(gtkconv->quickfind.entry); |
| 1128 } |
1129 } |
| 1129 |
1130 |
| 1130 #ifdef USE_VV |
1131 #ifdef USE_VV |
| 1131 static void |
1132 static void |
| 1132 menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) |
1133 menu_initiate_media_call_cb(GtkAction *action, gpointer data) |
| 1133 { |
1134 { |
| 1134 PidginWindow *win = (PidginWindow *)data; |
1135 PidginWindow *win = (PidginWindow *)data; |
| 1135 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
1136 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
| 1136 PurpleAccount *account = purple_conversation_get_account(conv); |
1137 PurpleAccount *account = purple_conversation_get_account(conv); |
| 1137 |
1138 |
| 1138 purple_prpl_initiate_media(account, |
1139 purple_prpl_initiate_media(account, |
| 1139 purple_conversation_get_name(conv), |
1140 purple_conversation_get_name(conv), |
| 1140 action == 0 ? PURPLE_MEDIA_AUDIO : |
1141 action == win->audio_call ? PURPLE_MEDIA_AUDIO : |
| 1141 action == 1 ? PURPLE_MEDIA_VIDEO : |
1142 action == win->video_call ? PURPLE_MEDIA_VIDEO : |
| 1142 action == 2 ? PURPLE_MEDIA_AUDIO | |
1143 action == win->audio_video_call ? PURPLE_MEDIA_AUDIO | |
| 1143 PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); |
1144 PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); |
| 1144 } |
1145 } |
| 1145 #endif |
1146 #endif |
| 1146 |
1147 |
| 1147 static void |
1148 static void |
| 1148 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
1149 menu_send_file_cb(GtkAction *action, gpointer data) |
| 1149 { |
1150 { |
| 1150 PidginWindow *win = data; |
1151 PidginWindow *win = data; |
| 1151 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
1152 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
| 1152 |
1153 |
| 1153 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
1154 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
| 1235 pidgin_dialogs_alias_chat(c); |
1236 pidgin_dialogs_alias_chat(c); |
| 1236 } |
1237 } |
| 1237 } |
1238 } |
| 1238 |
1239 |
| 1239 static void |
1240 static void |
| 1240 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
1241 menu_get_info_cb(GtkAction *action, gpointer data) |
| 1241 { |
1242 { |
| 1242 PidginWindow *win = data; |
1243 PidginWindow *win = data; |
| 1243 PurpleConversation *conv; |
1244 PurpleConversation *conv; |
| 1244 |
1245 |
| 1245 conv = pidgin_conv_window_get_active_conversation(win); |
1246 conv = pidgin_conv_window_get_active_conversation(win); |
| 1246 |
1247 |
| 1247 info_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1248 info_cb(NULL, PIDGIN_CONVERSATION(conv)); |
| 1248 } |
1249 } |
| 1249 |
1250 |
| 1250 static void |
1251 static void |
| 1251 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
1252 menu_invite_cb(GtkAction *action, gpointer data) |
| 1252 { |
1253 { |
| 1253 PidginWindow *win = data; |
1254 PidginWindow *win = data; |
| 1254 PurpleConversation *conv; |
1255 PurpleConversation *conv; |
| 1255 |
1256 |
| 1256 conv = pidgin_conv_window_get_active_conversation(win); |
1257 conv = pidgin_conv_window_get_active_conversation(win); |
| 1257 |
1258 |
| 1258 invite_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1259 invite_cb(NULL, PIDGIN_CONVERSATION(conv)); |
| 1259 } |
1260 } |
| 1260 |
1261 |
| 1261 static void |
1262 static void |
| 1262 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
1263 menu_block_cb(GtkAction *action, gpointer data) |
| 1263 { |
1264 { |
| 1264 PidginWindow *win = data; |
1265 PidginWindow *win = data; |
| 1265 PurpleConversation *conv; |
1266 PurpleConversation *conv; |
| 1266 |
1267 |
| 1267 conv = pidgin_conv_window_get_active_conversation(win); |
1268 conv = pidgin_conv_window_get_active_conversation(win); |
| 1268 |
1269 |
| 1269 block_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1270 block_cb(NULL, PIDGIN_CONVERSATION(conv)); |
| 1270 } |
1271 } |
| 1271 |
1272 |
| 1272 static void |
1273 static void |
| 1273 menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) |
1274 menu_unblock_cb(GtkAction *action, gpointer data) |
| 1274 { |
1275 { |
| 1275 PidginWindow *win = data; |
1276 PidginWindow *win = data; |
| 1276 PurpleConversation *conv; |
1277 PurpleConversation *conv; |
| 1277 |
1278 |
| 1278 conv = pidgin_conv_window_get_active_conversation(win); |
1279 conv = pidgin_conv_window_get_active_conversation(win); |
| 1279 |
1280 |
| 1280 unblock_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1281 unblock_cb(NULL, PIDGIN_CONVERSATION(conv)); |
| 1281 } |
1282 } |
| 1282 |
1283 |
| 1283 static void |
1284 static void |
| 1284 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
1285 menu_add_remove_cb(GtkAction *action, gpointer data) |
| 1285 { |
1286 { |
| 1286 PidginWindow *win = data; |
1287 PidginWindow *win = data; |
| 1287 PurpleConversation *conv; |
1288 PurpleConversation *conv; |
| 1288 |
1289 |
| 1289 conv = pidgin_conv_window_get_active_conversation(win); |
1290 conv = pidgin_conv_window_get_active_conversation(win); |
| 3048 { |
3049 { |
| 3049 g_return_val_if_fail(gtkconv != NULL, NULL); |
3050 g_return_val_if_fail(gtkconv != NULL, NULL); |
| 3050 return gtkconv->win; |
3051 return gtkconv->win; |
| 3051 } |
3052 } |
| 3052 |
3053 |
| |
3054 #if 1 |
| |
3055 |
| |
3056 static GtkActionEntry menu_entries[] = |
| |
3057 /* TODO: fill out tooltips... */ |
| |
3058 { |
| |
3059 /* Conversation menu */ |
| |
3060 { "ConversationMenu", NULL, N_("_Conversation"), NULL, NULL, NULL }, |
| |
3061 { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "<control>M", NULL, G_CALLBACK(menu_new_conv_cb) }, |
| |
3062 { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, G_CALLBACK(menu_find_cb) }, |
| |
3063 { "ViewLog", NULL, N_("View _Log"), NULL, NULL, G_CALLBACK(menu_view_log_cb) }, |
| |
3064 { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, G_CALLBACK(menu_save_as_cb) }, |
| |
3065 { "ClearScrollback", GTK_STOCK_CLEAR, N_("Clea_r Scrollback"), "<control>L", NULL, G_CALLBACK(menu_clear_cb) }, |
| |
3066 |
| |
3067 #ifdef USE_VV |
| |
3068 { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, |
| |
3069 { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, |
| |
3070 { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, |
| |
3071 { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, |
| |
3072 #endif |
| |
3073 |
| |
3074 { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, |
| |
3075 { "GetAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("Get _Attention"), NULL, NULL, G_CALLBACK(menu_get_attention_cb) }, |
| |
3076 { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, G_CALLBACK(menu_add_pounce_cb) }, |
| |
3077 { "GetInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("_Get Info"), "<control>O", NULL, G_CALLBACK(menu_get_info_cb) }, |
| |
3078 { "Invite", NULL, N_("In_vite..."), NULL, NULL, G_CALLBACK(menu_invite_cb) }, |
| |
3079 { "MoreMenu", NULL, N_("M_ore"), NULL, NULL, NULL }, |
| |
3080 { "Alias", NULL, N_("Al_ias..."), NULL, NULL, G_CALLBACK(menu_alias_cb) }, |
| |
3081 { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, G_CALLBACK(menu_block_cb) }, |
| |
3082 { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, G_CALLBACK(menu_unblock_cb) }, |
| |
3083 { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, |
| |
3084 { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, |
| |
3085 { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, G_CALLBACK(menu_insert_link_cb) }, |
| |
3086 { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, G_CALLBACK(menu_insert_image_cb) }, |
| |
3087 { "Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, NULL, G_CALLBACK(menu_close_conv_cb) }, |
| |
3088 |
| |
3089 /* Options */ |
| |
3090 { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL }, |
| |
3091 }; |
| |
3092 |
| |
3093 /* Toggle items */ |
| |
3094 static const GtkToggleActionEntry menu_toggle_entries[] = { |
| |
3095 { "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, G_CALLBACK(menu_logging_cb), FALSE }, |
| |
3096 { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, G_CALLBACK(menu_sounds_cb), FALSE }, |
| |
3097 { "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, G_CALLBACK(menu_toolbar_cb), FALSE }, |
| |
3098 { "ShowTimestamps", NULL, N_("Show Ti_mestamps"), NULL, NULL, G_CALLBACK(menu_timestamps_cb), FALSE }, |
| |
3099 }; |
| |
3100 |
| |
3101 static const char *conversation_menu = |
| |
3102 "<ui>" |
| |
3103 "<menubar name='Conversation'>" |
| |
3104 "<menu action='ConversationMenu'>" |
| |
3105 "<menuitem action='NewInstantMessage'/>" |
| |
3106 "<separator/>" |
| |
3107 "<menuitem action='Find'/>" |
| |
3108 "<menuitem action='ViewLog'/>" |
| |
3109 "<menuitem action='SaveAs'/>" |
| |
3110 "<menuitem action='ClearScrollback'/>" |
| |
3111 "<separator/>" |
| |
3112 #ifdef USE_VV |
| |
3113 "<menu action='MediaMenu'>" |
| |
3114 "<menuitem action='AudioCall'/>" |
| |
3115 "<menuitem action='VideoCall'/>" |
| |
3116 "<menuitem action='AudioVideoCall'/>" |
| |
3117 "</menu>" |
| |
3118 #endif |
| |
3119 "<menuitem action='SendFile'/>" |
| |
3120 "<menuitem action='GetAttention'/>" |
| |
3121 "<menuitem action='AddBuddyPounce'/>" |
| |
3122 "<menuitem action='GetInfo'/>" |
| |
3123 "<menuitem action='Invite'/>" |
| |
3124 "<menu action='MoreMenu'/>" |
| |
3125 "<separator/>" |
| |
3126 "<menuitem action='Alias'/>" |
| |
3127 "<menuitem action='Block'/>" |
| |
3128 "<menuitem action='Unblock'/>" |
| |
3129 "<menuitem action='Add'/>" |
| |
3130 "<menuitem action='Remove'/>" |
| |
3131 "<separator/>" |
| |
3132 "<menuitem action='InsertLink'/>" |
| |
3133 "<menuitem action='InsertImage'/>" |
| |
3134 "<separator/>" |
| |
3135 "<menuitem action='Close'/>" |
| |
3136 "</menu>" |
| |
3137 "<menu action='OptionsMenu'>" |
| |
3138 "<menuitem action='EnableLogging'/>" |
| |
3139 "<menuitem action='EnableSounds'/>" |
| |
3140 "<separator/>" |
| |
3141 "<menuitem action='ShowFormattingToolbars'/>" |
| |
3142 "<menuitem action='ShowTimestamps'/>" |
| |
3143 "</menu>" |
| |
3144 "</menubar>" |
| |
3145 "</ui>"; |
| |
3146 |
| |
3147 #else |
| |
3148 |
| 3053 static GtkItemFactoryEntry menu_items[] = |
3149 static GtkItemFactoryEntry menu_items[] = |
| 3054 { |
3150 { |
| 3055 /* Conversation menu */ |
3151 /* Conversation menu */ |
| 3056 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL }, |
3152 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL }, |
| 3057 |
3153 |
| 3124 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>", NULL }, |
3220 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>", NULL }, |
| 3125 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL }, |
3221 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL }, |
| 3126 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL }, |
3222 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL }, |
| 3127 { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "<CheckItem>", NULL }, |
3223 { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "<CheckItem>", NULL }, |
| 3128 }; |
3224 }; |
| 3129 |
3225 #endif |
| 3130 static const int menu_item_count = |
|
| 3131 sizeof(menu_items) / sizeof(*menu_items); |
|
| 3132 |
|
| 3133 static const char * |
|
| 3134 item_factory_translate_func (const char *path, gpointer func_data) |
|
| 3135 { |
|
| 3136 return _(path); |
|
| 3137 } |
|
| 3138 |
3226 |
| 3139 static void |
3227 static void |
| 3140 sound_method_pref_changed_cb(const char *name, PurplePrefType type, |
3228 sound_method_pref_changed_cb(const char *name, PurplePrefType type, |
| 3141 gconstpointer value, gpointer data) |
3229 gconstpointer value, gpointer data) |
| 3142 { |
3230 { |
| 3143 PidginWindow *win = data; |
3231 PidginWindow *win = data; |
| 3144 const char *method = value; |
3232 const char *method = value; |
| 3145 |
3233 |
| 3146 if (!strcmp(method, "none")) |
3234 if (!strcmp(method, "none")) |
| 3147 { |
3235 { |
| 3148 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), |
3236 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), |
| 3149 FALSE); |
3237 FALSE); |
| 3150 gtk_widget_set_sensitive(win->menu.sounds, FALSE); |
3238 gtk_action_set_sensitive(win->menu.sounds, FALSE); |
| 3151 } |
3239 } |
| 3152 else |
3240 else |
| 3153 { |
3241 { |
| 3154 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
3242 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
| 3155 |
3243 |
| 3156 if (gtkconv != NULL) |
3244 if (gtkconv != NULL) |
| 3157 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), |
3245 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), |
| 3158 gtkconv->make_sound); |
3246 gtkconv->make_sound); |
| 3159 gtk_widget_set_sensitive(win->menu.sounds, TRUE); |
3247 gtk_action_set_sensitive(win->menu.sounds, TRUE); |
| 3160 |
|
| 3161 } |
3248 } |
| 3162 } |
3249 } |
| 3163 |
3250 |
| 3164 /* Returns TRUE if some items were added to the menu, FALSE otherwise */ |
3251 /* Returns TRUE if some items were added to the menu, FALSE otherwise */ |
| 3165 static gboolean |
3252 static gboolean |
| 3283 == PURPLE_CONV_TYPE_IM) { |
3370 == PURPLE_CONV_TYPE_IM) { |
| 3284 PurpleMediaCaps caps = |
3371 PurpleMediaCaps caps = |
| 3285 purple_prpl_get_media_caps(account, |
3372 purple_prpl_get_media_caps(account, |
| 3286 purple_conversation_get_name(conv)); |
3373 purple_conversation_get_name(conv)); |
| 3287 |
3374 |
| 3288 gtk_widget_set_sensitive(win->audio_call, |
3375 gtk_action_set_sensitive(win->audio_call, |
| 3289 caps & PURPLE_MEDIA_CAPS_AUDIO |
3376 caps & PURPLE_MEDIA_CAPS_AUDIO |
| 3290 ? TRUE : FALSE); |
3377 ? TRUE : FALSE); |
| 3291 gtk_widget_set_sensitive(win->video_call, |
3378 gtk_action_set_sensitive(win->video_call, |
| 3292 caps & PURPLE_MEDIA_CAPS_VIDEO |
3379 caps & PURPLE_MEDIA_CAPS_VIDEO |
| 3293 ? TRUE : FALSE); |
3380 ? TRUE : FALSE); |
| 3294 gtk_widget_set_sensitive(win->audio_video_call, |
3381 gtk_action_set_sensitive(win->audio_video_call, |
| 3295 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO |
3382 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO |
| 3296 ? TRUE : FALSE); |
3383 ? TRUE : FALSE); |
| 3297 } else if (purple_conversation_get_type(conv) |
3384 } else if (purple_conversation_get_type(conv) |
| 3298 == PURPLE_CONV_TYPE_CHAT) { |
3385 == PURPLE_CONV_TYPE_CHAT) { |
| 3299 /* for now, don't care about chats... */ |
3386 /* for now, don't care about chats... */ |
| 3300 gtk_widget_set_sensitive(win->audio_call, FALSE); |
3387 gtk_action_set_sensitive(win->audio_call, FALSE); |
| 3301 gtk_widget_set_sensitive(win->video_call, FALSE); |
3388 gtk_action_set_sensitive(win->video_call, FALSE); |
| 3302 gtk_widget_set_sensitive(win->audio_video_call, FALSE); |
3389 gtk_action_set_sensitive(win->audio_video_call, FALSE); |
| 3303 } else { |
3390 } else { |
| 3304 gtk_widget_set_sensitive(win->audio_call, FALSE); |
3391 gtk_action_set_sensitive(win->audio_call, FALSE); |
| 3305 gtk_widget_set_sensitive(win->video_call, FALSE); |
3392 gtk_action_set_sensitive(win->video_call, FALSE); |
| 3306 gtk_widget_set_sensitive(win->audio_video_call, FALSE); |
3393 gtk_action_set_sensitive(win->audio_video_call, FALSE); |
| 3307 } |
3394 } |
| 3308 #endif |
3395 #endif |
| 3309 } |
3396 } |
| 3310 |
3397 |
| 3311 static void |
3398 static void |
| 3312 regenerate_options_items(PidginWindow *win) |
3399 regenerate_options_items(PidginWindow *win) |
| 3313 { |
3400 { |
| |
3401 #if GTK_CHECK_VERSION(2,6,0) |
| |
3402 #else |
| 3314 GtkWidget *menu; |
3403 GtkWidget *menu; |
| 3315 PidginConversation *gtkconv; |
3404 PidginConversation *gtkconv; |
| 3316 GList *list; |
3405 GList *list; |
| 3317 |
3406 |
| 3318 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
3407 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
| 3411 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); |
3505 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); |
| 3412 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); |
3506 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); |
| 3413 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), |
3507 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), |
| 3414 G_CALLBACK(focus_out_from_menubar), win); |
3508 G_CALLBACK(focus_out_from_menubar), win); |
| 3415 } |
3509 } |
| |
3510 #endif |
| 3416 |
3511 |
| 3417 static GtkWidget * |
3512 static GtkWidget * |
| 3418 setup_menubar(PidginWindow *win) |
3513 setup_menubar(PidginWindow *win) |
| 3419 { |
3514 { |
| 3420 GtkAccelGroup *accel_group; |
3515 GtkAccelGroup *accel_group; |
| 3421 const char *method; |
3516 const char *method; |
| 3422 GtkWidget *menuitem; |
3517 GtkActionGroup *action_group; |
| 3423 |
3518 GError *error; |
| 3424 accel_group = gtk_accel_group_new (); |
3519 |
| |
3520 action_group = gtk_action_group_new("ConversationActions"); |
| |
3521 gtk_action_group_add_actions(action_group, |
| |
3522 menu_entries, |
| |
3523 G_N_ELEMENTS(menu_entries), |
| |
3524 win); |
| |
3525 gtk_action_group_add_toggle_actions(action_group, |
| |
3526 menu_toggle_entries, |
| |
3527 G_N_ELEMENTS(menu_toggle_entries), |
| |
3528 win); |
| |
3529 #ifdef ENABLE_NLS |
| |
3530 gtk_action_group_set_translation_domain(action_group, |
| |
3531 PACKAGE); |
| |
3532 #endif |
| |
3533 |
| |
3534 win->menu.ui = gtk_ui_manager_new(); |
| |
3535 gtk_ui_manager_insert_action_group(win->menu.ui, action_group, 0); |
| |
3536 |
| |
3537 accel_group = gtk_ui_manager_get_accel_group(win->menu.ui); |
| 3425 gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group); |
3538 gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group); |
| 3426 g_object_unref(accel_group); |
|
| 3427 |
|
| 3428 win->menu.item_factory = |
|
| 3429 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
|
| 3430 |
|
| 3431 gtk_item_factory_set_translate_func(win->menu.item_factory, |
|
| 3432 (GtkTranslateFunc)item_factory_translate_func, |
|
| 3433 NULL, NULL); |
|
| 3434 |
|
| 3435 gtk_item_factory_create_items(win->menu.item_factory, menu_item_count, |
|
| 3436 menu_items, win); |
|
| 3437 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3539 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
| 3438 G_CALLBACK(pidgin_save_accels_cb), NULL); |
3540 G_CALLBACK(pidgin_save_accels_cb), NULL); |
| 3439 |
3541 |
| 3440 /* Make sure the 'Conversation -> More' menuitems are regenerated whenever |
3542 error = NULL; |
| 3441 * the 'Conversation' menu pops up because the entries can change after the |
3543 if (!gtk_ui_manager_add_ui_from_string(win->menu.ui, conversation_menu, -1, &error)) |
| 3442 * conversation is created. */ |
3544 { |
| 3443 menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); |
3545 g_message("building menus failed: %s", error->message); |
| 3444 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); |
3546 g_error_free(error); |
| |
3547 exit(EXIT_FAILURE); |
| |
3548 } |
| 3445 |
3549 |
| 3446 win->menu.menubar = |
3550 win->menu.menubar = |
| 3447 gtk_item_factory_get_widget(win->menu.item_factory, "<main>"); |
3551 gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); |
| 3448 |
3552 |
| 3449 win->menu.view_log = |
3553 win->menu.view_log = |
| 3450 gtk_item_factory_get_widget(win->menu.item_factory, |
3554 gtk_ui_manager_get_action(win->menu.ui, |
| 3451 N_("/Conversation/View Log")); |
3555 "/Conversation/ConversationMenu/ViewLog"); |
| 3452 |
3556 |
| 3453 #ifdef USE_VV |
3557 #ifdef USE_VV |
| 3454 win->audio_call = |
3558 win->audio_call = |
| 3455 gtk_item_factory_get_widget(win->menu.item_factory, |
3559 gtk_ui_manager_get_action(win->menu.ui, |
| 3456 N_("/Conversation/Media/Audio Call")); |
3560 "/Conversation/ConversationMenu/MediaMenu/AudioCall"); |
| 3457 win->video_call = |
3561 win->video_call = |
| 3458 gtk_item_factory_get_widget(win->menu.item_factory, |
3562 gtk_ui_manager_get_action(win->menu.ui, |
| 3459 N_("/Conversation/Media/Video Call")); |
3563 "/Conversation/ConversationMenu/MediaMenu/VideoCall"); |
| 3460 win->audio_video_call = |
3564 win->audio_video_call = |
| 3461 gtk_item_factory_get_widget(win->menu.item_factory, |
3565 gtk_ui_manager_get_action(win->menu.ui, |
| 3462 N_("/Conversation/Media/Audio\\/Video Call")); |
3566 "/Conversation/ConversationMenu/MediaMenu/AudioVideoCall"); |
| 3463 #endif |
3567 #endif |
| 3464 |
3568 |
| 3465 /* --- */ |
3569 /* --- */ |
| 3466 |
3570 |
| 3467 win->menu.send_file = |
3571 win->menu.send_file = |
| 3468 gtk_item_factory_get_widget(win->menu.item_factory, |
3572 gtk_ui_manager_get_action(win->menu.ui, |
| 3469 N_("/Conversation/Send File...")); |
3573 "/Conversation/ConversationMenu/SendFile"); |
| 3470 |
3574 |
| 3471 g_object_set_data(G_OBJECT(win->window), "get_attention", |
|
| 3472 gtk_item_factory_get_widget(win->menu.item_factory, |
|
| 3473 N_("/Conversation/Get Attention"))); |
|
| 3474 win->menu.add_pounce = |
3575 win->menu.add_pounce = |
| 3475 gtk_item_factory_get_widget(win->menu.item_factory, |
3576 gtk_ui_manager_get_action(win->menu.ui, |
| 3476 N_("/Conversation/Add Buddy Pounce...")); |
3577 "/Conversation/ConversationMenu/AddBuddyPounce"); |
| 3477 |
3578 |
| 3478 /* --- */ |
3579 /* --- */ |
| 3479 |
3580 |
| 3480 win->menu.get_info = |
3581 win->menu.get_info = |
| 3481 gtk_item_factory_get_widget(win->menu.item_factory, |
3582 gtk_ui_manager_get_action(win->menu.ui, |
| 3482 N_("/Conversation/Get Info")); |
3583 "/Conversation/ConversationMenu/GetInfo"); |
| 3483 |
3584 |
| 3484 win->menu.invite = |
3585 win->menu.invite = |
| 3485 gtk_item_factory_get_widget(win->menu.item_factory, |
3586 gtk_ui_manager_get_action(win->menu.ui, |
| 3486 N_("/Conversation/Invite...")); |
3587 "/Conversation/ConversationMenu/Invite"); |
| 3487 |
3588 |
| 3488 /* --- */ |
3589 /* --- */ |
| 3489 |
3590 |
| 3490 win->menu.alias = |
3591 win->menu.alias = |
| 3491 gtk_item_factory_get_widget(win->menu.item_factory, |
3592 gtk_ui_manager_get_action(win->menu.ui, |
| 3492 N_("/Conversation/Alias...")); |
3593 "/Conversation/ConversationMenu/Alias"); |
| 3493 |
3594 |
| 3494 win->menu.block = |
3595 win->menu.block = |
| 3495 gtk_item_factory_get_widget(win->menu.item_factory, |
3596 gtk_ui_manager_get_action(win->menu.ui, |
| 3496 N_("/Conversation/Block...")); |
3597 "/Conversation/ConversationMenu/Block"); |
| 3497 |
3598 |
| 3498 win->menu.unblock = |
3599 win->menu.unblock = |
| 3499 gtk_item_factory_get_widget(win->menu.item_factory, |
3600 gtk_ui_manager_get_action(win->menu.ui, |
| 3500 N_("/Conversation/Unblock...")); |
3601 "/Conversation/ConversationMenu/Unblock"); |
| 3501 |
3602 |
| 3502 win->menu.add = |
3603 win->menu.add = |
| 3503 gtk_item_factory_get_widget(win->menu.item_factory, |
3604 gtk_ui_manager_get_action(win->menu.ui, |
| 3504 N_("/Conversation/Add...")); |
3605 "/Conversation/ConversationMenu/Add"); |
| 3505 |
3606 |
| 3506 win->menu.remove = |
3607 win->menu.remove = |
| 3507 gtk_item_factory_get_widget(win->menu.item_factory, |
3608 gtk_ui_manager_get_action(win->menu.ui, |
| 3508 N_("/Conversation/Remove...")); |
3609 "/Conversation/ConversationMenu/Remove"); |
| 3509 |
3610 |
| 3510 /* --- */ |
3611 /* --- */ |
| 3511 |
3612 |
| 3512 win->menu.insert_link = |
3613 win->menu.insert_link = |
| 3513 gtk_item_factory_get_widget(win->menu.item_factory, |
3614 gtk_ui_manager_get_action(win->menu.ui, |
| 3514 N_("/Conversation/Insert Link...")); |
3615 "/Conversation/ConversationMenu/InsertLink"); |
| 3515 |
3616 |
| 3516 win->menu.insert_image = |
3617 win->menu.insert_image = |
| 3517 gtk_item_factory_get_widget(win->menu.item_factory, |
3618 gtk_ui_manager_get_action(win->menu.ui, |
| 3518 N_("/Conversation/Insert Image...")); |
3619 "/Conversation/ConversationMenu/InsertImage"); |
| 3519 |
3620 |
| 3520 /* --- */ |
3621 /* --- */ |
| 3521 |
3622 |
| 3522 win->menu.logging = |
3623 win->menu.logging = |
| 3523 gtk_item_factory_get_widget(win->menu.item_factory, |
3624 gtk_ui_manager_get_action(win->menu.ui, |
| 3524 N_("/Options/Enable Logging")); |
3625 "/Conversation/OptionsMenu/EnableLogging"); |
| 3525 win->menu.sounds = |
3626 win->menu.sounds = |
| 3526 gtk_item_factory_get_widget(win->menu.item_factory, |
3627 gtk_ui_manager_get_action(win->menu.ui, |
| 3527 N_("/Options/Enable Sounds")); |
3628 "/Conversation/OptionsMenu/EnableSounds"); |
| 3528 method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
3629 method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
| 3529 if (method != NULL && !strcmp(method, "none")) |
3630 if (method != NULL && !strcmp(method, "none")) |
| 3530 { |
3631 { |
| 3531 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), |
3632 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), |
| 3532 FALSE); |
3633 FALSE); |
| 3533 gtk_widget_set_sensitive(win->menu.sounds, FALSE); |
3634 gtk_action_set_sensitive(win->menu.sounds, FALSE); |
| 3534 } |
3635 } |
| 3535 purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method", |
3636 purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method", |
| 3536 sound_method_pref_changed_cb, win); |
3637 sound_method_pref_changed_cb, win); |
| 3537 |
3638 |
| 3538 win->menu.show_formatting_toolbar = |
3639 win->menu.show_formatting_toolbar = |
| 3539 gtk_item_factory_get_widget(win->menu.item_factory, |
3640 gtk_ui_manager_get_action(win->menu.ui, |
| 3540 N_("/Options/Show Formatting Toolbars")); |
3641 "/Conversation/OptionsMenu/ShowFormattingToolbars"); |
| 3541 win->menu.show_timestamps = |
3642 win->menu.show_timestamps = |
| 3542 gtk_item_factory_get_widget(win->menu.item_factory, |
3643 gtk_ui_manager_get_action(win->menu.ui, |
| 3543 N_("/Options/Show Timestamps")); |
3644 "/Conversation/OptionsMenu/ShowTimestamps"); |
| 3544 win->menu.show_icon = NULL; |
3645 win->menu.show_icon = NULL; |
| 3545 |
3646 |
| 3546 win->menu.tray = pidgin_menu_tray_new(); |
3647 win->menu.tray = pidgin_menu_tray_new(); |
| 3547 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), |
3648 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), |
| 3548 win->menu.tray); |
3649 win->menu.tray); |
| 6464 */ |
6576 */ |
| 6465 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
6577 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
| 6466 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
6578 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
| 6467 |
6579 |
| 6468 /* Deal with menu items */ |
6580 /* Deal with menu items */ |
| 6469 gtk_widget_show(win->menu.view_log); |
6581 gtk_action_set_visible(win->menu.view_log, TRUE); |
| 6470 gtk_widget_show(win->menu.send_file); |
6582 gtk_action_set_visible(win->menu.send_file, TRUE); |
| 6471 gtk_widget_show(g_object_get_data(G_OBJECT(win->window), "get_attention")); |
6583 gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), TRUE); |
| 6472 gtk_widget_show(win->menu.add_pounce); |
6584 gtk_action_set_visible(win->menu.add_pounce, TRUE); |
| 6473 gtk_widget_show(win->menu.get_info); |
6585 gtk_action_set_visible(win->menu.get_info, TRUE); |
| 6474 gtk_widget_hide(win->menu.invite); |
6586 gtk_action_set_visible(win->menu.invite, FALSE); |
| 6475 gtk_widget_show(win->menu.alias); |
6587 gtk_action_set_visible(win->menu.alias, TRUE); |
| 6476 if (purple_privacy_check(account, purple_conversation_get_name(conv))) { |
6588 if (purple_privacy_check(account, purple_conversation_get_name(conv))) { |
| 6477 gtk_widget_hide(win->menu.unblock); |
6589 gtk_action_set_visible(win->menu.unblock, FALSE); |
| 6478 gtk_widget_show(win->menu.block); |
6590 gtk_action_set_visible(win->menu.block, TRUE); |
| 6479 } else { |
6591 } else { |
| 6480 gtk_widget_hide(win->menu.block); |
6592 gtk_action_set_visible(win->menu.block, FALSE); |
| 6481 gtk_widget_show(win->menu.unblock); |
6593 gtk_action_set_visible(win->menu.unblock, TRUE); |
| 6482 } |
6594 } |
| 6483 |
6595 |
| 6484 if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { |
6596 if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { |
| 6485 gtk_widget_show(win->menu.add); |
6597 gtk_action_set_visible(win->menu.add, TRUE); |
| 6486 gtk_widget_hide(win->menu.remove); |
6598 gtk_action_set_visible(win->menu.remove, FALSE); |
| 6487 } else { |
6599 } else { |
| 6488 gtk_widget_show(win->menu.remove); |
6600 gtk_action_set_visible(win->menu.remove, TRUE); |
| 6489 gtk_widget_hide(win->menu.add); |
6601 gtk_action_set_visible(win->menu.add, FALSE); |
| 6490 } |
6602 } |
| 6491 |
6603 |
| 6492 gtk_widget_show(win->menu.insert_link); |
6604 gtk_action_set_visible(win->menu.insert_link, TRUE); |
| 6493 gtk_widget_show(win->menu.insert_image); |
6605 gtk_action_set_visible(win->menu.insert_image, TRUE); |
| 6494 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
6606 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
| 6495 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
6607 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
| 6496 |
6608 |
| 6497 /* Deal with menu items */ |
6609 /* Deal with menu items */ |
| 6498 gtk_widget_show(win->menu.view_log); |
6610 gtk_action_set_visible(win->menu.view_log, TRUE); |
| 6499 gtk_widget_hide(win->menu.send_file); |
6611 gtk_action_set_visible(win->menu.send_file, FALSE); |
| 6500 gtk_widget_hide(g_object_get_data(G_OBJECT(win->window), "get_attention")); |
6612 gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); |
| 6501 gtk_widget_hide(win->menu.add_pounce); |
6613 gtk_action_set_visible(win->menu.add_pounce, FALSE); |
| 6502 gtk_widget_hide(win->menu.get_info); |
6614 gtk_action_set_visible(win->menu.get_info, FALSE); |
| 6503 gtk_widget_show(win->menu.invite); |
6615 gtk_action_set_visible(win->menu.invite, TRUE); |
| 6504 gtk_widget_show(win->menu.alias); |
6616 gtk_action_set_visible(win->menu.alias, TRUE); |
| 6505 gtk_widget_hide(win->menu.block); |
6617 gtk_action_set_visible(win->menu.block, FALSE); |
| 6506 gtk_widget_hide(win->menu.unblock); |
6618 gtk_action_set_visible(win->menu.unblock, FALSE); |
| 6507 |
6619 |
| 6508 if ((account == NULL) || purple_blist_find_chat(account, purple_conversation_get_name(conv)) == NULL) { |
6620 if ((account == NULL) || purple_blist_find_chat(account, purple_conversation_get_name(conv)) == NULL) { |
| 6509 /* If the chat is NOT in the buddy list */ |
6621 /* If the chat is NOT in the buddy list */ |
| 6510 gtk_widget_show(win->menu.add); |
6622 gtk_action_set_visible(win->menu.add, TRUE); |
| 6511 gtk_widget_hide(win->menu.remove); |
6623 gtk_action_set_visible(win->menu.remove, FALSE); |
| 6512 } else { |
6624 } else { |
| 6513 /* If the chat IS in the buddy list */ |
6625 /* If the chat IS in the buddy list */ |
| 6514 gtk_widget_hide(win->menu.add); |
6626 gtk_action_set_visible(win->menu.add, FALSE); |
| 6515 gtk_widget_show(win->menu.remove); |
6627 gtk_action_set_visible(win->menu.remove, TRUE); |
| 6516 } |
6628 } |
| 6517 |
6629 |
| 6518 gtk_widget_show(win->menu.insert_link); |
6630 gtk_action_set_visible(win->menu.insert_link, TRUE); |
| 6519 gtk_widget_show(win->menu.insert_image); |
6631 gtk_action_set_visible(win->menu.insert_image, TRUE); |
| 6520 } |
6632 } |
| 6521 |
6633 |
| 6522 /* |
6634 /* |
| 6523 * Handle graying stuff out based on whether an account is connected |
6635 * Handle graying stuff out based on whether an account is connected |
| 6524 * and what features that account supports. |
6636 * and what features that account supports. |
| 6559 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
6671 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
| 6560 if (account != NULL) |
6672 if (account != NULL) |
| 6561 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); |
6673 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); |
| 6562 |
6674 |
| 6563 /* Deal with menu items */ |
6675 /* Deal with menu items */ |
| 6564 gtk_widget_set_sensitive(win->menu.view_log, TRUE); |
6676 gtk_action_set_sensitive(win->menu.view_log, TRUE); |
| 6565 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); |
6677 gtk_action_set_sensitive(win->menu.add_pounce, TRUE); |
| 6566 gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); |
6678 gtk_action_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); |
| 6567 gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); |
6679 gtk_action_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); |
| 6568 gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); |
6680 gtk_action_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); |
| 6569 gtk_widget_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); |
6681 gtk_action_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); |
| 6570 |
6682 |
| 6571 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
6683 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
| 6572 { |
6684 { |
| 6573 gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); |
6685 gtk_action_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); |
| 6574 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); |
6686 gtk_action_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); |
| 6575 gtk_widget_set_sensitive(win->menu.send_file, |
6687 gtk_action_set_sensitive(win->menu.send_file, |
| 6576 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || |
6688 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || |
| 6577 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); |
6689 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); |
| 6578 gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); |
6690 gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); |
| 6579 gtk_widget_set_sensitive(win->menu.alias, |
6691 gtk_action_set_sensitive(win->menu.alias, |
| 6580 (account != NULL) && |
6692 (account != NULL) && |
| 6581 (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); |
6693 (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); |
| 6582 } |
6694 } |
| 6583 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
6695 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
| 6584 { |
6696 { |
| 6585 gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); |
6697 gtk_action_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); |
| 6586 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); |
6698 gtk_action_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); |
| 6587 gtk_widget_set_sensitive(win->menu.alias, |
6699 gtk_action_set_sensitive(win->menu.alias, |
| 6588 (account != NULL) && |
6700 (account != NULL) && |
| 6589 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL)); |
6701 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL)); |
| 6590 } |
6702 } |
| 6591 |
6703 |
| 6592 } else { |
6704 } else { |
| 6593 /* Account is offline */ |
6705 /* Account is offline */ |
| 6594 /* Or it's a chat that we've left. */ |
6706 /* Or it's a chat that we've left. */ |
| 6595 |
6707 |
| 6596 /* Then deal with menu items */ |
6708 /* Then deal with menu items */ |
| 6597 gtk_widget_set_sensitive(win->menu.view_log, TRUE); |
6709 gtk_action_set_sensitive(win->menu.view_log, TRUE); |
| 6598 gtk_widget_set_sensitive(win->menu.send_file, FALSE); |
6710 gtk_action_set_sensitive(win->menu.send_file, FALSE); |
| 6599 gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), |
6711 gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), |
| 6600 "get_attention"), FALSE); |
6712 "get_attention"), FALSE); |
| 6601 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); |
6713 gtk_action_set_sensitive(win->menu.add_pounce, TRUE); |
| 6602 gtk_widget_set_sensitive(win->menu.get_info, FALSE); |
6714 gtk_action_set_sensitive(win->menu.get_info, FALSE); |
| 6603 gtk_widget_set_sensitive(win->menu.invite, FALSE); |
6715 gtk_action_set_sensitive(win->menu.invite, FALSE); |
| 6604 gtk_widget_set_sensitive(win->menu.alias, FALSE); |
6716 gtk_action_set_sensitive(win->menu.alias, FALSE); |
| 6605 gtk_widget_set_sensitive(win->menu.add, FALSE); |
6717 gtk_action_set_sensitive(win->menu.add, FALSE); |
| 6606 gtk_widget_set_sensitive(win->menu.remove, FALSE); |
6718 gtk_action_set_sensitive(win->menu.remove, FALSE); |
| 6607 gtk_widget_set_sensitive(win->menu.insert_link, TRUE); |
6719 gtk_action_set_sensitive(win->menu.insert_link, TRUE); |
| 6608 gtk_widget_set_sensitive(win->menu.insert_image, FALSE); |
6720 gtk_action_set_sensitive(win->menu.insert_image, FALSE); |
| 6609 } |
6721 } |
| 6610 |
6722 |
| 6611 /* |
6723 /* |
| 6612 * Update the window's icon |
6724 * Update the window's icon |
| 6613 */ |
6725 */ |
| 9086 gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE); |
9204 gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE); |
| 9087 } |
9205 } |
| 9088 |
9206 |
| 9089 /* Update the menubar */ |
9207 /* Update the menubar */ |
| 9090 |
9208 |
| 9091 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), |
9209 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging), |
| 9092 purple_conversation_is_logging(conv)); |
9210 purple_conversation_is_logging(conv)); |
| 9093 |
9211 |
| 9094 generate_send_to_items(win); |
9212 generate_send_to_items(win); |
| 9095 regenerate_options_items(win); |
9213 regenerate_options_items(win); |
| 9096 regenerate_plugins_items(win); |
9214 regenerate_plugins_items(win); |
| 9097 |
9215 |
| 9098 pidgin_conv_switch_active_conversation(conv); |
9216 pidgin_conv_switch_active_conversation(conv); |
| 9099 |
9217 |
| 9100 sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
9218 sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
| 9101 if (strcmp(sound_method, "none") != 0) |
9219 if (strcmp(sound_method, "none") != 0) |
| 9102 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), |
9220 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), |
| 9103 gtkconv->make_sound); |
9221 gtkconv->make_sound); |
| 9104 |
9222 |
| 9105 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), |
9223 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), |
| 9106 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); |
9224 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); |
| 9107 |
9225 |
| 9108 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), |
9226 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_timestamps), |
| 9109 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); |
9227 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); |
| 9110 |
9228 |
| 9111 /* |
9229 /* |
| 9112 * We pause icons when they are not visible. If this icon should |
9230 * We pause icons when they are not visible. If this icon should |
| 9113 * be animated then start it back up again. |
9231 * be animated then start it back up again. |
| 9114 */ |
9232 */ |