Merge lp:~psusi/ubuntu/saucy/brasero/fix-drive-selector into lp:ubuntu/saucy/brasero

Proposed by Phillip Susi
Status: Needs review
Proposed branch: lp:~psusi/ubuntu/saucy/brasero/fix-drive-selector
Merge into: lp:ubuntu/saucy/brasero
Diff against target: 793 lines (+731/-2)
6 files modified
.pc/05_populate-tree-model-after-construction.patch/libbrasero-media/brasero-drive-selection.c (+671/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+8/-0)
debian/patches/05_populate-tree-model-after-construction.patch (+42/-0)
debian/patches/series (+1/-0)
libbrasero-media/brasero-drive-selection.c (+8/-2)
To merge this branch: bzr merge lp:~psusi/ubuntu/saucy/brasero/fix-drive-selector
Reviewer Review Type Date Requested Status
Timo Aaltonen Approve
Review via email: mp+190014@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Timo Aaltonen (tjaalton) :
review: Approve

Unmerged revisions

111. By Phillip Susi

debian/patches/05_populate-tree-model-after-construction.patch:
backport upstream commit to fix drive selection not showing
up correctly (LP: #1237169).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/05_populate-tree-model-after-construction.patch'
2=== added directory '.pc/05_populate-tree-model-after-construction.patch/libbrasero-media'
3=== added file '.pc/05_populate-tree-model-after-construction.patch/libbrasero-media/brasero-drive-selection.c'
4--- .pc/05_populate-tree-model-after-construction.patch/libbrasero-media/brasero-drive-selection.c 1970-01-01 00:00:00 +0000
5+++ .pc/05_populate-tree-model-after-construction.patch/libbrasero-media/brasero-drive-selection.c 2013-10-09 02:24:44 +0000
6@@ -0,0 +1,671 @@
7+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
8+/*
9+ * Libbrasero-media
10+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
11+ *
12+ * Libbrasero-media is free software; you can redistribute it and/or modify
13+ * it under the terms of the GNU General Public License as published by
14+ * the Free Software Foundation; either version 2 of the License, or
15+ * (at your option) any later version.
16+ *
17+ * The Libbrasero-media authors hereby grant permission for non-GPL compatible
18+ * GStreamer plugins to be used and distributed together with GStreamer
19+ * and Libbrasero-media. This permission is above and beyond the permissions granted
20+ * by the GPL license by which Libbrasero-media is covered. If you modify this code
21+ * you may extend this exception to your version of the code, but you are not
22+ * obligated to do so. If you do not wish to do so, delete this exception
23+ * statement from your version.
24+ *
25+ * Libbrasero-media is distributed in the hope that it will be useful,
26+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+ * GNU Library General Public License for more details.
29+ *
30+ * You should have received a copy of the GNU General Public License
31+ * along with this program; if not, write to:
32+ * The Free Software Foundation, Inc.,
33+ * 51 Franklin Street, Fifth Floor
34+ * Boston, MA 02110-1301, USA.
35+ */
36+
37+#ifdef HAVE_CONFIG_H
38+# include <config.h>
39+#endif
40+
41+#include <glib.h>
42+#include <glib-object.h>
43+#include <glib/gi18n-lib.h>
44+
45+#include <gtk/gtk.h>
46+
47+#include "brasero-drive-selection.h"
48+#include "brasero-medium-monitor.h"
49+#include "brasero-drive.h"
50+#include "brasero-units.h"
51+
52+typedef struct _BraseroDriveSelectionPrivate BraseroDriveSelectionPrivate;
53+struct _BraseroDriveSelectionPrivate
54+{
55+ BraseroDrive *active;
56+
57+ BraseroDriveType type;
58+ gulong added_sig;
59+ gulong removed_sig;
60+};
61+
62+#define BRASERO_DRIVE_SELECTION_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DRIVE_SELECTION, BraseroDriveSelectionPrivate))
63+
64+typedef enum {
65+ CHANGED_SIGNAL,
66+ LAST_SIGNAL
67+} BraseroDriveSelectionSignalType;
68+
69+/* GtkBuildable */
70+static GtkBuildableIface *parent_buildable_iface;
71+
72+static guint brasero_drive_selection_signals [LAST_SIGNAL] = { 0 };
73+
74+enum {
75+ PROP_0,
76+ PROP_DRIVE,
77+ PROP_DRIVE_TYPE
78+};
79+
80+enum {
81+ DRIVE_COL,
82+ NAME_COL,
83+ ICON_COL,
84+ NUM_COL
85+};
86+
87+
88+static void
89+brasero_drive_selection_buildable_init (GtkBuildableIface *iface)
90+{
91+ parent_buildable_iface = g_type_interface_peek_parent (iface);
92+}
93+
94+G_DEFINE_TYPE_WITH_CODE (BraseroDriveSelection, brasero_drive_selection, GTK_TYPE_COMBO_BOX, G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, brasero_drive_selection_buildable_init));
95+
96+static void
97+brasero_drive_selection_set_current_drive (BraseroDriveSelection *self,
98+ GtkTreeIter *iter)
99+{
100+ BraseroDriveSelectionPrivate *priv;
101+ BraseroDrive *drive;
102+ GtkTreeModel *model;
103+
104+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (self);
105+
106+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
107+ gtk_tree_model_get (model, iter,
108+ DRIVE_COL, &drive,
109+ -1);
110+
111+ if (drive)
112+ gtk_widget_set_sensitive (GTK_WIDGET (self), TRUE);
113+ else
114+ gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE);
115+
116+ if (priv->active == drive)
117+ return;
118+
119+ if (priv->active)
120+ g_object_unref (priv->active);
121+
122+ priv->active = drive;
123+
124+ if (priv->active)
125+ g_object_ref (priv->active);
126+
127+ g_signal_emit (self,
128+ brasero_drive_selection_signals [CHANGED_SIGNAL],
129+ 0,
130+ priv->active);
131+}
132+
133+static void
134+brasero_drive_selection_changed (GtkComboBox *combo)
135+{
136+ GtkTreeIter iter;
137+
138+ if (!gtk_combo_box_get_active_iter (combo, &iter))
139+ return;
140+
141+ brasero_drive_selection_set_current_drive (BRASERO_DRIVE_SELECTION (combo), &iter);
142+}
143+
144+/**
145+ * brasero_drive_selection_set_active:
146+ * @selector: a #BraseroDriveSelection
147+ * @drive: a #BraseroDrive to set as the active one in the selector
148+ *
149+ * Sets the active drive. Emits the ::drive-changed signal.
150+ *
151+ * Return value: a #gboolean. TRUE if it succeeded, FALSE otherwise.
152+ **/
153+gboolean
154+brasero_drive_selection_set_active (BraseroDriveSelection *selector,
155+ BraseroDrive *drive)
156+{
157+ BraseroDriveSelectionPrivate *priv;
158+ gboolean result = FALSE;
159+ GtkTreeModel *model;
160+ GtkTreeIter iter;
161+
162+ g_return_val_if_fail (selector != NULL, FALSE);
163+ g_return_val_if_fail (BRASERO_IS_DRIVE_SELECTION (selector), FALSE);
164+
165+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selector);
166+
167+ if (priv->active == drive)
168+ return TRUE;
169+
170+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selector));
171+ if (!gtk_tree_model_get_iter_first (model, &iter))
172+ return FALSE;
173+
174+ do {
175+ BraseroDrive *iter_drive;
176+
177+ gtk_tree_model_get (model, &iter,
178+ DRIVE_COL, &iter_drive,
179+ -1);
180+
181+ if (drive == iter_drive) {
182+ if (iter_drive)
183+ g_object_unref (iter_drive);
184+
185+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (selector), &iter);
186+ brasero_drive_selection_set_current_drive (selector, &iter);
187+ result = TRUE;
188+ break;
189+ }
190+
191+ g_object_unref (iter_drive);
192+ } while (gtk_tree_model_iter_next (model, &iter));
193+
194+ return result;
195+}
196+
197+/**
198+ * brasero_drive_selection_get_active:
199+ * @selector: a #BraseroDriveSelection
200+ *
201+ * Gets the active drive.
202+ *
203+ * Return value: a #BraseroDrive or NULL. Unref when it is not needed anymore.
204+ **/
205+BraseroDrive *
206+brasero_drive_selection_get_active (BraseroDriveSelection *selector)
207+{
208+ BraseroDriveSelectionPrivate *priv;
209+
210+ g_return_val_if_fail (selector != NULL, NULL);
211+ g_return_val_if_fail (BRASERO_IS_DRIVE_SELECTION (selector), NULL);
212+
213+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selector);
214+ if (!priv->active)
215+ return NULL;
216+
217+ return g_object_ref (priv->active);
218+}
219+
220+static void
221+brasero_drive_selection_update_no_disc_entry (BraseroDriveSelection *self,
222+ GtkTreeModel *model,
223+ GtkTreeIter *iter)
224+{
225+ GIcon *icon;
226+
227+ icon = g_themed_icon_new_with_default_fallbacks ("drive-optical");
228+
229+ /* FIXME: that needs a string */
230+ gtk_list_store_set (GTK_LIST_STORE (model), iter,
231+ NAME_COL, NULL,
232+ ICON_COL, NULL,
233+ -1);
234+
235+ g_object_unref (icon);
236+
237+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self), iter);
238+ brasero_drive_selection_set_current_drive (self, iter);
239+}
240+
241+static void
242+brasero_drive_selection_add_no_disc_entry (BraseroDriveSelection *self)
243+{
244+ GtkTreeIter iter;
245+ GtkTreeModel *model;
246+
247+ /* Nothing's available. Say it. Two cases here, either we're
248+ * still probing drives or there isn't actually any available
249+ * drive. */
250+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
251+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
252+ brasero_drive_selection_update_no_disc_entry (self, model, &iter);
253+}
254+
255+/**
256+ * brasero_drive_selection_show_type:
257+ * @selector: a #BraseroDriveSelection
258+ * @type: a #BraseroDriveType
259+ *
260+ * Filters and displays drive corresponding to @type.
261+ *
262+ **/
263+void
264+brasero_drive_selection_show_type (BraseroDriveSelection *selector,
265+ BraseroDriveType type)
266+{
267+ BraseroDriveSelectionPrivate *priv;
268+ BraseroMediumMonitor *monitor;
269+ GtkTreeModel *model;
270+ GtkTreeIter iter;
271+ GSList *list;
272+ GSList *item;
273+
274+ g_return_if_fail (selector != NULL);
275+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (selector));
276+
277+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selector);
278+
279+ priv->type = type;
280+
281+ monitor = brasero_medium_monitor_get_default ();
282+ list = brasero_medium_monitor_get_drives (monitor, type);
283+ g_object_unref (monitor);
284+
285+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selector));
286+ if (gtk_tree_model_get_iter_first (model, &iter)) {
287+ /* First filter */
288+ do {
289+ GSList *node;
290+ BraseroDrive *drive;
291+
292+ gtk_tree_model_get (model, &iter,
293+ DRIVE_COL, &drive,
294+ -1);
295+
296+ if (!drive) {
297+ /* That's the dummy line saying there isn't any
298+ * available drive for whatever action it is */
299+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
300+ break;
301+ }
302+
303+ node = g_slist_find (list, drive);
304+ g_object_unref (drive);
305+
306+ if (!node) {
307+ if (gtk_list_store_remove (GTK_LIST_STORE (model), &iter))
308+ continue;
309+
310+ /* no more iter in the tree get out */
311+ break;
312+ }
313+
314+ g_object_unref (node->data);
315+ list = g_slist_delete_link (list, node);
316+ } while (gtk_tree_model_iter_next (model, &iter));
317+ }
318+
319+ if (list) {
320+ /* add remaining drive */
321+ for (item = list; item; item = item->next) {
322+ gchar *drive_name;
323+ BraseroDrive *drive;
324+ GIcon *drive_icon = NULL;
325+
326+ drive = item->data;
327+
328+ drive_name = brasero_drive_get_display_name (drive);
329+
330+ if (!brasero_drive_is_fake (drive)) {
331+ GDrive *gdrive;
332+
333+ gdrive = brasero_drive_get_gdrive (drive);
334+ if (gdrive) {
335+ drive_icon = g_drive_get_icon (gdrive);
336+ g_object_unref (gdrive);
337+ }
338+ else
339+ drive_icon = g_themed_icon_new_with_default_fallbacks ("drive-optical");
340+ }
341+ else
342+ drive_icon = g_themed_icon_new_with_default_fallbacks ("iso-image-new");
343+
344+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
345+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
346+ DRIVE_COL, drive,
347+ NAME_COL, drive_name?drive_name:_("Unnamed CD/DVD Drive"),
348+ ICON_COL, drive_icon,
349+ -1);
350+ g_free (drive_name);
351+ g_object_unref (drive_icon);
352+ }
353+ g_slist_foreach (list, (GFunc) g_object_unref, NULL);
354+ g_slist_free (list);
355+ }
356+
357+ if (!gtk_tree_model_get_iter_first (model, &iter)) {
358+ brasero_drive_selection_add_no_disc_entry (selector);
359+ return;
360+ }
361+
362+ gtk_widget_set_sensitive (GTK_WIDGET (selector), TRUE);
363+ if (gtk_combo_box_get_active (GTK_COMBO_BOX (selector)) == -1) {
364+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (selector), &iter);
365+ brasero_drive_selection_set_current_drive (selector, &iter);
366+ }
367+}
368+
369+static void
370+brasero_drive_selection_drive_added_cb (BraseroMediumMonitor *monitor,
371+ BraseroDrive *drive,
372+ BraseroDriveSelection *self)
373+{
374+ BraseroDriveSelectionPrivate *priv;
375+ gchar *drive_name = NULL;
376+ gboolean add = FALSE;
377+ GtkTreeModel *model;
378+ GIcon *drive_icon;
379+ GtkTreeIter iter;
380+
381+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (self);
382+
383+ if ((priv->type & BRASERO_DRIVE_TYPE_WRITER)
384+ && (brasero_drive_can_write (drive)))
385+ add = TRUE;
386+ else if (priv->type & BRASERO_DRIVE_TYPE_READER)
387+ add = TRUE;
388+
389+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
390+
391+ if (!add) {
392+ /* Try to get the first iter (it shouldn't fail) */
393+ if (!gtk_tree_model_get_iter_first (model, &iter)) {
394+ brasero_drive_selection_add_no_disc_entry (self);
395+ return;
396+ }
397+
398+ /* See if that's a real drive or not; if so, return. */
399+ drive = NULL;
400+ gtk_tree_model_get (model, &iter,
401+ DRIVE_COL, &drive,
402+ -1);
403+ if (drive)
404+ return;
405+
406+ brasero_drive_selection_update_no_disc_entry (self, model, &iter);
407+ return;
408+ }
409+
410+ /* remove warning message */
411+ if (gtk_tree_model_get_iter_first (model, &iter)) {
412+ BraseroDrive *tmp;
413+
414+ gtk_tree_model_get (model, &iter,
415+ DRIVE_COL, &tmp,
416+ -1);
417+ if (!tmp)
418+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
419+ else
420+ g_object_unref (tmp);
421+ }
422+
423+ if (!brasero_drive_is_fake (drive)) {
424+ GDrive *gdrive;
425+
426+ gdrive = brasero_drive_get_gdrive (drive);
427+ if (gdrive) {
428+ drive_icon = g_drive_get_icon (gdrive);
429+ g_object_unref (gdrive);
430+ }
431+ else
432+ drive_icon = g_themed_icon_new_with_default_fallbacks ("drive-optical");
433+ }
434+ else
435+ drive_icon = g_themed_icon_new_with_default_fallbacks ("iso-image-new");
436+
437+ drive_name = brasero_drive_get_display_name (drive);
438+
439+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
440+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
441+ DRIVE_COL, drive,
442+ NAME_COL, drive_name?drive_name:_("Unnamed CD/DVD Drive"),
443+ ICON_COL, drive_icon,
444+ -1);
445+ g_free (drive_name);
446+ g_object_unref (drive_icon);
447+
448+ gtk_widget_set_sensitive (GTK_WIDGET (self), TRUE);
449+ if (gtk_combo_box_get_active (GTK_COMBO_BOX (self)) == -1) {
450+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self), &iter);
451+ brasero_drive_selection_set_current_drive (self, &iter);
452+ }
453+}
454+
455+static void
456+brasero_drive_selection_drive_removed_cb (BraseroMediumMonitor *monitor,
457+ BraseroDrive *drive,
458+ BraseroDriveSelection *self)
459+{
460+ GtkTreeModel *model;
461+ GtkTreeIter iter;
462+
463+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
464+ if (!gtk_tree_model_get_iter_first (model, &iter))
465+ return;
466+
467+ do {
468+ BraseroDrive *iter_drive;
469+
470+ gtk_tree_model_get (model, &iter,
471+ DRIVE_COL, &iter_drive,
472+ -1);
473+
474+ if (drive == iter_drive) {
475+ g_object_unref (iter_drive);
476+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
477+ break;
478+ }
479+
480+ /* Could be NULL if a message "there is no drive ..." is on */
481+ if (iter_drive)
482+ g_object_unref (iter_drive);
483+
484+ } while (gtk_tree_model_iter_next (model, &iter));
485+
486+ if (!gtk_tree_model_get_iter_first (model, &iter)) {
487+ brasero_drive_selection_add_no_disc_entry (self);
488+ return;
489+ }
490+
491+ if (gtk_combo_box_get_active (GTK_COMBO_BOX (self)) == -1) {
492+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self), &iter);
493+ brasero_drive_selection_set_current_drive (self, &iter);
494+ }
495+}
496+
497+static void
498+brasero_drive_selection_init (BraseroDriveSelection *object)
499+{
500+ GtkListStore *model;
501+ GtkCellRenderer *renderer;
502+ BraseroMediumMonitor *monitor;
503+ BraseroDriveSelectionPrivate *priv;
504+
505+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (object);
506+
507+ monitor = brasero_medium_monitor_get_default ();
508+ priv->added_sig = g_signal_connect (monitor,
509+ "drive-added",
510+ G_CALLBACK (brasero_drive_selection_drive_added_cb),
511+ object);
512+ priv->removed_sig = g_signal_connect (monitor,
513+ "drive-removed",
514+ G_CALLBACK (brasero_drive_selection_drive_removed_cb),
515+ object);
516+
517+ g_object_unref (monitor);
518+
519+ /* get the list and fill the model */
520+ model = gtk_list_store_new (NUM_COL,
521+ G_TYPE_OBJECT,
522+ G_TYPE_STRING,
523+ G_TYPE_ICON);
524+
525+ gtk_combo_box_set_model (GTK_COMBO_BOX (object), GTK_TREE_MODEL (model));
526+ g_object_unref (model);
527+
528+ renderer = gtk_cell_renderer_pixbuf_new ();
529+ g_object_set (renderer, "follow-state", TRUE, NULL);
530+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE);
531+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
532+ "gicon", ICON_COL,
533+ NULL);
534+
535+ renderer = gtk_cell_renderer_text_new ();
536+ g_object_set (renderer, "xpad", 8, NULL);
537+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, TRUE);
538+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
539+ "markup", NAME_COL,
540+ NULL);
541+
542+ brasero_drive_selection_show_type (BRASERO_DRIVE_SELECTION (object),
543+ BRASERO_DRIVE_TYPE_ALL_BUT_FILE);
544+
545+}
546+
547+static void
548+brasero_drive_selection_finalize (GObject *object)
549+{
550+ BraseroDriveSelectionPrivate *priv;
551+ BraseroMediumMonitor *monitor;
552+
553+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (object);
554+
555+ monitor = brasero_medium_monitor_get_default ();
556+
557+ g_signal_handler_disconnect (monitor, priv->added_sig);
558+ g_signal_handler_disconnect (monitor, priv->removed_sig);
559+ priv->removed_sig = 0;
560+ priv->added_sig = 0;
561+
562+ g_object_unref (monitor);
563+
564+ G_OBJECT_CLASS (brasero_drive_selection_parent_class)->finalize (object);
565+ }
566+
567+static void
568+brasero_drive_selection_set_property (GObject *object,
569+ guint prop_id,
570+ const GValue *value,
571+ GParamSpec *pspec)
572+{
573+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (object));
574+
575+ switch (prop_id)
576+ {
577+ case PROP_DRIVE_TYPE:
578+ brasero_drive_selection_show_type (BRASERO_DRIVE_SELECTION (object),
579+ g_value_get_uint (value));
580+ break;
581+ case PROP_DRIVE:
582+ brasero_drive_selection_set_active (BRASERO_DRIVE_SELECTION (object),
583+ BRASERO_DRIVE (g_value_get_object (value)));
584+ break;
585+ default:
586+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
587+ break;
588+ }
589+ }
590+
591+static void
592+brasero_drive_selection_get_property (GObject *object,
593+ guint prop_id,
594+ GValue *value,
595+ GParamSpec *pspec)
596+{
597+ BraseroDriveSelectionPrivate *priv;
598+
599+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (object));
600+
601+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (object);
602+
603+ switch (prop_id)
604+ {
605+ case PROP_DRIVE_TYPE:
606+ g_value_set_uint (value, priv->type);
607+ break;
608+ case PROP_DRIVE:
609+ g_value_set_object (value, brasero_drive_selection_get_active (BRASERO_DRIVE_SELECTION (object)));
610+ break;
611+ default:
612+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
613+ break;
614+ }
615+}
616+
617+static void
618+brasero_drive_selection_class_init (BraseroDriveSelectionClass *klass)
619+{
620+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
621+ GtkComboBoxClass *combo_class = GTK_COMBO_BOX_CLASS (klass);
622+
623+ g_type_class_add_private (klass, sizeof (BraseroDriveSelectionPrivate));
624+
625+ object_class->finalize = brasero_drive_selection_finalize;
626+ object_class->set_property = brasero_drive_selection_set_property;
627+ object_class->get_property = brasero_drive_selection_get_property;
628+
629+ combo_class->changed = brasero_drive_selection_changed;
630+
631+ g_object_class_install_property (object_class, PROP_DRIVE,
632+ g_param_spec_object ("Drive",
633+ "Selected drive",
634+ "The currently selected drive",
635+ BRASERO_TYPE_DRIVE, G_PARAM_READWRITE));
636+
637+ g_object_class_install_property (object_class, PROP_DRIVE_TYPE,
638+ g_param_spec_uint ("drive-type",
639+ "The type of drives",
640+ "The type of drives displayed",
641+ 0, BRASERO_DRIVE_TYPE_ALL,
642+ BRASERO_DRIVE_TYPE_ALL_BUT_FILE,
643+ G_PARAM_READWRITE));
644+ /**
645+ * BraseroDriveSelection::drive-changed:
646+ * @selector: the object which received the signal
647+ * @drive: the drive which is now selected
648+ *
649+ * This signal gets emitted when the selected medium has changed
650+ *
651+ */
652+ brasero_drive_selection_signals [CHANGED_SIGNAL] =
653+ g_signal_new ("drive_changed",
654+ BRASERO_TYPE_DRIVE_SELECTION,
655+ G_SIGNAL_RUN_FIRST|G_SIGNAL_ACTION|G_SIGNAL_NO_RECURSE,
656+ G_STRUCT_OFFSET (BraseroDriveSelectionClass, drive_changed),
657+ NULL,
658+ NULL,
659+ g_cclosure_marshal_VOID__OBJECT,
660+ G_TYPE_NONE,
661+ 1,
662+ BRASERO_TYPE_DRIVE);
663+}
664+
665+/**
666+ * brasero_drive_selection_new:
667+ *
668+ * Creates a new #BraseroDriveSelection object
669+ *
670+ * Return value: a #GtkWidget. Unref when it is not needed anymore.
671+ **/
672+
673+GtkWidget *
674+brasero_drive_selection_new (void)
675+{
676+ return g_object_new (BRASERO_TYPE_DRIVE_SELECTION, NULL);
677+}
678
679=== modified file '.pc/applied-patches'
680--- .pc/applied-patches 2013-06-05 21:22:12 +0000
681+++ .pc/applied-patches 2013-10-09 02:24:44 +0000
682@@ -1,5 +1,6 @@
683 01_grafted_folders.patch
684 03_cue-invalid-frame-75.patch
685 04_tracker-0.16.patch
686+05_populate-tree-model-after-construction.patch
687 012_appindicator.patch
688 013_unity_launcher_progress.patch
689
690=== modified file 'debian/changelog'
691--- debian/changelog 2013-06-05 21:44:05 +0000
692+++ debian/changelog 2013-10-09 02:24:44 +0000
693@@ -1,3 +1,11 @@
694+brasero (3.8.0-1ubuntu3) UNRELEASED; urgency=low
695+
696+ * debian/patches/05_populate-tree-model-after-construction.patch:
697+ backport upstream commit to fix drive selection not showing
698+ up correctly (LP: #1237169).
699+
700+ -- Phillip Susi <psusi@ubuntu.com> Tue, 08 Oct 2013 21:51:54 -0400
701+
702 brasero (3.8.0-1ubuntu2) saucy; urgency=low
703
704 * Fix configure flags from last upload
705
706=== added file 'debian/patches/05_populate-tree-model-after-construction.patch'
707--- debian/patches/05_populate-tree-model-after-construction.patch 1970-01-01 00:00:00 +0000
708+++ debian/patches/05_populate-tree-model-after-construction.patch 2013-10-09 02:24:44 +0000
709@@ -0,0 +1,42 @@
710+From 4cdec3b2aa5e726714d34fff003480403ae6ae77 Mon Sep 17 00:00:00 2001
711+From: Jonh Wendell <jonh.wendell@intel.com>
712+Date: Wed, 19 Jun 2013 15:19:29 +0000
713+Subject: brasero-drive-selection: populate the tree model after construction
714+
715+Having it in the init was leading to an issue in the draw.
716+Postpone it to constructed phase fixes it.
717+---
718+diff --git a/libbrasero-media/brasero-drive-selection.c b/libbrasero-media/brasero-drive-selection.c
719+index 0e4bad6..7aa8275 100644
720+--- a/libbrasero-media/brasero-drive-selection.c
721++++ b/libbrasero-media/brasero-drive-selection.c
722+@@ -532,12 +532,17 @@ brasero_drive_selection_init (BraseroDriveSelection *object)
723+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
724+ "markup", NAME_COL,
725+ NULL);
726++}
727++
728++static void
729++brasero_drive_selection_constructed (GObject *object)
730++{
731++ G_OBJECT_CLASS (brasero_drive_selection_parent_class)->constructed (object);
732+
733+ brasero_drive_selection_show_type (BRASERO_DRIVE_SELECTION (object),
734+ BRASERO_DRIVE_TYPE_ALL_BUT_FILE);
735+-
736+ }
737+-
738++
739+ static void
740+ brasero_drive_selection_finalize (GObject *object)
741+ {
742+@@ -619,6 +624,7 @@ brasero_drive_selection_class_init (BraseroDriveSelectionClass *klass)
743+ object_class->finalize = brasero_drive_selection_finalize;
744+ object_class->set_property = brasero_drive_selection_set_property;
745+ object_class->get_property = brasero_drive_selection_get_property;
746++ object_class->constructed = brasero_drive_selection_constructed;
747+
748+ combo_class->changed = brasero_drive_selection_changed;
749+
750+--
751+cgit v0.9.2
752
753=== modified file 'debian/patches/series'
754--- debian/patches/series 2013-06-05 21:22:12 +0000
755+++ debian/patches/series 2013-10-09 02:24:44 +0000
756@@ -1,5 +1,6 @@
757 01_grafted_folders.patch
758 03_cue-invalid-frame-75.patch
759 04_tracker-0.16.patch
760+05_populate-tree-model-after-construction.patch
761 012_appindicator.patch
762 013_unity_launcher_progress.patch
763
764=== modified file 'libbrasero-media/brasero-drive-selection.c'
765--- libbrasero-media/brasero-drive-selection.c 2011-05-18 17:53:39 +0000
766+++ libbrasero-media/brasero-drive-selection.c 2013-10-09 02:24:44 +0000
767@@ -532,12 +532,17 @@
768 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
769 "markup", NAME_COL,
770 NULL);
771+}
772+
773+static void
774+brasero_drive_selection_constructed (GObject *object)
775+{
776+ G_OBJECT_CLASS (brasero_drive_selection_parent_class)->constructed (object);
777
778 brasero_drive_selection_show_type (BRASERO_DRIVE_SELECTION (object),
779 BRASERO_DRIVE_TYPE_ALL_BUT_FILE);
780-
781 }
782-
783+
784 static void
785 brasero_drive_selection_finalize (GObject *object)
786 {
787@@ -619,6 +624,7 @@
788 object_class->finalize = brasero_drive_selection_finalize;
789 object_class->set_property = brasero_drive_selection_set_property;
790 object_class->get_property = brasero_drive_selection_get_property;
791+ object_class->constructed = brasero_drive_selection_constructed;
792
793 combo_class->changed = brasero_drive_selection_changed;
794

Subscribers

People subscribed via source and target branches

to all changes: