Merge lp:~elementary-dev-community/switchboard-plug-pantheon-shell/bug-1182413 into lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk

Proposed by Richard Stromer
Status: Merged
Merged at revision: 219
Proposed branch: lp:~elementary-dev-community/switchboard-plug-pantheon-shell/bug-1182413
Merge into: lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk
Diff against target: 90 lines (+37/-3)
1 file modified
src/Wallpaper.vala (+37/-3)
To merge this branch: bzr merge lp:~elementary-dev-community/switchboard-plug-pantheon-shell/bug-1182413
Reviewer Review Type Date Requested Status
Danielle Foré Needs Fixing
David Gomes (community) Needs Fixing
Review via email: mp+182417@code.launchpad.net

Description of the change

Search recursively for images in all sub-folders (does not cover loops)

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

Diff line 41 should be:
    plug.switchboard_controller.progress_bar_set_text (_("Importing wallpapers from %s.").printf (basefolder));

Diff lines 58-60 should be:

    if (info.get_file_type () == FileType.DIRECTORY) {
        load_wallpapers (basefolder + "/" + info.get_name ());
    } else if (!IOHelper.is_valid_file_type (info)) {

review: Needs Fixing
174. By Richard Stromer <email address hidden>

add some missing spaces after function names

Revision history for this message
Danielle Foré (danrabbit) wrote :

OP, can you update this branch to fix the text conflicts please?

review: Needs Fixing
Revision history for this message
Richard Stromer (noxan) wrote :

Got some other stuff to be done first, but I will have a look at it next week.

175. By Richard Stromer

Merged upstream changes

Revision history for this message
Richard Stromer (noxan) wrote :

sorry, the merge with bzr does somehow not work as intended (I'm more some kind of git user) and furthermore I do not get the right versions of the required dependencies (switchboard-2.0, gtk+-3.0). I guess I got to wait till the beta release or submit some untested diff/patch files if those do help in any way.

Revision history for this message
Cameron Norman (cameronnemo) wrote :

I have worked on this and rebased it. Merge request here.

This is how the conflicts text is formatted:

    conflict-free code
<<<<<<< TREE
    pre-merge code
=======
    code from where you were trying to merge from
>>>>>>> MERGE-SOURCE
    conflict-free code

Once you merge the code from all of those types of sections in a file, you just use `bzr resolve FileName.vala`.

Revision history for this message
Cameron Norman (cameronnemo) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Wallpaper.vala'
2--- src/Wallpaper.vala 2013-11-24 00:08:31 +0000
3+++ src/Wallpaper.vala 2014-07-21 19:39:36 +0000
4@@ -216,16 +216,28 @@
5 void update_wallpaper_folder () {
6 if (folder_combo.get_active () == 0) {
7 clean_wallpapers ();
8+<<<<<<< TREE
9+ WALLPAPER_DIR = GLib.Environment.get_user_special_dir (GLib.UserDirectory.PICTURES);
10+ load_wallpapers (WALLPAPER_DIR);
11+=======
12 var picture_file = GLib.File.new_for_path (GLib.Environment.get_user_special_dir (GLib.UserDirectory.PICTURES));
13 WALLPAPER_DIR = picture_file.get_uri ();
14 load_wallpapers.begin ();
15+>>>>>>> MERGE-SOURCE
16 } else if (folder_combo.get_active () == 1) {
17 clean_wallpapers ();
18+<<<<<<< TREE
19+ WALLPAPER_DIR = "/usr/share/backgrounds";
20+ load_wallpapers.begin (WALLPAPER_DIR, () => {
21+ WALLPAPER_DIR = Environment.get_user_data_dir () + "/backgrounds";
22+ load_wallpapers (WALLPAPER_DIR);
23+=======
24 WALLPAPER_DIR = "file:///usr/share/backgrounds";
25 load_wallpapers.begin (() => {
26 var backgrounds_file = GLib.File.new_for_path (GLib.Environment.get_user_data_dir () + "/backgrounds");
27 WALLPAPER_DIR = backgrounds_file.get_uri ();
28 load_wallpapers.begin ();
29+>>>>>>> MERGE-SOURCE
30 });
31 } else if (folder_combo.get_active () == 2) {
32 var dialog = new Gtk.FileChooserDialog (_("Select a folder"), null, FileChooserAction.SELECT_FOLDER);
33@@ -235,8 +247,13 @@
34
35 if (dialog.run () == ResponseType.ACCEPT) {
36 clean_wallpapers ();
37+<<<<<<< TREE
38+ WALLPAPER_DIR = dialog.get_filename ();
39+ load_wallpapers (WALLPAPER_DIR);
40+=======
41 WALLPAPER_DIR = dialog.get_file ().get_uri ();
42 load_wallpapers.begin ();
43+>>>>>>> MERGE-SOURCE
44 dialog.destroy ();
45 } else {
46 dialog.destroy ();
47@@ -244,10 +261,21 @@
48 }
49 }
50
51- async void load_wallpapers () {
52+ async void load_wallpapers (string basefolder) {
53 folder_combo.set_sensitive (false);
54
55+<<<<<<< TREE
56+ // Make the progress bar visible, since we're gonna be using it.
57+ try {
58+ plug.switchboard_controller.progress_bar_set_text (_("Importing wallpapers from %s").printf(basefolder));
59+ } catch (Error e) {
60+ warning (e.message);
61+ }
62+
63+ var directory = File.new_for_path (basefolder);
64+=======
65 var directory = File.new_for_uri (WALLPAPER_DIR);
66+>>>>>>> MERGE-SOURCE
67 // The number of wallpapers we've added so far
68 double done = 0.0;
69
70@@ -272,12 +300,18 @@
71 foreach (var info in files) {
72 // We're going to add another wallpaper
73 done++;
74- // Skip the file if it's not a picture
75- if (!IOHelper.is_valid_file_type(info)) {
76+ // Skip the file if it's not a picture and continue search for directories
77+ if (info.get_file_type () == FileType.DIRECTORY) {
78+ load_wallpapers (basefolder + "/" + info.get_name());
79+ } else if (!IOHelper.is_valid_file_type (info)) {
80 continue;
81 }
82+<<<<<<< TREE
83+ string filename = basefolder + "/" + info.get_name ();
84+=======
85 var file = File.new_for_uri (WALLPAPER_DIR + "/" + info.get_name ());
86 string filename = file.get_path ();
87+>>>>>>> MERGE-SOURCE
88 // Skip the default_wallpaper as seen in the description of the
89 // default_link variable
90 if (filename == default_link) {

Subscribers

People subscribed via source and target branches