Mercurial > pidgin.yaz
comparison pidgin/gtkblist.c @ 16062:07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
until someone comes up with something cleverererer
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Wed, 11 Apr 2007 13:38:05 +0000 |
parents | eae8e127e4fb |
children | 31e6eb50b4fd |
comparison
equal
deleted
inserted
replaced
16061:3b86ad370861 | 16062:07554cc5d090 |
---|---|
177 | 177 |
178 static gboolean gtk_blist_window_state_cb(GtkWidget *w, GdkEventWindowState *event, gpointer data) | 178 static gboolean gtk_blist_window_state_cb(GtkWidget *w, GdkEventWindowState *event, gpointer data) |
179 { | 179 { |
180 if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) { | 180 if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) { |
181 if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN) | 181 if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN) |
182 purple_prefs_set_bool("/purple/gtk/blist/list_visible", FALSE); | 182 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", FALSE); |
183 else { | 183 else { |
184 purple_prefs_set_bool("/purple/gtk/blist/list_visible", TRUE); | 184 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", TRUE); |
185 pidgin_blist_refresh_timer(purple_get_blist()); | 185 pidgin_blist_refresh_timer(purple_get_blist()); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 if(event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { | 189 if(event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { |
190 if(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) | 190 if(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) |
191 purple_prefs_set_bool("/purple/gtk/blist/list_maximized", TRUE); | 191 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", TRUE); |
192 else | 192 else |
193 purple_prefs_set_bool("/purple/gtk/blist/list_maximized", FALSE); | 193 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", FALSE); |
194 } | 194 } |
195 | 195 |
196 /* Refresh gtkblist if un-iconifying */ | 196 /* Refresh gtkblist if un-iconifying */ |
197 if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED){ | 197 if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED){ |
198 if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)) | 198 if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)) |
237 return FALSE; | 237 return FALSE; |
238 } | 238 } |
239 #endif | 239 #endif |
240 | 240 |
241 /* don't save if nothing changed */ | 241 /* don't save if nothing changed */ |
242 if (x == purple_prefs_get_int("/purple/gtk/blist/x") && | 242 if (x == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x") && |
243 y == purple_prefs_get_int("/purple/gtk/blist/y") && | 243 y == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y") && |
244 event->width == purple_prefs_get_int("/purple/gtk/blist/width") && | 244 event->width == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") && |
245 event->height == purple_prefs_get_int("/purple/gtk/blist/height")) { | 245 event->height == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/height")) { |
246 | 246 |
247 return FALSE; /* carry on normally */ | 247 return FALSE; /* carry on normally */ |
248 } | 248 } |
249 | 249 |
250 /* don't save off-screen positioning */ | 250 /* don't save off-screen positioning */ |
255 | 255 |
256 return FALSE; /* carry on normally */ | 256 return FALSE; /* carry on normally */ |
257 } | 257 } |
258 | 258 |
259 /* ignore changes when maximized */ | 259 /* ignore changes when maximized */ |
260 if(purple_prefs_get_bool("/purple/gtk/blist/list_maximized")) | 260 if(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized")) |
261 return FALSE; | 261 return FALSE; |
262 | 262 |
263 /* store the position */ | 263 /* store the position */ |
264 purple_prefs_set_int("/purple/gtk/blist/x", x); | 264 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/x", x); |
265 purple_prefs_set_int("/purple/gtk/blist/y", y); | 265 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/y", y); |
266 purple_prefs_set_int("/purple/gtk/blist/width", event->width); | 266 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/width", event->width); |
267 purple_prefs_set_int("/purple/gtk/blist/height", event->height); | 267 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/height", event->height); |
268 | 268 |
269 gtk_widget_set_size_request(gtkblist->headline_label, | 269 gtk_widget_set_size_request(gtkblist->headline_label, |
270 purple_prefs_get_int("/purple/gtk/blist/width")-25,-1); | 270 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25,-1); |
271 /* continue to handle event normally */ | 271 /* continue to handle event normally */ |
272 return FALSE; | 272 return FALSE; |
273 } | 273 } |
274 | 274 |
275 static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b) | 275 static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b) |
1229 static GtkWidget * | 1229 static GtkWidget * |
1230 create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) { | 1230 create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) { |
1231 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; | 1231 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; |
1232 GtkWidget *menu; | 1232 GtkWidget *menu; |
1233 GtkWidget *menuitem; | 1233 GtkWidget *menuitem; |
1234 gboolean show_offline = purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies"); | 1234 gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); |
1235 | 1235 |
1236 menu = gtk_menu_new(); | 1236 menu = gtk_menu_new(); |
1237 pidgin_blist_make_buddy_menu(menu, b, FALSE); | 1237 pidgin_blist_make_buddy_menu(menu, b, FALSE); |
1238 | 1238 |
1239 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 1239 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1441 | 1441 |
1442 static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item) | 1442 static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item) |
1443 { | 1443 { |
1444 pidgin_set_cursor(gtkblist->window, GDK_WATCH); | 1444 pidgin_set_cursor(gtkblist->window, GDK_WATCH); |
1445 | 1445 |
1446 purple_prefs_set_bool("/purple/gtk/blist/show_buddy_icons", | 1446 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", |
1447 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); | 1447 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); |
1448 | 1448 |
1449 pidgin_clear_cursor(gtkblist->window); | 1449 pidgin_clear_cursor(gtkblist->window); |
1450 } | 1450 } |
1451 | 1451 |
1452 static void pidgin_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item) | 1452 static void pidgin_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item) |
1453 { | 1453 { |
1454 pidgin_set_cursor(gtkblist->window, GDK_WATCH); | 1454 pidgin_set_cursor(gtkblist->window, GDK_WATCH); |
1455 | 1455 |
1456 purple_prefs_set_bool("/purple/gtk/blist/show_idle_time", | 1456 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", |
1457 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); | 1457 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); |
1458 | 1458 |
1459 pidgin_clear_cursor(gtkblist->window); | 1459 pidgin_clear_cursor(gtkblist->window); |
1460 } | 1460 } |
1461 | 1461 |
1462 static void pidgin_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item) | 1462 static void pidgin_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item) |
1463 { | 1463 { |
1464 pidgin_set_cursor(gtkblist->window, GDK_WATCH); | 1464 pidgin_set_cursor(gtkblist->window, GDK_WATCH); |
1465 | 1465 |
1466 purple_prefs_set_bool("/purple/gtk/blist/show_empty_groups", | 1466 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", |
1467 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); | 1467 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); |
1468 | 1468 |
1469 pidgin_clear_cursor(gtkblist->window); | 1469 pidgin_clear_cursor(gtkblist->window); |
1470 } | 1470 } |
1471 | 1471 |
1472 static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_action, | 1472 static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_action, |
1473 GtkWidget *checkitem) | 1473 GtkWidget *checkitem) |
1474 { | 1474 { |
1475 pidgin_set_cursor(gtkblist->window, GDK_WATCH); | 1475 pidgin_set_cursor(gtkblist->window, GDK_WATCH); |
1476 | 1476 |
1477 purple_prefs_set_bool("/purple/gtk/blist/show_offline_buddies", | 1477 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", |
1478 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem))); | 1478 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem))); |
1479 | 1479 |
1480 pidgin_clear_cursor(gtkblist->window); | 1480 pidgin_clear_cursor(gtkblist->window); |
1481 } | 1481 } |
1482 | 1482 |
1483 static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item) | 1483 static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item) |
1484 { | 1484 { |
1485 purple_prefs_set_bool("/purple/gtk/sound/mute", GTK_CHECK_MENU_ITEM(item)->active); | 1485 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", GTK_CHECK_MENU_ITEM(item)->active); |
1486 } | 1486 } |
1487 | 1487 |
1488 static void | 1488 static void |
1489 pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type, | 1489 pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type, |
1490 gconstpointer value, gpointer data) | 1490 gconstpointer value, gpointer data) |
2119 | 2119 |
2120 if(account && account->gc) | 2120 if(account && account->gc) |
2121 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | 2121 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); |
2122 | 2122 |
2123 #if 0 | 2123 #if 0 |
2124 if (!purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons")) | 2124 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")) |
2125 return NULL; | 2125 return NULL; |
2126 #endif | 2126 #endif |
2127 | 2127 |
2128 if (custom) { | 2128 if (custom) { |
2129 const char *file = purple_blist_node_get_string((PurpleBlistNode*)purple_buddy_get_contact(buddy), | 2129 const char *file = purple_blist_node_get_string((PurpleBlistNode*)purple_buddy_get_contact(buddy), |
2502 gtknode = ((PurpleBlistNode*)buddy)->ui_data; | 2502 gtknode = ((PurpleBlistNode*)buddy)->ui_data; |
2503 | 2503 |
2504 return (purple_account_is_connected(buddy->account) && | 2504 return (purple_account_is_connected(buddy->account) && |
2505 (purple_presence_is_online(buddy->presence) || | 2505 (purple_presence_is_online(buddy->presence) || |
2506 (gtknode && gtknode->recent_signonoff) || | 2506 (gtknode && gtknode->recent_signonoff) || |
2507 purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies") || | 2507 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || |
2508 purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"))); | 2508 purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"))); |
2509 } | 2509 } |
2510 | 2510 |
2511 static gboolean pidgin_blist_tooltip_timeout(GtkWidget *tv) | 2511 static gboolean pidgin_blist_tooltip_timeout(GtkWidget *tv) |
2512 { | 2512 { |
2685 static gboolean pidgin_blist_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null) | 2685 static gboolean pidgin_blist_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null) |
2686 { | 2686 { |
2687 GtkTreePath *path; | 2687 GtkTreePath *path; |
2688 int delay; | 2688 int delay; |
2689 | 2689 |
2690 delay = purple_prefs_get_int("/purple/gtk/blist/tooltip_delay"); | 2690 delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay"); |
2691 | 2691 |
2692 if (delay == 0) | 2692 if (delay == 0) |
2693 return FALSE; | 2693 return FALSE; |
2694 | 2694 |
2695 if (gtkblist->timeout) { | 2695 if (gtkblist->timeout) { |
2741 } | 2741 } |
2742 | 2742 |
2743 static void | 2743 static void |
2744 toggle_debug(void) | 2744 toggle_debug(void) |
2745 { | 2745 { |
2746 purple_prefs_set_bool("/purple/gtk/debug/enabled", | 2746 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", |
2747 !purple_prefs_get_bool("/purple/gtk/debug/enabled")); | 2747 !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled")); |
2748 } | 2748 } |
2749 | 2749 |
2750 | 2750 |
2751 /*************************************************** | 2751 /*************************************************** |
2752 * Crap * | 2752 * Crap * |
3218 name = purple_buddy_get_alias(b); | 3218 name = purple_buddy_get_alias(b); |
3219 esc = g_markup_escape_text(name, strlen(name)); | 3219 esc = g_markup_escape_text(name, strlen(name)); |
3220 | 3220 |
3221 presence = purple_buddy_get_presence(b); | 3221 presence = purple_buddy_get_presence(b); |
3222 | 3222 |
3223 if (!purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons")) | 3223 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")) |
3224 { | 3224 { |
3225 if (!selected && purple_presence_is_idle(presence)) | 3225 if (!selected && purple_presence_is_idle(presence)) |
3226 { | 3226 { |
3227 text = g_strdup_printf("<span color='%s'>%s</span>", | 3227 text = g_strdup_printf("<span color='%s'>%s</span>", |
3228 dim_grey(), esc); | 3228 dim_grey(), esc); |
3302 statustext = g_strdup(_("Offline")); | 3302 statustext = g_strdup(_("Offline")); |
3303 else if (!statustext) | 3303 else if (!statustext) |
3304 text = g_strdup(esc); | 3304 text = g_strdup(esc); |
3305 | 3305 |
3306 if (purple_presence_is_idle(presence)) { | 3306 if (purple_presence_is_idle(presence)) { |
3307 if (purple_prefs_get_bool("/purple/gtk/blist/show_idle_time")) { | 3307 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")) { |
3308 time_t idle_secs = purple_presence_get_idle_time(presence); | 3308 time_t idle_secs = purple_presence_get_idle_time(presence); |
3309 | 3309 |
3310 if (idle_secs > 0) { | 3310 if (idle_secs > 0) { |
3311 int ihrs, imin; | 3311 int ihrs, imin; |
3312 | 3312 |
3372 | 3372 |
3373 static void pidgin_blist_restore_position() | 3373 static void pidgin_blist_restore_position() |
3374 { | 3374 { |
3375 int blist_x, blist_y, blist_width, blist_height; | 3375 int blist_x, blist_y, blist_width, blist_height; |
3376 | 3376 |
3377 blist_width = purple_prefs_get_int("/purple/gtk/blist/width"); | 3377 blist_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width"); |
3378 | 3378 |
3379 /* if the window exists, is hidden, we're saving positions, and the | 3379 /* if the window exists, is hidden, we're saving positions, and the |
3380 * position is sane... */ | 3380 * position is sane... */ |
3381 if (gtkblist && gtkblist->window && | 3381 if (gtkblist && gtkblist->window && |
3382 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) { | 3382 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) { |
3383 | 3383 |
3384 blist_x = purple_prefs_get_int("/purple/gtk/blist/x"); | 3384 blist_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x"); |
3385 blist_y = purple_prefs_get_int("/purple/gtk/blist/y"); | 3385 blist_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y"); |
3386 blist_height = purple_prefs_get_int("/purple/gtk/blist/height"); | 3386 blist_height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/height"); |
3387 | 3387 |
3388 /* ...check position is on screen... */ | 3388 /* ...check position is on screen... */ |
3389 if (blist_x >= gdk_screen_width()) | 3389 if (blist_x >= gdk_screen_width()) |
3390 blist_x = gdk_screen_width() - 100; | 3390 blist_x = gdk_screen_width() - 100; |
3391 else if (blist_x + blist_width < 0) | 3391 else if (blist_x + blist_width < 0) |
3397 blist_y = 100; | 3397 blist_y = 100; |
3398 | 3398 |
3399 /* ...and move it back. */ | 3399 /* ...and move it back. */ |
3400 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y); | 3400 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y); |
3401 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height); | 3401 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height); |
3402 if (purple_prefs_get_bool("/purple/gtk/blist/list_maximized")) | 3402 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized")) |
3403 gtk_window_maximize(GTK_WINDOW(gtkblist->window)); | 3403 gtk_window_maximize(GTK_WINDOW(gtkblist->window)); |
3404 } | 3404 } |
3405 } | 3405 } |
3406 | 3406 |
3407 static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) | 3407 static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) |
3678 #if GTK_CHECK_VERSION(2,2,1) | 3678 #if GTK_CHECK_VERSION(2,2,1) |
3679 pidgin_blist_sort_method_reg("alphabetical", _("Alphabetically"), sort_method_alphabetical); | 3679 pidgin_blist_sort_method_reg("alphabetical", _("Alphabetically"), sort_method_alphabetical); |
3680 pidgin_blist_sort_method_reg("status", _("By status"), sort_method_status); | 3680 pidgin_blist_sort_method_reg("status", _("By status"), sort_method_status); |
3681 pidgin_blist_sort_method_reg("log_size", _("By log size"), sort_method_log); | 3681 pidgin_blist_sort_method_reg("log_size", _("By log size"), sort_method_log); |
3682 #endif | 3682 #endif |
3683 pidgin_blist_sort_method_set(purple_prefs_get_string("/purple/gtk/blist/sort_type")); | 3683 pidgin_blist_sort_method_set(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type")); |
3684 } | 3684 } |
3685 | 3685 |
3686 static void _prefs_change_redo_list() | 3686 static void _prefs_change_redo_list() |
3687 { | 3687 { |
3688 GtkTreeSelection *sel; | 3688 GtkTreeSelection *sel; |
3717 } | 3717 } |
3718 | 3718 |
3719 static void _prefs_change_sort_method(const char *pref_name, PurplePrefType type, | 3719 static void _prefs_change_sort_method(const char *pref_name, PurplePrefType type, |
3720 gconstpointer val, gpointer data) | 3720 gconstpointer val, gpointer data) |
3721 { | 3721 { |
3722 if(!strcmp(pref_name, "/purple/gtk/blist/sort_type")) | 3722 if(!strcmp(pref_name, PIDGIN_PREFS_ROOT "/blist/sort_type")) |
3723 pidgin_blist_sort_method_set(val); | 3723 pidgin_blist_sort_method_set(val); |
3724 } | 3724 } |
3725 | 3725 |
3726 static void account_modified(PurpleAccount *account, PidginBuddyList *gtkblist) | 3726 static void account_modified(PurpleAccount *account, PidginBuddyList *gtkblist) |
3727 { | 3727 { |
4117 {"text/plain", 0, DRAG_TEXT}}; | 4117 {"text/plain", 0, DRAG_TEXT}}; |
4118 GtkTargetEntry ste[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, | 4118 GtkTargetEntry ste[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, |
4119 {"application/x-im-contact", 0, DRAG_BUDDY}, | 4119 {"application/x-im-contact", 0, DRAG_BUDDY}, |
4120 {"text/x-vcard", 0, DRAG_VCARD }}; | 4120 {"text/x-vcard", 0, DRAG_VCARD }}; |
4121 if (gtkblist && gtkblist->window) { | 4121 if (gtkblist && gtkblist->window) { |
4122 purple_blist_set_visible(purple_prefs_get_bool("/purple/gtk/blist/list_visible")); | 4122 purple_blist_set_visible(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible")); |
4123 return; | 4123 return; |
4124 } | 4124 } |
4125 | 4125 |
4126 gtkblist = PIDGIN_BLIST(list); | 4126 gtkblist = PIDGIN_BLIST(list); |
4127 | 4127 |
4187 "enable accounts, you'll be able to sign on, set your status, " | 4187 "enable accounts, you'll be able to sign on, set your status, " |
4188 "and talk to your friends."), PIDGIN_NAME); | 4188 "and talk to your friends."), PIDGIN_NAME); |
4189 pretty = pidgin_make_pretty_arrows(tmp); | 4189 pretty = pidgin_make_pretty_arrows(tmp); |
4190 g_free(tmp); | 4190 g_free(tmp); |
4191 label = gtk_label_new(NULL); | 4191 label = gtk_label_new(NULL); |
4192 gtk_widget_set_size_request(label, purple_prefs_get_int("/purple/gtk/blist/width") - 12, -1); | 4192 gtk_widget_set_size_request(label, purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") - 12, -1); |
4193 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 4193 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
4194 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2); | 4194 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2); |
4195 gtk_label_set_markup(GTK_LABEL(label), pretty); | 4195 gtk_label_set_markup(GTK_LABEL(label), pretty); |
4196 g_free(pretty); | 4196 g_free(pretty); |
4197 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook),label, NULL); | 4197 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook),label, NULL); |
4210 gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox); | 4210 gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox); |
4211 gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL); | 4211 gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL); |
4212 gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0); | 4212 gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0); |
4213 gtkblist->headline_label = gtk_label_new(NULL); | 4213 gtkblist->headline_label = gtk_label_new(NULL); |
4214 gtk_widget_set_size_request(gtkblist->headline_label, | 4214 gtk_widget_set_size_request(gtkblist->headline_label, |
4215 purple_prefs_get_int("/purple/gtk/blist/width")-25,-1); | 4215 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25,-1); |
4216 gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE); | 4216 gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE); |
4217 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0); | 4217 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0); |
4218 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0); | 4218 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0); |
4219 g_signal_connect(gtkblist->headline_hbox, | 4219 g_signal_connect(gtkblist->headline_hbox, |
4220 "style-set", | 4220 "style-set", |
4421 | 4421 |
4422 /* set the Show Offline Buddies option. must be done | 4422 /* set the Show Offline Buddies option. must be done |
4423 * after the treeview or faceprint gets mad. -Robot101 | 4423 * after the treeview or faceprint gets mad. -Robot101 |
4424 */ | 4424 */ |
4425 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Offline Buddies"))), | 4425 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Offline Buddies"))), |
4426 purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies")); | 4426 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); |
4427 | 4427 |
4428 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Empty Groups"))), | 4428 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Empty Groups"))), |
4429 purple_prefs_get_bool("/purple/gtk/blist/show_empty_groups")); | 4429 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")); |
4430 | 4430 |
4431 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))), | 4431 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))), |
4432 purple_prefs_get_bool("/purple/gtk/sound/mute")); | 4432 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")); |
4433 | 4433 |
4434 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Buddy Details"))), | 4434 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Buddy Details"))), |
4435 purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons")); | 4435 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")); |
4436 | 4436 |
4437 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Idle Times"))), | 4437 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Idle Times"))), |
4438 purple_prefs_get_bool("/purple/gtk/blist/show_idle_time")); | 4438 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")); |
4439 | 4439 |
4440 if(!strcmp(purple_prefs_get_string("/purple/gtk/sound/method"), "none")) | 4440 if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) |
4441 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE); | 4441 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE); |
4442 | 4442 |
4443 /* Update some dynamic things */ | 4443 /* Update some dynamic things */ |
4444 update_menu_bar(gtkblist); | 4444 update_menu_bar(gtkblist); |
4445 pidgin_blist_update_plugin_actions(); | 4445 pidgin_blist_update_plugin_actions(); |
4448 /* OK... let's show this bad boy. */ | 4448 /* OK... let's show this bad boy. */ |
4449 pidgin_blist_refresh(list); | 4449 pidgin_blist_refresh(list); |
4450 pidgin_blist_restore_position(); | 4450 pidgin_blist_restore_position(); |
4451 gtk_widget_show_all(GTK_WIDGET(gtkblist->vbox)); | 4451 gtk_widget_show_all(GTK_WIDGET(gtkblist->vbox)); |
4452 gtk_widget_realize(GTK_WIDGET(gtkblist->window)); | 4452 gtk_widget_realize(GTK_WIDGET(gtkblist->window)); |
4453 purple_blist_set_visible(purple_prefs_get_bool("/purple/gtk/blist/list_visible")); | 4453 purple_blist_set_visible(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible")); |
4454 | 4454 |
4455 /* start the refresh timer */ | 4455 /* start the refresh timer */ |
4456 gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)pidgin_blist_refresh_timer, list); | 4456 gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)pidgin_blist_refresh_timer, list); |
4457 | 4457 |
4458 handle = pidgin_blist_get_handle(); | 4458 handle = pidgin_blist_get_handle(); |
4459 | 4459 |
4460 /* things that affect how buddies are displayed */ | 4460 /* things that affect how buddies are displayed */ |
4461 purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_buddy_icons", | 4461 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", |
4462 _prefs_change_redo_list, NULL); | 4462 _prefs_change_redo_list, NULL); |
4463 purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_idle_time", | 4463 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_idle_time", |
4464 _prefs_change_redo_list, NULL); | 4464 _prefs_change_redo_list, NULL); |
4465 purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_empty_groups", | 4465 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_empty_groups", |
4466 _prefs_change_redo_list, NULL); | 4466 _prefs_change_redo_list, NULL); |
4467 purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_offline_buddies", | 4467 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", |
4468 _prefs_change_redo_list, NULL); | 4468 _prefs_change_redo_list, NULL); |
4469 | 4469 |
4470 /* sorting */ | 4470 /* sorting */ |
4471 purple_prefs_connect_callback(handle, "/purple/gtk/blist/sort_type", | 4471 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/sort_type", |
4472 _prefs_change_sort_method, NULL); | 4472 _prefs_change_sort_method, NULL); |
4473 | 4473 |
4474 /* menus */ | 4474 /* menus */ |
4475 purple_prefs_connect_callback(handle, "/purple/gtk/sound/mute", | 4475 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/sound/mute", |
4476 pidgin_blist_mute_pref_cb, NULL); | 4476 pidgin_blist_mute_pref_cb, NULL); |
4477 purple_prefs_connect_callback(handle, "/purple/gtk/sound/method", | 4477 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/sound/method", |
4478 pidgin_blist_sound_method_pref_cb, NULL); | 4478 pidgin_blist_sound_method_pref_cb, NULL); |
4479 | 4479 |
4480 /* Setup some purple signal handlers. */ | 4480 /* Setup some purple signal handlers. */ |
4481 purple_signal_connect(purple_accounts_get_handle(), "account-enabled", | 4481 purple_signal_connect(purple_accounts_get_handle(), "account-enabled", |
4482 gtkblist, PURPLE_CALLBACK(account_modified), gtkblist); | 4482 gtkblist, PURPLE_CALLBACK(account_modified), gtkblist); |
4727 else | 4727 else |
4728 return; | 4728 return; |
4729 | 4729 |
4730 group = (PurpleGroup*)gnode; | 4730 group = (PurpleGroup*)gnode; |
4731 | 4731 |
4732 if(purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies")) | 4732 if(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")) |
4733 count = purple_blist_get_group_size(group, FALSE); | 4733 count = purple_blist_get_group_size(group, FALSE); |
4734 else | 4734 else |
4735 count = purple_blist_get_group_online_count(group); | 4735 count = purple_blist_get_group_online_count(group); |
4736 | 4736 |
4737 if (count > 0 || purple_prefs_get_bool("/purple/gtk/blist/show_empty_groups")) | 4737 if (count > 0 || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")) |
4738 show = TRUE; | 4738 show = TRUE; |
4739 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)){ /* Or chat? */ | 4739 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)){ /* Or chat? */ |
4740 if (buddy_is_displayable((PurpleBuddy*)node)) | 4740 if (buddy_is_displayable((PurpleBuddy*)node)) |
4741 show = TRUE;} | 4741 show = TRUE;} |
4742 | 4742 |
4813 GdkPixbuf *status, *avatar, *emblem; | 4813 GdkPixbuf *status, *avatar, *emblem; |
4814 char *mark; | 4814 char *mark; |
4815 char *idle = NULL; | 4815 char *idle = NULL; |
4816 gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; | 4816 gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; |
4817 gboolean selected = (gtkblist->selected_node == node); | 4817 gboolean selected = (gtkblist->selected_node == node); |
4818 gboolean biglist = purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"); | 4818 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); |
4819 presence = purple_buddy_get_presence(buddy); | 4819 presence = purple_buddy_get_presence(buddy); |
4820 | 4820 |
4821 status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, | 4821 status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, |
4822 PIDGIN_STATUS_ICON_SMALL); | 4822 PIDGIN_STATUS_ICON_SMALL); |
4823 | 4823 |
4830 } | 4830 } |
4831 | 4831 |
4832 emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy); | 4832 emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy); |
4833 mark = pidgin_blist_get_name_markup(buddy, selected); | 4833 mark = pidgin_blist_get_name_markup(buddy, selected); |
4834 | 4834 |
4835 if (purple_prefs_get_bool("/purple/gtk/blist/show_idle_time") && | 4835 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time") && |
4836 purple_presence_is_idle(presence) && | 4836 purple_presence_is_idle(presence) && |
4837 !purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons")) | 4837 !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")) |
4838 { | 4838 { |
4839 time_t idle_secs = purple_presence_get_idle_time(presence); | 4839 time_t idle_secs = purple_presence_get_idle_time(presence); |
4840 | 4840 |
4841 if (idle_secs > 0) | 4841 if (idle_secs > 0) |
4842 { | 4842 { |
5010 | 5010 |
5011 gtk_tree_store_set(gtkblist->treemodel, &iter, | 5011 gtk_tree_store_set(gtkblist->treemodel, &iter, |
5012 STATUS_ICON_COLUMN, status, | 5012 STATUS_ICON_COLUMN, status, |
5013 STATUS_ICON_VISIBLE_COLUMN, TRUE, | 5013 STATUS_ICON_VISIBLE_COLUMN, TRUE, |
5014 BUDDY_ICON_COLUMN, avatar ? avatar : gtkblist->empty_avatar, | 5014 BUDDY_ICON_COLUMN, avatar ? avatar : gtkblist->empty_avatar, |
5015 BUDDY_ICON_VISIBLE_COLUMN, purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"), | 5015 BUDDY_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"), |
5016 EMBLEM_COLUMN, emblem, | 5016 EMBLEM_COLUMN, emblem, |
5017 EMBLEM_VISIBLE_COLUMN, emblem != NULL, | 5017 EMBLEM_VISIBLE_COLUMN, emblem != NULL, |
5018 NAME_COLUMN, mark, | 5018 NAME_COLUMN, mark, |
5019 -1); | 5019 -1); |
5020 | 5020 |
5886 purple_signal_connect(purple_connections_get_handle(), "signed-on", | 5886 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
5887 gtk_blist_handle, PURPLE_CALLBACK(account_signon_cb), | 5887 gtk_blist_handle, PURPLE_CALLBACK(account_signon_cb), |
5888 NULL); | 5888 NULL); |
5889 | 5889 |
5890 /* Initialize prefs */ | 5890 /* Initialize prefs */ |
5891 purple_prefs_add_none("/purple/gtk/blist"); | 5891 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/blist"); |
5892 purple_prefs_add_bool("/purple/gtk/blist/show_buddy_icons", TRUE); | 5892 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", TRUE); |
5893 purple_prefs_add_bool("/purple/gtk/blist/show_empty_groups", FALSE); | 5893 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", FALSE); |
5894 purple_prefs_add_bool("/purple/gtk/blist/show_idle_time", TRUE); | 5894 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", TRUE); |
5895 purple_prefs_add_bool("/purple/gtk/blist/show_offline_buddies", FALSE); | 5895 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", FALSE); |
5896 purple_prefs_add_bool("/purple/gtk/blist/list_visible", TRUE); | 5896 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", TRUE); |
5897 purple_prefs_add_bool("/purple/gtk/blist/list_maximized", FALSE); | 5897 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", FALSE); |
5898 purple_prefs_add_string("/purple/gtk/blist/sort_type", "alphabetical"); | 5898 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/sort_type", "alphabetical"); |
5899 purple_prefs_add_int("/purple/gtk/blist/x", 0); | 5899 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/x", 0); |
5900 purple_prefs_add_int("/purple/gtk/blist/y", 0); | 5900 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/y", 0); |
5901 purple_prefs_add_int("/purple/gtk/blist/width", 250); /* Golden ratio, baby */ | 5901 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/width", 250); /* Golden ratio, baby */ |
5902 purple_prefs_add_int("/purple/gtk/blist/height", 405); /* Golden ratio, baby */ | 5902 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/height", 405); /* Golden ratio, baby */ |
5903 purple_prefs_add_int("/purple/gtk/blist/tooltip_delay", 500); | 5903 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay", 500); |
5904 | 5904 |
5905 /* Register our signals */ | 5905 /* Register our signals */ |
5906 purple_signal_register(gtk_blist_handle, "gtkblist-hiding", | 5906 purple_signal_register(gtk_blist_handle, "gtkblist-hiding", |
5907 purple_marshal_VOID__POINTER, NULL, 1, | 5907 purple_marshal_VOID__POINTER, NULL, 1, |
5908 purple_value_new(PURPLE_TYPE_SUBTYPE, | 5908 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6522 if (gtk_check_menu_item_get_active(checkmenuitem)) | 6522 if (gtk_check_menu_item_get_active(checkmenuitem)) |
6523 { | 6523 { |
6524 pidgin_set_cursor(gtkblist->window, GDK_WATCH); | 6524 pidgin_set_cursor(gtkblist->window, GDK_WATCH); |
6525 /* This is redundant. I think. */ | 6525 /* This is redundant. I think. */ |
6526 /* pidgin_blist_sort_method_set(id); */ | 6526 /* pidgin_blist_sort_method_set(id); */ |
6527 purple_prefs_set_string("/purple/gtk/blist/sort_type", id); | 6527 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type", id); |
6528 | 6528 |
6529 pidgin_clear_cursor(gtkblist->window); | 6529 pidgin_clear_cursor(gtkblist->window); |
6530 } | 6530 } |
6531 } | 6531 } |
6532 | 6532 |
6536 GtkWidget *menuitem = NULL, *activeitem = NULL; | 6536 GtkWidget *menuitem = NULL, *activeitem = NULL; |
6537 PidginBlistSortMethod *method = NULL; | 6537 PidginBlistSortMethod *method = NULL; |
6538 GList *l; | 6538 GList *l; |
6539 GSList *sl = NULL; | 6539 GSList *sl = NULL; |
6540 GtkWidget *sortmenu; | 6540 GtkWidget *sortmenu; |
6541 const char *m = purple_prefs_get_string("/purple/gtk/blist/sort_type"); | 6541 const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type"); |
6542 | 6542 |
6543 if ((gtkblist == NULL) || (gtkblist->ift == NULL)) | 6543 if ((gtkblist == NULL) || (gtkblist->ift == NULL)) |
6544 return; | 6544 return; |
6545 | 6545 |
6546 sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies")); | 6546 sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies")); |