diff src/gtk/bookmarks.c @ 7:5551ab2301fe

* Fixed a DND crash * When running a SSH bookmark, make sure need_userpass is enabled for that connection * moved anonymous ftp stuff from gtk port to rfc959.c * call bind_textdomain_codeset in gtk+ port * translation fixes for menus (from Owen Taylor <otaylor@redhat.com>)
author masneyb
date Fri, 23 Aug 2002 12:40:44 +0000
parents 8b1883341c6f
children 3b2dcdefc7e9
line wrap: on
line diff
--- a/src/gtk/bookmarks.c	Fri Aug 23 05:31:50 2002 +0000
+++ b/src/gtk/bookmarks.c	Fri Aug 23 12:40:44 2002 +0000
@@ -123,6 +123,11 @@
   if (!gftp_protocols[i].name)
     gftp_protocols[0].init (current_wdata->request);
 
+  /* If we're using one of the SSH protocols, override the value of 
+     ssh_need_userpass in the config file */
+  if (strncmp (tempentry->protocol, "SSH", 3) == 0)
+    current_wdata->request->need_userpass = 1;
+
   ftp_connect (current_wdata, current_wdata->request, 1);
 }
 
@@ -202,15 +207,7 @@
   tempentry->remote_dir = g_malloc (strlen (edttxt) + 1);
   strcpy (tempentry->remote_dir, edttxt);
 
-  if ((edttxt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry))) == NULL)
-    {
-      tempentry->user = g_malloc (10);
-      strcpy (tempentry->user, "anonymous");
-
-      tempentry->pass = g_malloc (strlen (emailaddr) + 1);
-      strcpy (tempentry->pass, emailaddr);
-    }
-  else
+  if ((edttxt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry))) != NULL)
     {
       tempentry->user = g_malloc (strlen (edttxt) + 1);
       strcpy (tempentry->user, edttxt);
@@ -223,7 +220,7 @@
 
   add_to_bookmark (tempentry);
 
-  test.path = g_strconcat (_("/Bookmarks/"), tempentry->path, NULL);
+  test.path = g_strconcat ("/Bookmarks/", tempentry->path, NULL);
   gtk_item_factory_create_item (factory, &test, (gpointer) tempentry->path,
 				1);
   g_free (test.path);
@@ -240,7 +237,7 @@
   tempentry = bookmarks->children;
   while (tempentry != NULL)
     {
-      test.path = g_strconcat (_("/Bookmarks/"), tempentry->path, NULL);
+      test.path = g_strconcat ("/Bookmarks/", tempentry->path, NULL);
       if (tempentry->isfolder)
         {
           test.item_type = "<Branch>";
@@ -272,7 +269,7 @@
 {
   GtkWidget * dialog, * scroll, * tempwid;
   GtkItemFactory * ifactory;
-  GtkItemFactoryEntry dummy_item, menu_items[] = {
+  GtkItemFactoryEntry menu_items[] = {
     {N_("/_File"), NULL, 0, 0, "<Branch>"},
     {N_("/File/tearoff"), NULL, 0, 0, "<Tearoff>"},
     {N_("/File/New Folder..."), NULL, new_folder_entry, 0},
@@ -282,7 +279,6 @@
     {N_("/File/sep"), NULL, 0, 0, "<Separator>"},
     {N_("/File/Close"), NULL, gtk_widget_destroy, 0}
   };
-  int i;
 
   new_bookmarks = copy_bookmarks (bookmarks);
   new_bookmarks_htable = build_bookmarks_hash_table (new_bookmarks);
@@ -293,7 +289,7 @@
   gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
   gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
 
-  ifactory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<bookmarks>", NULL);
+  ifactory = item_factory_new (GTK_TYPE_MENU_BAR, "<bookmarks>", NULL, NULL);
   create_item_factory (ifactory, 7, menu_items, NULL);
   create_item_factory (ifactory, 1, menu_items + 7, dialog);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), ifactory->widget,
@@ -310,13 +306,9 @@
   gtk_container_border_width (GTK_CONTAINER (scroll), 3);
   gtk_widget_show (scroll);
 
-  edit_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<edit_bookmark>", NULL);
-  for (i = 2; i < 8; i++)
-    {
-      memcpy (&dummy_item, menu_items + i, sizeof (dummy_item));
-      dummy_item.path = strrchr (_(dummy_item.path), '/');
-      gtk_item_factory_create_item (edit_factory, &dummy_item, dialog, 1);
-    }
+  edit_factory = item_factory_new (GTK_TYPE_MENU, "<edit_bookmark>", NULL, "/File");
+
+  create_item_factory (edit_factory, 6, menu_items + 2, dialog);
 
   tree = gtk_ctree_new (1, 0);
   gtk_clist_set_selection_mode (GTK_CLIST (tree), GTK_SELECTION_BROWSE);
@@ -376,7 +368,7 @@
     {
       if (tempentry->path && !tempentry->isfolder)
 	{
-	  tempstr = g_strdup_printf (_("/Bookmarks/%s"), tempentry->path);
+	  tempstr = g_strdup_printf ("/Bookmarks/%s", tempentry->path);
           gtk_widget_destroy (gtk_item_factory_get_item (factory, tempstr));
 	  g_free (tempentry->path);
 	  g_free (tempstr);
@@ -408,7 +400,7 @@
 		  tempentry = tempentry->prev;
 		  if (delentry->isfolder)
 		    {
-		      tempstr = g_strdup_printf (_("/Bookmarks/%s"), 
+		      tempstr = g_strdup_printf ("/Bookmarks/%s", 
                                                  delentry->path);
                       gtk_widget_destroy (gtk_item_factory_get_item (factory, 
                                                                      tempstr));
@@ -421,7 +413,7 @@
 	      tempentry = tempentry->next;
 	      if (delentry->isfolder && tempentry != NULL)
 		{
-		  tempstr = g_strdup_printf (_("/Bookmarks/%s"), 
+		  tempstr = g_strdup_printf ("/Bookmarks/%s", 
                                              delentry->path);
                     gtk_widget_destroy (gtk_item_factory_get_item (factory, 
                                                                    tempstr));