Merge lp:~jeremywootten/pantheon-files/fix-1515061-filechooser-respect-set-filter into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Danielle Foré
Approved revision: 2102
Merged at revision: 2105
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1515061-filechooser-respect-set-filter
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 34 lines (+10/-4)
1 file modified
filechooser-module/FileChooserDialog.vala (+10/-4)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1515061-filechooser-respect-set-filter
Reviewer Review Type Date Requested Status
Adam Bieńkowski (community) code / tests Approve
Review via email: mp+291234@code.launchpad.net

Commit message

Initialize active file filter entry correctly.

Description of the change

This branch fixes the Pantheon FileChooser module so that the filter combobox is correctly initialised to the default filter passed in by the calling app rather than being hard-coded to start with entry 0 active.

Install the branch in order for the fixed module to be used e.g. by Scratch or Audience.
Scratch should now default to Text files and Audience to Video files when choosing a file to open.

To post a comment you must log in.
Revision history for this message
Adam Bieńkowski (donadigo) wrote :

I can confirm that this fixes the issue. Thanks for taking care of the module!

review: Approve (code / tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'filechooser-module/FileChooserDialog.vala'
2--- filechooser-module/FileChooserDialog.vala 2015-10-08 17:17:20 +0000
3+++ filechooser-module/FileChooserDialog.vala 2016-04-07 11:36:04 +0000
4@@ -239,7 +239,9 @@
5 }
6
7 private static void setup_filter_box () {
8- var filters = chooser.list_filters ();
9+ var filters = chooser.list_filters ();
10+ var current_filter_name = chooser.get_filter ().get_filter_name ();
11+
12 if (filters.length () > 0) {
13 filters_available = true;
14 var combo_box = new Gtk.ComboBoxText ();
15@@ -256,12 +258,16 @@
16 });
17 });
18
19+ var index = 0;
20 filters.foreach ((filter) => {
21- combo_box.append_text (filter.get_filter_name ());
22+ var name = filter.get_filter_name ();
23+ combo_box.append_text (name);
24+ if (name == current_filter_name) {
25+ combo_box.active = index;
26+ }
27+ index++;
28 });
29
30- combo_box.active = 0;
31-
32 var grid = new Gtk.Grid ();
33 grid.margin_start = 5;
34 grid.add (combo_box);

Subscribers

People subscribed via source and target branches

to all changes: