annotate src/gtk/gftp-gtk.c @ 58:c01d91c10f6c

2002-11-20 Brian Masney <masneyb@gftp.org> * lib/protocols.c lib/gftp.h - added gftp_get_line(), gftp_read(), gftp_write(), gftp_writefmt(), and gftp_set_sockblocking() functions. Added struct_gftp_getline_buffer for gftp_get_line function() * lib/cache.c lib/gftp.h lib/local.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/ssh.c lib/sshv2.c - *_get_file() returns off_t instead of long. *_{get,put}_next_file_chunk returns ssize_t instead of size_t. Added *_set_config_options function to gftp_request structure and protocol files. Use the new network functions documented above. Convert usage of ANSI C IO (FILE *) to standard BSD sockets so that I can use timeouts properly with select * lib/misc.c (ssh_start_login_sequence) - use gftp_set_sockblock(), gftp_read() and gftp_write() functions * lib/protocols.c - move some protocol specific code to the protocol specific files * lib/local.c - log succesful messages to gftp_logging_misc instead of gftp_logging_error * lib/cache.c - log some more error conditions to the user * lib/rfc959.c - added rfc959_getcwd(). In, rfc959_accept_active_connection(), set set socket to blocking mode before calling accept() * src/text/gftk-text.c - If we get no files in gftp_text_ls(), return instead of segfaulting * src/gtk/gftp-gtk.c - expand the port field in the toolbar to be 45 pixels wide * src/text/gftp-text.c src/gtk/misc-gtk.c src/gtk/transfer.c src/gtk/view_dialog.c - changes for conversion of request->{sock,data} from ANSI C IO (FILE *) to standard BSD sockets
author masneyb
date Thu, 21 Nov 2002 00:33:51 +0000
parents a12bcbc2fce4
children 41b71c4e5076
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2 /* gftp-gtk.c - GTK+ 1.2 port of gftp */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
4 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
5 /* This program is free software; you can redistribute it and/or modify */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
6 /* it under the terms of the GNU General Public License as published by */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
7 /* the Free Software Foundation; either version 2 of the License, or */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
8 /* (at your option) any later version. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
9 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
10 /* This program is distributed in the hope that it will be useful, */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
13 /* GNU General Public License for more details. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
14 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
15 /* You should have received a copy of the GNU General Public License */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
16 /* along with this program; if not, write to the Free Software */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
18 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
19
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
20 #include "gftp-gtk.h"
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
21 static const char cvsid[] = "$Id$";
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
23 static GtkItemFactory *log_factory, *dl_factory;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 static GtkWidget * local_frame, * remote_frame, * log_table, * transfer_scroll,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25 * openurl_btn;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
26
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
27 gftp_window_data window1, window2, *other_wdata, *current_wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 GtkWidget * stop_btn, * hostedit, * useredit, * passedit, * portedit, * logwdw,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
29 * dlwdw, * protocol_menu, * optionmenu;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
30 GtkAdjustment * logwdw_vadj;
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
31 #if GTK_MAJOR_VERSION > 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
32 GtkTextMark * logwdw_textmark;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
33 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
34 int local_start, remote_start, trans_start, log_start, tools_start;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
35 GHashTable * graphic_hash_table = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
36 GtkItemFactoryEntry * menus = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
37 GtkItemFactory * factory = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
38 pthread_mutex_t transfer_mutex = PTHREAD_MUTEX_INITIALIZER;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
39 pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
40 gftp_graphic * gftp_icon;
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
41 int gftp_is_started = 0;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
42 sigjmp_buf jmp_environment;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
43 volatile int use_jmp_environment = 0;
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 51
diff changeset
44 pthread_t main_thread_id;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
45
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
46 static int
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
47 get_column (GtkCListColumn * col)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
48 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
49 if (col->auto_resize)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
50 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
51 else if (!col->visible)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
52 return (-1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
53 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
54 return (col->width);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
55 }
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
56
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
58 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
59 doexit (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
60 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
61 listbox_local_width = GTK_WIDGET (local_frame)->allocation.width;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
62 listbox_remote_width = GTK_WIDGET (remote_frame)->allocation.width;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
63 listbox_file_height = GTK_WIDGET (remote_frame)->allocation.height;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
64 log_height = GTK_WIDGET (log_table)->allocation.height;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
65 transfer_height = GTK_WIDGET (transfer_scroll)->allocation.height;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
67 local_columns[0] = get_column (&GTK_CLIST (window1.listbox)->column[1]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
68 local_columns[1] = get_column (&GTK_CLIST (window1.listbox)->column[2]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
69 local_columns[2] = get_column (&GTK_CLIST (window1.listbox)->column[3]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
70 local_columns[3] = get_column (&GTK_CLIST (window1.listbox)->column[4]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
71 local_columns[4] = get_column (&GTK_CLIST (window1.listbox)->column[5]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
72 local_columns[5] = get_column (&GTK_CLIST (window1.listbox)->column[6]);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
73
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
74 remote_columns[0] = get_column (&GTK_CLIST (window2.listbox)->column[1]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
75 remote_columns[1] = get_column (&GTK_CLIST (window2.listbox)->column[2]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
76 remote_columns[2] = get_column (&GTK_CLIST (window2.listbox)->column[3]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
77 remote_columns[3] = get_column (&GTK_CLIST (window2.listbox)->column[4]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
78 remote_columns[4] = get_column (&GTK_CLIST (window2.listbox)->column[5]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
79 remote_columns[5] = get_column (&GTK_CLIST (window2.listbox)->column[6]);
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
80
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
81 file_trans_column = get_column (&GTK_CLIST (dlwdw)->column[0]);
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
82
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
83 gftp_write_config_file ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
84 gftp_clear_cache_files ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
85 exit (0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
86 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
87
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
88
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89 static gint
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
90 delete_event (GtkWidget * widget, GdkEvent * event, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
91 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92 if (file_transfers == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93 doexit (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
95 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
96 MakeYesNoDialog (_("Exit"), _("There are file transfers in progress.\nAre you sure you want to exit?"), doexit, NULL, NULL, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
97 return (TRUE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
98 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
101
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 destroy (GtkWidget * widget, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 exit (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
107 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
108
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
110 static RETSIGTYPE
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
111 sig_child (int signo)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
112 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
113 viewedit_process_done = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
114 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
115
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
117 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
118 menu_exit (GtkWidget * widget, gpointer data)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
120 if (!delete_event (widget, NULL, data))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
121 doexit (widget, data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
122 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
123
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
124
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
125 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
126 chfunc (gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
127 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
128 chdir_dialog (data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
129 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
130
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
131
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
132 static GtkWidget *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
133 CreateMenus (GtkWidget * parent)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
134 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135 int local_len, remote_len, len, i, trans_len, log_len, tools_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136 GtkAccelGroup *accel_group;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137 GtkWidget * tempwid;
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
138 static GtkItemFactoryEntry menu_items[] = {
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
139 {N_("/_FTP"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
140 {N_("/FTP/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
141 {N_("/FTP/Window 1"), NULL, change_setting, 3, MN_("<RadioItem>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
142 {N_("/FTP/Window 2"), NULL, change_setting, 4, MN_("/FTP/Window 1")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
143 {N_("/FTP/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
144 {N_("/FTP/Ascii"), NULL, change_setting, 1, MN_("<RadioItem>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
145 {N_("/FTP/Binary"), NULL, change_setting, 2, MN_("/FTP/Ascii")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
146 {N_("/FTP/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
147 {N_("/FTP/_Options..."), "<control>O", options_dialog, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
148 MS_(GTK_STOCK_PREFERENCES)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
149 {N_("/FTP/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
150 {N_("/FTP/_Quit"), "<control>Q", menu_exit, 0, MS_(GTK_STOCK_QUIT)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
151 {N_("/_Local"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
152 {N_("/Local/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
153 {N_("/Local/Open _URL..."), NULL, openurl_dialog, 0, MS_(GTK_STOCK_OPEN)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
154 {N_("/Local/Disconnect"), NULL, disconnect, 0, MS_(GTK_STOCK_CLOSE)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
155 {N_("/Local/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
156 {N_("/Local/Change Filespec..."), NULL, change_filespec, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
157 {N_("/Local/Show selected"), NULL, show_selected, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
158 {N_("/Local/Select All"), NULL, selectall, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
159 {N_("/Local/Select All Files"), NULL, selectallfiles, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
160 {N_("/Local/Deselect All"), NULL, deselectall, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
161 {N_("/Local/sep"), NULL, 0, 0, MN_("<Separator>")},
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 12
diff changeset
162 {N_("/Local/Save Directory Listing..."), NULL, save_directory_listing, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
163 {N_("/Local/Send SITE Command..."), NULL, site_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
164 {N_("/Local/Change Directory"), NULL, chfunc, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
165 {N_("/Local/Chmod..."), NULL, chmod_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
166 {N_("/Local/Make Directory..."), NULL, mkdir_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
167 {N_("/Local/Rename..."), NULL, rename_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
168 {N_("/Local/Delete..."), NULL, delete_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
169 {N_("/Local/Edit..."), NULL, edit_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
170 {N_("/Local/View..."), NULL, view_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
171 {N_("/Local/Refresh"), NULL, refresh, 0, MS_(GTK_STOCK_REFRESH)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
172 {N_("/_Remote"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
173 {N_("/Remote/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
174 {N_("/Remote/Open _URL..."), "<control>U", openurl_dialog, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
175 MS_(GTK_STOCK_OPEN)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
176 {N_("/Remote/Disconnect"), "<control>D", disconnect, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
177 MS_(GTK_STOCK_CLOSE)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
178 {N_("/Remote/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
179 {N_("/Remote/Change Filespec..."), NULL, change_filespec, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
180 {N_("/Remote/Show selected"), NULL, show_selected, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
181 {N_("/Remote/Select All"), NULL, selectall, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
182 {N_("/Remote/Select All Files"), NULL, selectallfiles, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
183 {N_("/Remote/Deselect All"), NULL, deselectall, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
184 {N_("/Remote/sep"), NULL, 0, 0, MN_("<Separator>")},
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 12
diff changeset
185 {N_("/Remote/Save Directory Listing..."), NULL, save_directory_listing, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
186 {N_("/Remote/Send SITE Command..."), NULL, site_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
187 {N_("/Remote/Change Directory"), NULL, chfunc, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
188 {N_("/Remote/Chmod..."), NULL, chmod_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
189 {N_("/Remote/Make Directory..."), NULL, mkdir_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
190 {N_("/Remote/Rename..."), NULL, rename_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
191 {N_("/Remote/Delete..."), NULL, delete_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
192 {N_("/Remote/Edit..."), NULL, edit_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
193 {N_("/Remote/View..."), NULL, view_dialog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
194 {N_("/Remote/Refresh"), NULL, refresh, 0, MS_(GTK_STOCK_REFRESH)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
195 {N_("/_Bookmarks"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
196 {N_("/Bookmarks/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
197 {N_("/Bookmarks/Add bookmark"), "<control>A", add_bookmark, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
198 MS_(GTK_STOCK_ADD)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
199 {N_("/Bookmarks/Edit bookmarks"), NULL, edit_bookmarks, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
200 {N_("/Bookmarks/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
201 {N_("/_Transfers"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
202 {N_("/Transfers/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
203 {N_("/Transfers/Start Transfer"), NULL, start_transfer, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
204 {N_("/Transfers/Stop Transfer"), NULL, stop_transfer, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
205 MS_(GTK_STOCK_STOP)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
206 {N_("/Transfers/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
207 {N_("/Transfers/Skip Current File"), NULL, skip_transfer, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
208 {N_("/Transfers/Remove File"), NULL, remove_file_transfer, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
209 MS_(GTK_STOCK_DELETE)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
210 {N_("/Transfers/Move File _Up"), NULL, move_transfer_up, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
211 MS_(GTK_STOCK_GO_UP)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
212 {N_("/Transfers/Move File _Down"), NULL, move_transfer_down, 0,
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
213 MS_(GTK_STOCK_GO_DOWN)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
214 {N_("/Transfers/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
215 {N_("/Transfers/Retrieve Files"), "<control>R", get_files, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
216 {N_("/Transfers/Put Files"), "<control>P", put_files, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
217 {N_("/L_ogging"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
218 {N_("/Logging/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
219 {N_("/Logging/Clear"), NULL, clearlog, 0, MS_(GTK_STOCK_CLEAR)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
220 {N_("/Logging/View log..."), NULL, viewlog, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
221 {N_("/Logging/Save log..."), NULL, savelog, 0, MS_(GTK_STOCK_SAVE)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
222 {N_("/Tool_s"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
223 {N_("/Tools/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
224 {N_("/Tools/Compare Windows"), NULL, compare_windows, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
225 {N_("/Tools/Clear Cache"), NULL, clear_cache, 0, MS_(GTK_STOCK_CLEAR)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
226 {N_("/_Help"), NULL, 0, 0, MN_("<LastBranch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
227 {N_("/Help/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
228 {N_("/Help/About..."), NULL, about_dialog, 0, MS_(GTK_STOCK_HELP)}
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
229 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
230
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
231 menus = menu_items;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
232
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
233 accel_group = gtk_accel_group_new ();
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
234 factory = item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
235
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
236 i = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
237 len = 11;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
238 /* FTP Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
239 create_item_factory (factory, len, menu_items, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
240
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
241 i += len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
242 /* Local Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
243 local_start = i;
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 12
diff changeset
244 local_len = 21;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
245 create_item_factory (factory, local_len, menu_items + i, &window1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
246
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
247 i += local_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
248 /* Remote Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
249 remote_start = i;
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 12
diff changeset
250 remote_len = 21;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
251 create_item_factory (factory, remote_len, menu_items + i, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
252
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
253 i += remote_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
254 len = 5;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
255 /* Bookmarks Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
256 create_item_factory (factory, len, menu_items + i, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
257
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
258 i += len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
259 /* Transfers Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
260 trans_start = i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
261 trans_len = 12;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
262 create_item_factory (factory, trans_len, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
263
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
264 i += trans_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
265 /* Logging Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
266 log_start = i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
267 log_len = 5;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
268 create_item_factory (factory, log_len, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
269
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
270 i += log_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
271 /* Tools Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
272 tools_start = i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
273 tools_len = 4;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
274 create_item_factory (factory, tools_len, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
275
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
276 i += tools_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
277 /* Help Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
278 create_item_factory (factory, 3, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
279
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
280 build_bookmarks_menu ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
281
44
9c0825c047e7 2002-10-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
282 gtk_window_add_accel_group (GTK_WINDOW (parent), accel_group);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
283
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
284 tempwid = gtk_item_factory_get_widget (factory, menu_items[6].path);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
285 gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
286
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
287 tempwid = gtk_item_factory_get_widget (factory, menu_items[3].path);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
288 gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
289
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
290 window1.ifactory = item_factory_new (GTK_TYPE_MENU, "<local>", NULL, "/Local");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
291 create_item_factory (window1.ifactory, local_len - 2, menu_items + local_start + 2, &window1);
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
292
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
293 window2.ifactory = item_factory_new (GTK_TYPE_MENU, "<remote>", NULL, "/Remote");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
294 create_item_factory (window2.ifactory, remote_len - 2, menu_items + remote_start + 2, &window2);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
295
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
296 log_factory = item_factory_new (GTK_TYPE_MENU, "<log>", NULL, "/Logging");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
297 create_item_factory (log_factory, log_len - 2, menu_items + log_start + 2, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
298
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
299 dl_factory = item_factory_new (GTK_TYPE_MENU, "<download>", NULL, "/Transfers");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
300 create_item_factory (dl_factory, trans_len - 2, menu_items + trans_start + 2, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
301
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
302 return (factory->widget);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
303 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
304
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
305
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
306 static GtkWidget *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
307 CreateToolbar (GtkWidget * parent)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
308 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
309 const GtkTargetEntry possible_types[] = {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
310 {"STRING", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
311 {"text/plain", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
312 {"application/x-rootwin-drop", 0, 1}
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
313 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
314 GtkWidget *toolbar, *box, *tempwid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
315 int i, num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
316
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
317 toolbar = gtk_handle_box_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
318
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
319 box = gtk_hbox_new (FALSE, 4);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
320 gtk_container_add (GTK_CONTAINER (toolbar), box);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
321 gtk_container_border_width (GTK_CONTAINER (box), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
322
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
323 tempwid = toolbar_pixmap (parent, "connect.xpm");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
324 openurl_btn = gtk_button_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
325 gtk_container_add (GTK_CONTAINER (openurl_btn), tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
326 gtk_signal_connect_object (GTK_OBJECT (openurl_btn), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
327 GTK_SIGNAL_FUNC (tb_openurl_dialog), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
328 gtk_signal_connect (GTK_OBJECT (openurl_btn), "drag_data_received",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
329 GTK_SIGNAL_FUNC (openurl_get_drag_data), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
330 gtk_drag_dest_set (openurl_btn, GTK_DEST_DEFAULT_ALL, possible_types, 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
331 GDK_ACTION_COPY | GDK_ACTION_MOVE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
332 gtk_container_border_width (GTK_CONTAINER (openurl_btn), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
333 gtk_box_pack_start (GTK_BOX (box), openurl_btn, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
334
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
335 tempwid = gtk_label_new (_("Host: "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
336 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
337
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
338 hostedit = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
339 gtk_combo_set_case_sensitive (GTK_COMBO (hostedit), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
340 gtk_widget_set_size_request (hostedit, 130, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
341
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
342 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (hostedit)->entry), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
343 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
344 if (host_history)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
345 gtk_combo_set_popdown_strings (GTK_COMBO (hostedit), host_history);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
346 gtk_combo_disable_activate (GTK_COMBO (hostedit));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
347 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), "");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
348 gtk_box_pack_start (GTK_BOX (box), hostedit, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
349
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
350 tempwid = gtk_label_new (_("Port: "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
351 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
352
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
353 portedit = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
354 gtk_combo_set_case_sensitive (GTK_COMBO (portedit), 1);
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
355 gtk_widget_set_size_request (portedit, 45, -1);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
356
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
357 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (portedit)->entry), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
358 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
359 if (port_history)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
360 gtk_combo_set_popdown_strings (GTK_COMBO (portedit), port_history);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
361 gtk_combo_disable_activate (GTK_COMBO (portedit));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
362 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), "");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
363 gtk_box_pack_start (GTK_BOX (box), portedit, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
364
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
365 tempwid = gtk_label_new (_("User: "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
366 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
367
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
368 useredit = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
369 gtk_combo_set_case_sensitive (GTK_COMBO (useredit), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
370 gtk_widget_set_size_request (useredit, 75, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
371
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
372 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (useredit)->entry), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
373 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
374 if (user_history)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
375 gtk_combo_set_popdown_strings (GTK_COMBO (useredit), user_history);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
376 gtk_combo_disable_activate (GTK_COMBO (useredit));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
377 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), "");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
378 gtk_box_pack_start (GTK_BOX (box), useredit, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
379
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
380 tempwid = gtk_label_new (_("Pass: "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
381 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
382
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
383 passedit = gtk_entry_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
384 gtk_widget_set_size_request (passedit, 55, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
385
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
386 gtk_entry_set_visibility (GTK_ENTRY (passedit), FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
387 gtk_signal_connect (GTK_OBJECT (passedit), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
388 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
389 gtk_box_pack_start (GTK_BOX (box), passedit, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
390
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
391 tempwid = gtk_vbox_new (FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
392 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
393
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
394 optionmenu = gtk_option_menu_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
395 gtk_box_pack_start (GTK_BOX (tempwid), optionmenu, TRUE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
396
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
397 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
398 protocol_menu = gtk_menu_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
399 for (i = 0; gftp_protocols[i].name; i++)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
400 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
401 if (!gftp_protocols[i].shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
402 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
403
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
404 if (strcmp (gftp_protocols[i].name, default_protocol) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
405 num = i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
406
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
407 tempwid = gtk_menu_item_new_with_label (gftp_protocols[i].name);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
408 gtk_object_set_user_data (GTK_OBJECT (tempwid), (gpointer) i);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
409 gtk_menu_append (GTK_MENU (protocol_menu), tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
410 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
411 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
412 gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), protocol_menu);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
413 gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
414
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
415 #if GTK_MAJOR_VERSION == 1
21
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
416 tempwid = toolbar_pixmap (parent, "stop.xpm");
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
417 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
418 tempwid = gtk_image_new_from_stock (GTK_STOCK_STOP,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
419 GTK_ICON_SIZE_LARGE_TOOLBAR);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
420 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
421
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
422 stop_btn = gtk_button_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
423 gtk_container_add (GTK_CONTAINER (stop_btn), tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
424 gtk_widget_set_sensitive (stop_btn, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
425 gtk_signal_connect_object (GTK_OBJECT (stop_btn), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
426 GTK_SIGNAL_FUNC (stop_button), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
427 gtk_container_border_width (GTK_CONTAINER (stop_btn), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
428 gtk_box_pack_start (GTK_BOX (box), stop_btn, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
429
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
430 return (toolbar);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
431 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
432
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
433
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
434 static void
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
435 setup_column (GtkWidget * listbox, int column, int width)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
436 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
437 if (width == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
438 gtk_clist_set_column_auto_resize (GTK_CLIST (listbox), column, TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
439 else if (width == -1)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
440 gtk_clist_set_column_visibility (GTK_CLIST (listbox), column, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
441 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
442 gtk_clist_set_column_width (GTK_CLIST (listbox), column, width);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
443 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
444
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
445
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
446 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
447 list_doaction (gftp_window_data * wdata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
448 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
449 GList *templist, *filelist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
450 int num, dir, success;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
451 gftp_file *tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
452
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
453 filelist = wdata->files;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
454 templist = GTK_CLIST (wdata->listbox)->selection;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
455 num = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
456 templist = get_next_selection (templist, &filelist, &num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
457 tempfle = (gftp_file *) filelist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
458
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
459 dir = tempfle->isdir;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
460 success = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
461
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
462 if (tempfle->islink || tempfle->isdir)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
463 success = chdir_dialog (wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
464
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
465 if (!dir && !success)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
466 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
467 switch (listbox_dblclick_action)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
468 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
469 case 0:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
470 view_dialog (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
471 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
472 case 1:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
473 edit_dialog (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
474 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
475 case 2:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
476 if (wdata == &window2)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
477 get_files (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
478 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
479 put_files (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
480 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
481 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
482 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
483 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
484
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
485
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
486 static gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
487 list_enter (GtkWidget * widget, GdkEventKey * event, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
488 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
489 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
490
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
491 wdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
492 if (!GFTP_IS_CONNECTED (wdata->request))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
493 return (TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
494
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
495 if (event->type == GDK_KEY_PRESS &&
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
496 (event->keyval == GDK_KP_Delete || event->keyval == GDK_Delete))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
497 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
498 delete_dialog (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
499 return (FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
500 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
501 else if (IS_ONE_SELECTED (wdata) && event->type == GDK_KEY_PRESS &&
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
502 event->keyval == GDK_Return)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
503 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
504 list_doaction (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
505 return (FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
506 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
507 return (TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
508 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
509
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
510
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
511 static gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
512 list_dblclick (GtkWidget * widget, GdkEventButton * event, gpointer data)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
513 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
514 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
515
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
516 wdata = data;
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
517
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
518 if (event->button == 3)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
519 gtk_item_factory_popup (wdata->ifactory, (guint) event->x_root,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
520 (guint) event->y_root, 3, event->time);
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
521 return (FALSE);
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
522 }
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
523
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
524
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
525 void
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
526 select_row_callback (GtkWidget *widget, gint row, gint column,
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
527 GdkEventButton *event, gpointer data)
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
528 {
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
529 gftp_window_data * wdata;
50
d433c1417d7d 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
530
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
531 wdata = data;
50
d433c1417d7d 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
532
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
533 if (event != NULL && event->type == GDK_2BUTTON_PRESS && event->button == 1 &&
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
534 GFTP_IS_CONNECTED (wdata->request) && IS_ONE_SELECTED (wdata))
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
535 list_doaction (wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
536 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
537
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
538
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
539 static GtkWidget *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
540 CreateFTPWindow (gftp_window_data * wdata, int width, int columns[6])
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
541 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
542 const GtkTargetEntry possible_types[] = {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
543 {"STRING", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
544 {"text/plain", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
545 {"application/x-rootwin-drop", 0, 1}
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
546 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
547 GtkWidget *box, *scroll_list, *parent;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
548 char *titles[7];
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
549
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
550 titles[0] = "";
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
551 titles[1] = _("Filename");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
552 titles[2] = _("Size");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
553 titles[3] = _("User");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
554 titles[4] = _("Group");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
555 titles[5] = _("Date");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
556 titles[6] = _("Attribs");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
557
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
558 wdata->request = gftp_request_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
559 wdata->request->logging_function = ftp_log;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
560 wdata->filespec = g_malloc0 (2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
561 *wdata->filespec = '*';
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
562
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
563 parent = gtk_frame_new (NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
564 gtk_widget_set_size_request (parent, width, listbox_file_height);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
565
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
566 gtk_container_border_width (GTK_CONTAINER (parent), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
567
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
568 box = gtk_vbox_new (FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
569 gtk_container_border_width (GTK_CONTAINER (box), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
570 gtk_container_add (GTK_CONTAINER (parent), box);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
571
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
572 wdata->combo = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
573 gtk_combo_set_case_sensitive (GTK_COMBO (wdata->combo), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
574 gtk_box_pack_start (GTK_BOX (box), wdata->combo, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
575 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (wdata->combo)->entry),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
576 "activate", GTK_SIGNAL_FUNC (chdir_edit),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
577 (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
578 if (*wdata->history)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
579 gtk_combo_set_popdown_strings (GTK_COMBO (wdata->combo), *wdata->history);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
580 gtk_combo_disable_activate (GTK_COMBO (wdata->combo));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
581 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry), "");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
582
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
583 wdata->hoststxt = gtk_label_new (NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
584 gtk_misc_set_alignment (GTK_MISC (wdata->hoststxt), 0, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
585 gtk_box_pack_start (GTK_BOX (box), wdata->hoststxt, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
586
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
587 scroll_list = gtk_scrolled_window_new (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
588 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_list),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
589 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
590 wdata->listbox = gtk_clist_new_with_titles (7, titles);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
591 gtk_container_add (GTK_CONTAINER (scroll_list), wdata->listbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
592 gtk_drag_source_set (wdata->listbox, GDK_BUTTON1_MASK, possible_types, 3,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
593 GDK_ACTION_COPY | GDK_ACTION_MOVE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
594 gtk_drag_dest_set (wdata->listbox, GTK_DEST_DEFAULT_ALL, possible_types, 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
595 GDK_ACTION_COPY | GDK_ACTION_MOVE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
596
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
597 gtk_clist_set_selection_mode (GTK_CLIST (wdata->listbox),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
598 GTK_SELECTION_EXTENDED);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
599
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
600 gtk_clist_set_column_width (GTK_CLIST (wdata->listbox), 0, 16);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
601 gtk_clist_set_column_justification (GTK_CLIST (wdata->listbox), 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
602 GTK_JUSTIFY_CENTER);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
603 setup_column (wdata->listbox, 1, columns[0]);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
604 gtk_clist_set_column_justification (GTK_CLIST (wdata->listbox), 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
605 GTK_JUSTIFY_RIGHT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
606 setup_column (wdata->listbox, 2, columns[1]);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
607 setup_column (wdata->listbox, 3, columns[2]);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
608 setup_column (wdata->listbox, 4, columns[3]);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
609 setup_column (wdata->listbox, 5, columns[4]);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
610 setup_column (wdata->listbox, 6, columns[5]);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
611 gtk_box_pack_start (GTK_BOX (box), scroll_list, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
612 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "click_column",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
613 GTK_SIGNAL_FUNC (sortrows), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
614 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "drag_data_get",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
615 GTK_SIGNAL_FUNC (listbox_drag), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
616 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "drag_data_received",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
617 GTK_SIGNAL_FUNC (listbox_get_drag_data),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
618 (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
619 gtk_signal_connect_after (GTK_OBJECT (wdata->listbox), "key_press_event",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
620 GTK_SIGNAL_FUNC (list_enter), (gpointer) wdata);
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
621 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "select_row",
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
622 GTK_SIGNAL_FUNC(select_row_callback),
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
623 (gpointer) wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
624 gtk_signal_connect_after (GTK_OBJECT (wdata->listbox), "button_press_event",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
625 GTK_SIGNAL_FUNC (list_dblclick), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
626 return (parent);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
627 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
628
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
629
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
630 static gint
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
631 menu_mouse_click (GtkWidget * widget, GdkEventButton * event, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
632 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
633 GtkItemFactory *factory;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
634
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
635 factory = (GtkItemFactory *) data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
636 if (event->button == 3)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
637 gtk_item_factory_popup (factory, (guint) event->x_root,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
638 (guint) event->y_root, 3, event->time);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
639 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
640 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
641
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
642
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
643 static GtkWidget *
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
644 CreateFTPWindows (GtkWidget * ui)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
645 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
646 GtkWidget *box, *dlbox, *winpane, *dlpane, *logpane, *mainvbox, *tempwid,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
647 *button;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
648 char *dltitles[2];
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
649 #if GTK_MAJOR_VERSION > 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
650 GtkTextBuffer * textbuf;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
651 GtkTextIter iter;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
652 GtkTextTag *tag;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
653 GdkColor fore;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
654 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
655
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
656 memset (&window1, 0, sizeof (window1));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
657 memset (&window2, 0, sizeof (window2));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
658 window1.history = &localhistory;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
659 window1.histlen = &localhistlen;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
660 window2.history = &remotehistory;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
661 window2.histlen = &remotehistlen;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
662
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
663 mainvbox = gtk_vbox_new (FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
664
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
665 tempwid = CreateMenus (ui);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
666 gtk_box_pack_start (GTK_BOX (mainvbox), tempwid, FALSE, FALSE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
667
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
668 tempwid = CreateToolbar (ui);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
669 gtk_box_pack_start (GTK_BOX (mainvbox), tempwid, FALSE, FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
670
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
671 winpane = gtk_hpaned_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
672
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
673 box = gtk_hbox_new (FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
674
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
675 local_frame = CreateFTPWindow (&window1, listbox_local_width, local_columns);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
676 window1.sortcol = &local_sortcol;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
677 window1.sortasds = &local_sortasds;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
678 gtk_box_pack_start (GTK_BOX (box), local_frame, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
679
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
680 dlbox = gtk_vbox_new (FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
681 gtk_container_border_width (GTK_CONTAINER (dlbox), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
682 gtk_box_pack_start (GTK_BOX (box), dlbox, FALSE, FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
683
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
684 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
685 tempwid = toolbar_pixmap (ui, "right.xpm");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
686 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
687 tempwid = gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
688 GTK_ICON_SIZE_SMALL_TOOLBAR);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
689 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
690
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
691 button = gtk_button_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
692 gtk_box_pack_start (GTK_BOX (dlbox), button, TRUE, FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
693 gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
694 GTK_SIGNAL_FUNC (put_files), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
695 gtk_container_add (GTK_CONTAINER (button), tempwid);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
696
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
697 #if GTK_MAJOR_VERSION == 1
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
698 tempwid = toolbar_pixmap (ui, "left.xpm");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
699 #else
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
700 tempwid = gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
701 GTK_ICON_SIZE_SMALL_TOOLBAR);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
702 #endif
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
703
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
704 button = gtk_button_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
705 gtk_box_pack_start (GTK_BOX (dlbox), button, TRUE, FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
706 gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
707 GTK_SIGNAL_FUNC (get_files), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
708 gtk_container_add (GTK_CONTAINER (button), tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
709
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
710 gtk_paned_pack1 (GTK_PANED (winpane), box, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
711
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
712 remote_frame = CreateFTPWindow (&window2, listbox_remote_width,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
713 remote_columns);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
714 window2.sortcol = &remote_sortcol;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
715 window2.sortasds = &remote_sortasds;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
716 gtk_paned_pack2 (GTK_PANED (winpane), remote_frame, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
717
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
718 dlpane = gtk_vpaned_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
719 gtk_paned_pack1 (GTK_PANED (dlpane), winpane, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
720
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
721 transfer_scroll = gtk_scrolled_window_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
722 gtk_widget_set_size_request (transfer_scroll, -1, transfer_height);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
723 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (transfer_scroll),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
724 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
725
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
726 dltitles[0] = _("Filename");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
727 dltitles[1] = _("Progress");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
728 dlwdw = gtk_ctree_new_with_titles (2, 0, dltitles);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
729 gtk_clist_set_selection_mode (GTK_CLIST (dlwdw), GTK_SELECTION_SINGLE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
730 gtk_clist_set_reorderable (GTK_CLIST (dlwdw), 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
731
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
732 if (file_trans_column == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
733 gtk_clist_set_column_auto_resize (GTK_CLIST (dlwdw), 0, TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
734 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
735 gtk_clist_set_column_width (GTK_CLIST (dlwdw), 0, file_trans_column);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
736
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
737 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (transfer_scroll), dlwdw);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
738 gtk_signal_connect (GTK_OBJECT (dlwdw), "button_press_event",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
739 GTK_SIGNAL_FUNC (menu_mouse_click), (gpointer) dl_factory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
740 gtk_paned_pack2 (GTK_PANED (dlpane), transfer_scroll, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
741
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
742 logpane = gtk_vpaned_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
743 gtk_paned_pack1 (GTK_PANED (logpane), dlpane, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
744
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
745 log_table = gtk_table_new (1, 2, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
746 gtk_widget_set_size_request (log_table, -1, log_height);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
747
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
748 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
749 logwdw = gtk_text_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
750
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
751 gtk_text_set_editable (GTK_TEXT (logwdw), FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
752 gtk_text_set_word_wrap (GTK_TEXT (logwdw), TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
753
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
754 gtk_table_attach (GTK_TABLE (log_table), logwdw, 0, 1, 0, 1,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
755 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
756 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
757 gtk_signal_connect (GTK_OBJECT (logwdw), "button_press_event",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
758 GTK_SIGNAL_FUNC (menu_mouse_click),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
759 (gpointer) log_factory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
760
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
761 tempwid = gtk_vscrollbar_new (GTK_TEXT (logwdw)->vadj);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
762 gtk_table_attach (GTK_TABLE (log_table), tempwid, 1, 2, 0, 1,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
763 GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
764 logwdw_vadj = GTK_TEXT (logwdw)->vadj;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
765 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
766 logwdw = gtk_text_view_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
767 gtk_text_view_set_editable (GTK_TEXT_VIEW (logwdw), FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
768 gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (logwdw), FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
769 gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (logwdw), GTK_WRAP_WORD);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
770
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
771 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
772
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
773 tag = gtk_text_buffer_create_tag (textbuf, "send", NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
774 fore.red = send_color.red;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
775 fore.green = send_color.green;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
776 fore.blue = send_color.blue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
777 g_object_set (G_OBJECT (tag), "foreground_gdk", &fore, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
778
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
779 tag = gtk_text_buffer_create_tag (textbuf, "recv", NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
780 fore.red = recv_color.red;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
781 fore.green = recv_color.green;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
782 fore.blue = recv_color.blue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
783 g_object_set (G_OBJECT (tag), "foreground_gdk", &fore, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
784
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
785 tag = gtk_text_buffer_create_tag (textbuf, "error", NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
786 fore.red = error_color.red;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
787 fore.green = error_color.green;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
788 fore.blue = error_color.blue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
789 g_object_set (G_OBJECT (tag), "foreground_gdk", &fore, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
790
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
791 tag = gtk_text_buffer_create_tag (textbuf, "misc", NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
792 fore.red = misc_color.red;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
793 fore.green = misc_color.green;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
794 fore.blue = misc_color.blue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
795 g_object_set (G_OBJECT (tag), "foreground_gdk", &fore, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
796
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
797 tempwid = gtk_scrolled_window_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
798 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tempwid),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
799 GTK_POLICY_AUTOMATIC,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
800 GTK_POLICY_AUTOMATIC);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
801 gtk_container_add (GTK_CONTAINER (tempwid), logwdw);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
802 gtk_table_attach (GTK_TABLE (log_table), tempwid, 0, 1, 0, 1,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
803 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
804 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
805 logwdw_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (tempwid));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
806 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
807 logwdw_textmark = gtk_text_buffer_create_mark (textbuf, "end", &iter, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
808 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
809 gtk_paned_pack2 (GTK_PANED (logpane), log_table, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
810 gtk_box_pack_start (GTK_BOX (mainvbox), logpane, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
811
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
812 gtk_widget_show_all (mainvbox);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
813 return (mainvbox);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
814 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
815
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
816
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
817 void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
818 init_gftp (int argc, char *argv[], GtkWidget * parent)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
819 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
820 if (argc == 2 && strncmp (argv[1], "--", 2) != 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
821 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
822 if (gftp_parse_url (window2.request, argv[1]) == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
823 ftp_connect (&window2, window2.request, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
824 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
825 gftp_usage ();
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
826 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
827 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
828
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
829
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
830 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
831 toolbar_hostedit (GtkWidget * widget, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
832 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
833 void (*init) (gftp_request * request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
834 GtkWidget *tempwid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
835 const char *txt;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
836 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
837
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
838 if (current_wdata->request->stopable)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
839 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
840 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
841 _("%s: Please hit the stop button first to do anything else\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
842 _("Connect"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
843 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
844 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
845
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
846 if (GFTP_IS_CONNECTED (current_wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
847 disconnect (current_wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
848
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
849 tempwid = gtk_menu_get_active (GTK_MENU (protocol_menu));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
850 num = (int) gtk_object_get_user_data (GTK_OBJECT (tempwid));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
851 init = gftp_protocols[num].init;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
852 init (current_wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
853
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
854 gftp_set_hostname (current_wdata->request, gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry)));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
855 alltrim (current_wdata->request->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
856
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
857 if (current_wdata->request->need_hostport &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
858 *current_wdata->request->hostname == '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
859 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
860 ftp_log (gftp_logging_error, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
861 _("Error: You must type in a host to connect to\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
862 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
863 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
864
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
865 add_history (hostedit, &host_history, &host_len,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
866 current_wdata->request->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
867
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
868 if (strchr (current_wdata->request->hostname, '/') != NULL &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
869 gftp_parse_url (current_wdata->request,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
870 current_wdata->request->hostname) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
871 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
872 ftp_connect (current_wdata, current_wdata->request, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
873 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
874 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
875
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
876 txt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (portedit)->entry));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
877 gftp_set_port (current_wdata->request, strtol (txt, NULL, 10));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
878 add_history (portedit, &port_history, &port_len, txt);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
879
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
880 gftp_set_username (current_wdata->request, gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry)));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
881 alltrim (current_wdata->request->username);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
882
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
883 add_history (useredit, &user_history, &user_len,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
884 current_wdata->request->username);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
885
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
886 gftp_set_password (current_wdata->request,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
887 gtk_entry_get_text (GTK_ENTRY (passedit)));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
888
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
889 gftp_set_directory (current_wdata->request, gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (current_wdata->combo)->entry)));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
890 alltrim (current_wdata->request->directory);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
891
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
892 add_history (current_wdata->combo, current_wdata->history,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
893 current_wdata->histlen, current_wdata->request->directory);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
894
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
895 ftp_connect (current_wdata, current_wdata->request, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
896 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
897
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
898
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
899 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
900 sortrows (GtkCList * clist, gint column, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
901 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
902 gftp_window_data * wdata;
16
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
903 GtkWidget * sort_wid;
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
904 GList * templist;
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
905 int swap_col;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
906
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
907 wdata = data;
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
908 if (column == 0 || (column == *wdata->sortcol && wdata->sorted))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
909 {
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
910 *wdata->sortasds = !(*wdata->sortasds);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
911 swap_col = 1;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
912 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
913 else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
914 swap_col = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
915
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
916 if (swap_col || !wdata->sorted)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
917 {
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
918 sort_wid = gtk_clist_get_column_widget (clist, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
919 gtk_widget_destroy (sort_wid);
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
920 #if GTK_MAJOR_VERSION == 1
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
921 if (*wdata->sortasds)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
922 sort_wid = toolbar_pixmap (wdata->listbox, "down.xpm");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
923 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
924 sort_wid = toolbar_pixmap (wdata->listbox, "up.xpm");
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
925 #else
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
926 if (*wdata->sortasds)
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
927 sort_wid = gtk_image_new_from_stock (GTK_STOCK_SORT_ASCENDING,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
928 GTK_ICON_SIZE_SMALL_TOOLBAR);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
929 else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
930 sort_wid = gtk_image_new_from_stock (GTK_STOCK_SORT_DESCENDING,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
931 GTK_ICON_SIZE_SMALL_TOOLBAR);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
932 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
933
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
934 gtk_clist_set_column_widget (clist, 0, sort_wid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
935 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
936 else
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
937 *wdata->sortcol = column;
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
938
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
939 if (!GFTP_IS_CONNECTED (wdata->request))
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
940 return;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
941
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
942 gtk_clist_freeze (clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
943 gtk_clist_clear (clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
944
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
945 wdata->files = gftp_sort_filelist (wdata->files, *wdata->sortcol,
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
946 *wdata->sortasds);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
947
16
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
948 templist = wdata->files;
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
949 while (templist != NULL)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
950 {
16
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
951 add_file_listbox (wdata, templist->data);
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
952 templist = templist->next;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
953 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
954
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
955 wdata->sorted = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
956 gtk_clist_thaw (clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
957 update_window_info ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
958 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
959
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
960
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
961 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
962 stop_button (GtkWidget * widget, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
963 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
964 pthread_t comptid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
965
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
966 memset (&comptid, 0, sizeof (comptid));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
967 if (!pthread_equal (comptid, window1.tid))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
968 pthread_kill (window1.tid, SIGINT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
969 else if (!pthread_equal (comptid, window2.tid))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
970 pthread_kill (window2.tid, SIGINT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
971 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
972
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
973
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
974 int
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
975 main (int argc, char **argv)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
976 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
977 GtkWidget *window, *ui;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
978
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
979 #ifdef HAVE_GETTEXT
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
980 setlocale (LC_ALL, "");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
981 bindtextdomain ("gftp", LOCALE_DIR);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
982 #if GTK_MAJOR_VERSION > 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
983 bind_textdomain_codeset ("gftp", "UTF-8");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
984 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
985 textdomain ("gftp");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
986 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
987
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
988 g_thread_init (NULL);
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 51
diff changeset
989 main_thread_id = pthread_self ();
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
990 gtk_set_locale ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
991 gtk_init (&argc, &argv);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
992
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
993 signal (SIGCHLD, sig_child);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
994 signal (SIGPIPE, SIG_IGN);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
995 signal (SIGALRM, signal_handler);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
996 signal (SIGINT, signal_handler);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
997
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
998 graphic_hash_table = g_hash_table_new (string_hash_function, string_hash_compare);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
999 gftp_read_config_file (argv, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1000 if (gftp_parse_command_line (&argc, &argv) != 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1001 exit (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1002
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1003 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1004 gtk_signal_connect (GTK_OBJECT (window), "delete_event",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1005 GTK_SIGNAL_FUNC (delete_event), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1006 gtk_signal_connect (GTK_OBJECT (window), "destroy",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1007 GTK_SIGNAL_FUNC (destroy), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1008 gtk_window_set_title (GTK_WINDOW (window), version);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1009 gtk_window_set_wmclass (GTK_WINDOW(window), "main", "gFTP");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1010 gtk_widget_set_name (window, version);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1011 gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1012 gtk_widget_realize (window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1013
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1014 gftp_icon = open_xpm (window, "gftp.xpm");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1015 if (gftp_icon != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1016 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1017 gdk_window_set_icon (window->window, NULL, gftp_icon->pixmap,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1018 gftp_icon->bitmap);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1019 gdk_window_set_icon_name (window->window, _("gFTP Icon"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1020 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1021
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1022 other_wdata = &window1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1023 current_wdata = &window2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1024 ui = CreateFTPWindows (window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1025 gtk_container_add (GTK_CONTAINER (window), ui);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1026 gtk_widget_show (window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1027
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1028 ftp_log (gftp_logging_misc, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1029 "%s, Copyright (C) 1998-2002 Brian Masney <", version);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1030 ftp_log (gftp_logging_recv, NULL, "masneyb@gftp.org");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1031 ftp_log (gftp_logging_misc, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1032 _(">. If you have any questions, comments, or suggestions about this program, please feel free to email them to me. You can always find out the latest news about gFTP from my website at http://www.gftp.org/\n"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1033 ftp_log (gftp_logging_misc, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1034 _("gFTP comes with ABSOLUTELY NO WARRANTY; for details, see the COPYING file. This is free software, and you are welcome to redistribute it under certain conditions; for details, see the COPYING file\n"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1035
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1036 gtk_timeout_add (1000, update_downloads, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1037 gftp_protocols[GFTP_LOCAL_NUM].init (window1.request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1038 if (startup_directory != NULL && *startup_directory != '\0')
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1039 gftp_set_directory (window1.request, startup_directory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1040 gftp_connect (window1.request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1041 ftp_list_files (&window1, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1042
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1043 /* On the remote window, even though we aren't connected, draw the sort
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1044 icon on that side */
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1045 sortrows (GTK_CLIST (window2.listbox), *window2.sortcol, &window2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1046
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1047 init_gftp (argc, argv, window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1048 gftp_is_started = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1049
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1050 GDK_THREADS_ENTER ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1051 gtk_main ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1052 GDK_THREADS_LEAVE ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1053 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1054 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1055
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1056