changeset 229:35ae2e80962e

2003-7-22 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/gftp.h - added gftp_lookup_bookmark_option() and gftp_set_bookmark_option(). Also added _gftp_set_option_value() that is used by the set functions for bookmark and request structures * src/gtk/bookmarks.c - make sure the options are copied over to the new bookmarks. Also show all of the editable toptions for this bookmark entry * src/gtk/options_dialog.c src/gtk/gftp-gtk.h lib/config_file.c lib/gftp.h - improvements to overriding options for each bookmark entry. There is still one crash that is occuring that I have to track down. For the moment, don't edit the bookmarks twice in the same session.
author masneyb
date Wed, 23 Jul 2003 02:39:24 +0000
parents 835a8c968264
children f330309d2f17
files ChangeLog lib/config_file.c lib/gftp.h src/gtk/bookmarks.c src/gtk/gftp-gtk.h src/gtk/options_dialog.c
diffstat 6 files changed, 238 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 21 19:54:10 2003 +0000
+++ b/ChangeLog	Wed Jul 23 02:39:24 2003 +0000
@@ -1,3 +1,18 @@
+2003-7-22 Brian Masney <masneyb@gftp.org>
+	* lib/config_file.c lib/gftp.h - added gftp_lookup_bookmark_option()
+	and gftp_set_bookmark_option(). Also added _gftp_set_option_value()
+	that is used by the set functions for bookmark and request structures
+
+	* src/gtk/bookmarks.c - make sure the options are copied over to the
+	new bookmarks. Also show all of the editable toptions for this bookmark
+	entry
+
+	* src/gtk/options_dialog.c src/gtk/gftp-gtk.h lib/config_file.c 
+	lib/gftp.h - improvements to overriding options for each bookmark 
+	entry. There is still one crash that is occuring that I have to track
+	down. For the moment, don't edit the bookmarks twice in the same 
+	session.
+
 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
@@ -1304,7 +1319,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.114 2003/07/21 00:26:41 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.115 2003/07/23 02:39:22 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/config_file.c	Mon Jul 21 19:54:10 2003 +0000
+++ b/lib/config_file.c	Wed Jul 23 02:39:24 2003 +0000
@@ -1216,6 +1216,20 @@
 
 
 void
+gftp_lookup_bookmark_option (gftp_bookmarks_var * bm, char * key, void *value)
+{
+  gftp_config_vars * tmpconfigvar;
+
+  if (bm != NULL && bm->local_options_hash != NULL &&
+      (tmpconfigvar = g_hash_table_lookup (bm->local_options_hash,
+                                           key)) != NULL)
+    memcpy (value, &tmpconfigvar->value, sizeof (value));
+  else
+    gftp_lookup_global_option (key, value);
+}
+
+
+void
 gftp_set_global_option (char * key, const void *value)
 {
   gftp_config_vars * tmpconfigvar, newconfigvar;
@@ -1248,8 +1262,25 @@
 }
 
 
+static void
+_gftp_set_option_value (gftp_config_vars * cv, const void * newval)
+{
+  gftp_config_vars newconfigvar;
+  void *nc_ptr;
+
+  memcpy (&newconfigvar, cv, sizeof (newconfigvar));
+
+  /* Cheap warning fix for const pointer... */
+  memcpy (&nc_ptr, &newval, sizeof (nc_ptr));
+  newconfigvar.value = nc_ptr;
+  newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
+
+  gftp_option_types[newconfigvar.otype].copy_function (&newconfigvar, cv);
+}
+
+
 void
