file-roller r2241 - in trunk: . src



Author: paobac
Date: Mon Apr 14 16:24:11 2008
New Revision: 2241
URL: http://svn.gnome.org/viewvc/file-roller?rev=2241&view=rev

Log:
2008-04-14  Paolo Bacchilega  <paobac svn gnome org>

	* src/main.h: 
	* src/main.c: removed ViewerList.

2008-04-14  Paolo Bacchilega  <paobac svn gnome org>
 
	* src/fr-window.h: 
	* src/fr-window.c: 
	
	Fixed bug #512474 â Visual glitches at startup

	* src/gtk-utils.h: 
	* src/gtk-utils.c:	
	* src/file-utils.h: 
	* src/dlg-batch-add.c: 
	
	Use the gtk API to get the icons for the mime-types.

	* src/ui.h: 	
	* src/actions.h: 
	* src/actions.c: 

	Use a gtk-toolbar for the location_bar.

Modified:
   trunk/ChangeLog
   trunk/src/actions.c
   trunk/src/actions.h
   trunk/src/dlg-batch-add.c
   trunk/src/file-utils.h
   trunk/src/fr-window.c
   trunk/src/fr-window.h
   trunk/src/gtk-utils.c
   trunk/src/gtk-utils.h
   trunk/src/main.c
   trunk/src/main.h
   trunk/src/ui.h

Modified: trunk/src/actions.c
==============================================================================
--- trunk/src/actions.c	(original)
+++ trunk/src/actions.c	Mon Apr 14 16:24:11 2008
@@ -1011,6 +1011,42 @@
 
 
 void
+activate_action_go_back (GtkAction *action,
+			 gpointer   data)
+{
+	FrWindow *window = data;
+	fr_window_go_back (window);
+}
+
+
+void
+activate_action_go_forward (GtkAction *action,
+			    gpointer   data)
+{
+	FrWindow *window = data;
+	fr_window_go_forward (window);
+}
+
+
+void
+activate_action_go_up (GtkAction *action,
+		       gpointer   data)
+{
+	FrWindow *window = data;
+	fr_window_go_up_one_level (window);
+}
+
+
+void
+activate_action_go_home (GtkAction *action,
+			 gpointer   data)
+{
+	FrWindow *window = data;
+	fr_window_go_to_location (window, "/", FALSE);
+}
+
+
+void
 activate_action_manual (GtkAction *action,
 			gpointer   data)
 {

Modified: trunk/src/actions.h
==============================================================================
--- trunk/src/actions.h	(original)
+++ trunk/src/actions.h	Mon Apr 14 16:24:11 2008
@@ -70,6 +70,11 @@
 void activate_action_sort_reverse_order (GtkAction *action, gpointer data);
 void activate_action_last_output (GtkAction *action, gpointer data);
 
+void activate_action_go_back (GtkAction *action, gpointer data);
+void activate_action_go_forward (GtkAction *action, gpointer data);
+void activate_action_go_up (GtkAction *action, gpointer data);
+void activate_action_go_home (GtkAction *action, gpointer data);
+
 void activate_action_manual (GtkAction *action, gpointer data);
 void activate_action_about (GtkAction *action, gpointer data);
 

Modified: trunk/src/dlg-batch-add.c
==============================================================================
--- trunk/src/dlg-batch-add.c	(original)
+++ trunk/src/dlg-batch-add.c	Mon Apr 14 16:24:11 2008
@@ -27,7 +27,6 @@
 
 #include <gio/gio.h>
 #include <gtk/gtk.h>
-#include <libgnomeui/gnome-icon-lookup.h>
 #include <glade/glade.h>
 
 #include "file-utils.h"
@@ -323,40 +322,6 @@
 }
 
 
-static GdkPixbuf *
-get_pixbuf_from_mime_type (const char *mime_type,
-			   int         icon_size)
-{
-	GtkIconTheme *icon_theme;
-	char         *icon_name = NULL;
-	GdkPixbuf    *icon = NULL;
-
-	icon_theme = gtk_icon_theme_get_default ();
-
-	if (icon_theme == NULL)
-		return NULL;
-
-	icon_name = gnome_icon_lookup (icon_theme,
-				       NULL,
-				       NULL,
-				       NULL,
-				       NULL,
-				       mime_type,
-				       GNOME_ICON_LOOKUP_FLAGS_NONE,
-				       NULL);
-
-	if (icon_name != NULL) 
-		icon = gtk_icon_theme_load_icon (icon_theme,
-						 icon_name,
-						 icon_size,
-						 0,
-						 NULL);
-
-	g_free (icon_name);
-	return icon;
-}
-
-
 static void
 archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
 				   DialogData  *data)
@@ -371,7 +336,7 @@
 		save_type_list =  save_type;
 	mime_type = file_type_desc[save_type_list[idx]].mime_type;
 
-	gtk_image_set_from_pixbuf (GTK_IMAGE (data->add_image), get_pixbuf_from_mime_type (mime_type, ARCHIVE_ICON_SIZE));
+	gtk_image_set_from_pixbuf (GTK_IMAGE (data->add_image), get_mime_type_pixbuf (mime_type, ARCHIVE_ICON_SIZE, NULL));
 }
 
 

Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h	(original)
+++ trunk/src/file-utils.h	Mon Apr 14 16:24:11 2008
@@ -25,9 +25,10 @@
 
 #include <sys/types.h>
 #include <time.h>
