annotate src/gtk/gftp-gtk.c @ 788:0e7ab0a51ddd

2006-7-28 Brian Masney <masneyb@gftp.org> * src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h src/gtk/misc-gtk.c - warning fixes when creating the system menus. Removed some unused global variables.
author masneyb
date Fri, 28 Jul 2006 11:20:05 +0000
parents 6cfc7104e23b
children afe56dd107ca
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 */
255
2ad324cf4930 2003-8-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 245
diff changeset
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
1
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,
604
5df5eac28f47 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 587
diff changeset
25 * gftpui_command_toolbar;
1
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,
587
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
29 * dlwdw, * protocol_menu, * optionmenu, * gftpui_command_widget,
604
5df5eac28f47 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 587
diff changeset
30 * download_left_arrow, * upload_right_arrow, * openurl_btn;
5df5eac28f47 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 587
diff changeset
31 GtkTooltips * openurl_tooltip;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
32 GtkAdjustment * logwdw_vadj;
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
33 #if GTK_MAJOR_VERSION > 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
34 GtkTextMark * logwdw_textmark;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
35 #endif
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
36 int local_start, remote_start, trans_start;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
37 GHashTable * graphic_hash_table = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
38 GtkItemFactoryEntry * menus = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
39 GtkItemFactory * factory = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
40 pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
41 gftp_graphic * gftp_icon;
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 51
diff changeset
42 pthread_t main_thread_id;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
43 GList * viewedit_processes = NULL;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
44
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
45 static int
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
46 get_column (GtkCListColumn * col)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
47 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
48 if (col->auto_resize)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
49 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
50 else if (!col->visible)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
51 return (-1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
52 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
53 return (col->width);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
54 }
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
55
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
57 static void
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
58 _gftp_exit (GtkWidget * widget, gpointer data)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
59 {
616
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
60 const char *tempstr;
472
5100b89c44e1 2004-5-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 470
diff changeset
61 intptr_t ret;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
62
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
63 ret = GTK_WIDGET (local_frame)->allocation.width;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
64 gftp_set_global_option ("listbox_local_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
65 ret = GTK_WIDGET (remote_frame)->allocation.width;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
66 gftp_set_global_option ("listbox_remote_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
67 ret = GTK_WIDGET (remote_frame)->allocation.height;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
68 gftp_set_global_option ("listbox_file_height", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
69 ret = GTK_WIDGET (log_table)->allocation.height;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
70 gftp_set_global_option ("log_height", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
71 ret = GTK_WIDGET (transfer_scroll)->allocation.height;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
72 gftp_set_global_option ("transfer_height", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
73
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
74 ret = get_column (&GTK_CLIST (dlwdw)->column[0]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
75 gftp_set_global_option ("file_trans_column", GINT_TO_POINTER (ret));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
76
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
77 ret = get_column (&GTK_CLIST (window1.listbox)->column[1]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
78 gftp_set_global_option ("local_file_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
79 ret = get_column (&GTK_CLIST (window1.listbox)->column[2]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
80 gftp_set_global_option ("local_size_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
81 ret = get_column (&GTK_CLIST (window1.listbox)->column[3]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
82 gftp_set_global_option ("local_user_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
83 ret = get_column (&GTK_CLIST (window1.listbox)->column[4]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
84 gftp_set_global_option ("local_group_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
85 ret = get_column (&GTK_CLIST (window1.listbox)->column[5]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
86 gftp_set_global_option ("local_date_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
87 ret = get_column (&GTK_CLIST (window1.listbox)->column[6]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
88 gftp_set_global_option ("local_attribs_width", GINT_TO_POINTER (ret));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
90 ret = get_column (&GTK_CLIST (window2.listbox)->column[1]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
91 gftp_set_global_option ("remote_file_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
92 ret = get_column (&GTK_CLIST (window2.listbox)->column[2]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
93 gftp_set_global_option ("remote_size_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
94 ret = get_column (&GTK_CLIST (window2.listbox)->column[3]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
95 gftp_set_global_option ("remote_user_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
96 ret = get_column (&GTK_CLIST (window2.listbox)->column[4]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
97 gftp_set_global_option ("remote_group_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
98 ret = get_column (&GTK_CLIST (window2.listbox)->column[5]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
99 gftp_set_global_option ("remote_date_width", GINT_TO_POINTER (ret));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
100 ret = get_column (&GTK_CLIST (window2.listbox)->column[6]);
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
101 gftp_set_global_option ("remote_attribs_width", GINT_TO_POINTER (ret));
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
102
616
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
103 tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry));
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
104 gftp_set_global_option ("host_value", tempstr);
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
105
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
106 tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (portedit)->entry));
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
107 gftp_set_global_option ("port_value", tempstr);
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
108
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
109 tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry));
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
110 gftp_set_global_option ("user_value", tempstr);
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
111
201
0098dae654a5 2003-6-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 198
diff changeset
112 gftp_shutdown ();
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
113 exit (0);
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
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117 static gint
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
118 _gftp_try_close (GtkWidget * widget, GdkEvent * event, gpointer data)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
120 if (gftp_file_transfers == NULL)
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
121 {
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
122 _gftp_exit (NULL, NULL);
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
123 return (0);
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
124 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
125 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
126 {
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
127 MakeYesNoDialog (_("Exit"), _("There are file transfers in progress.\nAre you sure you want to exit?"), _gftp_exit, NULL, NULL, NULL);
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
128 return (1);
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
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
133 static void
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
134 _gftp_force_close (GtkWidget * widget, gpointer data)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136 exit (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
139
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
140 static void
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
141 _gftp_menu_exit (GtkWidget * widget, gpointer data)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
142 {
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
143 if (!_gftp_try_close (widget, NULL, data))
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
144 _gftp_exit (widget, data);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
145 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
146
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
147
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
148 static void
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
149 change_setting (gftp_window_data * wdata, int menuitem, GtkWidget * checkmenu)
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
150 {
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
151 switch (menuitem)
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
152 {
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
153 case GFTP_MENU_ITEM_ASCII:
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
154 gftp_set_global_option ("ascii_transfers", GINT_TO_POINTER(1));
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
155 break;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
156 case GFTP_MENU_ITEM_BINARY:
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
157 gftp_set_global_option ("ascii_transfers", GINT_TO_POINTER(0));
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
158 break;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
159 case GFTP_MENU_ITEM_WIN1:
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
160 current_wdata = &window1;
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
161 other_wdata = &window2;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
162 if (wdata->request != NULL)
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
163 update_window_info ();
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
164 break;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
165 case GFTP_MENU_ITEM_WIN2:
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
166 current_wdata = &window2;
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
167 other_wdata = &window1;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
168 if (wdata->request != NULL)
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
169 update_window_info ();
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
170 break;
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
171 }
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
172 }
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
173
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
174
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
175 static void
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
176 _gftpui_gtk_do_openurl (gftp_window_data * wdata, gftp_dialog_data * ddata)
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
177 {
425
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
178 const char *tempstr;
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
179 char *buf;
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
180
425
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
181 tempstr = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
182 if (tempstr != NULL && *tempstr != '\0')
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
183 {
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
184 buf = g_strdup (tempstr);
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
185 destroy_dialog (ddata);
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
186 gftpui_common_cmd_open (wdata, wdata->request, NULL, NULL, buf);
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
187 g_free (buf);
8fc4efa3f72d 2004-3-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 422
diff changeset
188 }
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
189 }
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
190
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
191
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
192 static void
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
193 openurl_dialog (gpointer data)
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
194 {
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
195 gftp_window_data * wdata;
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
196
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
197 wdata = data;
784
6cfc7104e23b 2006-7-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 773
diff changeset
198 MakeEditDialog (_("Open Location"), _("Enter a URL to connect to"),
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
199 NULL, 1, NULL, gftp_dialog_button_connect,
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
200 _gftpui_gtk_do_openurl, wdata,
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
201 NULL, NULL);
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
202 }
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
203
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
204
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
205 static void
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
206 tb_openurl_dialog (gpointer data)
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
207 {
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
208 const char *edttxt;
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
209
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
210 if (current_wdata->request->stopable)
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
211 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 640
diff changeset
212 ftp_log (gftp_logging_error, NULL,
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
213 _("%s: Please hit the stop button first to do anything else\n"),
784
6cfc7104e23b 2006-7-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 773
diff changeset
214 _("Open Location"));
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
215 return;
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
216 }
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
217
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
218 edttxt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry));
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
219
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
220 if (GFTP_IS_CONNECTED (current_wdata->request))
380
05ee37a5558b 2003-1-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 377
diff changeset
221 gftpui_disconnect (current_wdata);
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
222 else if (edttxt != NULL && *edttxt != '\0')
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
223 toolbar_hostedit (NULL, NULL);
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
224 else
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
225 openurl_dialog (current_wdata);
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
226 }
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
227
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
228
514
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
229 static void
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
230 gftp_gtk_refresh (gftp_window_data * wdata)
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
231 {
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
232 gftpui_refresh (wdata, 1);
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
233 }
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
234
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 505
diff changeset
235
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
236 static GtkWidget *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
237 CreateMenus (GtkWidget * parent)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
238 {
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
239 int local_len, remote_len, len, i, trans_len, log_len, tools_len, log_start;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
240 GtkAccelGroup *accel_group;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
241 intptr_t ascii_transfers;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
242 GtkWidget * tempwid;
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
243 static GtkItemFactoryEntry menu_items[] = {
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
244 {N_("/_FTP"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
245 {N_("/FTP/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
246 {N_("/FTP/Window _1"), NULL, change_setting, GFTP_MENU_ITEM_WIN1,
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
247 MN_("<RadioItem>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
248 {N_("/FTP/Window _2"), NULL, change_setting, GFTP_MENU_ITEM_WIN2,
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
249 MN_("/FTP/Window 1")},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
250 {N_("/FTP/sep"), NULL, 0, 0, MN_("<Separator>")},
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
251 {N_("/FTP/Ascii"), NULL, change_setting, GFTP_MENU_ITEM_ASCII,
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
252 MN_("<RadioItem>")},
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
253 {N_("/FTP/Binary"), NULL, change_setting, GFTP_MENU_ITEM_BINARY,
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
254 MN_("/FTP/Ascii")},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
255 {N_("/FTP/sep"), NULL, 0, 0, MN_("<Separator>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
256 {N_("/FTP/_Preferences..."), NULL, options_dialog, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
257 MS_(GTK_STOCK_PREFERENCES)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
258 {N_("/FTP/sep"), NULL, 0, 0, MN_("<Separator>")},
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
259 {N_("/FTP/_Quit"), "<control>Q", _gftp_menu_exit, 0, MS_(GTK_STOCK_QUIT)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
260 {N_("/_Local"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
261 {N_("/Local/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
784
6cfc7104e23b 2006-7-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 773
diff changeset
262 {N_("/Local/Open Location..."), "", openurl_dialog, 0, MS_(GTK_STOCK_OPEN)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
263 {N_("/Local/_Disconnect"), "", gftpui_disconnect, 0, MS_(GTK_STOCK_CLOSE)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
264 {N_("/Local/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
265 {N_("/Local/Change Filespec..."), NULL, change_filespec, 0, MN_(NULL)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
266 {N_("/Local/_Show selected"), NULL, show_selected, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
267 {N_("/Local/Select _All"), NULL, selectall, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
268 {N_("/Local/Select All Files"), NULL, selectallfiles, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
269 {N_("/Local/Deselect All"), NULL, deselectall, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
270 {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
271 {N_("/Local/Save Directory Listing..."), NULL, save_directory_listing, 0, MN_(NULL)},
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
272 {N_("/Local/Send SITE Command..."), NULL, gftpui_site_dialog, 0, MN_(NULL)},
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
273 {N_("/Local/Change Directory"), NULL, gftpui_chdir_dialog, 0, MN_(NULL)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
274 {N_("/Local/_Permissions..."), NULL, chmod_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
275 {N_("/Local/_New Folder..."), "<control><shift>N", gftpui_mkdir_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
276 {N_("/Local/Re_name..."), "F2", gftpui_rename_dialog, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
277 {N_("/Local/Delete..."), NULL, delete_dialog, 0, MN_(NULL)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
278 {N_("/Local/_Edit..."), NULL, edit_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
279 {N_("/Local/_View..."), NULL, view_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
280 {N_("/Local/_Refresh"), NULL, gftp_gtk_refresh, 0, MS_(GTK_STOCK_REFRESH)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
281 {N_("/_Remote"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
282 {N_("/Remote/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
784
6cfc7104e23b 2006-7-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 773
diff changeset
283 {N_("/Remote/_Open Location..."), "<control>O", openurl_dialog, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
284 MS_(GTK_STOCK_OPEN)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
285 {N_("/Remote/_Disconnect"), "<control>D", gftpui_disconnect, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
286 MS_(GTK_STOCK_CLOSE)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
287 {N_("/Remote/sep"), NULL, 0, 0, MN_("<Separator>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
288 {N_("/Remote/Change Filespec..."), NULL, change_filespec, 0, MN_(NULL)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
289 {N_("/Remote/_Show selected"), NULL, show_selected, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
290 {N_("/Remote/Select _All"), NULL, selectall, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
291 {N_("/Remote/Select All Files"), NULL, selectallfiles, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
292 {N_("/Remote/Deselect All"), NULL, deselectall, 0, MN_(NULL)},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
293 {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
294 {N_("/Remote/Save Directory Listing..."), NULL, save_directory_listing, 0, MN_(NULL)},
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
295 {N_("/Remote/Send SITE Command..."), NULL, gftpui_site_dialog, 0, MN_(NULL)},
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
296 {N_("/Remote/Change Directory"), NULL, gftpui_chdir_dialog, 0, MN_(NULL)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
297 {N_("/Remote/_Permisssions..."), NULL, chmod_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
298 {N_("/Remote/_New Folder..."), NULL, gftpui_mkdir_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
299 {N_("/Remote/Re_name..."), NULL, gftpui_rename_dialog, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
300 {N_("/Remote/Delete..."), NULL, delete_dialog, 0, MN_(NULL)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
301 {N_("/Remote/_Edit..."), NULL, edit_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
302 {N_("/Remote/_View..."), NULL, view_dialog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
303 {N_("/Remote/_Refresh"), NULL, gftp_gtk_refresh, 0, MS_(GTK_STOCK_REFRESH)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
304 {N_("/_Bookmarks"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
305 {N_("/Bookmarks/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
306 {N_("/Bookmarks/Add _Bookmark"), "<control>B", add_bookmark, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
307 MS_(GTK_STOCK_ADD)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
308 {N_("/Bookmarks/Edit Bookmarks"), NULL, edit_bookmarks, 0, MN_(NULL)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
309 {N_("/Bookmarks/sep"), NULL, 0, 0, MN_("<Separator>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
310 {N_("/_Transfer"), NULL, 0, 0, MN_("<Branch>")},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
311 {N_("/Transfer/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
312 {N_("/Transfer/Start"), NULL, start_transfer, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
313 {N_("/Transfer/Stop"), NULL, stop_transfer, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
314 MS_(GTK_STOCK_STOP)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
315 {N_("/Transfer/sep"), NULL, 0, 0, MN_("<Separator>")},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
316 {N_("/Transfer/Skip Current File"), NULL, skip_transfer, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
317 {N_("/Transfer/Remove File"), NULL, remove_file_transfer, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
318 MS_(GTK_STOCK_DELETE)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
319 {N_("/Transfer/Move File Up"), NULL, move_transfer_up, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
320 MS_(GTK_STOCK_GO_UP)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
321 {N_("/Transfer/Move File Down"), NULL, move_transfer_down, 0,
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
322 MS_(GTK_STOCK_GO_DOWN)},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
323 {N_("/Transfer/sep"), NULL, 0, 0, MN_("<Separator>")},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
324 {N_("/Transfer/Retrieve Files"), "<control>R", get_files, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
325 {N_("/Transfer/Put Files"), "<control>P", put_files, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
326 {N_("/L_og"), NULL, 0, 0, MN_("<Branch>")},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
327 {N_("/Log/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
328 {N_("/Log/_Clear"), NULL, clearlog, 0, MS_(GTK_STOCK_CLEAR)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
329 {N_("/Log/_View"), NULL, viewlog, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
330 {N_("/Log/_Save..."), NULL, savelog, 0, MS_(GTK_STOCK_SAVE)},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
331 {N_("/Tool_s"), NULL, 0, 0, MN_("<Branch>")},
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
332 {N_("/Tools/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
333 {N_("/Tools/C_ompare Windows"), NULL, compare_windows, 0, MN_(NULL)},
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
334 {N_("/Tools/_Clear Cache"), NULL, clear_cache, 0, MS_(GTK_STOCK_CLEAR)},
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
335 {N_("/Help"), NULL, 0, 0, MN_("<Branch>")},
12
c1181ef9aaf0 * Patches from Nam SungHyun <namsh@kldp.org>
masneyb
parents: 7
diff changeset
336 {N_("/Help/tearoff"), NULL, 0, 0, MN_("<Tearoff>")},
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
337 {N_("/Help/_About"), NULL, about_dialog, 0, MS_(GTK_STOCK_ABOUT)}
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
338 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
339
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
340 menus = menu_items;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
341
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
342 accel_group = gtk_accel_group_new ();
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
343 factory = item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
344
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
345 i = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
346 len = 11;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
347 /* FTP Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
348 create_item_factory (factory, len, menu_items, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
349
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
350 i += len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
351 /* Local Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
352 local_start = i;
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 12
diff changeset
353 local_len = 21;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
354 create_item_factory (factory, local_len, menu_items + i, &window1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
355
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
356 i += local_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
357 /* Remote Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
358 remote_start = i;
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 12
diff changeset
359 remote_len = 21;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
360 create_item_factory (factory, remote_len, menu_items + i, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
361
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
362 i += remote_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
363 len = 5;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
364 /* Bookmarks Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
365 create_item_factory (factory, len, menu_items + i, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
366
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
367 i += len;
771
d966cf89a820 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
368 /* Transfer Menu */
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
369 trans_start = i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
370 trans_len = 12;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
371 create_item_factory (factory, trans_len, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
372
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
373 i += trans_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
374 /* Logging Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
375 log_start = i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
376 log_len = 5;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
377 create_item_factory (factory, log_len, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
378
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
379 i += log_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
380 /* Tools Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
381 tools_len = 4;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
382 create_item_factory (factory, tools_len, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
383
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
384 i += tools_len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
385 /* Help Menu */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
386 create_item_factory (factory, 3, menu_items + i, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
387
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
388 build_bookmarks_menu ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
389
44
9c0825c047e7 2002-10-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
390 gtk_window_add_accel_group (GTK_WINDOW (parent), accel_group);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
391
245
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
392 gftp_lookup_global_option ("ascii_transfers", &ascii_transfers);
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
393 if (ascii_transfers)
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
394 {
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
395 tempwid = gtk_item_factory_get_widget (factory, "/FTP/Ascii");
245
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
396 gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
397 }
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
398 else
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
399 {
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
400 tempwid = gtk_item_factory_get_widget (factory, "/FTP/Binary");
245
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
401 gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
41af60bc1f88 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 227
diff changeset
402 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
403
788
0e7ab0a51ddd 2006-7-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 784
diff changeset
404 tempwid = gtk_item_factory_get_widget (factory, "/FTP/Window 2");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
405 gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
406
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
407 window1.ifactory = item_factory_new (GTK_TYPE_MENU, "<local>", NULL, "/Local");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
408 create_item_factory (window1.ifactory, local_len - 2, menu_items + local_start + 2, &window1);
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
409
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
410 window2.ifactory = item_factory_new (GTK_TYPE_MENU, "<remote>", NULL, "/Remote");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
411 create_item_factory (window2.ifactory, remote_len - 2, menu_items + remote_start + 2, &window2);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
412
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
413 log_factory = item_factory_new (GTK_TYPE_MENU, "<log>", NULL, "/Logging");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
414 create_item_factory (log_factory, log_len - 2, menu_items + log_start + 2, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
415
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
416 dl_factory = item_factory_new (GTK_TYPE_MENU, "<download>", NULL, "/Transfers");
5551ab2301fe * Fixed a DND crash
masneyb
parents: 1
diff changeset
417 create_item_factory (dl_factory, trans_len - 2, menu_items + trans_start + 2, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
418
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
419 return (factory->widget);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
420 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
421
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
422
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
423 static GtkWidget *
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
424 CreateConnectToolbar (GtkWidget * parent)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
425 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
426 const GtkTargetEntry possible_types[] = {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
427 {"STRING", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
428 {"text/plain", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
429 {"application/x-rootwin-drop", 0, 1}
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
430 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
431 GtkWidget *toolbar, *box, *tempwid;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
432 gftp_config_list_vars * tmplistvar;
616
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
433 char *default_protocol, *tempstr;
773
942dd9c2a064 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 771
diff changeset
434 int i, j, num;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
435
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
436 toolbar = gtk_handle_box_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
437
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
438 box = gtk_hbox_new (FALSE, 4);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
439 gtk_container_add (GTK_CONTAINER (toolbar), box);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
440 gtk_container_border_width (GTK_CONTAINER (box), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
441
604
5df5eac28f47 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 587
diff changeset
442 openurl_tooltip = gtk_tooltips_new ();
5df5eac28f47 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 587
diff changeset
443
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
444 tempwid = toolbar_pixmap (parent, "connect.xpm");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
445 openurl_btn = gtk_button_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
446 gtk_container_add (GTK_CONTAINER (openurl_btn), tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
447 gtk_signal_connect_object (GTK_OBJECT (openurl_btn), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
448 GTK_SIGNAL_FUNC (tb_openurl_dialog), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
449 gtk_signal_connect (GTK_OBJECT (openurl_btn), "drag_data_received",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
450 GTK_SIGNAL_FUNC (openurl_get_drag_data), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
451 gtk_drag_dest_set (openurl_btn, GTK_DEST_DEFAULT_ALL, possible_types, 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
452 GDK_ACTION_COPY | GDK_ACTION_MOVE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
453 gtk_container_border_width (GTK_CONTAINER (openurl_btn), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
454 gtk_box_pack_start (GTK_BOX (box), openurl_btn, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
455
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
456 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
457 tempwid = gtk_label_new (_("Host: "));
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
458 #else
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
459 tempwid = gtk_label_new_with_mnemonic (_("_Host: "));
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
460 #endif
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
461
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
462 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
463
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
464 hostedit = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
465 gtk_combo_set_case_sensitive (GTK_COMBO (hostedit), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
466 gtk_widget_set_size_request (hostedit, 130, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
467
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
468 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (hostedit)->entry), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
469 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
470
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
471 gftp_lookup_global_option ("hosthistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
472 if (tmplistvar->list)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
473 gtk_combo_set_popdown_strings (GTK_COMBO (hostedit), tmplistvar->list);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
474
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
475 gtk_combo_disable_activate (GTK_COMBO (hostedit));
616
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
476
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
477 gftp_lookup_global_option ("host_value", &tempstr);
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
478 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), tempstr);
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
479 #if GTK_MAJOR_VERSION > 1
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
480 gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid),
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
481 GTK_COMBO (hostedit)->entry);
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
482 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
483 gtk_box_pack_start (GTK_BOX (box), hostedit, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
484
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
485 tempwid = gtk_label_new (_("Port: "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
486 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
487
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
488 portedit = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
489 gtk_combo_set_case_sensitive (GTK_COMBO (portedit), 1);
542
fd9ce7797984 2004-8-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 536
diff changeset
490 gtk_widget_set_size_request (portedit, 50, -1);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
491
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
492 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (portedit)->entry), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
493 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
494
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
495 gftp_lookup_global_option ("porthistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
496 if (tmplistvar->list)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
497 gtk_combo_set_popdown_strings (GTK_COMBO (portedit), tmplistvar->list);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
498
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
499 gtk_combo_disable_activate (GTK_COMBO (portedit));
616
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
500
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
501 gftp_lookup_global_option ("port_value", &tempstr);
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
502 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), tempstr);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
503 gtk_box_pack_start (GTK_BOX (box), portedit, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
504
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
505 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
506 tempwid = gtk_label_new (_("User: "));
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
507 #else
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
508 tempwid = gtk_label_new_with_mnemonic (_("_User: "));
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
509 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
510 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
511
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
512 useredit = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
513 gtk_combo_set_case_sensitive (GTK_COMBO (useredit), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
514 gtk_widget_set_size_request (useredit, 75, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
515
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
516 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (useredit)->entry), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
517 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
518
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
519 gftp_lookup_global_option ("userhistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
520 if (tmplistvar->list)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
521 gtk_combo_set_popdown_strings (GTK_COMBO (useredit), tmplistvar->list);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
522
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
523 gtk_combo_disable_activate (GTK_COMBO (useredit));
616
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
524
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
525 gftp_lookup_global_option ("user_value", &tempstr);
461ae1bba8b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 615
diff changeset
526 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), tempstr);
615
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
527 #if GTK_MAJOR_VERSION > 1
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
528 gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid),
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
529 GTK_COMBO (useredit)->entry);
7b9779d175b6 2004-11-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 604
diff changeset
530 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
531 gtk_box_pack_start (GTK_BOX (box), useredit, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
532
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
533 tempwid = gtk_label_new (_("Pass: "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
534 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
535
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
536 passedit = gtk_entry_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
537 gtk_widget_set_size_request (passedit, 55, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
538
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
539 gtk_entry_set_visibility (GTK_ENTRY (passedit), FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
540 gtk_signal_connect (GTK_OBJECT (passedit), "activate",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
541 GTK_SIGNAL_FUNC (toolbar_hostedit), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
542 gtk_box_pack_start (GTK_BOX (box), passedit, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
543
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
544 tempwid = gtk_vbox_new (FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
545 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
546
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
547 optionmenu = gtk_option_menu_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
548 gtk_box_pack_start (GTK_BOX (tempwid), optionmenu, TRUE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
549
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
550 num = 0;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
551 gftp_lookup_global_option ("default_protocol", &default_protocol);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
552 protocol_menu = gtk_menu_new ();
773
942dd9c2a064 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 771
diff changeset
553 for (i = 0, j = 0; gftp_protocols[i].name; i++)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
554 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
555 if (!gftp_protocols[i].shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
556 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
557
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
558 if (default_protocol != NULL &&
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
559 strcmp (gftp_protocols[i].name, default_protocol) == 0)
773
942dd9c2a064 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 771
diff changeset
560 num = j;
942dd9c2a064 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 771
diff changeset
561
942dd9c2a064 2006-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 771
diff changeset
562 j++;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
563
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
564 tempwid = gtk_menu_item_new_with_label (gftp_protocols[i].name);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
565 gtk_object_set_user_data (GTK_OBJECT (tempwid), GINT_TO_POINTER(i));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
566 gtk_menu_append (GTK_MENU (protocol_menu), tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
567 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
568 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
569 gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), protocol_menu);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
570 gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
571
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
572 #if GTK_MAJOR_VERSION == 1
21
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
573 tempwid = toolbar_pixmap (parent, "stop.xpm");
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
574 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
575 tempwid = gtk_image_new_from_stock (GTK_STOCK_STOP,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
576 GTK_ICON_SIZE_LARGE_TOOLBAR);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
577 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
578
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
579 stop_btn = gtk_button_new ();
604
5df5eac28f47 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 587
diff changeset
580
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
581 gtk_container_add (GTK_CONTAINER (stop_btn), tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
582 gtk_widget_set_sensitive (stop_btn, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
583 gtk_signal_connect_object (GTK_OBJECT (stop_btn), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
584 GTK_SIGNAL_FUNC (stop_button), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
585 gtk_container_border_width (GTK_CONTAINER (stop_btn), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
586 gtk_box_pack_start (GTK_BOX (box), stop_btn, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
587
326
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 290
diff changeset
588 gtk_widget_grab_focus (GTK_COMBO (hostedit)->entry);
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
589
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
590 return (toolbar);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
591 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
592
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
593
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
594 static GtkWidget *
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
595 CreateCommandToolbar (void)
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
596 {
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
597 GtkWidget * box, * tempwid;
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
598
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
599 gftpui_command_toolbar = gtk_handle_box_new ();
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
600
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
601 box = gtk_hbox_new (FALSE, 4);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
602 gtk_container_add (GTK_CONTAINER (gftpui_command_toolbar), box);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
603 gtk_container_border_width (GTK_CONTAINER (box), 5);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
604
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
605 tempwid = gtk_label_new (_("Command: "));
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
606 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
607
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
608 gftpui_command_widget = gtk_entry_new ();
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
609 gtk_box_pack_start (GTK_BOX (box), gftpui_command_widget, TRUE, TRUE, 0);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
610 gtk_signal_connect (GTK_OBJECT (gftpui_command_widget), "activate",
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
611 GTK_SIGNAL_FUNC (gftpui_run_command), NULL);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
612
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
613 return (gftpui_command_toolbar);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
614 }
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
615
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
616
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
617 static void
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
618 setup_column (GtkWidget * listbox, int column, int width)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
619 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
620 if (width == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
621 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
622 else if (width == -1)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
623 gtk_clist_set_column_visibility (GTK_CLIST (listbox), column, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
624 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
625 gtk_clist_set_column_width (GTK_CLIST (listbox), column, width);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
626 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
627
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
628
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
629 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
630 list_doaction (gftp_window_data * wdata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
631 {
326
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 290
diff changeset
632 intptr_t list_dblclk_action;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
633 GList *templist, *filelist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
634 gftp_file *tempfle;
499
39e9945288ea 2004-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 498
diff changeset
635 int num, success;
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
636 char *directory;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
637
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
638 gftp_lookup_request_option (wdata->request, "list_dblclk_action",
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
639 &list_dblclk_action);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
640
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
641 filelist = wdata->files;
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 518
diff changeset
642 templist = gftp_gtk_get_list_selection (wdata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
643 num = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
644 templist = get_next_selection (templist, &filelist, &num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
645 tempfle = (gftp_file *) filelist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
646
337
5f9d5aee0c1c 2003-12-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 326
diff changeset
647 if (check_reconnect (wdata) < 0)
5f9d5aee0c1c 2003-12-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 326
diff changeset
648 return;
5f9d5aee0c1c 2003-12-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 326
diff changeset
649
499
39e9945288ea 2004-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 498
diff changeset
650 if (S_ISLNK (tempfle->st_mode) || S_ISDIR (tempfle->st_mode))
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
651 {
555
7f54d0c0edbc 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 542
diff changeset
652 directory = gftp_build_path (wdata->request, wdata->request->directory,
7f54d0c0edbc 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 542
diff changeset
653 tempfle->file, NULL);
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
654 success = gftpui_run_chdir (wdata, directory);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
655 g_free (directory);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
656 }
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
657 else
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
658 success = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
659
499
39e9945288ea 2004-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 498
diff changeset
660 if (!S_ISDIR (tempfle->st_mode) && !success)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
661 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
662 switch (list_dblclk_action)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
663 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
664 case 0:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
665 view_dialog (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
666 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
667 case 1:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
668 edit_dialog (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
669 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
670 case 2:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
671 if (wdata == &window2)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
672 get_files (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
673 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
674 put_files (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
675 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
676 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
677 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
678 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
679
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
680
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
681 static gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
682 list_enter (GtkWidget * widget, GdkEventKey * event, gpointer data)
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 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
685
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
686 wdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
687 if (!GFTP_IS_CONNECTED (wdata->request))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
688 return (TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
689
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
690 if (event->type == GDK_KEY_PRESS &&
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
691 (event->keyval == GDK_KP_Delete || event->keyval == GDK_Delete))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
692 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
693 delete_dialog (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
694 return (FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
695 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
696 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
697 event->keyval == GDK_Return)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
698 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
699 list_doaction (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
700 return (FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
701 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
702 return (TRUE);
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
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
705
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
706 static gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
707 list_dblclick (GtkWidget * widget, GdkEventButton * event, gpointer data)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
708 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
709 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
710
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
711 wdata = data;
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
712
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
713 if (event->button == 3)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
714 gtk_item_factory_popup (wdata->ifactory, (guint) event->x_root,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
715 (guint) event->y_root, 3, event->time);
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
716 return (FALSE);
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
717 }
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
718
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
719
518
c6a6e908dbaf 2004-7-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
720 static void
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
721 select_row_callback (GtkWidget *widget, gint row, gint column,
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
722 GdkEventButton *event, gpointer data)
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
723 {
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
724 gftp_window_data * wdata;
50
d433c1417d7d 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
725
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
726 wdata = data;
50
d433c1417d7d 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
727
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
728 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
729 GFTP_IS_CONNECTED (wdata->request) && IS_ONE_SELECTED (wdata))
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
730 list_doaction (wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
731 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
732
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
733
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
734 static GtkWidget *
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
735 CreateFTPWindow (gftp_window_data * wdata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
736 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
737 const GtkTargetEntry possible_types[] = {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
738 {"STRING", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
739 {"text/plain", 0, 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
740 {"application/x-rootwin-drop", 0, 1}
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
741 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
742 GtkWidget *box, *scroll_list, *parent;
326
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 290
diff changeset
743 intptr_t listbox_file_height, colwidth;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
744 char *titles[7], tempstr[50];
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
745
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
746 titles[0] = "";
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
747 titles[1] = _("Filename");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
748 titles[2] = _("Size");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
749 titles[3] = _("User");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
750 titles[4] = _("Group");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
751 titles[5] = _("Date");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
752 titles[6] = _("Attribs");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
753
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
754 wdata->request = gftp_request_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
755 wdata->request->logging_function = ftp_log;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
756 wdata->filespec = g_malloc0 (2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
757 *wdata->filespec = '*';
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
758
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
759 parent = gtk_frame_new (NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
760
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
761 gftp_lookup_global_option ("listbox_file_height", &listbox_file_height);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
762 g_snprintf (tempstr, sizeof (tempstr), "listbox_%s_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
763 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
764 gtk_widget_set_size_request (parent, colwidth, listbox_file_height);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
765
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
766 gtk_container_border_width (GTK_CONTAINER (parent), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
767
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
768 box = gtk_vbox_new (FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
769 gtk_container_border_width (GTK_CONTAINER (box), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
770 gtk_container_add (GTK_CONTAINER (parent), box);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
771
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
772 wdata->combo = gtk_combo_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
773 gtk_combo_set_case_sensitive (GTK_COMBO (wdata->combo), 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
774 gtk_box_pack_start (GTK_BOX (box), wdata->combo, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
775 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (wdata->combo)->entry),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
776 "activate", GTK_SIGNAL_FUNC (chdir_edit),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
777 (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
778 if (*wdata->history)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
779 gtk_combo_set_popdown_strings (GTK_COMBO (wdata->combo), *wdata->history);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
780 gtk_combo_disable_activate (GTK_COMBO (wdata->combo));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
781 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry), "");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
782
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
783 wdata->hoststxt = gtk_label_new (NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
784 gtk_misc_set_alignment (GTK_MISC (wdata->hoststxt), 0, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
785 gtk_box_pack_start (GTK_BOX (box), wdata->hoststxt, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
786
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
787 scroll_list = gtk_scrolled_window_new (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
788 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_list),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
789 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
790 wdata->listbox = gtk_clist_new_with_titles (7, titles);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
791 gtk_container_add (GTK_CONTAINER (scroll_list), wdata->listbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
792 gtk_drag_source_set (wdata->listbox, GDK_BUTTON1_MASK, possible_types, 3,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
793 GDK_ACTION_COPY | GDK_ACTION_MOVE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
794 gtk_drag_dest_set (wdata->listbox, GTK_DEST_DEFAULT_ALL, possible_types, 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
795 GDK_ACTION_COPY | GDK_ACTION_MOVE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
796
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
797 gtk_clist_set_selection_mode (GTK_CLIST (wdata->listbox),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
798 GTK_SELECTION_EXTENDED);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
799
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
800 gtk_clist_set_column_width (GTK_CLIST (wdata->listbox), 0, 16);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
801 gtk_clist_set_column_justification (GTK_CLIST (wdata->listbox), 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
802 GTK_JUSTIFY_CENTER);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
803
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
804 g_snprintf (tempstr, sizeof (tempstr), "%s_file_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
805 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
806 setup_column (wdata->listbox, 1, colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
807
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
808 gtk_clist_set_column_justification (GTK_CLIST (wdata->listbox), 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
809 GTK_JUSTIFY_RIGHT);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
810
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
811 g_snprintf (tempstr, sizeof (tempstr), "%s_size_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
812 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
813 setup_column (wdata->listbox, 2, colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
814
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
815 g_snprintf (tempstr, sizeof (tempstr), "%s_user_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
816 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
817 setup_column (wdata->listbox, 3, colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
818
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
819 g_snprintf (tempstr, sizeof (tempstr), "%s_group_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
820 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
821 setup_column (wdata->listbox, 4, colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
822
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
823 g_snprintf (tempstr, sizeof (tempstr), "%s_date_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
824 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
825 setup_column (wdata->listbox, 5, colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
826
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
827 g_snprintf (tempstr, sizeof (tempstr), "%s_attribs_width", wdata->prefix_col_str);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
828 gftp_lookup_global_option (tempstr, &colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
829 setup_column (wdata->listbox, 6, colwidth);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
830
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
831 gtk_box_pack_start (GTK_BOX (box), scroll_list, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
832 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "click_column",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
833 GTK_SIGNAL_FUNC (sortrows), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
834 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "drag_data_get",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
835 GTK_SIGNAL_FUNC (listbox_drag), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
836 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "drag_data_received",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
837 GTK_SIGNAL_FUNC (listbox_get_drag_data),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
838 (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
839 gtk_signal_connect_after (GTK_OBJECT (wdata->listbox), "key_press_event",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
840 GTK_SIGNAL_FUNC (list_enter), (gpointer) wdata);
51
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
841 gtk_signal_connect (GTK_OBJECT (wdata->listbox), "select_row",
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
842 GTK_SIGNAL_FUNC(select_row_callback),
33a0ba7f52d1 2002-11-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 50
diff changeset
843 (gpointer) wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
844 gtk_signal_connect_after (GTK_OBJECT (wdata->listbox), "button_press_event",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
845 GTK_SIGNAL_FUNC (list_dblclick), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
846 return (parent);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
847 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
848
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
849
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
850 static gint
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
851 menu_mouse_click (GtkWidget * widget, GdkEventButton * event, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
852 {
518
c6a6e908dbaf 2004-7-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
853 GtkItemFactory *mfactory;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
854
518
c6a6e908dbaf 2004-7-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
855 mfactory = (GtkItemFactory *) data;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
856 if (event->button == 3)
518
c6a6e908dbaf 2004-7-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
857 gtk_item_factory_popup (mfactory, (guint) event->x_root,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
858 (guint) event->y_root, 3, event->time);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
859 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
860 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
861
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
862
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
863 static GtkWidget *
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
864 CreateFTPWindows (GtkWidget * ui)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
865 {
587
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
866 GtkWidget *box, *dlbox, *winpane, *dlpane, *logpane, *mainvbox, *tempwid;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
867 gftp_config_list_vars * tmplistvar;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
868 char *dltitles[2];
326
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 290
diff changeset
869 intptr_t tmplookup;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
870 #if GTK_MAJOR_VERSION > 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
871 GtkTextBuffer * textbuf;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
872 GtkTextIter iter;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
873 GtkTextTag *tag;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
874 GdkColor * fore;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
875 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
876
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
877 memset (&window1, 0, sizeof (window1));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
878 memset (&window2, 0, sizeof (window2));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
879
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
880 gftp_lookup_global_option ("localhistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
881 window1.history = &tmplistvar->list;
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
882 window1.histlen = &tmplistvar->num_items;
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
883
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
884 gftp_lookup_global_option ("remotehistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
885 window2.history = &tmplistvar->list;
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
886 window2.histlen = &tmplistvar->num_items;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
887
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
888 mainvbox = gtk_vbox_new (FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
889
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
890 tempwid = CreateMenus (ui);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
891 gtk_box_pack_start (GTK_BOX (mainvbox), tempwid, FALSE, FALSE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
892
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
893 tempwid = CreateConnectToolbar (ui);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
894 gtk_box_pack_start (GTK_BOX (mainvbox), tempwid, FALSE, FALSE, 0);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
895
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
896 tempwid = CreateCommandToolbar ();
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
897 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
898
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
899 winpane = gtk_hpaned_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
900
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
901 box = gtk_hbox_new (FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
902
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
903 window1.prefix_col_str = "local";
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
904 local_frame = CreateFTPWindow (&window1);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
905 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
906
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
907 dlbox = gtk_vbox_new (FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
908 gtk_container_border_width (GTK_CONTAINER (dlbox), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
909 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
910
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
911 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
912 tempwid = toolbar_pixmap (ui, "right.xpm");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
913 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
914 tempwid = gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
915 GTK_ICON_SIZE_SMALL_TOOLBAR);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
916 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
917
587
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
918 upload_right_arrow = gtk_button_new ();
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
919 gtk_box_pack_start (GTK_BOX (dlbox), upload_right_arrow, TRUE, FALSE, 0);
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
920 gtk_signal_connect_object (GTK_OBJECT (upload_right_arrow), "clicked",
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
921 GTK_SIGNAL_FUNC (put_files), NULL);
587
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
922 gtk_container_add (GTK_CONTAINER (upload_right_arrow), tempwid);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
923
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
924 #if GTK_MAJOR_VERSION == 1
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
925 tempwid = toolbar_pixmap (ui, "left.xpm");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
926 #else
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
927 tempwid = gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
928 GTK_ICON_SIZE_SMALL_TOOLBAR);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
929 #endif
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
930
587
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
931 download_left_arrow = gtk_button_new ();
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
932 gtk_box_pack_start (GTK_BOX (dlbox), download_left_arrow, TRUE, FALSE, 0);
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
933 gtk_signal_connect_object (GTK_OBJECT (download_left_arrow), "clicked",
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
934 GTK_SIGNAL_FUNC (get_files), NULL);
587
7937ade77c22 2004-10-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 586
diff changeset
935 gtk_container_add (GTK_CONTAINER (download_left_arrow), tempwid);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
936
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
937 gtk_paned_pack1 (GTK_PANED (winpane), box, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
938
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
939 window2.prefix_col_str = "remote";
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
940 remote_frame = CreateFTPWindow (&window2);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
941
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
942 gtk_paned_pack2 (GTK_PANED (winpane), remote_frame, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
943
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
944 dlpane = gtk_vpaned_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
945 gtk_paned_pack1 (GTK_PANED (dlpane), winpane, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
946
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
947 transfer_scroll = gtk_scrolled_window_new (NULL, NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
948 gftp_lookup_global_option ("transfer_height", &tmplookup);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
949 gtk_widget_set_size_request (transfer_scroll, -1, tmplookup);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
950 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (transfer_scroll),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
951 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
952
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
953 dltitles[0] = _("Filename");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
954 dltitles[1] = _("Progress");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
955 dlwdw = gtk_ctree_new_with_titles (2, 0, dltitles);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
956 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
957 gtk_clist_set_reorderable (GTK_CLIST (dlwdw), 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
958
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
959 gftp_lookup_global_option ("file_trans_column", &tmplookup);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
960 if (tmplookup == 0)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
961 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
962 else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
963 gtk_clist_set_column_width (GTK_CLIST (dlwdw), 0, tmplookup);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
964
115
32cbf51617fb 2003-2-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 63
diff changeset
965 gtk_container_add (GTK_CONTAINER (transfer_scroll), dlwdw);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
966 gtk_signal_connect (GTK_OBJECT (dlwdw), "button_press_event",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
967 GTK_SIGNAL_FUNC (menu_mouse_click), (gpointer) dl_factory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
968 gtk_paned_pack2 (GTK_PANED (dlpane), transfer_scroll, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
969
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
970 logpane = gtk_vpaned_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
971 gtk_paned_pack1 (GTK_PANED (logpane), dlpane, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
972
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
973 log_table = gtk_table_new (1, 2, FALSE);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
974 gftp_lookup_global_option ("log_height", &tmplookup);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
975 gtk_widget_set_size_request (log_table, -1, tmplookup);
48
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 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
978 logwdw = gtk_text_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
979
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
980 gtk_text_set_editable (GTK_TEXT (logwdw), FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
981 gtk_text_set_word_wrap (GTK_TEXT (logwdw), TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
982
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
983 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
984 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
985 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
986 gtk_signal_connect (GTK_OBJECT (logwdw), "button_press_event",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
987 GTK_SIGNAL_FUNC (menu_mouse_click),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
988 (gpointer) log_factory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
989
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
990 tempwid = gtk_vscrollbar_new (GTK_TEXT (logwdw)->vadj);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
991 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
992 GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
993 logwdw_vadj = GTK_TEXT (logwdw)->vadj;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
994 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
995 logwdw = gtk_text_view_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
996 gtk_text_view_set_editable (GTK_TEXT_VIEW (logwdw), FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
997 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
998 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
999
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1000 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1001
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1002 tag = gtk_text_buffer_create_tag (textbuf, "send", NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1003 gftp_lookup_global_option ("send_color", &fore);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1004 g_object_set (G_OBJECT (tag), "foreground_gdk", fore, NULL);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1005
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1006 tag = gtk_text_buffer_create_tag (textbuf, "recv", NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1007 gftp_lookup_global_option ("recv_color", &fore);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1008 g_object_set (G_OBJECT (tag), "foreground_gdk", fore, NULL);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1009
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1010 tag = gtk_text_buffer_create_tag (textbuf, "error", NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1011 gftp_lookup_global_option ("error_color", &fore);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1012 g_object_set (G_OBJECT (tag), "foreground_gdk", fore, NULL);
48
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 tag = gtk_text_buffer_create_tag (textbuf, "misc", NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1015 gftp_lookup_global_option ("misc_color", &fore);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1016 g_object_set (G_OBJECT (tag), "foreground_gdk", &fore, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1017
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1018 tempwid = gtk_scrolled_window_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1019 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tempwid),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1020 GTK_POLICY_AUTOMATIC,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1021 GTK_POLICY_AUTOMATIC);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1022 gtk_container_add (GTK_CONTAINER (tempwid), logwdw);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1023 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
1024 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1025 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1026 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
1027 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1028 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
1029 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1030 gtk_paned_pack2 (GTK_PANED (logpane), log_table, 1, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1031 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
1032
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1033 gtk_widget_show_all (mainvbox);
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1034 gftpui_show_or_hide_command ();
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1035 return (mainvbox);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1036 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1037
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1038
518
c6a6e908dbaf 2004-7-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
1039 static void
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1040 init_gftp (int argc, char *argv[], GtkWidget * parent)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1041 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1042 if (argc == 2 && strncmp (argv[1], "--", 2) != 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1043 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1044 if (gftp_parse_url (window2.request, argv[1]) == 0)
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 758
diff changeset
1045 ftp_connect (&window2, window2.request);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1046 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1047 gftp_usage ();
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1048 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1049 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1050
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1051
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1052 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1053 toolbar_hostedit (GtkWidget * widget, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1054 {
173
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1055 int (*init) (gftp_request * request);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1056 gftp_config_list_vars * tmplistvar;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1057 GtkWidget *tempwid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1058 const char *txt;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1059 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1060
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1061 if (current_wdata->request->stopable)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1062 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 640
diff changeset
1063 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1064 _("%s: Please hit the stop button first to do anything else\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1065 _("Connect"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1066 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1067 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1068
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1069 if (GFTP_IS_CONNECTED (current_wdata->request))
640
cad45ebbc520 2004-12-12 Brian Masney <masneyb@gftp.org>
masneyb
parents: 616
diff changeset
1070 gftp_disconnect (current_wdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1071
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1072 tempwid = gtk_menu_get_active (GTK_MENU (protocol_menu));
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 173
diff changeset
1073 num = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (tempwid)));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1074 init = gftp_protocols[num].init;
173
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1075 if (init (current_wdata->request) < 0)
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1076 return;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1077
395
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1078 txt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry));
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1079 if (strchr (txt, '/') != NULL)
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1080 {
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1081 /* The user entered a URL in the host box... */
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1082 gftpui_common_cmd_open (current_wdata, current_wdata->request, NULL, NULL, txt);
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1083 return;
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1084 }
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1085
ac1e7ac005d1 2003-2-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 387
diff changeset
1086 gftp_set_hostname (current_wdata->request, txt);
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1087 if (current_wdata->request->hostname == NULL)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1088 return;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1089 alltrim (current_wdata->request->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1090
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1091 if (current_wdata->request->need_hostport &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1092 *current_wdata->request->hostname == '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1093 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1094 ftp_log (gftp_logging_error, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1095 _("Error: You must type in a host to connect to\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1096 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1097 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1098
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1099 gftp_lookup_global_option ("hosthistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1100 add_history (hostedit, &tmplistvar->list, &tmplistvar->num_items,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1101 current_wdata->request->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1102
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1103 if (strchr (current_wdata->request->hostname, '/') != NULL &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1104 gftp_parse_url (current_wdata->request,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1105 current_wdata->request->hostname) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1106 {
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 758
diff changeset
1107 ftp_connect (current_wdata, current_wdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1108 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1109 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1110
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1111 txt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (portedit)->entry));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1112 gftp_set_port (current_wdata->request, strtol (txt, NULL, 10));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1113
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1114 gftp_lookup_global_option ("porthistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1115 add_history (portedit, &tmplistvar->list, &tmplistvar->num_items, txt);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1116
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1117 gftp_set_username (current_wdata->request, gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry)));
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1118 if (current_wdata->request->username != NULL)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1119 alltrim (current_wdata->request->username);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1120
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1121
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1122 gftp_lookup_global_option ("userhistory", &tmplistvar);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1123 add_history (useredit, &tmplistvar->list, &tmplistvar->num_items,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1124 current_wdata->request->username);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1125
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1126 gftp_set_password (current_wdata->request,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1127 gtk_entry_get_text (GTK_ENTRY (passedit)));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1128
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1129 gftp_set_directory (current_wdata->request, gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (current_wdata->combo)->entry)));
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1130 if (current_wdata->request->directory != NULL)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 201
diff changeset
1131 alltrim (current_wdata->request->directory);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1132
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1133 add_history (current_wdata->combo, current_wdata->history,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1134 current_wdata->histlen, current_wdata->request->directory);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1135
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 758
diff changeset
1136 ftp_connect (current_wdata, current_wdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1137 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1138
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1139
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1140 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1141 sortrows (GtkCList * clist, gint column, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1142 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1143 char sortcol_name[25], sortasds_name[25];
326
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 290
diff changeset
1144 intptr_t sortcol, sortasds;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1145 gftp_window_data * wdata;
16
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
1146 GtkWidget * sort_wid;
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
1147 GList * templist;
472
5100b89c44e1 2004-5-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 470
diff changeset
1148 int swap_col;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1149
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1150 wdata = data;
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
1151 g_snprintf (sortcol_name, sizeof (sortcol_name), "%s_sortcol",
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
1152 wdata->prefix_col_str);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1153 gftp_lookup_global_option (sortcol_name, &sortcol);
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
1154 g_snprintf (sortasds_name, sizeof (sortasds_name), "%s_sortasds",
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
1155 wdata->prefix_col_str);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1156 gftp_lookup_global_option (sortasds_name, &sortasds);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1157
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1158 if (column == -1)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1159 column = sortcol;
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1160
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1161 if (column == 0 || (column == sortcol && wdata->sorted))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1162 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1163 sortasds = !sortasds;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
1164 gftp_set_global_option (sortasds_name, GINT_TO_POINTER (sortasds));
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1165 swap_col = 1;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1166 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1167 else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1168 swap_col = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1169
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1170 if (swap_col || !wdata->sorted)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1171 {
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1172 sort_wid = gtk_clist_get_column_widget (clist, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1173 gtk_widget_destroy (sort_wid);
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 44
diff changeset
1174 #if GTK_MAJOR_VERSION == 1
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1175 if (sortasds)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1176 sort_wid = toolbar_pixmap (wdata->listbox, "down.xpm");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1177 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1178 sort_wid = toolbar_pixmap (wdata->listbox, "up.xpm");
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1179 #else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1180 if (sortasds)
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1181 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
1182 GTK_ICON_SIZE_SMALL_TOOLBAR);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1183 else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1184 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
1185 GTK_ICON_SIZE_SMALL_TOOLBAR);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1186 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 16
diff changeset
1187
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1188 gtk_clist_set_column_widget (clist, 0, sort_wid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1189 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1190 else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1191 {
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1192 sortcol = column;
227
a85a097bbb02 2003-7-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
1193 gftp_set_global_option (sortcol_name, GINT_TO_POINTER (sortcol));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1194 }
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
1195
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
1196 if (!GFTP_IS_CONNECTED (wdata->request))
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
1197 return;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1198
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1199 gtk_clist_freeze (clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1200 gtk_clist_clear (clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1201
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1202 wdata->files = gftp_sort_filelist (wdata->files, sortcol, sortasds);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1203
16
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
1204 templist = wdata->files;
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
1205 while (templist != NULL)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1206 {
16
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
1207 add_file_listbox (wdata, templist->data);
ddb983d8574b * Improved directory sorting algorithm
masneyb
parents: 14
diff changeset
1208 templist = templist->next;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1209 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1210
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1211 wdata->sorted = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1212 gtk_clist_thaw (clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1213 update_window_info ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1214 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1215
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1216
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1217 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1218 stop_button (GtkWidget * widget, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1219 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1220 pthread_t comptid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1221
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1222 memset (&comptid, 0, sizeof (comptid));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1223 if (!pthread_equal (comptid, window1.tid))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1224 pthread_kill (window1.tid, SIGINT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1225 else if (!pthread_equal (comptid, window2.tid))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1226 pthread_kill (window2.tid, SIGINT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1227 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1228
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1229
198
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1230 static int
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1231 gftp_gtk_config_file_read_color (char *str, gftp_config_vars * cv, int line)
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1232 {
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1233 char *red, *green, *blue;
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1234 GdkColor * color;
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1235
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1236 if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM && cv->value != NULL)
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1237 g_free (cv->value);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1238
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1239 gftp_config_parse_args (str, 3, line, &red, &green, &blue);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1240
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1241 color = g_malloc (sizeof (*color));
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1242 color->red = strtol (red, NULL, 16);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1243 color->green = strtol (green, NULL, 16);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1244 color->blue = strtol (blue, NULL, 16);
447
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1245
198
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1246 g_free (red);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1247 g_free (green);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1248 g_free (blue);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1249
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1250 cv->value = color;
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1251 cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1252
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1253 return (0);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1254 }
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1255
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1256
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1257 static int
387
2f5ce7fb5aad 2003-2-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 380
diff changeset
1258 gftp_gtk_config_file_write_color (gftp_config_vars * cv, char *buf,
2f5ce7fb5aad 2003-2-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 380
diff changeset
1259 size_t buflen, int to_config_file)
198
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1260 {
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1261 GdkColor * color;
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1262
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1263 color = cv->value;
387
2f5ce7fb5aad 2003-2-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 380
diff changeset
1264 g_snprintf (buf, buflen, "%x:%x:%x", color->red, color->green, color->blue);
198
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1265 return (0);
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1266 }
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1267
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1268
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1269 int
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1270 main (int argc, char **argv)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1271 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1272 GtkWidget *window, *ui;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1273
447
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1274 /* We override the read color functions because we are using a GdkColor
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1275 structures to store the color. If I put this in lib/config_file.c, then
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1276 the core library would be dependant on Gtk+ being present */
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1277 gftp_option_types[gftp_option_type_color].read_function = gftp_gtk_config_file_read_color;
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1278 gftp_option_types[gftp_option_type_color].write_function = gftp_gtk_config_file_write_color;
35e70b328c96 2004-3-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 425
diff changeset
1279
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
1280 gftpui_common_init (&argc, &argv, ftp_log);
498
76c4e4cd108e 2004-7-12 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
1281 gftpui_common_child_process_done = 0;
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
1282
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1283 g_thread_init (NULL);
496
937f2b75bbee 2004-7-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 472
diff changeset
1284
937f2b75bbee 2004-7-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 472
diff changeset
1285 #if GTK_MAJOR_VERSION > 1
460
075f89b4395c 2004-4-14 Brian Masney <masneyb@gftp.org>
masneyb
parents: 447
diff changeset
1286 gdk_threads_init();
496
937f2b75bbee 2004-7-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 472
diff changeset
1287 #endif
460
075f89b4395c 2004-4-14 Brian Masney <masneyb@gftp.org>
masneyb
parents: 447
diff changeset
1288
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 51
diff changeset
1289 main_thread_id = pthread_self ();
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1290 gtk_set_locale ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1291 gtk_init (&argc, &argv);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1292
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
1293 graphic_hash_table = g_hash_table_new (string_hash_function,
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
1294 string_hash_compare);
198
8fea1b1a2ec6 2003-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1295
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1296 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1297 gtk_signal_connect (GTK_OBJECT (window), "delete_event",
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
1298 GTK_SIGNAL_FUNC (_gftp_try_close), NULL);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1299 gtk_signal_connect (GTK_OBJECT (window), "destroy",
505
c89019945241 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
1300 GTK_SIGNAL_FUNC (_gftp_force_close), NULL);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1301 gtk_window_set_title (GTK_WINDOW (window), gftp_version);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1302 gtk_window_set_wmclass (GTK_WINDOW(window), "main", "gFTP");
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1303 gtk_widget_set_name (window, gftp_version);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1304 gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1305 gtk_widget_realize (window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1306
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1307 gftp_icon = open_xpm (window, "gftp.xpm");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1308 if (gftp_icon != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1309 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1310 gdk_window_set_icon (window->window, NULL, gftp_icon->pixmap,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1311 gftp_icon->bitmap);
168
c505d9ba9d53 2003-6-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1312 gdk_window_set_icon_name (window->window, gftp_version);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1313 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1314
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1315 other_wdata = &window1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1316 current_wdata = &window2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1317 ui = CreateFTPWindows (window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1318 gtk_container_add (GTK_CONTAINER (window), ui);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1319 gtk_widget_show (window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1320
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1321 gftpui_common_about (ftp_log, NULL);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1322
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1323 gtk_timeout_add (1000, update_downloads, NULL);
173
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1324 if (gftp_protocols[GFTP_LOCAL_NUM].init (window1.request) == 0)
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1325 {
422
38bfc112ab46 2004-3-14 Brian Masney <masneyb@gftp.org>
masneyb
parents: 395
diff changeset
1326 gftp_setup_startup_directory (window1.request);
173
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1327 gftp_connect (window1.request);
496
937f2b75bbee 2004-7-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 472
diff changeset
1328 ftp_list_files (&window1);
173
4c288d05b26a 2003-6-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
1329 }
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1330
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1331 /* 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
1332 icon on that side */
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 115
diff changeset
1333 sortrows (GTK_CLIST (window2.listbox), -1, &window2);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1334
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1335 init_gftp (argc, argv, window);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1336
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1337 GDK_THREADS_ENTER ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1338 gtk_main ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1339 GDK_THREADS_LEAVE ();
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
1340
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1341 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1342 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1343
374
d207b8241e96 2003-1-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
1344
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1345 void
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1346 gftpui_show_or_hide_command (void)
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1347 {
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1348 intptr_t cmd_in_gui;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1349
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1350 gftp_lookup_global_option ("cmd_in_gui", &cmd_in_gui);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1351 if (cmd_in_gui)
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1352 gtk_widget_show (gftpui_command_toolbar);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1353 else
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1354 gtk_widget_hide (gftpui_command_toolbar);
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1355 }
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 337
diff changeset
1356