| 308 } |
308 } |
| 309 |
309 |
| 310 static void gtk_blist_menu_join_cb(GtkWidget *w, PurpleChat *chat) |
310 static void gtk_blist_menu_join_cb(GtkWidget *w, PurpleChat *chat) |
| 311 { |
311 { |
| 312 gtk_blist_join_chat(chat); |
312 gtk_blist_join_chat(chat); |
| |
313 } |
| |
314 |
| |
315 static void gtk_blist_renderer_editing_started_cb(GtkCellRenderer *renderer, |
| |
316 GtkCellEditable *editable, |
| |
317 gchar *path_str, |
| |
318 gpointer user_data) |
| |
319 { |
| |
320 GtkTreeIter iter; |
| |
321 GtkTreePath *path = NULL; |
| |
322 GValue val; |
| |
323 PurpleBlistNode *node; |
| |
324 const char *text = NULL; |
| |
325 char *esc; |
| |
326 |
| |
327 path = gtk_tree_path_new_from_string (path_str); |
| |
328 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
| |
329 gtk_tree_path_free (path); |
| |
330 val.g_type = 0; |
| |
331 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
| |
332 node = g_value_get_pointer(&val); |
| |
333 |
| |
334 switch (node->type) { |
| |
335 case PURPLE_BLIST_CONTACT_NODE: |
| |
336 text = purple_contact_get_alias((PurpleContact *)node); |
| |
337 break; |
| |
338 case PURPLE_BLIST_BUDDY_NODE: |
| |
339 text = purple_buddy_get_alias((PurpleBuddy *)node); |
| |
340 break; |
| |
341 case PURPLE_BLIST_GROUP_NODE: |
| |
342 text = ((PurpleGroup *)node)->name; |
| |
343 break; |
| |
344 default: |
| |
345 g_return_if_reached(); |
| |
346 } |
| |
347 |
| |
348 esc = g_markup_escape_text(text, -1); |
| |
349 if (GTK_IS_ENTRY (editable)) { |
| |
350 GtkEntry *entry = GTK_ENTRY (editable); |
| |
351 gtk_entry_set_text(entry, esc); |
| |
352 } |
| |
353 g_free(esc); |
| 313 } |
354 } |
| 314 |
355 |
| 315 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1, |
356 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1, |
| 316 char *arg2, gpointer nada) |
357 char *arg2, gpointer nada) |
| 317 { |
358 { |
| 369 |
410 |
| 370 static void gtk_blist_menu_alias_cb(GtkWidget *w, PurpleBlistNode *node) |
411 static void gtk_blist_menu_alias_cb(GtkWidget *w, PurpleBlistNode *node) |
| 371 { |
412 { |
| 372 GtkTreeIter iter; |
413 GtkTreeIter iter; |
| 373 GtkTreePath *path; |
414 GtkTreePath *path; |
| 374 const char *text = NULL; |
|
| 375 char *esc; |
|
| 376 |
415 |
| 377 if (!(get_iter_from_node(node, &iter))) { |
416 if (!(get_iter_from_node(node, &iter))) { |
| 378 /* This is either a bug, or the buddy is in a collapsed contact */ |
417 /* This is either a bug, or the buddy is in a collapsed contact */ |
| 379 node = node->parent; |
418 node = node->parent; |
| 380 if (!get_iter_from_node(node, &iter)) |
419 if (!get_iter_from_node(node, &iter)) |
| 381 /* Now it's definitely a bug */ |
420 /* Now it's definitely a bug */ |
| 382 return; |
421 return; |
| 383 } |
422 } |
| 384 |
|
| 385 switch (node->type) { |
|
| 386 case PURPLE_BLIST_BUDDY_NODE: |
|
| 387 text = purple_buddy_get_alias((PurpleBuddy *)node); |
|
| 388 break; |
|
| 389 case PURPLE_BLIST_CONTACT_NODE: |
|
| 390 text = purple_contact_get_alias((PurpleContact *)node); |
|
| 391 break; |
|
| 392 case PURPLE_BLIST_GROUP_NODE: |
|
| 393 text = ((PurpleGroup *)node)->name; |
|
| 394 break; |
|
| 395 case PURPLE_BLIST_CHAT_NODE: |
|
| 396 text = purple_chat_get_name((PurpleChat *)node); |
|
| 397 break; |
|
| 398 default: |
|
| 399 g_return_if_reached(); |
|
| 400 } |
|
| 401 |
|
| 402 esc = g_markup_escape_text(text, -1); |
|
| 403 gtk_tree_store_set(gtkblist->treemodel, &iter, NAME_COLUMN, esc, -1); |
|
| 404 g_free(esc); |
|
| 405 |
423 |
| 406 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); |
424 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); |
| 407 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL); |
425 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL); |
| 408 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), FALSE); |
426 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), FALSE); |
| 409 gtk_widget_grab_focus(gtkblist->treeview); |
427 gtk_widget_grab_focus(gtkblist->treeview); |
| 2801 ***************************************************/ |
2821 ***************************************************/ |
| 2802 static GtkItemFactoryEntry blist_menu[] = |
2822 static GtkItemFactoryEntry blist_menu[] = |
| 2803 { |
2823 { |
| 2804 /* Buddies menu */ |
2824 /* Buddies menu */ |
| 2805 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL }, |
2825 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL }, |
| 2806 { N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgindialogs_im, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, |
2826 { N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgin_dialogs_im, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, |
| 2807 { N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_joinchat_show, 0, "<Item>", NULL }, |
2827 { N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_joinchat_show, 0, "<Item>", NULL }, |
| 2808 { N_("/Buddies/Get User _Info..."), "<CTL>I", pidgindialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, |
2828 { N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_dialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, |
| 2809 { N_("/Buddies/View User _Log..."), "<CTL>L", pidgindialogs_log, 0, "<Item>", NULL }, |
2829 { N_("/Buddies/View User _Log..."), "<CTL>L", pidgin_dialogs_log, 0, "<Item>", NULL }, |
| 2810 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL }, |
2830 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL }, |
| 2811 { N_("/Buddies/Show _Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "<CheckItem>", NULL }, |
2831 { N_("/Buddies/Show _Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "<CheckItem>", NULL }, |
| 2812 { N_("/Buddies/Show _Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL }, |
2832 { N_("/Buddies/Show _Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL }, |
| 2813 { N_("/Buddies/Show Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "<CheckItem>", NULL }, |
2833 { N_("/Buddies/Show Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "<CheckItem>", NULL }, |
| 2814 { N_("/Buddies/Show Idle _Times"), NULL, pidgin_blist_show_idle_time_cb, 1, "<CheckItem>", NULL }, |
2834 { N_("/Buddies/Show Idle _Times"), NULL, pidgin_blist_show_idle_time_cb, 1, "<CheckItem>", NULL }, |
| 2829 { N_("/Tools/Buddy _Pounces"), NULL, pidgin_pounces_manager_show, 0, "<Item>", NULL }, |
2849 { N_("/Tools/Buddy _Pounces"), NULL, pidgin_pounces_manager_show, 0, "<Item>", NULL }, |
| 2830 { N_("/Tools/Plu_gins"), "<CTL>U", pidgin_plugin_dialog_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS }, |
2850 { N_("/Tools/Plu_gins"), "<CTL>U", pidgin_plugin_dialog_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS }, |
| 2831 { N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, |
2851 { N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, |
| 2832 { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "<Item>", NULL }, |
2852 { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "<Item>", NULL }, |
| 2833 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
2853 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
| 2834 { N_("/Tools/_File Transfers"), "<CTL>T", pidginxfer_dialog_show, 0, "<Item>", NULL }, |
2854 { N_("/Tools/_File Transfers"), "<CTL>T", pidgin_xfer_dialog_show, 0, "<Item>", NULL }, |
| 2835 { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL }, |
2855 { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL }, |
| 2836 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<Item>", NULL }, |
2856 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<Item>", NULL }, |
| 2837 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL }, |
2857 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL }, |
| 2838 { N_("/Tools/Mute _Sounds"), "<CTL>S", pidgin_blist_mute_sounds_cb, 0, "<CheckItem>", NULL }, |
2858 { N_("/Tools/Mute _Sounds"), "<CTL>S", pidgin_blist_mute_sounds_cb, 0, "<CheckItem>", NULL }, |
| 2839 |
2859 |
| 2840 /* Help */ |
2860 /* Help */ |
| 2841 { N_("/_Help"), NULL, NULL, 0, "<Branch>", NULL }, |
2861 { N_("/_Help"), NULL, NULL, 0, "<Branch>", NULL }, |
| 2842 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP }, |
2862 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP }, |
| 2843 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL }, |
2863 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL }, |
| 2844 { N_("/Help/_About"), NULL, pidgindialogs_about, 0, "<StockItem>", PIDGIN_STOCK_ABOUT }, |
2864 { N_("/Help/_About"), NULL, pidgin_dialogs_about, 0, "<StockItem>", PIDGIN_STOCK_ABOUT }, |
| 2845 }; |
2865 }; |
| 2846 |
2866 |
| 2847 /********************************************************* |
2867 /********************************************************* |
| 2848 * Private Utility functions * |
2868 * Private Utility functions * |
| 2849 *********************************************************/ |
2869 *********************************************************/ |
| 4398 #if GTK_CHECK_VERSION(2,6,0) |
4418 #if GTK_CHECK_VERSION(2,6,0) |
| 4399 "cell-background-gdk", BGCOLOR_COLUMN, |
4419 "cell-background-gdk", BGCOLOR_COLUMN, |
| 4400 #endif |
4420 #endif |
| 4401 "markup", NAME_COLUMN, |
4421 "markup", NAME_COLUMN, |
| 4402 NULL); |
4422 NULL); |
| |
4423 g_signal_connect(G_OBJECT(rend), "editing-started", G_CALLBACK(gtk_blist_renderer_editing_started_cb), NULL); |
| 4403 g_signal_connect(G_OBJECT(rend), "edited", G_CALLBACK(gtk_blist_renderer_edited_cb), NULL); |
4424 g_signal_connect(G_OBJECT(rend), "edited", G_CALLBACK(gtk_blist_renderer_edited_cb), NULL); |
| 4404 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL); |
4425 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL); |
| 4405 #if GTK_CHECK_VERSION(2,6,0) |
4426 #if GTK_CHECK_VERSION(2,6,0) |
| 4406 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
4427 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
| 4407 #endif |
4428 #endif |
| 4463 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); |
4484 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); |
| 4464 |
4485 |
| 4465 /* Add the statusbox */ |
4486 /* Add the statusbox */ |
| 4466 gtkblist->statusbox = pidgin_status_box_new(); |
4487 gtkblist->statusbox = pidgin_status_box_new(); |
| 4467 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0); |
4488 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0); |
| 4468 gtk_widget_set_name(gtkblist->statusbox, "pidginblist_statusbox"); |
4489 gtk_widget_set_name(gtkblist->statusbox, "pidgin_blist_statusbox"); |
| 4469 gtk_container_set_border_width(GTK_CONTAINER(gtkblist->statusbox), 3); |
4490 gtk_container_set_border_width(GTK_CONTAINER(gtkblist->statusbox), 3); |
| 4470 gtk_widget_show(gtkblist->statusbox); |
4491 gtk_widget_show(gtkblist->statusbox); |
| 4471 |
4492 |
| 4472 /* set the Show Offline Buddies option. must be done |
4493 /* set the Show Offline Buddies option. must be done |
| 4473 * after the treeview or faceprint gets mad. -Robot101 |
4494 * after the treeview or faceprint gets mad. -Robot101 |