+#include <unistd.h>
 #include <gio/gio.h>
 
-#define MIME_TYPE_DIRECTORY "application/directory-normal"
+#define MIME_TYPE_DIRECTORY "gnome-fs-directory"
 #define MIME_TYPE_ARCHIVE "application/x-archive"
 
 #define get_home_relative_path(x)        \

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Mon Apr 14 16:24:11 2008
@@ -26,9 +26,9 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkcursor.h>
 #include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-icon-lookup.h>
 #include <gio/gio.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libgnome/gnome-url.h>
 
 #include "actions.h"
 #include "dlg-batch-add.h"
@@ -77,8 +77,6 @@
 #define DEF_WIN_HEIGHT 480
 #define DEF_SIDEBAR_WIDTH 200
 
-#define ICON_TYPE_DIRECTORY "gnome-fs-directory"
-#define ICON_TYPE_REGULAR   "gnome-fs-regular"
 #define FILE_LIST_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
 #define DIR_TREE_ICON_SIZE GTK_ICON_SIZE_MENU
 
@@ -110,7 +108,7 @@
 };
 
 typedef struct {
-	FRBatchActionType type;
+	FrBatchActionType type;
 	void *            data;
 	GFreeFunc         free_func;
 } FRBatchAction;
@@ -139,6 +137,16 @@
 } ExtractData;
 
 
+typedef enum {
+        FR_WINDOW_AREA_MENUBAR,
+        FR_WINDOW_AREA_TOOLBAR,
+        FR_WINDOW_AREA_LOCATIONBAR,
+        FR_WINDOW_AREA_CONTENTS,
+        FR_WINDOW_AREA_FILTERBAR,
+        FR_WINDOW_AREA_STATUSBAR,
+} FrWindowArea;
+
+
 /* -- FrClipboardData -- */
 
 
@@ -211,10 +219,12 @@
 	LAST_SIGNAL
 };
 
-static GnomeAppClass *parent_class = NULL;
+static GtkWindowClass *parent_class = NULL;
 static guint fr_window_signals[LAST_SIGNAL] = { 0 };
 
 struct _FrWindowPrivateData {
+	GtkWidget         *layout;
+	GtkWidget         *contents;
 	GtkWidget         *list_view;
 	GtkListStore      *list_store;
 	GtkWidget         *tree_view;
@@ -225,10 +235,6 @@
 	GtkWidget         *location_bar;
 	GtkWidget         *location_entry;
 	GtkWidget         *location_label;
-	GtkWidget         *up_button;
-	GtkWidget         *home_button;
-	GtkWidget         *back_button;
-	GtkWidget         *fwd_button;
 	GtkWidget         *filter_bar;
 	GtkWidget         *filter_entry;
 	GtkWidget         *paned;
@@ -717,7 +723,7 @@
 			(GInstanceInitFunc) fr_window_init
 		};
 
