Merge lp:~donadigo/pantheon-files/fix-treeview-detection into lp:~elementary-apps/pantheon-files/trunk

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Felipe Escoto
Approved revision: 2261
Merged at revision: 2261
Proposed branch: lp:~donadigo/pantheon-files/fix-treeview-detection
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 52 lines (+18/-8)
1 file modified
filechooser-module/FileChooserDialog.vala (+18/-8)
To merge this branch: bzr merge lp:~donadigo/pantheon-files/fix-treeview-detection
Reviewer Review Type Date Requested Status
Felipe Escoto (community) Approve
Review via email: mp+301579@code.launchpad.net

Commit message

- FileChooser Module: fix Treeview detection

Description of the change

This branch fixes that the code assumes that there is only one widget per container, but in reality there can be more, it fails because the next widget does not need to be a container.

It also does add a guard against null TreeView in case something's gone wrong with detecting the widget.

To post a comment you must log in.
Revision history for this message
Felipe Escoto (philip.scott) wrote :

Fixes the crashes it was giving

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'filechooser-module/FileChooserDialog.vala'
--- filechooser-module/FileChooserDialog.vala 2016-07-25 17:50:23 +0000
+++ filechooser-module/FileChooserDialog.vala 2016-07-30 20:14:58 +0000
@@ -35,6 +35,7 @@
35 /* Paths to widgets */35 /* Paths to widgets */
36 private const string[] GTK_PATHBAR_PATH = { "widget", "browse_widgets_box", "browse_files_box", "browse_header_revealer" };36 private const string[] GTK_PATHBAR_PATH = { "widget", "browse_widgets_box", "browse_files_box", "browse_header_revealer" };
37 private const string[] GTK_FILTERCHOOSER_PATH = { "extra_and_filters", "filter_combo_hbox" };37 private const string[] GTK_FILTERCHOOSER_PATH = { "extra_and_filters", "filter_combo_hbox" };
38 private const string[] GTK_TREEVIEW_PATH = { "browse_files_stack", "browse_files_swin", "browse_files_tree_view" };
38 private const string PLACES_SIDEBAR_PATH = "places_sidebar";39 private const string PLACES_SIDEBAR_PATH = "places_sidebar";
3940
40 private GLib.Queue<string> previous_paths;41 private GLib.Queue<string> previous_paths;
@@ -231,7 +232,9 @@
231 (w2 as Gtk.Container).remove (w3);232 (w2 as Gtk.Container).remove (w3);
232 } else if (w3.get_name () == "list_and_preview_box") { /* file browser list and preview box */233 } else if (w3.get_name () == "list_and_preview_box") { /* file browser list and preview box */
233 var tv = find_tree_view (w3);234 var tv = find_tree_view (w3);
234 tv.set_activate_on_single_click (is_single_click);235 if (tv != null) {
236 tv.set_activate_on_single_click (is_single_click);
237 }
235 }238 }
236 });239 });
237 }240 }
@@ -240,16 +243,23 @@
240 /* Locate the TreeView and set its click behaviour */243 /* Locate the TreeView and set its click behaviour */
241 Gtk.TreeView? tv = null;244 Gtk.TreeView? tv = null;
242 ((Gtk.Container)browser_box).get_children ().foreach ((w) => {245 ((Gtk.Container)browser_box).get_children ().foreach ((w) => {
243 ((Gtk.Container)w).get_children ().foreach ((w) => {246 if (w.get_name () == GTK_TREEVIEW_PATH[0]) {
244 ((Gtk.Container)w).get_children ().foreach ((w) => {247 ((Gtk.Container)w).get_children ().foreach ((w) => {
245 ((Gtk.Container)w).get_children ().foreach ((w) => {248 if (w.name == "GtkBox") {
246 if (w is Gtk.TreeView) {249 ((Gtk.Container)w).get_children ().foreach ((w) => {
247 tv =(Gtk.TreeView)w;250 if (w.get_name () == GTK_TREEVIEW_PATH[1]) {
248 }251 ((Gtk.Container)w).get_children ().foreach ((w) => {
249 });252 if (w.get_name () == GTK_TREEVIEW_PATH[2]) {
253 tv = (Gtk.TreeView)w;
254 }
255 });
256 }
257 });
258 }
250 });259 });
251 });260 }
252 });261 });
262
253 return tv;263 return tv;
254 }264 }
255265

Subscribers

People subscribed via source and target branches

to all changes: