Mercurial > pidgin.yaz
comparison pidgin/plugins/gevolution/add_buddy_dialog.c @ 31816:917c597beb97
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | Gabriel Schulhof <nix@go-nix.ca> |
---|---|
date | Sat, 08 Jan 2011 03:45:42 +0000 |
parents | 735c759d80d6 |
children |
comparison
equal
deleted
inserted
replaced
31815:d169a587901f | 31816:917c597beb97 |
---|---|
428 gevo_add_buddy_dialog_show(PurpleAccount *account, const char *username, | 428 gevo_add_buddy_dialog_show(PurpleAccount *account, const char *username, |
429 const char *group, const char *alias) | 429 const char *group, const char *alias) |
430 { | 430 { |
431 GevoAddBuddyDialog *dialog; | 431 GevoAddBuddyDialog *dialog; |
432 GtkWidget *button; | 432 GtkWidget *button; |
433 GtkWidget *sw; | |
434 GtkWidget *label; | 433 GtkWidget *label; |
435 GtkWidget *vbox; | 434 GtkWidget *vbox; |
436 GtkWidget *hbox; | 435 GtkWidget *hbox; |
437 GtkWidget *bbox; | 436 GtkWidget *bbox; |
438 GtkWidget *sep; | 437 GtkWidget *sep; |
508 gtk_widget_show(button); | 507 gtk_widget_show(button); |
509 | 508 |
510 g_signal_connect(G_OBJECT(button), "clicked", | 509 g_signal_connect(G_OBJECT(button), "clicked", |
511 G_CALLBACK(clear_cb), dialog); | 510 G_CALLBACK(clear_cb), dialog); |
512 | 511 |
513 /* Scrolled Window */ | |
514 sw = gtk_scrolled_window_new(0, 0); | |
515 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
516 GTK_POLICY_AUTOMATIC, | |
517 GTK_POLICY_ALWAYS); | |
518 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
519 GTK_SHADOW_IN); | |
520 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
521 gtk_widget_show(sw); | |
522 | |
523 /* Create the list model for the treeview. */ | 512 /* Create the list model for the treeview. */ |
524 dialog->model = gtk_list_store_new(NUM_COLUMNS, | 513 dialog->model = gtk_list_store_new(NUM_COLUMNS, |
525 G_TYPE_STRING, GDK_TYPE_PIXBUF, | 514 G_TYPE_STRING, GDK_TYPE_PIXBUF, |
526 G_TYPE_STRING, G_TYPE_POINTER); | 515 G_TYPE_STRING, G_TYPE_POINTER); |
527 | 516 |
528 /* Now for the treeview */ | 517 /* Now for the treeview */ |
529 dialog->treeview = | 518 dialog->treeview = |
530 gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); | 519 gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); |
531 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(dialog->treeview), TRUE); | 520 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(dialog->treeview), TRUE); |
532 gtk_container_add(GTK_CONTAINER(sw), dialog->treeview); | 521 gtk_box_pack_start(GTK_BOX(vbox), |
522 pidgin_make_scrollable(dialog->treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), | |
523 TRUE, TRUE, 0); | |
533 gtk_widget_show(dialog->treeview); | 524 gtk_widget_show(dialog->treeview); |
534 | 525 |
535 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | 526 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
536 | 527 |
537 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); | 528 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); |