-		type = g_type_register_static (GNOME_TYPE_APP,
+		type = g_type_register_static (GTK_TYPE_WINDOW,
 					       "FrWindow",
 					       &type_info,
 					       0);
@@ -1133,7 +1139,6 @@
 get_mime_type_icon (const char *mime_type)
 {
 	GdkPixbuf *pixbuf = NULL;
-	char      *icon_name = NULL;
 	
 	pixbuf = g_hash_table_lookup (tree_pixbuf_hash, mime_type);
 	if (pixbuf != NULL) {
@@ -1141,24 +1146,7 @@
 		return pixbuf;
 	}
 
-	if (strcmp (mime_type, MIME_TYPE_DIRECTORY) == 0)
-		icon_name = g_strdup (ICON_TYPE_DIRECTORY);
-	else
-		icon_name = gnome_icon_lookup (icon_theme,
-                	                       NULL,
-	                                       NULL,
-        	                               NULL,
-                	                       NULL,
-       	                	               mime_type,
-               	                	       GNOME_ICON_LOOKUP_FLAGS_NONE,
-	                       	               NULL);
-	pixbuf = gtk_icon_theme_load_icon (icon_theme,
-					   icon_name,
-					   dir_tree_icon_size,
-					   0,
-					   NULL);
-	g_free (icon_name);						
-						
+	pixbuf = get_mime_type_pixbuf (mime_type, file_list_icon_size, icon_theme);
 	if (pixbuf == NULL)
 		return NULL;
 
@@ -1174,54 +1162,32 @@
 get_icon (GtkWidget *widget,
 	  FileData  *fdata)
 {
-	GdkPixbuf   *pixbuf = NULL;
-	char        *icon_name = NULL;
-	gboolean     free_icon_name = FALSE;
-	const char  *mime_type;
+	GdkPixbuf  *pixbuf = NULL;
+	const char *content_type;
+	GIcon      *icon;
 
 	if (file_data_is_dir (fdata))
-		mime_type = MIME_TYPE_DIRECTORY;
+		content_type = MIME_TYPE_DIRECTORY;
 	else
-		mime_type = g_content_type_get_mime_type (fdata->content_type);
+		content_type = fdata->content_type;
 
 	/* look in the hash table. */
 
-	pixbuf = g_hash_table_lookup (pixbuf_hash, mime_type);
+	pixbuf = g_hash_table_lookup (pixbuf_hash, content_type);
 	if (pixbuf != NULL) {
 		g_object_ref (G_OBJECT (pixbuf));
 		return pixbuf;
 	}
 
-	if (file_data_is_dir (fdata))
-		icon_name = ICON_TYPE_DIRECTORY;
-	else if (! eel_gconf_get_boolean (PREF_LIST_USE_MIME_ICONS, TRUE))
-		icon_name = ICON_TYPE_REGULAR;
-	else {
-		icon_name = gnome_icon_lookup (icon_theme,
-	                                       NULL,
-	                                       NULL,
-	                                       NULL,
-	                                       NULL,
-        	                               mime_type,
-                	                       GNOME_ICON_LOOKUP_FLAGS_NONE,
-                        	               NULL);
-		free_icon_name = TRUE;
-	}
-	
-	pixbuf = gtk_icon_theme_load_icon (icon_theme,
-					   icon_name,
-					   file_list_icon_size,
-					   0,
-					   NULL);
-						
-	if (free_icon_name)
-		g_free (icon_name);						
-						
+	icon = g_content_type_get_icon (content_type);
+	pixbuf = get_icon_pixbuf (icon_theme, G_THEMED_ICON (icon), file_list_icon_size);				
+	g_object_unref (icon);
+			
 	if (pixbuf == NULL)
 		return NULL;
 
 	pixbuf = gdk_pixbuf_copy (pixbuf);
-	g_hash_table_insert (pixbuf_hash, (gpointer) mime_type, pixbuf);
+	g_hash_table_insert (pixbuf_hash, (gpointer) content_type, pixbuf);
 	g_object_ref (G_OBJECT (pixbuf));
 
 	return pixbuf;
@@ -1610,6 +1576,18 @@
 
 
 static void
+set_sensitive (FrWindow   *window,
+	       const char *action_name,
+	       gboolean    sensitive)
+{
+	GtkAction *action;
+	
+	action = gtk_action_group_get_action (window->priv->actions, action_name);
+	g_object_set (action, "sensitive", sensitive, NULL);
+}
+
+
+static void
 fr_window_update_current_location (FrWindow *window)
 {
 	const char *current_dir = fr_window_get_current_location (window);
@@ -1624,10 +1602,11 @@
 	gtk_widget_show (window->priv->location_bar);
 
 	gtk_entry_set_text (GTK_ENTRY (window->priv->location_entry), window->priv->archive_present? current_dir: "");
-	gtk_widget_set_sensitive (window->priv->home_button, window->priv->archive_present);
-	gtk_widget_set_sensitive (window->priv->up_button, window->priv->archive_present && (current_dir != NULL) && (strcmp (current_dir, "/") != 0));
-	gtk_widget_set_sensitive (window->priv->back_button, window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->next != NULL));
-	gtk_widget_set_sensitive (window->priv->fwd_button, window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL));
+	
+	set_sensitive (window, "GoBack", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->next != NULL));
+	set_sensitive (window, "GoForward", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL));
+	set_sensitive (window, "GoUp", window->priv->archive_present && (current_dir != NULL) && (strcmp (current_dir, "/") != 0));
+	set_sensitive (window, "GoHome", window->priv->archive_present);
 	gtk_widget_set_sensitive (window->priv->location_entry, window->priv->archive_present);
 	gtk_widget_set_sensitive (window->priv->location_label, window->priv->archive_present);
 	gtk_widget_set_sensitive (window->priv->filter_entry, window->priv->archive_present);
@@ -1773,7 +1752,8 @@
 		g_free (parent_dir);
 	}
 	g_hash_table_destroy (dir_cache);
-	g_object_unref (icon);
+	if (icon != NULL)
+		g_object_unref (icon);
 			
 	g_ptr_array_free (dirs, TRUE);
 	
@@ -1953,17 +1933,6 @@
 }
 
 
-static void
-set_sensitive (FrWindow   *window,
-	       const char *action_name,
-	       gboolean    sensitive)
-{
-	GtkAction *action;
-	action = gtk_action_group_get_action (window->priv->actions, action_name);
-	g_object_set (action, "sensitive", sensitive, NULL);
-}
-
-
 static gboolean
 check_clipboard_cb (gpointer data)
 {
@@ -4518,44 +4487,6 @@
 }
 
 
-static GtkWidget*
-create_locationbar_button (const char *stock_id,
-			   gboolean    view_text)
-{
-	GtkWidget *button;
-	GtkWidget *box;
-	GtkWidget *image;
-
-	button = gtk_button_new ();
-	gtk_button_set_relief (GTK_BUTTON (button),
-			       GTK_RELIEF_NONE);
-
-	box = gtk_hbox_new (FALSE, 1);
-	image = gtk_image_new ();
-	gtk_image_set_from_stock (GTK_IMAGE (image),
-				  stock_id,
-				  GTK_ICON_SIZE_SMALL_TOOLBAR);
-	gtk_box_pack_start (GTK_BOX (box), image, !view_text, FALSE, 0);
-
-	if (view_text) {
-		GtkStockItem  stock_item;
-		const char   *text;
-		GtkWidget    *label;
-
-		if (gtk_stock_lookup (stock_id, &stock_item))
-			text = stock_item.label;
-		else
-			text = "";
-		label = gtk_label_new_with_mnemonic (text);
-		gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
-	}
-
-	gtk_container_add (GTK_CONTAINER (button), box);
-
-	return button;
-}
-
-
 static void
 menu_item_select_cb (GtkMenuItem *proxy,
 		     FrWindow    *window)
