~vcs-imports/gnome-media/main

« back to all changes in this revision

Viewing changes to cddb-slave2/cddb-slave-capplet.c

  • Committer: thomasvs
  • Date: 2004-05-10 08:52:25 UTC
  • Revision ID: vcs-imports@canonical.com-20040510085225-zb6tqc12yi1h08gd
remove unneccesary whitespace

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
typedef struct _PropertyDialog {
48
48
        GtkWidget *dialog;
49
 
        
 
49
 
50
50
        GtkWidget *no_info;
51
51
        GtkWidget *real_info;
52
52
        GtkWidget *specific_info;
59
59
        GtkWidget *freedb_box;
60
60
        GtkWidget *freedb_server;
61
61
        GtkWidget *update;
62
 
        
 
62
 
63
63
        GtkWidget *other_server;
64
64
        GtkWidget *other_box;
65
65
        GtkWidget *other_host;
219
219
                      PropertyDialog *pd)
220
220
{
221
221
        const char *str;
222
 
        
 
222
 
223
223
        if (gtk_toggle_button_get_active (tb) == FALSE) {
224
224
                return;
225
225
        }
263
263
{
264
264
        guint bytes_writen;
265
265
        GIOError status;
266
 
        
 
266
 
267
267
        status = gnet_io_channel_writen (pd->iochannel, "quit\n",
268
268
                                         5, &bytes_writen);
269
269
        pd->mode = CONNECTION_MODE_NEED_GOODBYE;
298
298
 
299
299
        pd->mode = CONNECTION_MODE_NEED_HELLO;
300
300
        gtk_widget_set_sensitive (pd->update, TRUE);
301
 
        
 
301
 
302
302
        return FALSE;
303
303
}
304
304
 
315
315
        } else {
316
316
                code = atoi (response);
317
317
        }
318
 
        
 
318
 
319
319
        switch (code) {
320
320
        case 210:
321
321
                if (response[0] == '.') {
335
335
                        if (end != NULL) {
336
336
                                *end = 0;
337
337
                        }
338
 
                        
 
338
 
339
339
                        vector = g_strsplit (res, " ", 5);
340
340
                        g_free (res);
341
341
                        if (vector == NULL) {
372
372
        }
373
373
        return more;
374
374
}
375
 
        
 
375
 
376
376
static void
377
377
do_sites (PropertyDialog *pd)
378
378
{
528
528
                        case CONNECTION_MODE_NEED_SITES_RESPONSE:
529
529
                                more = do_sites_response (pd, buffer);
530
530
                                break;
531
 
                                
 
531
 
532
532
                        case CONNECTION_MODE_NEED_GOODBYE:
533
533
                                more = do_goodbye_response (pd, buffer);
534
534
                                break;
586
586
{
587
587
        GTcpSocketConnectAsyncID *sock;
588
588
        GtkTreeIter iter;
589
 
        
 
589
 
590
590
        /* Clear the list and put the default there */
591
591
        gtk_list_store_clear (GTK_LIST_STORE (pd->model));
592
592
        gtk_list_store_append (GTK_LIST_STORE (pd->model), &iter);
593
593
        gtk_list_store_set (GTK_LIST_STORE (pd->model), &iter, 0, "freedb.freedb.org", 1, "888", 2, "Random server", -1);
594
 
        
 
594
 
595
595
        gtk_widget_set_sensitive (pd->update, FALSE);
596
596
        /* Should use the gconf values */
597
597
        sock = gnet_tcp_socket_connect_async ("freedb.freedb.org", 888,
639
639
        GtkWidget *vbox, *vbox2, *hbox;
640
640
        GtkWidget *label;
641
641
        gchar *tmp;
642
 
        
 
642
 
643
643
        vbox = gtk_vbox_new (FALSE, 6);
644
644
        gtk_box_pack_start (GTK_BOX (parent), vbox, expand, fill, 0);
645
645
 
676
676
        GtkCellRenderer *cell;
677
677
        GtkTreeViewColumn *col;
678
678
        GtkTreeSelection *selection;
679
 
        
 
679
 
680
680
        char *str;
681
681
        int info = CDDB_SEND_FAKE_INFO;
682
682
        int port;
683
 
        
 
683
 
684
684
        pd = g_new (PropertyDialog, 1);
685
685
        pd->dialog = window;
686
686
        g_signal_connect (G_OBJECT (window), "destroy",
721
721
        if (info == CDDB_SEND_OTHER_INFO) {
722
722
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->specific_info), TRUE);
723
723
        }
724
 
        
 
724
 
725
725
        g_signal_connect (G_OBJECT (pd->specific_info), "toggled",
726
726
                          G_CALLBACK (specific_info_toggled), pd);
727
727
        gtk_box_pack_start (GTK_BOX (vbox), pd->specific_info, FALSE, FALSE, 0);
728
728
 
729
729
        hbox = gtk_hbox_new (FALSE, 0);
730
730
        gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
731
 
        
 
731
 
732
732
        label = gtk_label_new ("    ");
733
733
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
734
734
 
738
738
        if (info != CDDB_SEND_OTHER_INFO) {
739
739
                gtk_widget_set_sensitive (pd->name_box, FALSE);
740
740
        }
741
 
        
 
741
 
742
742
        gtk_box_pack_start (GTK_BOX (hbox), pd->name_box, TRUE, TRUE, 0);
743
743
 
744
744
        align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
760
760
        gtk_table_attach (GTK_TABLE (pd->name_box), pd->real_name,
761
761
                          1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL,
762
762
                          0, 0);
763
 
        
 
763
 
764
764
        align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
765
765
        label = gtk_label_new_with_mnemonic (_("Hostna_me:"));
766
766
        gtk_container_add (GTK_CONTAINER (align), label);
767
767
        gtk_table_attach (GTK_TABLE (pd->name_box), align,
768
768
                          0, 1, 1, 2, GTK_FILL, GTK_FILL,
769
769
                          0, 0);
770
 
        
 
770
 
771
771
        pd->real_host = gtk_entry_new ();
772
772
        gtk_label_set_mnemonic_widget (GTK_LABEL (label), pd->real_host);
773
773
        str = gconf_client_get_string (client, "/apps/CDDB-Slave2/hostname", NULL);
801
801
 
802
802
        hbox = gtk_hbox_new (FALSE, 0);
803
803
        gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
804
 
        
 
804
 
805
805
        label = gtk_label_new ("    ");
806
806
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
807
 
        
 
807
 
808
808
        pd->freedb_box = gtk_vbox_new (FALSE, 6);
809
809
        gtk_widget_set_sensitive (pd->freedb_box, FALSE);
810
810
        gtk_box_pack_start (GTK_BOX (hbox), pd->freedb_box, TRUE, TRUE, 0);
816
816
        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
817
817
                                             GTK_SHADOW_IN);
818
818
        gtk_box_pack_start (GTK_BOX (pd->freedb_box), sw, TRUE, TRUE, 2);
819
 
        
 
819
 
820
820
        pd->model = make_tree_model ();
821
821
        pd->freedb_server = gtk_tree_view_new_with_model (pd->model);
822
822
        g_object_unref (pd->model);
824
824
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pd->freedb_server));
825
825
        g_signal_connect (G_OBJECT (selection), "changed",
826
826
                          G_CALLBACK (server_selection_changed), pd);
