[Xfce4-commits] r26153 - xarchiver/trunk/src

Giuseppe Torelli colossus at xfce.org
Sat Oct 20 15:45:39 CEST 2007


Author: colossus
Date: 2007-10-20 13:45:39 +0000 (Sat, 20 Oct 2007)
New Revision: 26153

Modified:
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/interface.c
   xarchiver/trunk/src/window.c
Log:
Up button works again.
Fixed bug #3438.
Fixed initial / in location entry.


Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c	2007-10-20 11:23:40 UTC (rev 26152)
+++ xarchiver/trunk/src/archive.c	2007-10-20 13:45:39 UTC (rev 26153)
@@ -519,9 +519,9 @@
 		dummy = g_string_prepend(dummy,entry->filename);
 		entry = entry->prev;
 	}
-	fullpathname = g_strdup(dummy->str);
+	fullpathname = g_strdup(++dummy->str);
+	dummy->str--;
 	g_string_free(dummy,TRUE);
-	g_print ("%s\n",fullpathname);
 	return fullpathname;
 }
 

Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c	2007-10-20 11:23:40 UTC (rev 26152)
+++ xarchiver/trunk/src/interface.c	2007-10-20 13:45:39 UTC (rev 26153)
@@ -296,7 +296,7 @@
 	tmp_image = gtk_image_new_from_stock ("gtk-go-up", tmp_toolbar_icon_size);
 	gtk_widget_show (tmp_image);
 	up_button = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Up"));
-	gtk_widget_set_sensitive(up_button,FALSE);
+	gtk_widget_set_sensitive(up_button,TRUE);
 	gtk_widget_show (up_button);
 	gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (up_button), FALSE);
 	gtk_container_add (GTK_CONTAINER (toolbar1), up_button);
@@ -313,6 +313,7 @@
 	tmp_image = gtk_image_new_from_stock ("gtk-home", tmp_toolbar_icon_size);
 	gtk_widget_show (tmp_image);
 	home_button = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Home"));
+	gtk_widget_set_sensitive(home_button,FALSE);
 	gtk_widget_show (home_button);
 	gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (home_button), FALSE);
 	gtk_container_add (GTK_CONTAINER (toolbar1), home_button);
@@ -901,12 +902,13 @@
 	unsigned short int bp = GPOINTER_TO_UINT(user_data);
 	gint current_page;
 	gint idx;
-	gchar *up = NULL;
-	gchar *path = NULL;
-	gchar *_path = NULL;
+	gchar **components = NULL;
+	unsigned short int x = 0;
+	XEntry *new_entry = NULL;
 
 	current_page = gtk_notebook_get_current_page (notebook);
 	idx = xa_find_archive_index (current_page);
+	XEntry *last_entry = archive[idx]->root_entry;
 
 	switch (bp)
 	{
@@ -923,26 +925,21 @@
 
 		/* Up */
 		case 2:
-			path =	g_strndup((gchar*)gtk_entry_get_text(GTK_ENTRY(location_entry)),
-					strlen(gtk_entry_get_text(GTK_ENTRY(location_entry)))-1);
-			up = xa_get_parent_dir (path);
-			_path = remove_level_from_path(path);
-			g_free (path);
-
-			if (_path == NULL || *up == '/')
+			components = g_strsplit(gtk_entry_get_text(GTK_ENTRY(location_entry)),"/",-1);
+			while (components[x] && strlen(components[x]) > 0)
 			{
-				g_free (up);
-				g_free (_path);
-				archive[idx]->location_entry_path = NULL;
+				new_entry = xa_find_child_entry(last_entry->child,components[x]);
+				last_entry = new_entry;
+				x++;
+			}
+			g_strfreev(components);
+			if (new_entry->prev->prev == NULL)
+			{
 				xa_update_window_with_archive_entries(archive[idx],NULL);
+				gtk_widget_set_sensitive(up_button,FALSE);
 				return;
 			}
-			else
-				archive[idx]->location_entry_path = g_strconcat (_path,"/",NULL);
-
-			g_free (_path);
-			xa_update_window_with_archive_entries(archive[idx],up);
-			g_free (up);
+			xa_update_window_with_archive_entries(archive[idx],new_entry->prev);
 		break;
 	}
 }

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c	2007-10-20 11:23:40 UTC (rev 26152)
+++ xarchiver/trunk/src/window.c	2007-10-20 13:45:39 UTC (rev 26153)
@@ -176,6 +176,7 @@
 			gtk_widget_set_sensitive ( password_entry , TRUE);
 	}
 	xa_set_button_state (1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties);
+	gtk_widget_set_sensitive(home_button,TRUE);
 	Update_StatusBar ( _("Operation completed."));
 
 	if (archive->status == XA_ARCHIVESTATUS_TEST)



More information about the Xfce4-commits mailing list