@@ -4638,38 +4569,6 @@
 
 
 static void
-go_up_one_level_cb (GtkWidget *widget,
-		    void      *data)
-{
-	fr_window_go_up_one_level ((FrWindow*) data);
-}
-
-
-static void
-go_home_cb (GtkWidget *widget,
-	    void      *data)
-{
-	fr_window_go_to_location ((FrWindow*) data, "/", FALSE);
-}
-
-
-static void
-go_back_cb (GtkWidget *widget,
-	    void      *data)
-{
-	fr_window_go_back ((FrWindow*) data);
-}
-
-
-static void
-go_forward_cb (GtkWidget *widget,
-	       void      *data)
-{
-	fr_window_go_forward ((FrWindow*) data);
-}
-
-
-static void
 recent_chooser_item_activated_cb (GtkRecentChooser *chooser,
 				  FrWindow         *window)
 {
@@ -4761,11 +4660,73 @@
 
 
 static void
+fr_window_attach (FrWindow      *window,
+                  GtkWidget     *child,
+                  FrWindowArea   area)
+{
+	int position;
+
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (FR_IS_WINDOW (window));
+	g_return_if_fail (child != NULL);
+	g_return_if_fail (GTK_IS_WIDGET (child));
+
+	switch (area) {
+	case FR_WINDOW_AREA_MENUBAR:
+		position = 0;
+		break;
+	case FR_WINDOW_AREA_TOOLBAR:
+		position = 1;
+		break;
+	case FR_WINDOW_AREA_LOCATIONBAR:
+		position = 2;
+		break;
+	case FR_WINDOW_AREA_CONTENTS:
+		position = 3;
+		if (window->priv->contents != NULL)
+			gtk_widget_destroy (window->priv->contents);
+		window->priv->contents = child;
+		break;
+	case FR_WINDOW_AREA_FILTERBAR:
+		position = 4;
+		break;
+	case FR_WINDOW_AREA_STATUSBAR:
+		position = 5;
+		break;
+	default:
+		g_critical ("%s: area not recognized!", G_STRFUNC);
+		return;
+		break;
+	}
+        
+	gtk_table_attach (GTK_TABLE (window->priv->layout),
+			  child,
+			  0, 1,
+			  position, position + 1,
+			  GTK_EXPAND | GTK_FILL,
+			  ((area == FR_WINDOW_AREA_CONTENTS) ? GTK_EXPAND : 0) | GTK_FILL,
+			  0, 0);
+}
+
+
+static void
+set_action_important (GtkUIManager *ui,
+		      const char   *action_name)
+{
+	GtkAction *action;
+
+	action = gtk_ui_manager_get_action (ui, action_name);
+	g_object_set (action, "is_important", TRUE, NULL);
+	g_object_unref (action);
+}
+
+
+static void
 fr_window_construct (FrWindow *window)
 {
+	GtkWidget        *menubar;
 	GtkWidget        *toolbar;
 	GtkWidget        *list_scrolled_window;
-	GtkWidget        *vbox;
 	GtkWidget        *location_box;
 	GtkStatusbar     *statusbar;
 	GtkWidget        *statusbar_box;
@@ -4796,8 +4757,11 @@
 
 	/* Create the application. */
 
-	gnome_app_construct (GNOME_APP (window), "main", _("Archive Manager"));
-	gnome_window_icon_set_from_default (GTK_WINDOW (window));
+	window->priv->layout = gtk_table_new (4, 1, FALSE);
+        gtk_container_add (GTK_CONTAINER (window), window->priv->layout);
+        gtk_widget_show (window->priv->layout);
+
+	gtk_window_set_title (GTK_WINDOW (window), _("Archive Manager"));
 
 	g_signal_connect (G_OBJECT (window),
 			  "delete_event",
@@ -4940,6 +4904,10 @@
 	
 	/* Create the widgets. */
 
+	window->priv->tooltips = gtk_tooltips_new ();
+	g_object_ref (G_OBJECT (window->priv->tooltips));
+	gtk_object_sink (GTK_OBJECT (window->priv->tooltips));
+
 	/* * File list. */
 
 	window->priv->list_store = fr_list_model_new (NUMBER_OF_COLUMNS,
@@ -5032,102 +5000,11 @@
 					GTK_POLICY_AUTOMATIC);
 	gtk_container_add (GTK_CONTAINER (list_scrolled_window), window->priv->list_view);
 
-	/* * Location bar. */
-
-	location_box = gtk_hbox_new (FALSE, 1);
-	gtk_container_set_border_width (GTK_CONTAINER (location_box), 3);
-
-	window->priv->location_bar = gnome_app_add_docked (GNOME_APP (window),
-						     location_box,
-						     "LocationBar",
-						     (BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL
-						      | BONOBO_DOCK_ITEM_BEH_EXCLUSIVE
-						      | (eel_gconf_get_boolean (PREF_DESKTOP_TOOLBAR_DETACHABLE, TRUE) ? BONOBO_DOCK_ITEM_BEH_NORMAL : BONOBO_DOCK_ITEM_BEH_LOCKED)),
-						     BONOBO_DOCK_TOP,
-						     3, 1, 0);
-
-	/* buttons. */
-
-	window->priv->tooltips = gtk_tooltips_new ();
-	g_object_ref (G_OBJECT (window->priv->tooltips));
-	gtk_object_sink (GTK_OBJECT (window->priv->tooltips));
-
-	window->priv->back_button = create_locationbar_button (GTK_STOCK_GO_BACK, TRUE);
-	gtk_tooltips_set_tip (window->priv->tooltips, window->priv->back_button, _("Go to the previous visited location"), NULL);
-	gtk_box_pack_start (GTK_BOX (location_box), window->priv->back_button, FALSE, FALSE, 0);
-	g_signal_connect (G_OBJECT (window->priv->back_button),
-			  "clicked",
-			  G_CALLBACK (go_back_cb),
-			  window);
-
-	window->priv->fwd_button = create_locationbar_button (GTK_STOCK_GO_FORWARD, FALSE);
-	gtk_tooltips_set_tip (window->priv->tooltips, window->priv->fwd_button, _("Go to the next visited location"), NULL);
-	gtk_box_pack_start (GTK_BOX (location_box), window->priv->fwd_button, FALSE, FALSE, 0);
-	g_signal_connect (G_OBJECT (window->priv->fwd_button),
-			  "clicked",
-			  G_CALLBACK (go_forward_cb),
-			  window);
-
-	window->priv->up_button = create_locationbar_button (GTK_STOCK_GO_UP, FALSE);
-	gtk_tooltips_set_tip (window->priv->tooltips, window->priv->up_button, _("Go up one level"), NULL);
-	gtk_box_pack_start (GTK_BOX (location_box), window->priv->up_button, FALSE, FALSE, 0);
-	g_signal_connect (G_OBJECT (window->priv->up_button),
-			  "clicked",
-			  G_CALLBACK (go_up_one_level_cb),
-			  window);
-
-	window->priv->home_button = create_locationbar_button (GTK_STOCK_HOME, FALSE);
-	gtk_tooltips_set_tip (window->priv->tooltips, window->priv->home_button, _("Go to the home location"), NULL);
-	gtk_box_pack_start (GTK_BOX (location_box), window->priv->home_button, FALSE, FALSE, 0);
-	g_signal_connect (G_OBJECT (window->priv->home_button),
-			  "clicked",
-			  G_CALLBACK (go_home_cb),
-			  window);
-
-	/* separator */
-
-	vbox = gtk_vbox_new (FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (location_box),
-			    vbox,
-			    FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox),
-			    gtk_vseparator_new (),
-			    TRUE, TRUE, 5);
-
-	/* current location */
-
-	window->priv->location_label = gtk_label_new (_("Location:"));
-	gtk_box_pack_start (GTK_BOX (location_box),
-			    window->priv->location_label, FALSE, FALSE, 5);
-
-	window->priv->location_entry = sexy_icon_entry_new ();
-	sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (window->priv->location_entry),
-				  SEXY_ICON_ENTRY_PRIMARY,
-				  GTK_IMAGE (gtk_image_new_from_stock (GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU)));
-
-	gtk_box_pack_start (GTK_BOX (location_box),
-			    window->priv->location_entry, TRUE, TRUE, 5);
-
-	g_signal_connect (G_OBJECT (window->priv->location_entry),
-			  "key_press_event",
-			  G_CALLBACK (location_entry_key_press_event_cb),
-			  window);
-			  
-	gtk_widget_show_all (window->priv->location_bar);
-
 	/* filter bar */
 
-	filter_box = gtk_hbox_new (FALSE, 6);
+	window->priv->filter_bar = filter_box = gtk_hbox_new (FALSE, 6);
 	gtk_container_set_border_width (GTK_CONTAINER (filter_box), 3);
-
-	window->priv->filter_bar = gnome_app_add_docked (GNOME_APP (window),
-						         filter_box,
-						         "FilterBar",
-						         (BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL
-						          | BONOBO_DOCK_ITEM_BEH_EXCLUSIVE
-						          | (eel_gconf_get_boolean (PREF_DESKTOP_TOOLBAR_DETACHABLE, TRUE) ? BONOBO_DOCK_ITEM_BEH_NORMAL : BONOBO_DOCK_ITEM_BEH_LOCKED)),
-						         BONOBO_DOCK_BOTTOM,
-						         4, 1, 0);
+	fr_window_attach (FR_WINDOW (window), window->priv->filter_bar, FR_WINDOW_AREA_FILTERBAR);
 	
 	gtk_box_pack_start (GTK_BOX (filter_box),
 			    gtk_label_new (_("Find:")), FALSE, FALSE, 0);
@@ -5217,10 +5094,10 @@
 	gtk_paned_pack1 (GTK_PANED (window->priv->paned), window->priv->sidepane, FALSE, TRUE);
 	gtk_paned_pack2 (GTK_PANED (window->priv->paned), list_scrolled_window, TRUE, TRUE);
 	gtk_paned_set_position (GTK_PANED (window->priv->paned), eel_gconf_get_integer (PREF_UI_SIDEBAR_WIDTH, DEF_SIDEBAR_WIDTH));
+	
+	fr_window_attach (FR_WINDOW (window), window->priv->paned, FR_WINDOW_AREA_CONTENTS);
 	gtk_widget_show_all (window->priv->paned);
 	
-	gnome_app_set_contents (GNOME_APP (window), window->priv->paned);
-
 	/* Build the menu and the toolbar. */
 
 	ui = gtk_ui_manager_new ();
@@ -5261,25 +5138,61 @@
 		g_message ("building menus failed: %s", error->message);
 		g_error_free (error);
 	}
