brasero r925 - in trunk: . src



Author: philippr
Date: Sat Jun 28 11:16:43 2008
New Revision: 925
URL: http://svn.gnome.org/viewvc/brasero?rev=925&view=rev

Log:
	Fixed some problems for beagle search
	Fixed some problems with playlist pane
	Stop size preview (in statusbar) to carry on when we change a pane

	* src/brasero-io.c (brasero_io_start_end_playlist_cb),
	(brasero_io_parse_playlist_get_uris),
	(brasero_io_parse_playlist_thread):
	* src/brasero-io.h:
	* src/brasero-layout.c (brasero_layout_combo_changed_cb):
	* src/brasero-playlist.c (brasero_playlist_start_beagle_search),
	(brasero_playlist_parse_result),
	(brasero_playlist_add_uri_playlist):
	* src/brasero-search-entry.c (brasero_search_entry_get_query):

Modified:
   trunk/ChangeLog
   trunk/src/brasero-io.c
   trunk/src/brasero-io.h
   trunk/src/brasero-layout.c
   trunk/src/brasero-playlist.c
   trunk/src/brasero-project-manager.c
   trunk/src/brasero-search-entry.c

Modified: trunk/src/brasero-io.c
==============================================================================
--- trunk/src/brasero-io.c	(original)
+++ trunk/src/brasero-io.c	Sat Jun 28 11:16:43 2008
@@ -886,9 +886,13 @@
 
 static void
 brasero_io_start_end_playlist_cb (TotemPlParser *parser,
-				  const gchar *title,
+				  const gchar *uri,
+				  GHashTable *metadata,
 				  BraseroIOPlaylist *data)
 {
+	const gchar *title;
+
+	title = g_hash_table_lookup (metadata, TOTEM_PL_PARSER_FIELD_TITLE);
 	if (!title)
 		return;
 
@@ -906,11 +910,11 @@
 
 	parser = totem_pl_parser_new ();
 	g_signal_connect (parser,
-			  "playlist-start",
+			  "playlist-started",
 			  G_CALLBACK (brasero_io_start_end_playlist_cb),
 			  playlist);
 	g_signal_connect (parser,
-			  "playlist-end",
+			  "playlist-ended",
 			  G_CALLBACK (brasero_io_start_end_playlist_cb),
 			  playlist);
 	g_signal_connect (parser,
@@ -956,7 +960,6 @@
 					  NULL,
 					  error,
 					  job->callback_data);
-
 		return BRASERO_ASYNC_TASK_FINISHED;
 	}
 
@@ -965,7 +968,17 @@
 
 	/* that's finished; Send the title */
 	info = g_file_info_new ();
-	g_file_info_set_attribute_string (info, BRASERO_IO_PLAYLIST_TITLE, data.title ? data.title:_("No title"));
+	g_file_info_set_attribute_boolean (info,
+					   BRASERO_IO_IS_PLAYLIST,
+					   TRUE);
+	g_file_info_set_attribute_uint32 (info,
+					  BRASERO_IO_PLAYLIST_ENTRIES_NUM,
+					  g_slist_length (data.uris));
+	if (data.title)
+		g_file_info_set_attribute_string (info,
+						  BRASERO_IO_PLAYLIST_TITLE,
+						  data.title);
+
 	brasero_io_return_result (BRASERO_IO (manager),
 				  job->base,
 				  job->uri,

Modified: trunk/src/brasero-io.h
==============================================================================
--- trunk/src/brasero-io.h	(original)
+++ trunk/src/brasero-io.h	Sat Jun 28 11:16:43 2008
@@ -76,6 +76,8 @@
 #define BRASERO_IO_XFER_DESTINATION	"xfer::destination"
 
 #define BRASERO_IO_PLAYLIST_TITLE	"playlist::title"
+#define BRASERO_IO_IS_PLAYLIST		"playlist::is_playlist"
+#define BRASERO_IO_PLAYLIST_ENTRIES_NUM	"playlist::entries_num"
 
 #define BRASERO_IO_COUNT_NUM		"count::num"
 #define BRASERO_IO_COUNT_SIZE		"count::size"

Modified: trunk/src/brasero-layout.c
==============================================================================
--- trunk/src/brasero-layout.c	(original)
+++ trunk/src/brasero-layout.c	Sat Jun 28 11:16:43 2008
@@ -720,12 +720,13 @@
 	source = brasero_layout_item_get_object (item);
 	if (!BRASERO_IS_URI_CONTAINER (source)) {
 		BRASERO_BURN_LOG ("Item is not an URI container");
-		brasero_project_set_source (BRASERO_PROJECT (layout->priv->project),
-					    NULL);
+		brasero_project_set_source (BRASERO_PROJECT (layout->priv->project), NULL);
 	}
-	else
+	else {
+		brasero_uri_container_uri_selected (BRASERO_URI_CONTAINER (source));
 		brasero_project_set_source (BRASERO_PROJECT (layout->priv->project),
 					    BRASERO_URI_CONTAINER (source));
+	}
 
 	brasero_layout_save (layout, item->id);
 }

