changeset 616:461ae1bba8b6

2004-11-4 Brian Masney <masneyb@gftp.org> * lib/options.h src/gtk/gftp-gtk.c src/gtk/misc-gtk.c - whenever gftp is started, show in the toolbar the last connection details (except the password)
author masneyb
date Fri, 05 Nov 2004 03:27:23 +0000
parents 7b9779d175b6
children cc534d203668
files ChangeLog lib/options.h src/gtk/gftp-gtk.c src/gtk/misc-gtk.c
diffstat 4 files changed, 63 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Nov 05 03:05:26 2004 +0000
+++ b/ChangeLog	Fri Nov 05 03:27:23 2004 +0000
@@ -1,4 +1,8 @@
 2004-11-4 Brian Masney <masneyb@gftp.org>
+	* lib/options.h src/gtk/gftp-gtk.c src/gtk/misc-gtk.c - whenever gftp
+	is started, show in the toolbar the last connection details (except the
+	password)
+
 	* src/gtk/gftp-gtk.c - added mnemonics for the host and user field
 	in the toolbar
 
@@ -3034,7 +3038,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.363 2004/11/05 03:05:26 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.364 2004/11/05 03:27:23 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/options.h	Fri Nov 05 03:05:26 2004 +0000
+++ b/lib/options.h	Fri Nov 05 03:27:23 2004 +0000
@@ -164,6 +164,10 @@
    gftp_option_type_int, GINT_TO_POINTER(100), NULL, 0,
    N_("The width of the filename column in the transfer window. Set this to 0 to have this column automagically resize."), 0, NULL},
 
+  {"host_value", "", gftp_option_type_text, "", NULL, 0, NULL, 0, NULL},
+  {"port_value", "", gftp_option_type_text, "", NULL, 0, NULL, 0, NULL},
+  {"user_value", "", gftp_option_type_text, "", NULL, 0, NULL, 0, NULL},
+
   {"local_sortcol", "", 
    gftp_option_type_intcombo, GINT_TO_POINTER(1), gftp_sort_columns, 0,
    N_("The default column to sort by"), GFTP_PORT_TEXT, NULL},
--- a/src/gtk/gftp-gtk.c	Fri Nov 05 03:05:26 2004 +0000
+++ b/src/gtk/gftp-gtk.c	Fri Nov 05 03:27:23 2004 +0000
@@ -57,6 +57,7 @@
 static void
 _gftp_exit (GtkWidget * widget, gpointer data)
 {
+  const char *tempstr;
   intptr_t ret;
 
   ret = GTK_WIDGET (local_frame)->allocation.width;
@@ -99,6 +100,15 @@
   ret = get_column (&GTK_CLIST (window2.listbox)->column[6]);
   gftp_set_global_option ("remote_attribs_width", GINT_TO_POINTER (ret));
 
+  tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry));
+  gftp_set_global_option ("host_value", tempstr);
+
+  tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (portedit)->entry));
+  gftp_set_global_option ("port_value", tempstr);
+
+  tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry));
+  gftp_set_global_option ("user_value", tempstr);
+
   gftp_shutdown ();
   exit (0);
 }
@@ -421,7 +431,7 @@
   };
   GtkWidget *toolbar, *box, *tempwid;
   gftp_config_list_vars * tmplistvar;
-  char *default_protocol;
+  char *default_protocol, *tempstr;
   int i, num;
 
   toolbar = gtk_handle_box_new ();
@@ -464,7 +474,9 @@
     gtk_combo_set_popdown_strings (GTK_COMBO (hostedit), tmplistvar->list);
 
   gtk_combo_disable_activate (GTK_COMBO (hostedit));
-  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), "");
+
+  gftp_lookup_global_option ("host_value", &tempstr);
+  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), tempstr);
 #if GTK_MAJOR_VERSION > 1
   gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid),
                                  GTK_COMBO (hostedit)->entry);