-
-	gnome_app_add_docked (GNOME_APP (window),
-			      gtk_ui_manager_get_widget (ui, "/MenuBar"),
-			      "MenuBar",
-			      (BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL
-			       | BONOBO_DOCK_ITEM_BEH_EXCLUSIVE
-			       | (eel_gconf_get_boolean (PREF_DESKTOP_MENUBAR_DETACHABLE, TRUE) ? BONOBO_DOCK_ITEM_BEH_NORMAL : BONOBO_DOCK_ITEM_BEH_LOCKED)),
-			      BONOBO_DOCK_TOP,
-			      1, 1, 0);
+	
+	menubar = gtk_ui_manager_get_widget (ui, "/MenuBar");
+	fr_window_attach (FR_WINDOW (window), menubar, FR_WINDOW_AREA_MENUBAR);
+	gtk_widget_show (menubar);
+	 
 	window->priv->toolbar = toolbar = gtk_ui_manager_get_widget (ui, "/ToolBar");
 	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
+	set_action_important (ui, "/ToolBar/Extract_Toolbar");
 
-	{
-		GtkAction *action;
+	/* location bar */
+
+	window->priv->location_bar = gtk_ui_manager_get_widget (ui, "/LocationBar");
+	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (window->priv->location_bar), FALSE);
+	gtk_toolbar_set_style (GTK_TOOLBAR (window->priv->location_bar), GTK_TOOLBAR_BOTH_HORIZ);
+	set_action_important (ui, "/LocationBar/GoBack");
 
