diff src/gtk/misc-gtk.c @ 792:37bc51131e2d

2006-7-29 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/options.h lib/protocols.c src/gtk/gftp-gtk.c src/gtk/misc-gtk.c src/text/gftp-text.c - removed the startup_directory option. Added local_startup_directory and remote_startup_directory_options. These options are automatically saved whenever gftp exits.
author masneyb
date Sat, 29 Jul 2006 14:38:47 +0000
parents 0e7ab0a51ddd
children 419443feddac
line wrap: on
line diff
--- a/src/gtk/misc-gtk.c	Sat Jul 29 13:51:15 2006 +0000
+++ b/src/gtk/misc-gtk.c	Sat Jul 29 14:38:47 2006 +0000
@@ -298,7 +298,7 @@
 void
 update_window (gftp_window_data * wdata)
 {
-  char *dir, *tempstr, *temp1str, *fspec, *utf8_directory;
+  char *tempstr, *hostname, *fspec, *utf8_directory;
   int connected, start;
 
   connected = GFTP_IS_CONNECTED (wdata->request);
@@ -306,33 +306,33 @@
     {
       fspec = wdata->show_selected ? "Selected" : strcmp (wdata->filespec, "*") == 0 ?  _("All Files") : wdata->filespec;
 
-      if ((temp1str = wdata->request->hostname) == NULL ||
+      if (wdata->request->hostname == NULL ||
           wdata->request->protonum == GFTP_LOCAL_NUM)
-	temp1str = "";
-      tempstr = g_strconcat (temp1str, *temp1str == '\0' ? "[" : " [",
-		     gftp_protocols[wdata->request->protonum].name,
-		     wdata->request->cached ? _("] (Cached) [") : "] [",
-                     fspec, "]", current_wdata == wdata ? "*" : "", NULL);
+        hostname = "";
+      else
+        hostname = wdata->request->hostname;
+
+      tempstr = g_strconcat (hostname, *hostname == '\0' ? "[" : " [",
+                             gftp_protocols[wdata->request->protonum].name,
+                             wdata->request->cached ? _("] (Cached) [") : "] [",
+                             fspec, "]", current_wdata == wdata ? "*" : "", NULL);
       gtk_label_set (GTK_LABEL (wdata->hoststxt), tempstr);
       g_free (tempstr);
 
-      utf8_directory = NULL;
-      if ((dir = wdata->request->directory) == NULL)
-        temp1str = "";
-      else
+      if (wdata->request->directory != NULL)
         {
           utf8_directory = gftp_string_to_utf8 (wdata->request, 
                                                 wdata->request->directory);
           if (utf8_directory != NULL)
-            temp1str = utf8_directory;
+            {
+              gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry),
+                                  utf8_directory);
+              g_free (utf8_directory);
+            }
           else
-            temp1str = dir;
+            gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry),
+                                wdata->request->directory);
         }
-
-      gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry),temp1str);
-
-      if (utf8_directory != NULL)
-        g_free (utf8_directory);
     }
   else if (wdata->hoststxt != NULL)
     {
@@ -340,7 +340,6 @@
                              current_wdata == wdata ? "*" : "", NULL);
       gtk_label_set (GTK_LABEL (wdata->hoststxt), tempstr);
       g_free (tempstr);
-      gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry), "");
     }
 
   if (wdata == &window1)