827
 
        
 
827
 
828
828
        cell = gtk_cell_renderer_text_new ();
829
829
        col = gtk_tree_view_column_new_with_attributes (_("Server"), cell,
830
830
                                                        "text", 0, NULL);
835
835
        col = gtk_tree_view_column_new_with_attributes (_("Location"), cell,
836
836
                                                        "text", 2, NULL);
837
837
        gtk_tree_view_append_column (GTK_TREE_VIEW (pd->freedb_server), col);
838
 
        
 
838
 
839
839
        gtk_container_add (GTK_CONTAINER (sw), pd->freedb_server);
840
840
 
841
841
        /* create the update server list button */
846
846
                          G_CALLBACK (update_clicked), pd);
847
847
 
848
848
        gtk_container_add (GTK_CONTAINER (align), pd->update);
849
 
        
 
849
 
850
850
        gtk_box_pack_start (GTK_BOX (pd->freedb_box), align, FALSE, FALSE, 0);
851
851
 
852
852
        /* ... and it's contents */
879
879
 
880
880
        hbox3 = gtk_hbox_new (FALSE, 0);
881
881
        gtk_box_pack_start (GTK_BOX (pd->other_box), hbox3, FALSE, FALSE, 0);
882
 
        
 
882
 
883
883
        label = gtk_label_new ("    ");
884
 
        gtk_box_pack_start (GTK_BOX (hbox3), label, FALSE, FALSE, 0);   
 
884
        gtk_box_pack_start (GTK_BOX (hbox3), label, FALSE, FALSE, 0);
885
885
 
886
886
        hbox2 = gtk_hbox_new (FALSE, 12);
887
887
        gtk_box_pack_start (GTK_BOX (hbox3), hbox2, FALSE, FALSE, 0);
888
 
        
 
888
 
889
889
        hbox = gtk_hbox_new (FALSE, 12);
890
890
        gtk_box_pack_start (GTK_BOX (hbox2), hbox, FALSE, FALSE, 0);
891
891
        label = gtk_label_new_with_mnemonic (_("Hos_tname:"));
915
915
        str = g_strdup_printf ("%d", port);
916
916
        gtk_entry_set_text (GTK_ENTRY (pd->other_port), str);
917
917
        g_free (str);
918
 
        
 
918
 
919
919
        gtk_box_pack_start (GTK_BOX (hbox), pd->other_port, FALSE, FALSE, 0);
920
920
 
921
921
        switch (info) {
942
942
        GdkPixbuf *pixbuf;
943
943
        char *fullname;
944
944
 
945
 
        fullname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, 
 
945
        fullname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
946
946
                   filename, TRUE, NULL);
947
947
        g_return_val_if_fail (fullname != NULL, NULL);
948
948
 
951
951
 
952
952
        return pixbuf;
953
953
}
954
 
        
 
954
 
955
955
int
956
956
main (int argc,
957
957
      char **argv)
958
958
{
959
959
        GtkWidget *dialog_win;
960
960
        GdkPixbuf *pixbuf;
961
 
        
 
961
 
962
962
        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
963
963
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
964
964
        textdomain (GETTEXT_PACKAGE);