-		action = gtk_ui_manager_get_action (ui, "/ToolBar/Extract_Toolbar");
-		g_object_set (action, "is_important", TRUE, NULL);
-		g_object_unref (action);
+	/* current location */
+
+	location_box = gtk_hbox_new (FALSE, 6);
+	window->priv->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
+	gtk_box_pack_start (GTK_BOX (location_box),
+			    window->priv->location_label, FALSE, FALSE, 5);
+
+	window->priv->location_entry = sexy_icon_entry_new ();
+	sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (window->priv->location_entry),
+				  SEXY_ICON_ENTRY_PRIMARY,
+				  GTK_IMAGE (gtk_image_new_from_stock (GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU)));
+
+	gtk_box_pack_start (GTK_BOX (location_box),
+			    window->priv->location_entry, TRUE, TRUE, 5);
+
+	g_signal_connect (G_OBJECT (window->priv->location_entry),
+			  "key_press_event",
+			  G_CALLBACK (location_entry_key_press_event_cb),
+			  window);
+	
+	{
+		GtkToolItem *tool_item;
+		
+		tool_item = gtk_separator_tool_item_new ();
+		gtk_widget_show_all (GTK_WIDGET (tool_item));
+		gtk_toolbar_insert (GTK_TOOLBAR (window->priv->location_bar), tool_item, -1);
+		
+		tool_item = gtk_tool_item_new ();
+		gtk_tool_item_set_expand (tool_item, TRUE);
+		gtk_container_add (GTK_CONTAINER (tool_item), location_box);
+		gtk_widget_show_all (GTK_WIDGET (tool_item));
+		gtk_toolbar_insert (GTK_TOOLBAR (window->priv->location_bar), tool_item, -1);
 	}
+	
+	fr_window_attach (FR_WINDOW (window), window->priv->location_bar, FR_WINDOW_AREA_LOCATIONBAR);
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) 
+		gtk_widget_hide (window->priv->location_bar);
+	else
+		gtk_widget_show (window->priv->location_bar);
 
 	/* Recent manager */
 
@@ -5311,7 +5224,7 @@
 	gtk_action_connect_proxy (window->priv->open_action, GTK_WIDGET (open_recent_tool_item));
 
 	gtk_widget_show (GTK_WIDGET (open_recent_tool_item));
-	gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar), open_recent_tool_item, 1);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), open_recent_tool_item, 1);
 
 	/**/
 
@@ -5326,22 +5239,19 @@
 				  GTK_WIDGET (open_recent_tool_item));
 
 	gtk_widget_show (GTK_WIDGET (open_recent_tool_item));
-	gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar),
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
 			    open_recent_tool_item,
 			    4);
 	*/
-
+	
 	/**/
 
-	gnome_app_add_docked (GNOME_APP (window),
-			      toolbar,
-			      "ToolBar",
-			      (BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL
-			       | BONOBO_DOCK_ITEM_BEH_EXCLUSIVE
-			       | (eel_gconf_get_boolean (PREF_DESKTOP_TOOLBAR_DETACHABLE, TRUE) ? BONOBO_DOCK_ITEM_BEH_NORMAL : BONOBO_DOCK_ITEM_BEH_LOCKED)),
-			      BONOBO_DOCK_TOP,
-			      2, 1, 0);
-
+	fr_window_attach (FR_WINDOW (window), window->priv->toolbar, FR_WINDOW_AREA_TOOLBAR);
+	if (eel_gconf_get_boolean (PREF_UI_TOOLBAR, TRUE))
+		gtk_widget_show (toolbar);
+	else
+		gtk_widget_hide (toolbar);
+	
 	window->priv->file_popup_menu = gtk_ui_manager_get_widget (ui, "/FilePopupMenu");
 	window->priv->folder_popup_menu = gtk_ui_manager_get_widget (ui, "/FolderPopupMenu");
 	window->priv->sidebar_folder_popup_menu = gtk_ui_manager_get_widget (ui, "/SidebarFolderPopupMenu");