-gftp_set_request_option (gftp_request * request, char * key, void *value)
+gftp_set_request_option (gftp_request * request, char * key, const void *value)
 {
   gftp_config_vars * tmpconfigvar;
 
@@ -1259,7 +1290,7 @@
 
   if ((tmpconfigvar = g_hash_table_lookup (request->local_options_hash,
                                            key)) != NULL)
-    memcpy (&tmpconfigvar->value, &value, sizeof (tmpconfigvar->value));
+    _gftp_set_option_value (tmpconfigvar, value);
   else
     {
       if (gftp_global_options_htable == NULL ||
@@ -1274,9 +1305,8 @@
       request->local_options_vars = g_realloc (request->local_options_vars, 
                                                sizeof (gftp_config_vars) * request->num_local_options_vars);
 
-      memcpy (&request->local_options_vars[request->num_local_options_vars - 1],
-              tmpconfigvar, sizeof (*tmpconfigvar));
-      memcpy (&request->local_options_vars[request->num_local_options_vars - 1].value, &value, sizeof (value));
+      memcpy (&request->local_options_vars[request->num_local_options_vars - 1], tmpconfigvar, sizeof (*tmpconfigvar));
+      _gftp_set_option_value (&request->local_options_vars[request->num_local_options_vars - 1], value);
 
       g_hash_table_insert (request->local_options_hash, request->local_options_vars[request->num_local_options_vars - 1].key, &request->local_options_vars[request->num_local_options_vars - 1]);
     }
@@ -1284,6 +1314,52 @@
 
 
 void
+gftp_set_bookmark_option (gftp_bookmarks_var * bm, char * key, const void *value)
+{
+  gftp_config_vars * tmpconfigvar, newconfigvar;
+  int ret;
+
+  if (bm->local_options_hash != NULL &&
+      (tmpconfigvar = g_hash_table_lookup (bm->local_options_hash,
+                                           key)) != NULL)
+    _gftp_set_option_value (tmpconfigvar, value);
+  else
+    {
+      if (gftp_global_options_htable == NULL ||
+          (tmpconfigvar = g_hash_table_lookup (gftp_global_options_htable,
+                                               key)) == NULL)
+        {
+          fprintf (stderr, _("FATAL gFTP Error: Config option '%s' not found in global hash table\n"), key);
+          exit (1);
+        }
+
+      /* Check to see if this is set to the same value as the global option. 
+         If so, don't add it to the bookmark preferences */
+      memcpy (&newconfigvar, tmpconfigvar, sizeof (newconfigvar));
+      memcpy (&newconfigvar.value, &value, sizeof (newconfigvar.value));
+      newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
+
+      ret = gftp_option_types[newconfigvar.otype].compare_function (&newconfigvar, tmpconfigvar);
+      if (ret == 0)
+        return;
+      
+      if (bm->local_options_hash == NULL)
+        bm->local_options_hash = g_hash_table_new (string_hash_function,
+                                                   string_hash_compare);
+
+      bm->num_local_options_vars++;
+      bm->local_options_vars = g_realloc (bm->local_options_vars, 
+                                          sizeof (gftp_config_vars) * bm->num_local_options_vars);
+
+      memcpy (&bm->local_options_vars[bm->num_local_options_vars - 1], tmpconfigvar, sizeof (*tmpconfigvar));
+      _gftp_set_option_value (&bm->local_options_vars[bm->num_local_options_vars - 1], value);
+
+      g_hash_table_insert (bm->local_options_hash, bm->local_options_vars[bm->num_local_options_vars - 1].key, &bm->local_options_vars[bm->num_local_options_vars - 1]);
+    }
+}
+
+
+void
 gftp_register_config_vars (gftp_config_vars * config_vars)
 {
   gftp_options_list = g_list_append (gftp_options_list, config_vars);
--- a/lib/gftp.h	Mon Jul 21 19:54:10 2003 +0000
+++ b/lib/gftp.h	Wed Jul 23 02:39:24 2003 +0000
@@ -299,7 +299,7 @@
   int (*write_function) (gftp_config_vars * cv, FILE * fd, int to_config_file);
   void (*copy_function) (gftp_config_vars * cv, gftp_config_vars * dest_cv);
   int (*compare_function) (gftp_config_vars * cv1, gftp_config_vars * cv2);
-  void * (*ui_print_function) (gftp_config_vars * cv, void *user_data);
+  void *(*ui_print_function) (gftp_config_vars * cv, void *user_data, void *value);
   void (*ui_save_function) (gftp_config_vars * cv, void *user_data);
   void (*ui_cancel_function) (gftp_config_vars * cv, void *user_data);
   void *user_data;
@@ -636,12 +636,20 @@
 					  char * key, 
 					  void *value );
 
+void gftp_lookup_bookmark_option 	( gftp_bookmarks_var * bm, 
+					  char * key, 
+					  void *value );
+
 void gftp_set_global_option 		( char * key, 
 					  const void *value );
 
 void gftp_set_request_option 		( gftp_request * request, 
 					  char * key, 
-					  void *value );
+					  const void *value );
+
+void gftp_set_bookmark_option 		( gftp_bookmarks_var * bm,
+					  char * key, 
+					  const void *value );
 
 void gftp_register_config_vars 		( gftp_config_vars *config_vars );
 
--- a/src/gtk/bookmarks.c	Mon Jul 21 19:54:10 2003 +0000
+++ b/src/gtk/bookmarks.c	Wed Jul 23 02:39:24 2003 +0000
@@ -220,6 +220,12 @@
 
       newentry->port = tempentry->port;
 
+      gftp_copy_local_options (&newentry->local_options_vars,
+                               &newentry->local_options_hash,
+                               tempentry->local_options_vars,
+                               tempentry->num_local_options_vars);
+      newentry->num_local_options_vars = tempentry->num_local_options_vars;
+
       if (sibling == NULL)
 	{
 	  if (preventry->children == NULL)
@@ -261,6 +267,7 @@
 	    }
 	}
     }
