diff lib/misc.c @ 227:a85a097bbb02

2003-7-20 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/gftp.h - added compare_function to gftp_config_vars structure. (gftp_set_global_option) use the compare function to see if the value was actually changed, and if so set the gftp_configuration_changed variable * lib/misc.c lib/gftp.h - For glib 1.2, added my version of g_build_path() since it's not there * lib/misc.c - GLIB/GTK+ 1.2 fixes * lib/protocols.c (gftp_fd_open) - cleaned up some * lib/rfc959.c (rfc959_init) - if the email address is blank, get the users address here instead of in register_module. It was being blanked out when the config file was being read * lib/options.h lib/rfc2068.c lib/rfc959.c lib/sshv2.c - mark the config variables that can show up in the bookmarks editor * src/text/gftp-text.c src/gtk/options_dialog.c - use gftp_set_global_option() to set the new configuration values * src/gtk/bookmarks.c - fixed crash in bookmarks dialog. Added notebook widget to the dialog as well. The options that can be edited for this site will show up in other tabs * src/gtk/gftp-gtk.c - fixes to the calls to gftp_set_global_option() * src/gtk/options_dialog.c - added gftp_gtk_setup_bookmark_options() to display all the editable options for this bookmark
author masneyb
date Mon, 21 Jul 2003 00:26:43 +0000
parents 6de9a8280aa4
children b42e7233533a
line wrap: on
line diff
--- a/lib/misc.c	Mon Jul 21 00:22:46 2003 +0000
+++ b/lib/misc.c	Mon Jul 21 00:26:43 2003 +0000
@@ -508,11 +508,21 @@
 gftp_transfer *
 gftp_tdata_new (void)
 {
+#if GLIB_MAJOR_VERSION == 1
+  static GStaticMutex init_mutex = G_STATIC_MUTEX_INIT;
+#endif
   gftp_transfer * tdata;
 
   tdata = g_malloc0 (sizeof (*tdata));
+
+#if GLIB_MAJOR_VERSION == 1
+  tdata->statmutex = init_mutex;
+  tdata->structmutex = init_mutex;
+#else
   g_static_mutex_init (&tdata->statmutex);
   g_static_mutex_init (&tdata->structmutex);
+#endif
+
   return (tdata);
 }
 
@@ -1116,3 +1126,47 @@
 }
 
 
+#if GLIB_MAJOR_VERSION == 1
+
+char *
+g_build_path (const char *separator, const char *first_element, ...)
+{
+  const char *element;
+  size_t len, retlen;
+  int add_separator;
+  va_list args;
+  char *ret;
+
+  g_return_val_if_fail (separator != NULL, NULL);
+
+  ret = g_malloc0 (1);
+  retlen = 0;
+
+  va_start (args, first_element);
+  for (element = first_element;
+       element != NULL;
+       element = va_arg (args, char *))
+    {
+      len = strlen (element);
+
+      if (len > 0 && element[len - 1] == *separator)
+        add_separator = 0;
+      else
+        {
+          add_separator = 1;
+          len++;
+        }
+      
+      retlen += len;
+      ret = g_realloc (ret, retlen + 1);
+      strncat (ret, element, retlen);
+
+      if (add_separator)
+        strncat (ret, separator, retlen);
+    }
+
+  return (ret);
+}
+
+#endif
+