@@ -5373,8 +5283,13 @@
                 gtk_widget_show (vbox);
         }
         gtk_widget_show (statusbar_box);
-	gnome_app_set_statusbar (GNOME_APP (window), window->priv->statusbar);
-	gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (window->priv->statusbar), TRUE);
+        gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (window->priv->statusbar), TRUE);
+        
+	fr_window_attach (FR_WINDOW (window), window->priv->statusbar, FR_WINDOW_AREA_STATUSBAR);
+	if (eel_gconf_get_boolean (PREF_UI_STATUSBAR, TRUE))
+		gtk_widget_show (window->priv->statusbar);
+	else
+		gtk_widget_hide (window->priv->statusbar);
 
 	/**/
 
@@ -7949,9 +7864,9 @@
 	g_return_if_fail (window != NULL);
 
 	if (visible)
-		gtk_widget_show (window->priv->toolbar->parent);
+		gtk_widget_show (window->priv->toolbar);
 	else
-		gtk_widget_hide (window->priv->toolbar->parent);
+		gtk_widget_hide (window->priv->toolbar);
 
 	set_active (window, "ViewToolbar", visible);
 }
@@ -8139,7 +8054,7 @@
 
 void
 fr_window_set_current_batch_action (FrWindow          *window,
-				    FRBatchActionType  action,
+				    FrBatchActionType  action,
 				    void              *data,
 				    GFreeFunc          free_func)
 {
@@ -8162,7 +8077,7 @@
 
 void
 fr_window_append_batch_action (FrWindow          *window,
-			       FRBatchActionType  action,
+			       FrBatchActionType  action,
 			       void              *data,
 			       GFreeFunc          free_func)
 {

Modified: trunk/src/fr-window.h
==============================================================================
--- trunk/src/fr-window.h	(original)
+++ trunk/src/fr-window.h	Mon Apr 14 16:24:11 2008
@@ -25,7 +25,6 @@
 
 #include <gio/gio.h>
 #include <gtk/gtk.h>
-#include <libgnomeui/libgnomeui.h>
 #include "typedefs.h"
 #include "fr-archive.h"
 
@@ -67,7 +66,7 @@
 	FR_BATCH_ACTION_CLOSE,
 	FR_BATCH_ACTION_QUIT,
 	FR_BATCH_ACTIONS
-} FRBatchActionType;
+} FrBatchActionType;
 
 /* -- FrWindow -- */
 
@@ -84,15 +83,14 @@
 
 struct _FrWindow
 {
-	GnomeApp __parent;
-
-	FrArchive           *archive;
+	GtkWindow __parent;
+	FrArchive *archive;
 	FrWindowPrivateData *priv;
 };
 
 struct _FrWindowClass
 {
-	GnomeAppClass __parent_class;
+	GtkWindowClass __parent_class;
 
 	/*<signals>*/
 
@@ -102,7 +100,7 @@
 
 GType       fr_window_get_type                  (void);
 GtkWidget * fr_window_new                       (void);
-void        fr_window_close                     (FrWindow *window);
+void        fr_window_close                     (FrWindow      *window);
 
 /* archive operations */
 
@@ -277,13 +275,13 @@
 
 void       fr_window_new_batch                    (FrWindow      *window);
 void       fr_window_set_current_batch_action     (FrWindow      *window,
-						   FRBatchActionType  action,
+						   FrBatchActionType  action,
 						   void          *data,
 						   GFreeFunc      free_func);
 void       fr_window_reset_current_batch_action   (FrWindow      *window);
 void       fr_window_restart_current_batch_action (FrWindow      *window);
 void       fr_window_append_batch_action          (FrWindow      *window,
-						   FRBatchActionType  action,
+						   FrBatchActionType  action,
 						   void          *data,
 						   GFreeFunc      free_func);
 void       fr_window_start_batch                  (FrWindow      *window);

Modified: trunk/src/gtk-utils.c
==============================================================================
--- trunk/src/gtk-utils.c	(original)
+++ trunk/src/gtk-utils.c	Mon Apr 14 16:24:11 2008
@@ -806,6 +806,16 @@
 	g_object_get (icon, "names", &icon_names, NULL);
 	
 	icon_info = gtk_icon_theme_choose_icon (icon_theme, (const char **)icon_names, size, 0);
+	if (icon_info == NULL) {
+		GIcon *default_icon;
+		
+		default_icon = g_content_type_get_icon ("gnome-fs-regular");
+		pixbuf = get_icon_pixbuf (icon_theme, G_THEMED_ICON (default_icon), size);
+		g_object_unref (default_icon);
+		
+		return pixbuf;
+	}
+		
 	pixbuf = gtk_icon_info_load_icon (icon_info, &error);
 	if (pixbuf == NULL) {
 		g_warning ("could not load icon pixbuf: %s\n", error->message);
@@ -819,6 +829,25 @@
 }
 
 
+GdkPixbuf *
+get_mime_type_pixbuf (const char   *mime_type,
+		      int           icon_size,
+		      GtkIconTheme *icon_theme)
+{
+	GdkPixbuf *pixbuf = NULL;
+	GIcon     *icon;
+	
+	if (icon_theme == NULL) 
+		icon_theme = gtk_icon_theme_get_default ();
+	
+	icon = g_content_type_get_icon (mime_type);
+	pixbuf = get_icon_pixbuf (icon_theme, G_THEMED_ICON (icon), icon_size);
+	g_object_unref (icon);
+	
+	return pixbuf;
+}
+
+
 int
 get_folder_pixbuf_size_for_list (GtkWidget *widget)
 {

Modified: trunk/src/gtk-utils.h
==============================================================================
--- trunk/src/gtk-utils.h	(original)
+++ trunk/src/gtk-utils.h	Mon Apr 14 16:24:11 2008
@@ -76,6 +76,9 @@
 GdkPixbuf * get_icon_pixbuf                 (GtkIconTheme *icon_theme,
 		 			     GThemedIcon  *icon,
 		 			     int           size); 
+GdkPixbuf * get_mime_type_pixbuf            (const char   *mime_type,
+		                             int           icon_size,
+		                             GtkIconTheme *icon_theme);
 int         get_folder_pixbuf_size_for_list (GtkWidget    *widget);
 void        show_help_dialog                (GtkWindow    *parent,
 					     const char   *section);

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Mon Apr 14 16:24:11 2008
@@ -47,7 +47,6 @@
 static gboolean load_session        (void);
 
 GList        *WindowList = NULL;
-GList        *ViewerList = NULL;
 GList        *CommandList = NULL;
 gint          ForceDirectoryCreation;
 GHashTable   *ProgramsCache = NULL;
@@ -250,40 +249,13 @@
 	eel_gconf_monitor_add (PREF_NAUTILUS_CLICK_POLICY);
 
 	ProgramsCache = g_hash_table_new_full (g_str_hash,
-						g_str_equal,
-						g_free,
-						NULL);
+					       g_str_equal,
+					       g_free,
+					       NULL);
 }
 
 /* Free application data. */
 