+
   return (new_bm);
 }
 
@@ -734,6 +741,8 @@
     g_free (entry->acct);
   entry->acct = g_strdup (str);
 
+  gftp_gtk_save_bookmark_options (entry);
+
   if (strcmp (entry->path, newpath) != 0)
     {
       tempentry = entry;
@@ -1036,7 +1045,7 @@
                     G_CALLBACK (bmedit_action), (gpointer) entry);
 #endif
 
-/* FIXME gftp_gtk_setup_bookmark_options (notebook); */
+  gftp_gtk_setup_bookmark_options (notebook, entry);
 
   gtk_widget_show (dialog);
 }
--- a/src/gtk/gftp-gtk.h	Mon Jul 21 19:54:10 2003 +0000
+++ b/src/gtk/gftp-gtk.h	Wed Jul 23 02:39:24 2003 +0000
@@ -151,6 +151,7 @@
   int tbl_col_num,
       tbl_row_num;
   gftp_option_type_enum last_option;
+  gftp_bookmarks_var * bm;
 } gftp_options_dialog_data;
 
 
@@ -363,10 +364,10 @@
 /* options_dialog.c */
 void options_dialog 				( gpointer data );
 
-void gftp_gtk_setup_bookmark_options 		( GtkWidget * notebook );
+void gftp_gtk_setup_bookmark_options 		( GtkWidget * notebook,
+						  gftp_bookmarks_var * bm );
 
-void gftp_gtk_save_bookmark_options 		( GtkWidget * widget, 
-						  gpointer data );
+void gftp_gtk_save_bookmark_options 		( gftp_bookmarks_var * bm );
 
 /* rename_dialog.c */
 void rename_dialog				( gpointer data );
--- a/src/gtk/options_dialog.c	Mon Jul 21 19:54:10 2003 +0000
+++ b/src/gtk/options_dialog.c	Wed Jul 23 02:39:24 2003 +0000
@@ -23,13 +23,15 @@
 static GtkWidget * proxy_list, * new_proxy_domain, * network1,
                  * network2, * network3, * network4, * netmask1, * netmask2, 
                  * netmask3, * netmask4, * domain_active;
-static GList * new_proxy_hosts;
+static gftp_options_dialog_data * option_data = NULL;
+static GList * new_proxy_hosts = NULL;
 
 static void
 _setup_option (gftp_option_type_enum otype,
                gftp_options_dialog_data * option_data, 
                void * (*ui_print_function) (gftp_config_vars * cv,
-                                                 void *user_data),
+                                            void *user_data,
+                                            void *value),
                void (*ui_save_function) (gftp_config_vars * cv,
                                          void *user_data),
                void (*ui_cancel_function) (gftp_config_vars * cv,
@@ -77,7 +79,7 @@
 
 
 static void *
-_print_option_type_newtable (gftp_config_vars * cv, void *user_data)
+_print_option_type_newtable (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
 
@@ -97,7 +99,7 @@
 
 
 static void *
-_print_option_type_text (gftp_config_vars * cv, void *user_data)
+_print_option_type_text (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkWidget * tempwid;
@@ -105,8 +107,8 @@
   option_data = user_data;
 
   tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
-  if (cv->value != NULL)
-    gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) cv->value);
+  if (value != NULL)
+    gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) value);
 
   return (tempwid);
 }