Modified: trunk/src/brasero-playlist.c
==============================================================================
--- trunk/src/brasero-playlist.c	(original)
+++ trunk/src/brasero-playlist.c	Sat Jun 28 11:16:43 2008
@@ -492,6 +492,9 @@
 	playlist->priv->client = beagle_client_new (NULL);
 	if(playlist->priv->client) {
 		GError *error = NULL;
+		BeagleQueryPartOr *or_part;
+		BeagleQueryPartHuman *type;
+		BeagleQueryPartProperty *filetype;
 
 		playlist->priv->query = beagle_query_new ();
 
@@ -505,12 +508,37 @@
 				  G_CALLBACK (brasero_playlist_beagle_finished_cb),
 				  playlist);
 	
-		beagle_query_add_text (playlist->priv->query, "Files");
-	
-		beagle_query_add_text (playlist->priv->query, "audio/x-scpls");
-		beagle_query_add_text (playlist->priv->query, "audio/x-ms-asx");
-		beagle_query_add_text (playlist->priv->query, "audio/x-mp3-playlist");
-		beagle_query_add_text (playlist->priv->query, "audio/x-mpegurl");
+		type = beagle_query_part_human_new ();
+		beagle_query_part_human_set_string (type, "type:File");
+		beagle_query_add_part (playlist->priv->query, BEAGLE_QUERY_PART (type));
+
+		or_part = beagle_query_part_or_new ();
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:MimeType");
+		beagle_query_part_property_set_value (filetype, "audio/x-ms-asx");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:MimeType");
+		beagle_query_part_property_set_value (filetype, "audio/x-mpegurl");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:MimeType");
+		beagle_query_part_property_set_value (filetype, "audio/x-scpls");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:FileType");
+		beagle_query_part_property_set_value (filetype, "audio/x-mp3-playlist");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
+
+		beagle_query_add_part (playlist->priv->query, BEAGLE_QUERY_PART (or_part));
 
 		brasero_playlist_increase_activity_counter (playlist);
 		beagle_client_send_request_async (playlist->priv->client,
@@ -834,13 +862,11 @@
 			       gpointer callback_data)
 {
 	gint num;
-	gboolean has_audio;
 	gint64 total_length;
 	GtkTreeModel *model;
 	GtkTreePath *treepath;
 	GtkTreeIter parent, row;
 	gchar *len_string, *num_string;
-	const gchar *playlist_title = NULL;
 	BraseroPlaylistParseData *data = callback_data;
 	BraseroPlaylist *playlist = BRASERO_PLAYLIST (object);
 
@@ -849,8 +875,9 @@
 	gtk_tree_model_get_iter (model, &parent, treepath);
 	gtk_tree_path_free (treepath);
 
-	playlist_title = g_file_info_get_attribute_string (info, BRASERO_IO_PLAYLIST_TITLE);
-	if (playlist_title) {
+	if (info && g_file_info_get_attribute_boolean (info, BRASERO_IO_IS_PLAYLIST)) {
+		const gchar *playlist_title = NULL;
+
 		/* The first entry returned is always the playlist as a whole:
 		 * if it was successfully parsed uri is the title if any. If not
 		 * it's simply the URI */
@@ -861,10 +888,14 @@
 				brasero_playlist_dialog_error (playlist, uri);
 
 			gtk_list_store_remove (GTK_LIST_STORE (model), &parent);
+			data->title = 1;
+			return;
 		}
-		else if (uri)
+
+		playlist_title = g_file_info_get_attribute_string (info, BRASERO_IO_PLAYLIST_TITLE);
+		if (playlist_title)
 			gtk_tree_store_set (GTK_TREE_STORE (model), &parent,
-					    BRASERO_PLAYLIST_DISPLAY_COL, uri,
+					    BRASERO_PLAYLIST_DISPLAY_COL, playlist_title,
 					    -1);
 
 		data->title = 1;
@@ -872,8 +903,7 @@
 	}
 
     	/* See if the song can be added */
-	has_audio = g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO);
-	if (!error && has_audio) {
+	if (!error && info && g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO)) {
 		gchar *name;
 		guint64 len;
 		const gchar *title;
@@ -978,7 +1008,8 @@
 				   uri,
 				   playlist->priv->parse_type,
 				   BRASERO_IO_INFO_PERM|
-				   BRASERO_IO_INFO_MIME,
+				   BRASERO_IO_INFO_MIME|
+				   BRASERO_IO_INFO_METADATA,
 				   data);
 	brasero_playlist_increase_activity_counter (playlist);
 }

Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c	(original)
+++ trunk/src/brasero-project-manager.c	Sat Jun 28 11:16:43 2008
@@ -345,7 +345,7 @@
 					   manager->priv->size_preview);
 
 	uris = brasero_uri_container_get_selected_uris (container);