-void
-viewer_done (ViewerData *vdata)
-{
-	if ((vdata->temp_dir != NULL) && uri_is_dir (vdata->temp_dir)) {
-		char *argv[4];
-
-		argv[0] = "rm";
-		argv[1] = "-rf";
-		argv[2] = vdata->temp_dir;
-		argv[3] = NULL;
-		g_spawn_sync (g_get_tmp_dir (), argv, NULL,
-			      G_SPAWN_SEARCH_PATH,
-			      NULL, NULL,
-			      NULL, NULL, NULL,
-			      NULL);
-	}
-
-	g_free (vdata->filename);
-	g_free (vdata->e_filename);
-	g_free (vdata->temp_dir);
-	if (vdata->process != NULL)
-		g_object_unref (vdata->process);
-
-	ViewerList = g_list_remove (ViewerList, vdata);
-	g_free (vdata);
-}
-
 
 void
 command_done (CommandData *cdata)
@@ -325,11 +297,6 @@
 
 	eel_global_client_free ();
 
-	while (ViewerList != NULL) {
-		ViewerData *vdata = ViewerList->data;
-		viewer_done (vdata);
-	}
-
 	while (CommandList != NULL) {
 		CommandData *cdata = CommandList->data;
 		command_done (cdata);

Modified: trunk/src/main.h
==============================================================================
--- trunk/src/main.h	(original)
+++ trunk/src/main.h	Mon Apr 14 16:24:11 2008
@@ -55,7 +55,6 @@
 
 
 extern GList       *WindowList;
-extern GList       *ViewerList;
 extern GList       *CommandList;
 extern gint         ForceDirectoryCreation;
 extern GHashTable  *ProgramsCache;

Modified: trunk/src/ui.h
==============================================================================
--- trunk/src/ui.h	(original)
+++ trunk/src/ui.h	Mon Apr 14 16:24:11 2008
@@ -193,6 +193,23 @@
 	  NULL, NULL,
 	  N_("Open the selected folder"),
 	  G_CALLBACK (activate_action_open_folder_from_sidebar) },
+	  
+	{ "GoBack", GTK_STOCK_GO_BACK,
+	  NULL, NULL,
+	  N_("Go to the previous visited location"),
+	  G_CALLBACK (activate_action_go_back) },
+	{ "GoForward", GTK_STOCK_GO_FORWARD,
+	  NULL, NULL,
+	  N_("Open Go to the next visited location selected folder"),
+	  G_CALLBACK (activate_action_go_forward) },
+	{ "GoUp", GTK_STOCK_GO_UP,
+	  NULL, NULL,
+	  N_("Go up one level"),
+	  G_CALLBACK (activate_action_go_up) },
+	{ "GoHome", GTK_STOCK_HOME,
+	  NULL, NULL,
+	  N_("Go to the home location"),
+	  G_CALLBACK (activate_action_go_home) },
 };
 static guint n_action_entries = G_N_ELEMENTS (action_entries);
 
@@ -326,6 +343,12 @@
 "    <separator/>"
 "    <toolitem action='Stop'/>"
 "  </toolbar>"
+"  <toolbar name='LocationBar'>"
+"    <toolitem action='GoBack'/>"
+"    <toolitem action='GoForward'/>"
+"    <toolitem action='GoUp'/>"
+"    <toolitem action='GoHome'/>"
+"  </toolbar>"
 "  <popup name='FilePopupMenu'>"
 "    <menuitem action='ViewSelection'/>"
 "    <menuitem action='OpenSelection'/>"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]