@@ -121,7 +123,10 @@
   option_data = user_data;
   tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
 
-  gftp_set_global_option (cv->key, tempstr);
+  if (option_data->bm == NULL)
+    gftp_set_global_option (cv->key, tempstr);
+  else
+    gftp_set_bookmark_option (option_data->bm, cv->key, tempstr);
 }
 
 
@@ -150,7 +155,7 @@
 
 
 static void *
-_print_option_type_textcombo (gftp_config_vars * cv, void *user_data)
+_print_option_type_textcombo (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkWidget * tempwid, * combo;
@@ -170,8 +175,7 @@
       clist = cv->listdata;
       for (i=0; clist[i] != NULL; i++)
         {
-          if (cv->value != NULL &&
-              strcasecmp ((char *) cv->value, clist[i]) == 0)
+          if (value != NULL && strcasecmp ((char *) value, clist[i]) == 0)
             selitem = i;
 
           tempwid = gtk_list_item_new_with_label (clist[i]);
@@ -205,7 +209,10 @@
 
   tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (cv->user_data)->entry));
 
-  gftp_set_global_option (cv->key, tempstr);
+  if (option_data->bm == NULL)
+    gftp_set_global_option (cv->key, tempstr);
+  else
+    gftp_set_bookmark_option (option_data->bm, cv->key, tempstr);
 }
 
 
@@ -330,7 +337,7 @@
 
 
 static void *
-_print_option_type_textcomboedt (gftp_config_vars * cv, void *user_data)
+_print_option_type_textcomboedt (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_textcomboedt_widget_data * widdata;
   GtkWidget * combo, * textwid, * tempwid;
@@ -345,8 +352,8 @@
   combo = _gen_combo_widget (option_data, cv->description);
  
   tempstr = NULL;
-  if (cv->value != NULL)
-    tempstr = _gftp_convert_to_newlines (cv->value);
+  if (value != NULL)
+    tempstr = _gftp_convert_to_newlines (value);
   if (tempstr == NULL)
     tempstr = g_strdup ("");
 
@@ -438,7 +445,7 @@
 _save_option_type_textcomboedt (gftp_config_vars * cv, void *user_data)
 {
   gftp_textcomboedt_widget_data * widdata;
-  char *newstr;
+  char *newstr, *proxy_config;
   int freeit;
 #if GTK_MAJOR_VERSION == 1
   char tmp[128];
@@ -474,11 +481,14 @@
   freeit = 1;
 #endif
 
-  if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM)
-    g_free (cv->value);
+  proxy_config = _gftp_convert_from_newlines (newstr);
 
-  cv->value = _gftp_convert_from_newlines (newstr);
-  cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
+  if (option_data->bm == NULL)
+    gftp_set_global_option (cv->key, proxy_config);
+  else
+    gftp_set_bookmark_option (option_data->bm, cv->key, proxy_config);
+
+  g_free (proxy_config);
 
   if (freeit)
     g_free (newstr);
@@ -488,7 +498,7 @@
 
 
 static void *
-_print_option_type_hidetext (gftp_config_vars * cv, void *user_data)
+_print_option_type_hidetext (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkWidget * tempwid;
@@ -497,13 +507,13 @@
 
   tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
   gtk_entry_set_visibility (GTK_ENTRY (tempwid), 0);
-  gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) cv->value);
+  gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) value);
   return (tempwid);
 }
 
 
 static void *
-_print_option_type_int (gftp_config_vars * cv, void *user_data)
+_print_option_type_int (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkWidget * tempwid;
@@ -512,7 +522,7 @@
   option_data = user_data;
 
   tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
-  g_snprintf (tempstr, sizeof (tempstr), "%d", GPOINTER_TO_INT(cv->value));
+  g_snprintf (tempstr, sizeof (tempstr), "%d", GPOINTER_TO_INT(value));
   gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
   return (tempwid);
 }