-    	if (!uris) {
+	if (!uris) {
 		gtk_statusbar_pop (GTK_STATUSBAR (manager->priv->status),
 				   manager->priv->status_ctx);
 		gtk_statusbar_push (GTK_STATUSBAR (manager->priv->status),

Modified: trunk/src/brasero-search-entry.c
==============================================================================
--- trunk/src/brasero-search-entry.c	(original)
+++ trunk/src/brasero-search-entry.c	Sat Jun 28 11:16:43 2008
@@ -47,13 +47,16 @@
 #include <gtk/gtkcombobox.h>
 #include <gtk/gtkcomboboxentry.h>
 #include <gtk/gtkentry.h>
-#include <gconf/gconf-client.h>
 #include <gtk/gtkcellrenderer.h>
 #include <gtk/gtkcellrenderertext.h>
 #include <gtk/gtkcelllayout.h>
 #include <gtk/gtkmessagedialog.h>
 #include <gtk/gtkdialog.h>
 
+#include <beagle/beagle.h>
+
+#include <gconf/gconf-client.h>
+
 #include "brasero-search-entry.h"
 #include "brasero-layout.h"
 
@@ -79,134 +82,6 @@
 
 };
 
-/* cut and pasted from nautilus */
-struct _MimeTypeGroup{
-	gchar *name;
-	gchar *mimetypes[30];
-};
-typedef struct _MimeTypeGroup MimeTypeGroup;
-const static MimeTypeGroup mime_type_groups [] = {
-	{ N_("Find all available music"),
-	  { "application/ogg",
-	    "audio/ac3",
-	    "audio/basic",
-	    "audio/midi",
-	    "audio/x-flac",
-	    "audio/mp4",
-	    "audio/mpeg",
-	    "audio/x-vorbis+ogg", /* beagle stores ogg-vorbis files under this mime type */
-	    "audio/x-mpeg",
-	    "audio/x-ms-asx",
-	    "audio/x-pn-realaudio",
-	    NULL
-	  }
-	},
-	{ N_("Find all available videos"),
-	  { "video/mp4",
-	    "video/3gpp",
-	    "video/mpeg",
-	    "video/quicktime",
-	    "video/vivo",
-	    "video/x-avi",
-	    "video/x-mng",
-	    "video/x-ms-asf",
-	    "video/x-ms-wmv",
-	    "video/x-msvideo",
-	    "video/x-nsv",
-	    "video/x-real-video",
-	    NULL
-	  }
-	},
-	{ N_("Find all available pictures"),
-	  { "application/vnd.oasis.opendocument.image",
-	    "application/x-krita",
-	    "image/bmp",
-	    "image/cgm",
-	    "image/gif",
-	    "image/jpeg",
-	    "image/jpeg2000",
-	    "image/png",
-	    "image/svg+xml",
-	    "image/tiff",
-	    "image/x-compressed-xcf",
-	    "image/x-pcx",
-	    "image/x-photo-cd",
-	    "image/x-psd",
-	    "image/x-tga",
-	    "image/x-xcf",
-	    "application/illustrator",
-	    "application/vnd.corel-draw",
-	    "application/vnd.stardivision.draw",
-	    "application/vnd.oasis.opendocument.graphics",
-	    "application/x-dia-diagram",
-	    "application/x-karbon",
-	    "application/x-killustrator",
-	    "application/x-kivio",
-	    "application/x-kontour",
-	    "application/x-wpg",
-	    NULL
-	  }
-	},
-	{ N_("Find all available documents"),
-	  { "application/rtf",
-	    "application/msword",
-	    "application/vnd.sun.xml.writer",
-	    "application/vnd.sun.xml.writer.global",
-	    "application/vnd.sun.xml.writer.template",
-	    "application/vnd.oasis.opendocument.text",
-	    "application/vnd.oasis.opendocument.text-template",
-	    "application/x-abiword",
-	    "application/x-applix-word",
-	    "application/x-mswrite",
-	    "application/docbook+xml",
-	    "application/x-kword",
-	    "application/x-kword-crypt",
-	    "application/x-lyx",
-	    NULL
-	  }
-	},
-	{ N_("Find all available spreadsheets"),
-	  { "application/vnd.lotus-1-2-3",
-	    "application/vnd.ms-excel",
-	    "application/vnd.stardivision.calc",
-	    "application/vnd.sun.xml.calc",
-	    "application/vnd.oasis.opendocument.spreadsheet",
-	    "application/x-applix-spreadsheet",
-	    "application/x-gnumeric",
-	    "application/x-kspread",
-	    "application/x-kspread-crypt",
-	    "application/x-quattropro",
-	    "application/x-sc",
-	    "application/x-siag",
-	    NULL
-	  }
-	},
-	{ N_("Find all available presentations"),
-	  { "application/vnd.ms-powerpoint",
-	    "application/vnd.sun.xml.impress",
-	    "application/vnd.oasis.opendocument.presentation",
-	    "application/x-magicpoint",
-	    "application/x-kpresenter",
-	    NULL
-	  }
-	},
-	{ N_("Find all available Pdf / Postscripts"),
-	  { "application/pdf",
-	    "application/postscript",
-	    "application/x-dvi",
-	    "image/x-eps",
-	    NULL
-	  }
-	},
-	{NULL},
-	{ N_("Text File"),
-	  { "text/plain",
-	    NULL
-	  }
-	},
-	{ NULL }
-};
-
 enum {
 	BRASERO_SEARCH_ENTRY_DISPLAY_COL,
 	BRASERO_SEARCH_ENTRY_BACKGRD_COL,
@@ -806,41 +681,74 @@
 	brasero_search_entry_set_history (entry);
 }
 
-static void
-_add_mime_types_to_query (BeagleQuery *query, const MimeTypeGroup *group)
-{
-	gchar **mime;
-
-	mime = (gchar **) group->mimetypes;
-	while (*mime) {
-		beagle_hit_get_mime_type (query);
-		mime ++;
-	}
-}
-
 BeagleQuery *
 brasero_search_entry_get_query (BraseroSearchEntry *entry)
 {
 	BeagleQuery *query;
+	BeagleQueryPartOr *or_part;
+	BeagleQueryPartHuman *text;
 
+	/* Not sure about all this */
 	query = beagle_query_new ();
-	beagle_query_add_text (query, "Files");
 
+	if (strcmp (entry->priv->keywords, _("All files"))) {
+		BeagleQueryPartHuman *text;
+
+		text = beagle_query_part_human_new ();
+		beagle_query_part_human_set_string (text, entry->priv->keywords);
+		beagle_query_part_set_logic (BEAGLE_QUERY_PART (text),
+					     BEAGLE_QUERY_PART_LOGIC_REQUIRED);
+
+		beagle_query_add_part (query, BEAGLE_QUERY_PART (text));
+	}
+
+	text = beagle_query_part_human_new ();
+	beagle_query_part_human_set_string (text, "type:File");
+	beagle_query_add_part (query, BEAGLE_QUERY_PART (text));
+
+	or_part = beagle_query_part_or_new ();
+	
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->documents))) {
-		_add_mime_types_to_query (query, mime_type_groups + 3);
+		BeagleQueryPartProperty *filetype;
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:FileType");
+		beagle_query_part_property_set_value (filetype, "document");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
 	}
+
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->pictures))) {
-		_add_mime_types_to_query (query, mime_type_groups + 2);
+		BeagleQueryPartProperty *filetype;
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:FileType");
+		beagle_query_part_property_set_value (filetype, "image");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
 	}
+
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->music))) {
-		_add_mime_types_to_query (query, mime_type_groups);
+		BeagleQueryPartProperty *filetype;
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:FileType");
+		beagle_query_part_property_set_value (filetype, "audio");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
 	}
+
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->video))) {
-		_add_mime_types_to_query (query, mime_type_groups + 1);
+		BeagleQueryPartProperty *filetype;
+
+		filetype = beagle_query_part_property_new ();
+		beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
+		beagle_query_part_property_set_key (filetype, "beagle:FileType");
+		beagle_query_part_property_set_value (filetype, "video");
+		beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
 	}
 
-	if (strcmp (entry->priv->keywords, _("All files")))
-		beagle_query_add_text (query, entry->priv->keywords);
+	beagle_query_add_part (query, BEAGLE_QUERY_PART (or_part));
 
 	return query;
 }



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