comparison pidgin/gtkft.c @ 29471:d83ee160ffb6

propagate from branch 'im.pidgin.pidgin' (head eb9385f349a20856b9d3f9911dbc8024caa44052) to branch 'im.pidgin.pidgin.next.minor' (head 439fb2dd7a285d9ca645f65f36ef0f037abe7311)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 19 Aug 2009 00:46:04 +0000
parents 2e49cbdd5040
children ac6c2dda0eae 39005e0d26a0 399756f65c88
comparison
equal deleted inserted replaced
29470:7a3458436140 29471:d83ee160ffb6
73 73
74 GtkWidget *progress; 74 GtkWidget *progress;
75 75
76 /* Buttons */ 76 /* Buttons */
77 GtkWidget *open_button; 77 GtkWidget *open_button;
78 GtkWidget *pause_button;
79 GtkWidget *resume_button;
80 GtkWidget *remove_button; 78 GtkWidget *remove_button;
81 GtkWidget *stop_button; 79 GtkWidget *stop_button;
82 GtkWidget *close_button; 80 GtkWidget *close_button;
83 }; 81 };
84 82
328 update_buttons(PidginXferDialog *dialog, PurpleXfer *xfer) 326 update_buttons(PidginXferDialog *dialog, PurpleXfer *xfer)
329 { 327 {
330 if (dialog->selected_xfer == NULL) { 328 if (dialog->selected_xfer == NULL) {
331 gtk_widget_set_sensitive(dialog->expander, FALSE); 329 gtk_widget_set_sensitive(dialog->expander, FALSE);
332 gtk_widget_set_sensitive(dialog->open_button, FALSE); 330 gtk_widget_set_sensitive(dialog->open_button, FALSE);
333 gtk_widget_set_sensitive(dialog->pause_button, FALSE);
334 gtk_widget_set_sensitive(dialog->resume_button, FALSE);
335 gtk_widget_set_sensitive(dialog->stop_button, FALSE); 331 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
336 332
337 gtk_widget_show(dialog->stop_button); 333 gtk_widget_show(dialog->stop_button);
338 gtk_widget_hide(dialog->remove_button); 334 gtk_widget_hide(dialog->remove_button);
339 335
359 gtk_widget_set_sensitive(dialog->open_button, TRUE); 355 gtk_widget_set_sensitive(dialog->open_button, TRUE);
360 } else { 356 } else {
361 gtk_widget_set_sensitive (dialog->open_button, FALSE); 357 gtk_widget_set_sensitive (dialog->open_button, FALSE);
362 } 358 }
363 #endif 359 #endif
364 gtk_widget_set_sensitive(dialog->pause_button, FALSE);
365 gtk_widget_set_sensitive(dialog->resume_button, FALSE);
366 360
367 gtk_widget_set_sensitive(dialog->remove_button, TRUE); 361 gtk_widget_set_sensitive(dialog->remove_button, TRUE);
368 } else if (purple_xfer_is_canceled(xfer)) { 362 } else if (purple_xfer_is_canceled(xfer)) {
369 gtk_widget_hide(dialog->stop_button); 363 gtk_widget_hide(dialog->stop_button);
370 gtk_widget_show(dialog->remove_button); 364 gtk_widget_show(dialog->remove_button);
371 365
372 gtk_widget_set_sensitive(dialog->open_button, FALSE); 366 gtk_widget_set_sensitive(dialog->open_button, FALSE);
373 gtk_widget_set_sensitive(dialog->pause_button, FALSE);
374 gtk_widget_set_sensitive(dialog->resume_button, FALSE);
375 367
376 gtk_widget_set_sensitive(dialog->remove_button, TRUE); 368 gtk_widget_set_sensitive(dialog->remove_button, TRUE);
377 } else { 369 } else {
378 gtk_widget_show(dialog->stop_button); 370 gtk_widget_show(dialog->stop_button);
379 gtk_widget_hide(dialog->remove_button); 371 gtk_widget_hide(dialog->remove_button);
380 372
381 gtk_widget_set_sensitive(dialog->open_button, FALSE); 373 gtk_widget_set_sensitive(dialog->open_button, FALSE);
382
383 /* TODO: If the transfer can pause, blah blah */
384 gtk_widget_set_sensitive(dialog->pause_button, FALSE);
385 gtk_widget_set_sensitive(dialog->resume_button, FALSE);
386 gtk_widget_set_sensitive(dialog->stop_button, TRUE); 374 gtk_widget_set_sensitive(dialog->stop_button, TRUE);
387 } 375 }
388 } 376 }
389 377
390 static void 378 static void
554 purple_notify_error(dialog, NULL, primary, secondary); 542 purple_notify_error(dialog, NULL, primary, secondary);
555 g_free(tmp); 543 g_free(tmp);
556 } 544 }
557 } 545 }
558 #endif 546 #endif
559 }
560
561 static void
562 pause_button_cb(GtkButton *button, PidginXferDialog *dialog)
563 {
564 }
565
566 static void
567 resume_button_cb(GtkButton *button, PidginXferDialog *dialog)
568 {
569 } 547 }
570 548
571 static void 549 static void
572 remove_button_cb(GtkButton *button, PidginXferDialog *dialog) 550 remove_button_cb(GtkButton *button, PidginXferDialog *dialog)
573 { 551 {
703 { &label, &dialog->time_elapsed_label, _("Time Elapsed:") }, 681 { &label, &dialog->time_elapsed_label, _("Time Elapsed:") },
704 { &label, &dialog->time_remaining_label, _("Time Remaining:") } 682 { &label, &dialog->time_remaining_label, _("Time Remaining:") }
705 }; 683 };
706 684
707 /* Setup the initial table */ 685 /* Setup the initial table */
708 dialog->table = table = gtk_table_new(9, 2, FALSE); 686 dialog->table = table = gtk_table_new(G_N_ELEMENTS(labels) + 1, 2, FALSE);
709 gtk_table_set_row_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE); 687 gtk_table_set_row_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE);
710 gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE); 688 gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE);
711 689
712 /* Setup the labels */ 690 /* Setup the labels */
713 for (i = 0; i < sizeof(labels) / sizeof(*labels); i++) { 691 for (i = 0; i < G_N_ELEMENTS(labels); i++) {
714 GtkWidget *label; 692 GtkWidget *label;
715 char buf[256]; 693 char buf[256];
716 694
717 g_snprintf(buf, sizeof(buf), "<b>%s</b>", 695 g_snprintf(buf, sizeof(buf), "<b>%s</b>",
718 labels[i].desc != NULL ? labels[i].desc : ""); 696 labels[i].desc != NULL ? labels[i].desc : "");
732 gtk_widget_show(label); 710 gtk_widget_show(label);
733 } 711 }
734 712
735 /* Setup the progress bar */ 713 /* Setup the progress bar */
736 dialog->progress = gtk_progress_bar_new(); 714 dialog->progress = gtk_progress_bar_new();
737 gtk_table_attach(GTK_TABLE(table), dialog->progress, 0, 2, 8, 9, 715 gtk_table_attach(GTK_TABLE(table), dialog->progress,
716 0, 2,
717 G_N_ELEMENTS(labels), G_N_ELEMENTS(labels) + 1,
738 GTK_FILL, GTK_FILL, 0, 0); 718 GTK_FILL, GTK_FILL, 0, 0);
739 gtk_widget_show(dialog->progress); 719 gtk_widget_show(dialog->progress);
740 720
741 return table; 721 return table;
742 } 722 }
759 dialog->auto_clear = 739 dialog->auto_clear =
760 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished"); 740 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished");
761 741
762 /* Create the window. */ 742 /* Create the window. */
763 dialog->window = window = pidgin_create_dialog(_("File Transfers"), PIDGIN_HIG_BORDER, "file transfer", TRUE); 743 dialog->window = window = pidgin_create_dialog(_("File Transfers"), PIDGIN_HIG_BORDER, "file transfer", TRUE);
744 gtk_window_set_default_size(GTK_WINDOW(window), 450, 250);
764 745
765 g_signal_connect(G_OBJECT(window), "delete_event", 746 g_signal_connect(G_OBJECT(window), "delete_event",
766 G_CALLBACK(delete_win_cb), dialog); 747 G_CALLBACK(delete_win_cb), dialog);
767 748
768 /* Create the parent vbox for everything. */ 749 /* Create the parent vbox for everything. */
813 794
814 /* Open button */ 795 /* Open button */
815 button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog); 796 button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog);
816 gtk_widget_set_sensitive(button, FALSE); 797 gtk_widget_set_sensitive(button, FALSE);
817 dialog->open_button = button; 798 dialog->open_button = button;
818
819 /* Pause button */
820 button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Pause"), G_CALLBACK(pause_button_cb), dialog);
821 gtk_widget_set_sensitive(button, FALSE);
822 dialog->pause_button = button;
823
824 /* Resume button */
825 button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Resume"), G_CALLBACK(resume_button_cb), dialog);
826 gtk_widget_set_sensitive(button, FALSE);
827 dialog->resume_button = button;
828 799
829 /* Remove button */ 800 /* Remove button */
830 button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog); 801 button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog);
831 gtk_widget_hide(button); 802 gtk_widget_hide(button);
832 dialog->remove_button = button; 803 dialog->remove_button = button;