@@ -523,16 +533,22 @@
 {
   gftp_options_dialog_data * option_data;
   const char *tempstr;
+  int val;
 
   option_data = user_data;
   tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
 
-  gftp_set_global_option (cv->key, GINT_TO_POINTER(strtol (tempstr, NULL, 10)));
+  val = strtol (tempstr, NULL, 10);
+
+  if (option_data->bm == NULL)
+    gftp_set_global_option (cv->key, GINT_TO_POINTER(val));
+  else
+    gftp_set_bookmark_option (option_data->bm, cv->key, GINT_TO_POINTER(val));
 }
 
 
 static void *
-_print_option_type_checkbox (gftp_config_vars * cv, void *user_data)
+_print_option_type_checkbox (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkTooltips * tooltip;
@@ -541,7 +557,7 @@
   option_data = user_data;
 
   if (option_data->last_option != gftp_option_type_checkbox)
-    _print_option_type_newtable (NULL, user_data);
+    _print_option_type_newtable (NULL, user_data, NULL);
 
   if (option_data->tbl_col_num == 0)
     {
@@ -557,7 +573,7 @@
                              option_data->tbl_row_num, 
                              option_data->tbl_row_num + 1);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid),
-                                GPOINTER_TO_INT(cv->value));
+                                GPOINTER_TO_INT(value));
   gtk_widget_show (tempwid);
 
   option_data->tbl_col_num = (option_data->tbl_col_num + 1) % 2;
@@ -576,14 +592,21 @@
 _save_option_type_checkbox (gftp_config_vars * cv, void *user_data)
 {
   gftp_options_dialog_data * option_data;
+  int val;
 
   option_data = user_data;
-  gftp_set_global_option (cv->key, GINT_TO_POINTER (GTK_TOGGLE_BUTTON (cv->user_data)->active));
+
+  val = GTK_TOGGLE_BUTTON (cv->user_data)->active;
+
+  if (option_data->bm == NULL)
+    gftp_set_global_option (cv->key, GINT_TO_POINTER (val));
+  else
+    gftp_set_bookmark_option (option_data->bm, cv->key, GINT_TO_POINTER (val));
 }
 
 
 static void *
-_print_option_type_float (gftp_config_vars * cv, void *user_data)
+_print_option_type_float (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkWidget * tempwid;
@@ -593,7 +616,7 @@
   option_data = user_data;
 
   tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
-  memcpy (&f, &cv->value, sizeof (f));
+  memcpy (&f, &value, sizeof (f));
   g_snprintf (tempstr, sizeof (tempstr), "%.2f", f);
   gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
   return (tempwid);
@@ -612,12 +635,16 @@
   tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
   f = strtod (tempstr, NULL);
   memcpy (&val, &f, sizeof (val));
-  gftp_set_global_option (cv->key, val);
+
+  if (option_data->bm == NULL)
+    gftp_set_global_option (cv->key, val);
+  else
+    gftp_set_bookmark_option (option_data->bm, cv->key, val);
 }
 
 
 static void *
-_print_option_type_notebook (gftp_config_vars * cv, void *user_data)
+_print_option_type_notebook (gftp_config_vars * cv, void *user_data, void *value)
 {
   gftp_options_dialog_data * option_data;
   GtkWidget * tempwid;
@@ -633,7 +660,7 @@
   gtk_notebook_append_page (GTK_NOTEBOOK (option_data->notebook), 
                             option_data->box, tempwid);
 
-  _print_option_type_newtable (NULL, user_data);
+  _print_option_type_newtable (NULL, user_data, NULL);
   
   return (NULL);
 }
@@ -1163,10 +1190,12 @@
 }
 
 
-static void
-_init_option_data (gftp_options_dialog_data * option_data)
+static gftp_options_dialog_data *
+_init_option_data (void)
 {
-  memset (option_data, 0, sizeof (*option_data));
+  gftp_options_dialog_data * option_data;
+
+  option_data = g_malloc0 (sizeof (*option_data));
 
   _setup_option (gftp_option_type_text, option_data, 
                  _print_option_type_text, _save_option_type_text, NULL);
@@ -1187,30 +1216,32 @@
                  _print_option_type_float, _save_option_type_float, NULL);
   _setup_option (gftp_option_type_notebook, option_data, 
                  _print_option_type_notebook, NULL, NULL);
