changeset 245:41af60bc1f88

2003-8-4 Brian Masney <masneyb@gftp.org> * src/gtk/gftp-gtk.c (CreateMenus) - on startup, select the proper ASCII/binary radio button (looks like an old bug!) * lib/misc.c lib/gftp.h - renamed my version of g_build_path() (was used only in glib 1.2 only) to gftp_build_path() and it's compiled in all the time now * lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c - instead of using g_build_path(), use gftp_build_path()
author masneyb
date Tue, 05 Aug 2003 01:40:49 +0000
parents afbbc72b73e2
children 290d00853950
files ChangeLog lib/gftp.h lib/misc.c lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/menu-items.c
diffstat 8 files changed, 41 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Aug 03 18:44:29 2003 +0000
+++ b/ChangeLog	Tue Aug 05 01:40:49 2003 +0000
@@ -1,3 +1,14 @@
+2003-8-4 Brian Masney <masneyb@gftp.org>
+	* src/gtk/gftp-gtk.c (CreateMenus) - on startup, select the proper
+	ASCII/binary radio button (looks like an old bug!)
+
+	* lib/misc.c lib/gftp.h - renamed my version of g_build_path() (was
+	used only in glib 1.2 only) to gftp_build_path() and it's compiled in
+	all the time now
+
+	* lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c - 
+	instead of using g_build_path(), use gftp_build_path()
+
 2003-8-3 Brian Masney <masneyb@gftp.org>
 	* lib/local.c (local_put_file) - specify an initial file creation mode
 	of 0644
@@ -1419,7 +1430,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.125 2003/08/03 18:44:28 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.126 2003/08/05 01:40:47 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/gftp.h	Sun Aug 03 18:44:29 2003 +0000
+++ b/lib/gftp.h	Tue Aug 05 01:40:49 2003 +0000
@@ -719,14 +719,9 @@
 					  GList ** list, 
 					  int *curnum );
 
-#if GLIB_MAJOR_VERSION == 1
-
-gchar * g_build_path 			( const gchar *separator, 
-					  const gchar *first_element,
+char * gftp_build_path 			( const char *first_element,
 					  ... );
 
-#endif
-
 off_t gftp_parse_file_size 		( char *str );
 
 /* protocols.c */
--- a/lib/misc.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/lib/misc.c	Tue Aug 05 01:40:49 2003 +0000
@@ -1192,10 +1192,8 @@
 }
 
 
-#if GLIB_MAJOR_VERSION == 1
-
 char *
-g_build_path (const char *separator, const char *first_element, ...)
+gftp_build_path (const char *first_element, ...) 
 {
   const char *element;
   size_t len, retlen;
@@ -1203,7 +1201,7 @@
   va_list args;
   char *ret;
 
-  g_return_val_if_fail (separator != NULL, NULL);
+  g_return_val_if_fail (first_element != NULL, NULL);
 
   ret = g_malloc0 (1);
   retlen = 0;
@@ -1215,7 +1213,7 @@
     {
       len = strlen (element);
 
-      if (len > 0 && element[len - 1] == *separator)
+      if (len > 0 && element[len - 1] == '/')
         add_separator = 0;
       else
         {
@@ -1225,17 +1223,16 @@
       
       retlen += len;
       ret = g_realloc (ret, retlen + 1);
-      strncat (ret, element, retlen);
 
       if (add_separator)
-        strncat (ret, separator, retlen);
+        strncat (ret, "/", retlen);
+
+      strncat (ret, element, retlen);
     }
 
   return (ret);
 }
 
-#endif
-
 
 off_t
 gftp_parse_file_size (char *str)
--- a/lib/protocols.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/lib/protocols.c	Tue Aug 05 01:40:49 2003 +0000
@@ -1547,11 +1547,11 @@
         fle->startsize = *newsize;
 
       if (transfer->toreq)
-        fle->destfile = g_build_path ("/", transfer->toreq->directory, 
-                                      fle->file, NULL);
-
-      newname = g_build_path ("/", transfer->fromreq->directory,
-			     fle->file, NULL);
+        fle->destfile = gftp_build_path (transfer->toreq->directory, 
+                                         fle->file, NULL);
+
+      newname = gftp_build_path (transfer->fromreq->directory,
+                                 fle->file, NULL);
 
       g_free (fle->file);
       fle->file = newname;
--- a/lib/sshv2.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/lib/sshv2.c	Tue Aug 05 01:40:49 2003 +0000
@@ -1666,8 +1666,7 @@
   else
     {
       oldlen = strlen (request->directory) + strlen (oldname) + 1;
-      oldstr = g_build_path ("/", request->directory, oldname, 
-                             NULL);
+      oldstr = gftp_build_path (request->directory, oldname, NULL);
     }
 
   if (*newname == '/')
@@ -1678,8 +1677,7 @@
   else
     {
       newlen = strlen (request->directory) + strlen (newname) + 1;
-      newstr = g_build_path ("/", request->directory, newname, 
-                             NULL);
+      newstr = gftp_build_path (request->directory, newname, NULL);
     }
 
   tempstr = g_malloc (oldlen + newlen + 13);
--- a/src/gtk/dnd.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/src/gtk/dnd.c	Tue Aug 05 01:40:49 2003 +0000
@@ -79,7 +79,7 @@
   newfle->file = g_strdup (current_ftpdata->directory);
   *(pos - 1) = '\0';
   
-  newfle->destfile = g_build_path ("/", wdata->request->directory, pos, NULL);
+  newfle->destfile = gftp_build_path (wdata->request->directory, pos, NULL);
   templist = g_malloc0 (sizeof (*templist));
   templist->data = newfle;
   templist->next = NULL;
--- a/src/gtk/gftp-gtk.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/src/gtk/gftp-gtk.c	Tue Aug 05 01:40:49 2003 +0000
@@ -152,7 +152,8 @@
 static GtkWidget *
 CreateMenus (GtkWidget * parent)
 {
-  int local_len, remote_len, len, i, trans_len, log_len, tools_len;
+  int local_len, remote_len, len, i, trans_len, log_len, tools_len,
+      ascii_transfers;
   GtkAccelGroup *accel_group;
   GtkWidget * tempwid;
   static GtkItemFactoryEntry menu_items[] = {
@@ -301,8 +302,17 @@
 
   gtk_window_add_accel_group (GTK_WINDOW (parent), accel_group);
 
-  tempwid = gtk_item_factory_get_widget (factory, menu_items[6].path);
-  gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
+  gftp_lookup_global_option ("ascii_transfers", &ascii_transfers);
+  if (ascii_transfers)
+    {
+      tempwid = gtk_item_factory_get_widget (factory, menu_items[5].path);
+      gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
+    }
+  else
+    {
+      tempwid = gtk_item_factory_get_widget (factory, menu_items[6].path);
+      gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
+    }
 
   tempwid = gtk_item_factory_get_widget (factory, menu_items[3].path);
   gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (tempwid), TRUE);
--- a/src/gtk/menu-items.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/src/gtk/menu-items.c	Tue Aug 05 01:40:49 2003 +0000
@@ -533,7 +533,7 @@
   templist = get_next_selection (templist, &filelist, &num);
   tempfle = filelist->data;
 
-  newdir = g_build_path ("/", wdata->request->directory, tempfle->file, NULL);
+  newdir = gftp_build_path (wdata->request->directory, tempfle->file, NULL);
 
   if ((tempstr = expand_path (newdir)) == NULL)
     {