marlin r1319 - trunk/src



Author: iain
Date: Sun Oct 19 01:57:34 2008
New Revision: 1319
URL: http://svn.gnome.org/viewvc/marlin?rev=1319&view=rev

Log:
Open recent files in the current window if it is empty


Modified:
   trunk/src/ChangeLog
   trunk/src/marlin-recent-action.c
   trunk/src/marlin-window-menu.c
   trunk/src/marlin-window.c
   trunk/src/marlin-window.h

Modified: trunk/src/marlin-recent-action.c
==============================================================================
--- trunk/src/marlin-recent-action.c	(original)
+++ trunk/src/marlin-recent-action.c	Sun Oct 19 01:57:34 2008
@@ -51,12 +51,12 @@
 
 	dialog = gtk_recent_chooser_dialog_new ("Recent Documents",
 						NULL,
-						GTK_STOCK_CANCEL, 
+						GTK_STOCK_CANCEL,
 						GTK_RESPONSE_CANCEL,
 						GTK_STOCK_OPEN,
 						GTK_RESPONSE_ACCEPT,
 						NULL);
-	
+
 	chooser = GTK_RECENT_CHOOSER (dialog);
 
 	filter = gtk_recent_filter_new ();

Modified: trunk/src/marlin-window-menu.c
==============================================================================
--- trunk/src/marlin-window-menu.c	(original)
+++ trunk/src/marlin-window-menu.c	Sun Oct 19 01:57:34 2008
@@ -107,7 +107,14 @@
 		  GtkRecentInfo *info,
 		  MarlinWindow  *window)
 {
-	marlin_open_window (gtk_recent_info_get_uri (info), NULL, NULL, NULL);
+	const char *uri;
+
+	uri = gtk_recent_info_get_uri (info);
+	if (marlin_window_is_empty (window)) {
+		marlin_window_load_file (window, uri);
+	} else {
+		marlin_open_window (uri, NULL, NULL, NULL);
+	}
 }
 
 static void

Modified: trunk/src/marlin-window.c
==============================================================================
--- trunk/src/marlin-window.c	(original)
+++ trunk/src/marlin-window.c	Sun Oct 19 01:57:34 2008
@@ -4865,7 +4865,7 @@
 	MarlinSample *clipboard;
 	MarlinUndoContext *ctxt;
 	MarlinRange range;
-	
+
 	priv = window->priv;
 
 	clipboard = MARLIN_SAMPLE (marlin_program_get_clipboard (program));
@@ -4884,10 +4884,10 @@
 		g_object_get (G_OBJECT (priv->view),
 			      "cursor_position", &(range.start),
 			      NULL);
-		
+
 		range.finish += range.start;
 	}
-	
+
 	ctxt = marlin_undo_manager_context_begin (priv->undo, _("Replace"));
 	/* Replace is really a "mix with the dest at 0%" */
 	marlin_sample_mix (priv->sample, clipboard, 0.0, MARLIN_INFINITE_DB,
@@ -4969,11 +4969,11 @@
 marlin_window_show_properties (MarlinWindow *window)
 {
 	MarlinWindowPrivate *priv = window->priv;
-	
+
 	if (priv->properties_dialog != NULL) {
 		gtk_window_present (GTK_WINDOW (priv->properties_dialog));
 		return;
-	} 
+	}
 
 	priv->properties_dialog = marlin_information_dialog_new (MARLIN_BASE_WINDOW (window));
 	g_signal_connect (G_OBJECT (priv->properties_dialog), "destroy",
@@ -5384,3 +5384,27 @@
 			  &priv->edit_marker_dialog);
 	gtk_widget_show (priv->edit_marker_dialog);
 }
+
+/**
+ * marlin_window_is_empty:
+ * window: A #MarlinWindow object
+ *
+ * Checks if @window has a sample loaded or not.
+ *
+ * Return value: TRUE if the window is empty, FALSE otherwise.
+ */
+gboolean
+marlin_window_is_empty (MarlinWindow *window)
+{
+	MarlinWindowPrivate *priv;
+	guint64 frames;
+
+	g_return_val_if_fail (IS_MARLIN_WINDOW (window), FALSE);
+	priv = window->priv;
+
+	g_object_get (priv->sample,
+		      "total-frames", &frames,
+		      NULL);
+
+	return (frames == 0);
+}

Modified: trunk/src/marlin-window.h
==============================================================================
--- trunk/src/marlin-window.h	(original)
+++ trunk/src/marlin-window.h	Sun Oct 19 01:57:34 2008
@@ -170,5 +170,6 @@
 void marlin_window_marker_view_snap_to_ticks (MarlinWindow *window,
 					      gboolean snap);
 void marlin_window_marker_view_edit_marker (MarlinWindow *window);
+gboolean marlin_window_is_empty (MarlinWindow *window);
 
 #endif



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