+
+  return (option_data);
 }
 
 
 void
 options_dialog (gpointer data)
 {
-  gftp_options_dialog_data option_data;
   gftp_config_vars * cv;
   GList * templist;
+  void *value;
   int i;
 #if GTK_MAJOR_VERSION == 1
   GtkWidget * tempwid;
 #endif
 
-  _init_option_data (&option_data);
+  option_data = _init_option_data ();
 
 #if GTK_MAJOR_VERSION == 1
-  option_data.dialog = gtk_dialog_new ();
-  gtk_window_set_title (GTK_WINDOW (option_data.dialog), _("Options"));
-  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (option_data.dialog)->action_area), 5);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), 15);
-  gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), TRUE);
+  option_data->dialog = gtk_dialog_new ();
+  gtk_window_set_title (GTK_WINDOW (option_data->dialog), _("Options"));
+  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (option_data->dialog)->action_area), 5);
+  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (option_data->dialog)->action_area), 15);
+  gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (option_data->dialog)->action_area), TRUE);
 #else
-  option_data.dialog = gtk_dialog_new_with_buttons (_("Options"), NULL, 0,
+  option_data->dialog = gtk_dialog_new_with_buttons (_("Options"), NULL, 0,
                                         GTK_STOCK_OK,
                                         GTK_RESPONSE_OK,
                                         GTK_STOCK_CANCEL,
@@ -1219,26 +1250,26 @@
                                         GTK_RESPONSE_APPLY,
                                         NULL);
 #endif
-  gtk_window_set_wmclass (GTK_WINDOW(option_data.dialog), "options", "gFTP");
-  gtk_window_set_position (GTK_WINDOW (option_data.dialog), GTK_WIN_POS_MOUSE);
-  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (option_data.dialog)->vbox), 10);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (option_data.dialog)->vbox), 2);
-  gtk_widget_realize (option_data.dialog);
+  gtk_window_set_wmclass (GTK_WINDOW(option_data->dialog), "options", "gFTP");
+  gtk_window_set_position (GTK_WINDOW (option_data->dialog), GTK_WIN_POS_MOUSE);
+  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (option_data->dialog)->vbox), 10);
+  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (option_data->dialog)->vbox), 2);
+  gtk_widget_realize (option_data->dialog);
 
   if (gftp_icon != NULL)
     {
-      gdk_window_set_icon (option_data.dialog->window, NULL, gftp_icon->pixmap,
+      gdk_window_set_icon (option_data->dialog->window, NULL, gftp_icon->pixmap,
                            gftp_icon->bitmap);
-      gdk_window_set_icon_name (option_data.dialog->window, gftp_version);
+      gdk_window_set_icon_name (option_data->dialog->window, gftp_version);
     }
 
-  option_data.notebook = gtk_notebook_new ();
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->vbox), 
-                      option_data.notebook, TRUE, TRUE, 0);
-  gtk_widget_show (option_data.notebook);
+  option_data->notebook = gtk_notebook_new ();
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data->dialog)->vbox), 
+                      option_data->notebook, TRUE, TRUE, 0);
+  gtk_widget_show (option_data->notebook);
 
   cv = gftp_options_list->data;
-  option_data.last_option = cv[0].otype;
+  option_data->last_option = cv[0].otype;
   for (templist = gftp_options_list; 
        templist != NULL; 
        templist = templist->next)
@@ -1253,67 +1284,73 @@
           if (gftp_option_types[cv[i].otype].ui_print_function == NULL)
             continue;
 
-          cv[i].user_data = gftp_option_types[cv[i].otype].ui_print_function (&cv[i], gftp_option_types[cv[i].otype].user_data);
+          if (*cv[i].key != '\0')
+            gftp_lookup_global_option (cv[i].key, &value);
+          else
+            value = NULL;
 
