Mercurial > pidgin.yaz
comparison src/dialogs.c @ 2493:1b7a1133962d
[gaim-migrate @ 2506]
select which connection to import to
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 12 Oct 2001 21:12:56 +0000 |
parents | dd4114ed4c07 |
children | c9e316b04048 |
comparison
equal
deleted
inserted
replaced
2492:1a25e4869e7d | 2493:1b7a1133962d |
---|---|
84 GdkColor fgcolor; | 84 GdkColor fgcolor; |
85 | 85 |
86 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ | 86 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ |
87 static GtkWidget *infodialog = NULL; | 87 static GtkWidget *infodialog = NULL; |
88 static GList *dialogwindows = NULL; | 88 static GList *dialogwindows = NULL; |
89 static GtkWidget *exportdialog, *importdialog; | 89 static GtkWidget *importdialog; |
90 static struct gaim_connection *importgc; | |
90 static GtkWidget *icondlg; | 91 static GtkWidget *icondlg; |
91 static GtkWidget *aliasdlg = NULL; | 92 static GtkWidget *aliasdlg = NULL; |
92 static GtkWidget *aliasentry = NULL; | 93 static GtkWidget *aliasentry = NULL; |
93 static GtkWidget *aliasname = NULL; | 94 static GtkWidget *aliasname = NULL; |
94 static GtkWidget *rename_dialog = NULL; | 95 static GtkWidget *rename_dialog = NULL; |
275 imdialog = NULL; | 276 imdialog = NULL; |
276 | 277 |
277 if (dest == infodialog) | 278 if (dest == infodialog) |
278 infodialog = NULL; | 279 infodialog = NULL; |
279 | 280 |
280 if (dest == exportdialog) | 281 if (dest == importdialog) { |
281 exportdialog = NULL; | |
282 | |
283 if (dest == importdialog) | |
284 importdialog = NULL; | 282 importdialog = NULL; |
283 importgc = NULL; | |
284 } | |
285 | 285 |
286 if (dest == icondlg) | 286 if (dest == icondlg) |
287 icondlg = NULL; | 287 icondlg = NULL; |
288 | 288 |
289 if (dest == aliasdlg) { | 289 if (dest == aliasdlg) { |
325 } | 325 } |
326 | 326 |
327 if (infodialog) { | 327 if (infodialog) { |
328 destroy_dialog(NULL, infodialog); | 328 destroy_dialog(NULL, infodialog); |
329 infodialog = NULL; | 329 infodialog = NULL; |
330 } | |
331 | |
332 if (exportdialog) { | |
333 destroy_dialog(NULL, exportdialog); | |
334 exportdialog = NULL; | |
335 } | 330 } |
336 | 331 |
337 if (importdialog) { | 332 if (importdialog) { |
338 destroy_dialog(NULL, importdialog); | 333 destroy_dialog(NULL, importdialog); |
339 importdialog = NULL; | 334 importdialog = NULL; |
2614 { | 2609 { |
2615 char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); | 2610 char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); |
2616 if (file_is_dir(file, importdialog)) { | 2611 if (file_is_dir(file, importdialog)) { |
2617 return; | 2612 return; |
2618 } | 2613 } |
2619 /* FIXME : import buddy list file. moderately important */ | 2614 do_import(importgc, file); |
2620 do_import(connections->data, file); | 2615 do_export(importgc); |
2621 destroy_dialog(NULL, importdialog); | 2616 destroy_dialog(NULL, importdialog); |
2622 importdialog = NULL; | 2617 } |
2623 do_export(connections->data); | 2618 |
2619 static void set_import_gc(gpointer data, struct gaim_connection *gc) | |
2620 { | |
2621 importgc = gc; | |
2622 } | |
2623 | |
2624 static void create_import_dropdown(GtkFileSelection *fs) | |
2625 { | |
2626 GtkWidget *hbox; | |
2627 GtkWidget *label; | |
2628 GSList *g = connections; | |
2629 struct gaim_connection *c; | |
2630 GtkWidget *optmenu; | |
2631 GtkWidget *menu; | |
2632 char buf[256]; | |
2633 GtkWidget *opt; | |
2634 | |
2635 if (!connections) | |
2636 return; | |
2637 importgc = connections->data; | |
2638 if (!connections->next) | |
2639 return; | |
2640 | |
2641 hbox = gtk_hbox_new(FALSE, 0); | |
2642 gtk_box_pack_end(GTK_BOX(fs->action_area), hbox, FALSE, FALSE, 0); | |
2643 gtk_widget_show(hbox); | |
2644 | |
2645 optmenu = gtk_option_menu_new(); | |
2646 gtk_box_pack_end(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); | |
2647 gtk_widget_show(optmenu); | |
2648 | |
2649 label = gtk_label_new(_("Import to:")); | |
2650 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2651 gtk_widget_show(label); | |
2652 | |
2653 menu = gtk_menu_new(); | |
2654 | |
2655 while (g) { | |
2656 c = (struct gaim_connection *)g->data; | |
2657 g_snprintf(buf, sizeof buf, "%s (%s)", c->username, (*c->prpl->name)()); | |
2658 opt = gtk_menu_item_new_with_label(buf); | |
2659 gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(set_import_gc), c); | |
2660 gtk_widget_show(opt); | |
2661 gtk_menu_append(GTK_MENU(menu), opt); | |
2662 g = g->next; | |
2663 } | |
2664 | |
2665 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
2666 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); | |
2624 } | 2667 } |
2625 | 2668 |
2626 void show_import_dialog() | 2669 void show_import_dialog() |
2627 { | 2670 { |
2628 char *buf = g_malloc(BUF_LEN); | 2671 char *buf = g_malloc(BUF_LEN); |
2640 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), | 2683 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), |
2641 "clicked", GTK_SIGNAL_FUNC(do_import_dialog), NULL); | 2684 "clicked", GTK_SIGNAL_FUNC(do_import_dialog), NULL); |
2642 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), | 2685 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), |
2643 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | 2686 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), importdialog); |
2644 | 2687 |
2645 | 2688 create_import_dropdown(GTK_FILE_SELECTION(importdialog)); |
2646 } | 2689 } |
2647 | 2690 |
2648 g_free(buf); | 2691 g_free(buf); |
2649 gtk_widget_show(importdialog); | 2692 gtk_widget_show(importdialog); |
2650 gdk_window_raise(importdialog->window); | 2693 gdk_window_raise(importdialog->window); |
2651 } | 2694 } |
2652 | |
2653 /* | |
2654 void show_export_dialog() | |
2655 { | |
2656 char *buf = g_malloc(BUF_LEN); | |
2657 if (!exportdialog) { | |
2658 exportdialog = gtk_file_selection_new(_("Gaim - Export Buddy List")); | |
2659 | |
2660 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(exportdialog)); | |
2661 | |
2662 g_snprintf(buf, BUF_LEN - 1, "%s/gaim.buddy", getenv("HOME")); | |
2663 | |
2664 gtk_file_selection_set_filename(GTK_FILE_SELECTION(exportdialog), buf); | |
2665 gtk_signal_connect(GTK_OBJECT(exportdialog), "destroy", | |
2666 GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | |
2667 | |
2668 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->ok_button), | |
2669 "clicked", GTK_SIGNAL_FUNC(do_export), (void*)1); | |
2670 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->cancel_button), | |
2671 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | |
2672 | |
2673 | |
2674 } | |
2675 | |
2676 g_free(buf); | |
2677 | |
2678 gtk_widget_show(exportdialog); | |
2679 gdk_window_raise(exportdialog->window); | |
2680 | |
2681 } | |
2682 */ | |
2683 | 2695 |
2684 /*------------------------------------------------------------------------*/ | 2696 /*------------------------------------------------------------------------*/ |
2685 /* The dialog for new away messages */ | 2697 /* The dialog for new away messages */ |
2686 /*------------------------------------------------------------------------*/ | 2698 /*------------------------------------------------------------------------*/ |
2687 | 2699 |