brasero r1494 - in trunk: . src src/plugins/local-track



Author: philippr
Date: Sat Nov  8 14:42:19 2008
New Revision: 1494
URL: http://svn.gnome.org/viewvc/brasero?rev=1494&view=rev

Log:
	Change behavior of display->show/hide sidebar.
	This setting is now for all types of projects and not on a per-type
	basis which was stupid

	* src/brasero-file-chooser.c (brasero_file_chooser_set_context):
	* src/brasero-layout.c (brasero_layout_item_set_active),
	(brasero_layout_show_sidepane_changed_cb),
	(brasero_layout_combo_changed_cb), (brasero_layout_load),
	(brasero_layout_empty_toggled_cb), (brasero_layout_init):
	* src/brasero-search-entry.c (brasero_search_entry_set_context):
	* src/plugins/local-track/burn-uri.c
	(brasero_burn_uri_start_if_found):

Modified:
   trunk/ChangeLog
   trunk/src/brasero-file-chooser.c
   trunk/src/brasero-layout.c
   trunk/src/brasero-search-entry.c
   trunk/src/plugins/local-track/burn-uri.c

Modified: trunk/src/brasero-file-chooser.c
==============================================================================
--- trunk/src/brasero-file-chooser.c	(original)
+++ trunk/src/brasero-file-chooser.c	Sat Nov  8 14:42:19 2008
@@ -71,6 +71,8 @@
 	GtkFileFilter *filter_any;
 	GtkFileFilter *filter_audio;
 	GtkFileFilter *filter_video;
+
+	BraseroLayoutType type;
 };
 
 static GObjectClass *parent_class = NULL;
@@ -375,6 +377,9 @@
 	BraseroFileChooser *self;
 
 	self = BRASERO_FILE_CHOOSER (object);
+	if (type == self->priv->type)
+		return;
+
 	if (type == BRASERO_LAYOUT_AUDIO)
 		gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (self->priv->chooser),
 					     self->priv->filter_audio);
@@ -384,6 +389,8 @@
 	else
 		gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (self->priv->chooser),
 					     self->priv->filter_any);
+
+	self->priv->type = type;
 }
 
 static void

Modified: trunk/src/brasero-layout.c
==============================================================================
--- trunk/src/brasero-layout.c	(original)
+++ trunk/src/brasero-layout.c	Sat Nov  8 14:42:19 2008
@@ -112,6 +112,7 @@
 	gint radio_notify;
 	gint preview_notify;
 	gint layout_notify;
+	gint sidepane_notify;
 
 	GtkWidget *notebook;
 	GtkWidget *main_box;
@@ -171,6 +172,7 @@
 
 
 #define BRASERO_KEY_DISPLAY_DIR		"/apps/brasero/display/"
+#define BRASERO_KEY_SHOW_SIDEPANE	BRASERO_KEY_DISPLAY_DIR "sidepane"
 #define BRASERO_KEY_LAYOUT_AUDIO	BRASERO_KEY_DISPLAY_DIR "audio_pane"
 #define BRASERO_KEY_LAYOUT_DATA		BRASERO_KEY_DISPLAY_DIR "data_pane"
 #define BRASERO_KEY_LAYOUT_VIDEO	BRASERO_KEY_DISPLAY_DIR "video_pane"
@@ -557,9 +559,15 @@
 				    -1);
 
 		if (tree_item == item) {
+			BraseroLayoutObject *object;
+
 			gtk_combo_box_set_active_iter (GTK_COMBO_BOX (layout->priv->combo), &iter);
 			gtk_widget_show (item->widget);
 			layout->priv->active_item = item;
+
+			/* tell the object what context we are in */
+			object = brasero_layout_item_get_object (item);
+			brasero_layout_object_set_context (object, layout->priv->ctx_type);
 			return;
 		}
 	} while (gtk_tree_model_iter_next (model, &iter));
@@ -567,6 +575,30 @@
 }
 
 static void
+brasero_layout_show_sidepane_changed_cb (GConfClient *client,
+					 guint cxn,
+					 GConfEntry *entry,
+					 gpointer data)
+{
+	BraseroLayout *layout;
+	GtkAction *action;
+	GConfValue *value;
+	gboolean show;
+
+	value = gconf_entry_get_value (entry);
+	if (value->type != GCONF_VALUE_BOOL)
+		return;
+
+	show = gconf_value_get_bool (value);
+
+	layout = BRASERO_LAYOUT (data);
+
+	action = gtk_action_group_get_action (layout->priv->action_group, BRASERO_LAYOUT_NONE_ID);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show);
+	brasero_layout_set_side_pane_visible (layout, show);
+}
+
+static void
 brasero_layout_displayed_item_changed_cb (GConfClient *client,
 					  guint cxn,
 					  GConfEntry *entry,
@@ -771,7 +803,10 @@
 	layout->priv->active_item = item;
 	gtk_widget_show (item->widget);
 
+	/* tell the object what context we are in */
 	source = brasero_layout_item_get_object (item);
+	brasero_layout_object_set_context (source, layout->priv->ctx_type);
+
 	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);
@@ -821,12 +856,14 @@
 }
 
 void