@@ -486,7 +498,9 @@
     gtk_combo_set_popdown_strings (GTK_COMBO (portedit), tmplistvar->list);
 
   gtk_combo_disable_activate (GTK_COMBO (portedit));
-  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), "");
+
+  gftp_lookup_global_option ("port_value", &tempstr);
+  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), tempstr);
   gtk_box_pack_start (GTK_BOX (box), portedit, FALSE, FALSE, 0);
 
 #if GTK_MAJOR_VERSION == 1
@@ -508,7 +522,9 @@
     gtk_combo_set_popdown_strings (GTK_COMBO (useredit), tmplistvar->list);
 
   gtk_combo_disable_activate (GTK_COMBO (useredit));
-  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), "");
+
+  gftp_lookup_global_option ("user_value", &tempstr);
+  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), tempstr);
 #if GTK_MAJOR_VERSION > 1
   gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid),
                                  GTK_COMBO (useredit)->entry);
--- a/src/gtk/misc-gtk.c	Fri Nov 05 03:05:26 2004 +0000
+++ b/src/gtk/misc-gtk.c	Fri Nov 05 03:27:23 2004 +0000
@@ -215,41 +215,43 @@
 
   if (current_wdata->request != NULL)
     {
-      if ((tempstr = current_wdata->request->hostname) == NULL)
-        tempstr = empty;
-      gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), tempstr);
-
-      if ((tempstr = current_wdata->request->username) == NULL)
-        tempstr = empty;
-      gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), tempstr);
-
-      if ((tempstr = current_wdata->request->password) == NULL)
-        tempstr = empty;
-      gtk_entry_set_text (GTK_ENTRY (passedit), tempstr);
-
-      port = gftp_protocol_default_port (current_wdata->request);
-      if (current_wdata->request->port != 0 &&
-          port != current_wdata->request->port)
+      if (GFTP_IS_CONNECTED (current_wdata->request))
         {
-          tempstr = g_strdup_printf ("%d", current_wdata->request->port);
-          gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), tempstr);
-          g_free (tempstr);
-        }
-      else
-        gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), "");
+          if ((tempstr = current_wdata->request->hostname) == NULL)
+            tempstr = empty;
+          gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), tempstr);
+    
+          if ((tempstr = current_wdata->request->username) == NULL)
+            tempstr = empty;
+          gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), tempstr);
+    
+          if ((tempstr = current_wdata->request->password) == NULL)
+            tempstr = empty;
+          gtk_entry_set_text (GTK_ENTRY (passedit), tempstr);
+    
+          port = gftp_protocol_default_port (current_wdata->request);
+          if (current_wdata->request->port != 0 &&
+              port != current_wdata->request->port)
+            {
+              tempstr = g_strdup_printf ("%d", current_wdata->request->port);
+              gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), tempstr);
+              g_free (tempstr);
+            }
+          else
+            gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), "");
+    
+          for (i=0; gftp_protocols[i].init != NULL; i++)
+            {
+              if (current_wdata->request->init == gftp_protocols[i].init)
+                {
+                  gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), i);
+                  break;
+                }
+            }
 
-      for (i=0; gftp_protocols[i].init != NULL; i++)
-        {
-          if (current_wdata->request->init == gftp_protocols[i].init)
-            {
-              gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), i);
-              break;
-            }
+          gtk_tooltips_set_tip (GTK_TOOLTIPS(openurl_tooltip), openurl_btn,
+                                _("Disconnect from the remote server"), NULL);
         }
-
-      if (GFTP_IS_CONNECTED (current_wdata->request))
-        gtk_tooltips_set_tip (GTK_TOOLTIPS(openurl_tooltip), openurl_btn,
-                              _("Disconnect from the remote server"), NULL);
       else
         gtk_tooltips_set_tip (GTK_TOOLTIPS(openurl_tooltip), openurl_btn,
                               _("Connect to the site specified in the host entry. If the host entry is blank, then a dialog is presented that will allow you to enter a URL."), NULL);