comparison src/buddy.c @ 3540:785292d72aed

[gaim-migrate @ 3615] fixed the saving of the buddy list possition and size(thanks robot101) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 23 Sep 2002 01:31:26 +0000
parents 88a0068fc048
children 7afbc063038d
comparison
equal deleted inserted replaced
3539:88a0068fc048 3540:785292d72aed
2034 2034
2035 /* mostly used by code in this file */ 2035 /* mostly used by code in this file */
2036 void unhide_buddy_list() { 2036 void unhide_buddy_list() {
2037 if (blist) { 2037 if (blist) {
2038 gtk_window_present(GTK_WINDOW(blist)); 2038 gtk_window_present(GTK_WINDOW(blist));
2039 if (blist_options & OPT_BLIST_SAVED_WINDOWS) { 2039 if (blist_options & OPT_BLIST_SAVED_WINDOWS && blist_pos.width != 0) {
2040 if (blist_pos.width != 0) { /* Sanity check! */ 2040 gtk_window_move(GTK_WINDOW(blist), blist_pos.x, blist_pos.y);
2041 gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, 2041 gtk_window_resize(GTK_WINDOW(blist), blist_pos.width, blist_pos.height);
2042 blist_pos.y - blist_pos.yoff);
2043 gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height);
2044 }
2045 } 2042 }
2046 } 2043 }
2047 } 2044 }
2048 2045
2049 /* for the delete_event handler */ 2046 /* for the delete_event handler */
2446 2443
2447 bs->sound = 1; 2444 bs->sound = 1;
2448 } 2445 }
2449 } 2446 }
2450 2447
2451 2448 static void configure_blist_window(GtkWidget *w, GdkEventConfigure *event, void *data) {
2452 static void move_blist_window(GtkWidget *w, GdkEventConfigure *e, void *dummy) 2449 if (event->x != blist_pos.x ||
2453 { 2450 event->y != blist_pos.y ||
2454 int x, y, width, height; 2451 event->width != blist_pos.width ||
2455 int save = 0; 2452 event->height != blist_pos.height) {
2456 gdk_window_get_position(blist->window, &x, &y); 2453 blist_pos.x = event->x;
2457 gdk_window_get_size(blist->window, &width, &height); 2454 blist_pos.y = event->y;
2458 2455 blist_pos.width = event->width;
2459 if (e->send_event) { /* Is a position event */ 2456 blist_pos.height = event->height;
2460 if (blist_pos.x != x || blist_pos.y != y)
2461 save = 1;
2462 blist_pos.x = x;
2463 blist_pos.y = y;
2464 } else { /* Is a size event */
2465 if (blist_pos.xoff != x || blist_pos.yoff != y || blist_pos.width != width || blist_pos.height != height)
2466 save = 1;
2467
2468 blist_pos.width = width;
2469 blist_pos.height = height;
2470 blist_pos.xoff = x;
2471 blist_pos.yoff = y;
2472 }
2473
2474 if (save)
2475 save_prefs(); 2457 save_prefs();
2476 2458 }
2477 } 2459 }
2478
2479 2460
2480 /******************************************************************* 2461 /*******************************************************************
2481 * 2462 *
2482 * Helper funs for making the menu 2463 * Helper funs for making the menu
2483 * 2464 *
2669 2650
2670 gtk_window_set_wmclass(GTK_WINDOW(blist), "buddy_list", "Gaim"); 2651 gtk_window_set_wmclass(GTK_WINDOW(blist), "buddy_list", "Gaim");
2671 2652
2672 gtk_widget_realize(blist); 2653 gtk_widget_realize(blist);
2673 2654
2655 gtk_window_set_gravity(GTK_WINDOW(blist), GDK_GRAVITY_STATIC);
2674 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE); 2656 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE);
2675 2657
2676 accel = gtk_accel_group_new(); 2658 accel = gtk_accel_group_new();
2677 gtk_accel_group_attach(accel, G_OBJECT(blist)); 2659 gtk_accel_group_attach(accel, G_OBJECT(blist));
2678 2660
2907 gtk_container_add(GTK_CONTAINER(blist), vbox); 2889 gtk_container_add(GTK_CONTAINER(blist), vbox);
2908 2890
2909 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(close_buddy_list), 2891 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(close_buddy_list),
2910 NULL); 2892 NULL);
2911 2893
2912 gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(move_blist_window), 2894 gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(configure_blist_window),
2913 NULL); 2895 NULL);
2914 2896
2915 2897
2916 2898
2917 /* The edit tree */ 2899 /* The edit tree */