2 * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "tcp_connect.h"
28 rploop (GIOChannel *src, GIOCondition cond, gpointer xmpp)
30 hc_xmpp_read_and_parse (xmpp);
39 connect_clicked (GtkWidget *button, gpointer data)
46 server = (char *) gtk_entry_get_text (GTK_ENTRY (entry1));
47 user = (char *) gtk_entry_get_text (GTK_ENTRY (entry2));
48 password = (char *) gtk_entry_get_text (GTK_ENTRY (entry3));
49 xmpp = hc_xmpp_new (hc_xmpp_hook, server, user, password);
50 hc_xmpp_send_stream (xmpp);
51 channel = g_io_channel_unix_new (hc_xmpp_fd (xmpp));
52 g_io_add_watch (channel, G_IO_IN, rploop, xmpp);
61 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
62 vbox = gtk_vbox_new (TRUE, 5);
63 entry1 = gtk_entry_new ();
64 entry2 = gtk_entry_new ();
65 entry3 = gtk_entry_new ();
66 gtk_entry_set_visibility (GTK_ENTRY (entry3), FALSE);
67 button = gtk_button_new_with_label ("Connect");
68 g_signal_connect (G_OBJECT (button), "clicked",
69 G_CALLBACK (connect_clicked), NULL);
70 gtk_container_add (GTK_CONTAINER (window), vbox);
71 gtk_container_add (GTK_CONTAINER (vbox), entry1);
72 gtk_container_add (GTK_CONTAINER (vbox), entry2);
73 gtk_container_add (GTK_CONTAINER (vbox), entry3);
74 gtk_container_add (GTK_CONTAINER (vbox), button);
75 gtk_widget_show_all (window);
79 main (int argc, char **argv)
82 gtk_init (&argc, &argv);
84 loop = g_main_loop_new (g_main_context_default (), TRUE);
86 g_main_loop_run (loop);