-          option_data.last_option = cv[i].otype;
+          cv[i].user_data = gftp_option_types[cv[i].otype].ui_print_function (&cv[i], gftp_option_types[cv[i].otype].user_data, value);
+
+          option_data->last_option = cv[i].otype;
         }
     }
 
-  make_proxy_hosts_tab (option_data.notebook);
+  make_proxy_hosts_tab (option_data->notebook);
 
 #if GTK_MAJOR_VERSION == 1
   tempwid = gtk_button_new_with_label (_("OK"));
   GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), 
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data->dialog)->action_area), 
                       tempwid, TRUE, TRUE, 0);
   gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
                       GTK_SIGNAL_FUNC (apply_changes), NULL);
   gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
                              GTK_SIGNAL_FUNC (gtk_widget_destroy),
-                             GTK_OBJECT (option_data.dialog));
+                             GTK_OBJECT (option_data->dialog));
   gtk_widget_show (tempwid);
 
   tempwid = gtk_button_new_with_label (_("  Cancel  "));
   GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), 
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data->dialog)->action_area), 
                       tempwid, TRUE, TRUE, 0);
   gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
                       GTK_SIGNAL_FUNC (clean_old_changes), NULL);
   gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
                              GTK_SIGNAL_FUNC (gtk_widget_destroy),
-                             GTK_OBJECT (option_data.dialog));
+                             GTK_OBJECT (option_data->dialog));
   gtk_widget_show (tempwid);
 
   tempwid = gtk_button_new_with_label (_("Apply"));
   GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), 
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data->dialog)->action_area), 
                       tempwid, TRUE, TRUE, 0);
   gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
                       GTK_SIGNAL_FUNC (apply_changes), NULL);
   gtk_widget_grab_default (tempwid);
   gtk_widget_show (tempwid);
 #else
-  g_signal_connect (GTK_OBJECT (option_data.dialog), "response",
+  g_signal_connect (GTK_OBJECT (option_data->dialog), "response",
                     G_CALLBACK (options_action), NULL);
 #endif
 
-  gtk_widget_show (option_data.dialog);
+  gtk_widget_show (option_data->dialog);
 }
 
 
 void
-gftp_gtk_setup_bookmark_options (GtkWidget * notebook)
+gftp_gtk_setup_bookmark_options (GtkWidget * notebook, gftp_bookmarks_var * bm)
 {
-  gftp_options_dialog_data option_data;
   gftp_config_vars * cv;
   GList * templist;
+  void *value;
   int i;
 
-  _init_option_data (&option_data);
-  option_data.notebook = notebook;
+  option_data = _init_option_data ();
+  option_data->bm = bm;
+  option_data->notebook = notebook;
 
   cv = gftp_options_list->data;
-  option_data.last_option = cv[0].otype;
+  option_data->last_option = cv[0].otype;
   for (templist = gftp_options_list; 
        templist != NULL; 
        templist = templist->next)
@@ -1328,18 +1365,22 @@
           if (gftp_option_types[cv[i].otype].ui_print_function == NULL)
             continue;
 
-          cv[i].user_data = gftp_option_types[cv[i].otype].ui_print_function (&cv[i], gftp_option_types[cv[i].otype].user_data);
+          if (*cv[i].key != '\0')
+            gftp_lookup_bookmark_option (bm, cv[i].key, &value);
+          else
+            value = NULL;
 
-          option_data.last_option = cv[i].otype;
+          cv[i].user_data = gftp_option_types[cv[i].otype].ui_print_function (&cv[i], option_data, value);
+
+          option_data->last_option = cv[i].otype;
         }
     }
 }
 
 
 void
-gftp_gtk_save_bookmark_options (GtkWidget * widget, gpointer data)
+gftp_gtk_save_bookmark_options (gftp_bookmarks_var * bm)
 {
-/* FIXME  - implement
   gftp_config_vars * cv;
   GList * templist;
   int i;
@@ -1358,9 +1399,8 @@
           if (gftp_option_types[cv[i].otype].ui_save_function == NULL)
             continue;
 
-          gftp_option_types[cv[i].otype].ui_save_function (&cv[i], gftp_option_types[cv[i].otype].user_data);
+          gftp_option_types[cv[i].otype].ui_save_function (&cv[i], option_data);
         }
     }
-*/
 }