-brasero_layout_load (BraseroLayout *layout, BraseroLayoutType type)
+brasero_layout_load (BraseroLayout *layout,
+		     BraseroLayoutType type)
 {
 	gchar *layout_id = NULL;
 	GError *error = NULL;
 	GtkTreeModel *model;
 	GtkAction *action;
+	gboolean sidepane;
 	GtkTreeIter iter;
 
 	/* remove GCONF notification if any */
@@ -908,18 +945,12 @@
 	model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
 	if (gtk_tree_model_get_iter_first (model, &iter)) {
 		do {
-			BraseroLayoutObject *object;
 			BraseroLayoutItem *item = NULL;
 
 			gtk_tree_model_get (model, &iter,
 					    ITEM_COL, &item,
 					    -1);
 
-			/* tell all the object what context we are in */
-			object = brasero_layout_item_get_object (item);
-			if (object)
-				brasero_layout_object_set_context (object, type);
-
 			/* check if that pane should be displayed in such a context */
 			if (!(item->types & type)) {
 				brasero_layout_item_set_visible (layout, item, FALSE);
@@ -949,10 +980,12 @@
 	}
 
 	/* hide or show side pane */
-	action = gtk_action_group_get_action (layout->priv->action_group, BRASERO_LAYOUT_NONE_ID);
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-				     (layout_id && strcmp (layout_id, BRASERO_LAYOUT_NONE_ID)));
+	sidepane = gconf_client_get_bool (layout->priv->client,
+					  BRASERO_KEY_SHOW_SIDEPANE,
+					  NULL);
 
+	action = gtk_action_group_get_action (layout->priv->action_group, BRASERO_LAYOUT_NONE_ID);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), sidepane);
 	g_free (layout_id);
 }
 
@@ -1159,14 +1192,34 @@
 				 BraseroLayout *layout)
 {
 	gboolean active;
+	GError *error = NULL;
 
 	active = gtk_toggle_action_get_active (action);
 	brasero_layout_set_side_pane_visible (layout, active);
 
-	if (!active)
-		brasero_layout_save (layout, BRASERO_LAYOUT_NONE_ID);
-	else if (layout->priv->active_item)
-		brasero_layout_save (layout, layout->priv->active_item->id);
+	if (layout->priv->sidepane_notify) {
+		gconf_client_notify_remove (layout->priv->client,
+					    layout->priv->sidepane_notify);
+		layout->priv->sidepane_notify = 0;
+	}
+
+	gconf_client_set_bool (layout->priv->client,
+			       BRASERO_KEY_SHOW_SIDEPANE,
+			       active,
+			       &error);
+
+	if (error) {
+		g_warning ("Can't set GConf key %s. \n", error->message);
+		g_error_free (error);
+		error = NULL;
+	}
+
+	layout->priv->sidepane_notify = gconf_client_notify_add (layout->priv->client,
+								 BRASERO_KEY_SHOW_SIDEPANE,
+								 brasero_layout_show_sidepane_changed_cb,
+								 layout,
+								 NULL,
+								 &error);
 }
 
 void
@@ -1381,6 +1434,13 @@
 	gtk_container_add (GTK_CONTAINER (alignment), obj->priv->main_box);
 	gtk_widget_show (obj->priv->main_box);
 
+	obj->priv->sidepane_notify = gconf_client_notify_add (obj->priv->client,
+							      BRASERO_KEY_SHOW_SIDEPANE,
+							      brasero_layout_show_sidepane_changed_cb,
+							      obj,
+							      NULL,
+							      NULL);
+
 	/* close button and  combo */
 	box = gtk_hbox_new (FALSE, 6);
 	gtk_widget_show (box);

Modified: trunk/src/brasero-search-entry.c
==============================================================================
--- trunk/src/brasero-search-entry.c	(original)
+++ trunk/src/brasero-search-entry.c	Sat Nov  8 14:42:19 2008
@@ -75,6 +75,8 @@
 	guint cxn;
 	gint search_id;
 
+	BraseroLayoutType ctx;
+
 	gchar *keywords;
 
 	GtkWidget *documents;
@@ -768,12 +770,22 @@
 brasero_search_entry_set_context (BraseroSearchEntry *self,
 				  BraseroLayoutType type)
 {
+	if (self->priv->ctx == type)
+		return;
+
+	self->priv->ctx = type;
 	if (type == BRASERO_LAYOUT_AUDIO) {
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->video), FALSE);
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->music), TRUE);
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->pictures), FALSE);
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->documents), FALSE);
 	}
+	else if (type == BRASERO_LAYOUT_VIDEO) {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->video), TRUE);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->music), FALSE);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->pictures), FALSE);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->documents), FALSE);
+	}
 }
 
 #endif /*BUILD_SEARCH*/

Modified: trunk/src/plugins/local-track/burn-uri.c
==============================================================================
--- trunk/src/plugins/local-track/burn-uri.c	(original)
+++ trunk/src/plugins/local-track/burn-uri.c	Sat Nov  8 14:42:19 2008
@@ -378,8 +378,11 @@
 				 const gchar *uri,
 				 GError **error)
 {
+	if (!uri)
+		return BRASERO_BURN_NOT_RUNNING;
+
 	/* Find any graft point with burn:// URI */
-	if (uri && !g_str_has_prefix (uri, "burn://"))
+	if (!g_str_has_prefix (uri, "burn://"))
 		return BRASERO_BURN_NOT_RUNNING;
 
 	BRASERO_JOB_LOG (self, "burn:// URI found %s", uri);



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