diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2024-11-11 12:28:23 +0100 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2024-11-11 12:28:23 +0100 | 
| commit | 483b2e960f24c370d9e0260ab4ba8b3453408590 (patch) | |
| tree | ec5e83ac39e4e5cec0ab9494da2d0edaafe72d89 /src | |
| parent | 1bbf886bafc680c56ddd5e27ddd803b4e03685df (diff) | |
| parent | cb001bb8056869f98e9a62248bdd509a69d08faf (diff) | |
Merge branch 'feature/upstrem' into develop
Diffstat (limited to 'src')
| -rw-r--r-- | src/AppDirs.vala | 31 | ||||
| -rw-r--r-- | src/AppWindow.vala | 15 | ||||
| -rw-r--r-- | src/Application.vala | 1 | ||||
| -rw-r--r-- | src/Debug.vala | 2 | ||||
| -rw-r--r-- | src/Event.vala | 5 | ||||
| -rw-r--r-- | src/Photo.vala | 4 | ||||
| -rw-r--r-- | src/PhotoPage.vala | 3 | ||||
| -rw-r--r-- | src/PixbufCache.vala | 2 | ||||
| -rw-r--r-- | src/Properties.vala | 2 | ||||
| -rw-r--r-- | src/TimedQueue.vala | 189 | ||||
| -rw-r--r-- | src/dialogs/AdjustDateTimeDialog.vala | 2 | ||||
| -rw-r--r-- | src/dialogs/ProgressDialog.vala | 2 | ||||
| -rw-r--r-- | src/editing_tools/EditingTools.vala | 1 | ||||
| -rw-r--r-- | src/events/EventsBranch.vala | 8 | ||||
| -rw-r--r-- | src/library/LibraryWindow.vala | 9 | ||||
| -rw-r--r-- | src/main.vala | 9 | ||||
| -rw-r--r-- | src/metadata/MetadataDateTime.vala | 3 | ||||
| -rw-r--r-- | src/photos/WebPSupport.vala | 10 | ||||
| -rw-r--r-- | src/searches/SavedSearchDialog.vala | 4 | ||||
| -rw-r--r-- | src/sidebar/Tree.vala | 31 | ||||
| -rw-r--r-- | src/util/string.vala | 24 | ||||
| -rw-r--r-- | src/video-support/AVIMetadataLoader.vala | 4 | 
22 files changed, 196 insertions, 165 deletions
| diff --git a/src/AppDirs.vala b/src/AppDirs.vala index 05e172c..fd357c2 100644 --- a/src/AppDirs.vala +++ b/src/AppDirs.vala @@ -193,12 +193,39 @@ class AppDirs {      public static File get_exec_dir() {          return exec_dir;      } + +    public enum Runtime { +        NATIVE, +        FLATPAK, +        SNAP, +        UNKNOWN +    } + +    private static Runtime _runtime = Runtime.UNKNOWN; + +    public static Runtime get_runtime() { +        if (_runtime == Runtime.UNKNOWN) { +            var snap = Environment.get_variable("SNAP_NAME"); +            if (snap != null) { +                _runtime = Runtime.SNAP; +            } +            else { +                var flatpak_canary = File.new_for_path("/.flatpak-info"); +                if (flatpak_canary.query_exists()) { +                    _runtime = Runtime.FLATPAK; +                } else { +                    _runtime = Runtime.NATIVE; +                } +            } +        } + +        return _runtime; +    }      public static File get_temp_dir() {          if (tmp_dir == null) {              var basedir = Environment.get_tmp_dir(); -            var flatpak_canary = File.new_for_path("/.flatpak-info"); -            if (flatpak_canary.query_exists() && basedir == "/tmp") { +            if (get_runtime() == Runtime.FLATPAK && basedir == "/tmp") {                  basedir = Environment.get_user_cache_dir() + "/tmp";              } diff --git a/src/AppWindow.vala b/src/AppWindow.vala index 7398c74..ae8bfb9 100644 --- a/src/AppWindow.vala +++ b/src/AppWindow.vala @@ -586,6 +586,21 @@ public abstract class AppWindow : PageWindow {          if (Resources.GIT_VERSION != null && Resources.GIT_VERSION != "" && Resources.GIT_VERSION != Resources.APP_VERSION) {              hash = " (%s)".printf(Resources.GIT_VERSION.substring(0,7));          } +        var runtime = AppDirs.get_runtime(); +        switch (runtime) { +            case AppDirs.Runtime.SNAP: +                hash += " (Snap)"; +                break; +            case AppDirs.Runtime.FLATPAK: +                hash += " (Flatpak)"; +                break; +            case AppDirs.Runtime.NATIVE: +                hash += " (Native)"; +                break; +            default: +                hash += " (Unknown)"; +                break; +        }          string[] artists = {"Image of the Delmenhorst Town Hall by Charlie1965nrw, source: https://commons.wikimedia.org/wiki/File:Delmenhorst_Rathaus.jpg", null};          Gtk.show_about_dialog(this,              "version", Resources.APP_VERSION + hash + " — Delmenhorst", diff --git a/src/Application.vala b/src/Application.vala index d9edcaf..2225f7c 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -74,6 +74,7 @@ public class Application {          public abstract void authenticated(HashTable<string, string> params);      }      private static Application instance = null; +    public static TimeZone timezone = null;      private Gtk.Application system_app = null;      private int system_app_run_retval = 0;      private bool direct; diff --git a/src/Debug.vala b/src/Debug.vala index 799a94f..186a175 100644 --- a/src/Debug.vala +++ b/src/Debug.vala @@ -107,7 +107,7 @@ namespace Debug {          stream.printf("%s %d %s [%s] %s\n",              log_app_version_prefix,              Posix.getpid(), -            new DateTime.now_local().format("%F %T"), +            new DateTime.now(Application.timezone).format("%F %T"),              prefix,              message          ); diff --git a/src/Event.vala b/src/Event.vala index 69d27d0..4375aad 100644 --- a/src/Event.vala +++ b/src/Event.vala @@ -601,10 +601,11 @@ public class Event : EventSource, ContainerSource, Proxyable, Indexable {          // media sources are stored in ViewCollection from earliest to latest          MediaSource earliest_media = (MediaSource) ((DataView) view.get_at(0)).get_source(); -        var earliest_tm = earliest_media.get_exposure_time().to_local(); +        var earliest_tm = earliest_media.get_exposure_time().to_timezone(Application.timezone);          // use earliest to generate the boundary hour for that day -        var start_boundary = new DateTime.local(earliest_tm.get_year(), +        var start_boundary = new DateTime(Application.timezone, +            earliest_tm.get_year(),                                              earliest_tm.get_month(),                                              earliest_tm.get_day_of_month(),                                              EVENT_BOUNDARY_HOUR, diff --git a/src/Photo.vala b/src/Photo.vala index f636a32..2b90361 100644 --- a/src/Photo.vala +++ b/src/Photo.vala @@ -405,9 +405,7 @@ public abstract class Photo : PhotoSource, Dateable, Positionable {          readers.master = row.master.file_format.create_reader(row.master.filepath);          // get the file title of the Photo without using a File object, skipping the separator itself -        string? basename = String.sliced_at_last_char(row.master.filepath, Path.DIR_SEPARATOR); -        if (basename != null) -            file_title = String.sliced_at(basename, 1); +        file_title = Path.get_basename(row.master.filepath);          if (is_string_empty(file_title))              file_title = row.master.filepath; diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala index 5e94c24..a28ab44 100644 --- a/src/PhotoPage.vala +++ b/src/PhotoPage.vala @@ -966,7 +966,7 @@ public abstract class EditingHostPage : SinglePhotoPage {          return photo.has_transformations() || photo.has_editable();      } -    private void on_pixbuf_fetched(Photo photo, owned Gdk.Pixbuf? pixbuf, Error? err) { +    private void on_pixbuf_fetched(Photo photo, Gdk.Pixbuf? pixbuf, Error? err) {          // if not of the current photo, nothing more to do          if (!photo.equals(get_photo()))              return; @@ -987,6 +987,7 @@ public abstract class EditingHostPage : SinglePhotoPage {                      if (tool_pixbuf != null) {                          pixbuf = tool_pixbuf; +                        pixbuf.ref();                          max_dim = tool_pixbuf_dim;                      }                  } catch(Error err) { diff --git a/src/PixbufCache.vala b/src/PixbufCache.vala index cee33c6..6ff740e 100644 --- a/src/PixbufCache.vala +++ b/src/PixbufCache.vala @@ -80,7 +80,7 @@ public class PixbufCache : Object {      private Gee.ArrayList<Photo> lru = new Gee.ArrayList<Photo>();      private Gee.HashMap<Photo, FetchJob> in_progress = new Gee.HashMap<Photo, FetchJob>(); -    public signal void fetched(Photo photo, owned Gdk.Pixbuf? pixbuf, Error? err); +    public signal void fetched(Photo photo, Gdk.Pixbuf? pixbuf, Error? err);      public PixbufCache(SourceCollection sources, PhotoType type, Scaling scaling, int max_count,          CacheFilter? filter = null) { diff --git a/src/Properties.vala b/src/Properties.vala index 7c6ab89..8eb5742 100644 --- a/src/Properties.vala +++ b/src/Properties.vala @@ -97,7 +97,7 @@ private abstract class Properties : Gtk.Box {      protected string get_prettyprint_date(DateTime date) {          string date_string = null; -        var today = new DateTime.now_local(); +        var today = new DateTime.now(Application.timezone);          if (date.get_day_of_year() == today.get_day_of_year() && date.get_year() == today.get_year()) {              date_string = _("Today");          } else if (date.get_day_of_year() == (today.get_day_of_year() - 1) && date.get_year() == today.get_year()) { diff --git a/src/TimedQueue.vala b/src/TimedQueue.vala index 4ea6a23..ac1aab6 100644 --- a/src/TimedQueue.vala +++ b/src/TimedQueue.vala @@ -18,7 +18,7 @@  public delegate void DequeuedCallback<G>(G item); -public class TimedQueue<G> { +public class HashTimedQueue<G> {      private class Element<G> {          public G item;          public ulong ready; @@ -42,6 +42,7 @@ public class TimedQueue<G> {      private uint dequeue_spacing_msec = 0;      private ulong last_dequeue = 0;      private bool paused_state = false; +    private Gee.HashMap<G, int> item_count;      public virtual signal void paused(bool is_paused) {      } @@ -49,7 +50,8 @@ public class TimedQueue<G> {      // Initial design was to have a signal that passed the dequeued G, but bug in valac meant      // finding a workaround, namely using a delegate:      // https://bugzilla.gnome.org/show_bug.cgi?id=628639 -    public TimedQueue(uint hold_msec, DequeuedCallback<G> callback, +    public HashTimedQueue(uint hold_msec, DequeuedCallback<G> callback, +        owned Gee.HashDataFunc<G>? hash_func = null,          owned Gee.EqualDataFunc<G>? equal_func = null, int priority = Priority.DEFAULT) {          this.hold_msec = hold_msec;          this.callback = callback; @@ -64,9 +66,10 @@ public class TimedQueue<G> {          queue = new SortedList<Element<G>>(Element.comparator);          timer_id = Timeout.add(get_heartbeat_timeout(), on_heartbeat, priority); +        item_count = new Gee.HashMap<G, int>((owned) hash_func, (owned) equal_func);      } -    ~TimedQueue() { +    ~HashTimedQueue() {          if (timer_id != 0)              Source.remove(timer_id);      } @@ -93,10 +96,6 @@ public class TimedQueue<G> {              : (dequeue_spacing_msec / 2)).clamp(10, uint.MAX);      } -    protected virtual void notify_dequeued(G item) { -        callback(item); -    } -          public bool is_paused() {          return paused_state;      } @@ -119,50 +118,80 @@ public class TimedQueue<G> {          paused(false);      } -    public virtual void clear() { -        queue.clear(); +    public void clear() { +        lock(queue) { +            item_count.clear(); +            queue.clear(); +        }      } -    public virtual bool contains(G item) { -        foreach (Element<G> e in queue) { -            if (equal_func(item, e.item)) -                return true; +    public bool contains(G item) { +        lock(queue) { +            return item_count.has_key(item);          } -         -        return false;      } -    public virtual bool enqueue(G item) { -        return queue.add(new Element<G>(item, calc_ready_time())); +    public bool enqueue(G item) { +        lock(queue) { +            if (!queue.add(new Element<G>(item, calc_ready_time()))) { +                return false; +            } +            item_count.set(item, item_count.has_key(item) ? item_count.get(item) + 1 : 1); +             +            return true; +        }      } -    public virtual bool enqueue_many(Gee.Collection<G> items) { +    public bool enqueue_many(Gee.Collection<G> items) {          ulong ready_time = calc_ready_time();          Gee.ArrayList<Element<G>> elements = new Gee.ArrayList<Element<G>>();          foreach (G item in items)              elements.add(new Element<G>(item, ready_time)); -        return queue.add_list(elements); +        lock(queue) { +            if (!queue.add_list(elements)) { +                return false; +            } + +            foreach (G item in items) { +                item_count.set(item, item_count.has_key(item) ? item_count.get(item) + 1 : 1); +            } +        } +         +        return true; +      } -    public virtual bool remove_first(G item) { -        Gee.Iterator<Element<G>> iter = queue.iterator(); -        while (iter.next()) { -            Element<G> e = iter.get(); -            if (equal_func(item, e.item)) { -                iter.remove(); -                 -                return true; +    public bool remove_first(G item) { +        lock(queue) { +            var item_removed = false; +            var iter = queue.iterator(); +            while (iter.next()) { +                Element<G> e = iter.get(); +                if (equal_func(item, e.item)) { +                    iter.remove(); +                     +                    item_removed = true; +                    break; +                } +            } + +            if (!item_removed) { +                return false;              } + +            removed(item);          } -         -        return false; + +        return true;      } -    public virtual int size { +    public int size {          get { -            return queue.size; +            lock(queue) { +                return queue.size; +            }          }      } @@ -180,23 +209,28 @@ public class TimedQueue<G> {              if (queue.size == 0)                  break; -            Element<G>? head = queue.get_at(0); -            assert(head != null); -             -            if (now == 0) -                now = now_ms(); -             -            if (head.ready > now) -                break; -             -            // if a space of time is required between dequeues, check now -            if ((dequeue_spacing_msec != 0) && ((now - last_dequeue) < dequeue_spacing_msec)) -                break; -             -            Element<G>? h = queue.remove_at(0); -            assert(head == h); -             -            notify_dequeued(head.item); +            G? item = null; +            lock(queue) { +                Element<G>? head = queue.get_at(0); +                assert(head != null); +                 +                if (now == 0) +                    now = now_ms(); +                 +                if (head.ready > now) +                    break; +                 +                // if a space of time is required between dequeues, check now +                if ((dequeue_spacing_msec != 0) && ((now - last_dequeue) < dequeue_spacing_msec)) +                    break; +                 +                Element<G>? h = queue.remove_at(0); +                assert(head == h); +         +                removed(head.item); +                item = head.item; +            } +            callback(item);              last_dequeue = now;              // if a dequeue spacing is in place, it's a lock that only one item is dequeued per @@ -207,65 +241,8 @@ public class TimedQueue<G> {          return true;      } -} - -// HashTimedQueue uses a HashMap for quick lookups of elements via contains(). -public class HashTimedQueue<G> : TimedQueue<G> { -    private Gee.HashMap<G, int> item_count; -     -    public HashTimedQueue(uint hold_msec, DequeuedCallback<G> callback, -        owned Gee.HashDataFunc<G>? hash_func = null, owned Gee.EqualDataFunc<G>? equal_func = null, -        int priority = Priority.DEFAULT) { -        base (hold_msec, callback, (owned) equal_func, priority); -         -        item_count = new Gee.HashMap<G, int>((owned) hash_func, (owned) equal_func); -    } -     -    protected override void notify_dequeued(G item) { -        removed(item); -         -        base.notify_dequeued(item); -    } -     -    public override void clear() { -        item_count.clear(); -         -        base.clear(); -    } -     -    public override bool contains(G item) { -        return item_count.has_key(item); -    } -     -    public override bool enqueue(G item) { -        if (!base.enqueue(item)) -            return false; -         -        item_count.set(item, item_count.has_key(item) ? item_count.get(item) + 1 : 1); -         -        return true; -    } -     -    public override bool enqueue_many(Gee.Collection<G> items) { -        if (!base.enqueue_many(items)) -            return false; -         -        foreach (G item in items) -            item_count.set(item, item_count.has_key(item) ? item_count.get(item) + 1 : 1); -         -        return true; -    } -     -    public override bool remove_first(G item) { -        if (!base.remove_first(item)) -            return false; -         -        removed(item); -         -        return true; -    } -     +    // Not locking. This is always called with the lock hold      private void removed(G item) {          // item in question is either already removed          // or was never added, safe to do nothing here diff --git a/src/dialogs/AdjustDateTimeDialog.vala b/src/dialogs/AdjustDateTimeDialog.vala index f475773..2b6ae45 100644 --- a/src/dialogs/AdjustDateTimeDialog.vala +++ b/src/dialogs/AdjustDateTimeDialog.vala @@ -231,7 +231,7 @@ public class AdjustDateTimeDialog : Gtk.Dialog {          uint year, month, day;          calendar.get_date(out year, out month, out day); -        return new DateTime.local((int)year, (int)month + 1, (int)day, hour, (int)minute.get_value(), (int)second.get_value()); +        return new DateTime(Application.timezone, (int)year, (int)month + 1, (int)day, hour, (int)minute.get_value(), (int)second.get_value());      }      public bool execute(out TimeSpan time_shift, out bool keep_relativity, diff --git a/src/dialogs/ProgressDialog.vala b/src/dialogs/ProgressDialog.vala index 9368764..9d28551 100644 --- a/src/dialogs/ProgressDialog.vala +++ b/src/dialogs/ProgressDialog.vala @@ -37,6 +37,8 @@ public class ProgressDialog : Gtk.Window {              cancel_button = new Gtk.Button.with_mnemonic(Resources.CANCEL_LABEL);              cancel_button.clicked.connect(on_cancel);              delete_event.connect(on_window_closed); +        } else { +            delete_event.connect(hide_on_delete);          }          Gtk.Box hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 8); diff --git a/src/editing_tools/EditingTools.vala b/src/editing_tools/EditingTools.vala index 3345a3f..594281e 100644 --- a/src/editing_tools/EditingTools.vala +++ b/src/editing_tools/EditingTools.vala @@ -2126,7 +2126,6 @@ public class RedeyeTool : EditingTool {          if (coord_in_rectangle((int)Math.lround(x * scale), (int)Math.lround(y * scale), bounds_rect)) { -            print("Motion in progress!!\n");              is_reticle_move_in_progress = true;              reticle_move_mouse_start_point.x = (int)Math.lround(x * scale);              reticle_move_mouse_start_point.y = (int)Math.lround(y * scale); diff --git a/src/events/EventsBranch.vala b/src/events/EventsBranch.vala index 0550eb7..1a3ac69 100644 --- a/src/events/EventsBranch.vala +++ b/src/events/EventsBranch.vala @@ -174,8 +174,10 @@ public class Events.Branch : Sidebar.Branch {      private void on_config_changed() {          bool value = Config.Facade.get_instance().get_events_sort_ascending(); -        sort_ascending = value; -        reorder_all(); +	if (value != sort_ascending) { +		sort_ascending = value; +        	reorder_all(); +	}      }      private void on_events_added_removed(Gee.Iterable<DataObject>? added,  @@ -456,7 +458,7 @@ public class Events.UndatedDirectoryEntry : Events.DirectoryEntry {      protected override Page create_page() {          return new SubEventsDirectoryPage(SubEventsDirectoryPage.DirectoryType.UNDATED, -            new DateTime.now_local()); +            new DateTime.now(Application.timezone));      }  } diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala index 280a50b..1b3f4b3 100644 --- a/src/library/LibraryWindow.vala +++ b/src/library/LibraryWindow.vala @@ -155,13 +155,14 @@ public class LibraryWindow : AppWindow {          sidebar_tree.selected_entry_removed.connect(on_sidebar_selected_entry_removed);          sidebar_tree.graft(library_branch, SidebarRootPosition.LIBRARY); -        sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS); -        sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS); -        sidebar_tree.graft(faces_branch, SidebarRootPosition.FACES); -        sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS);          sidebar_tree.graft(camera_branch, SidebarRootPosition.CAMERAS);          sidebar_tree.graft(saved_search_branch, SidebarRootPosition.SAVED_SEARCH); +        sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS);          sidebar_tree.graft(import_roll_branch, SidebarRootPosition.IMPORT_ROLL); +        sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS); +        sidebar_tree.graft(faces_branch, SidebarRootPosition.FACES); +        sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS); +        sidebar_tree.finish();          properties_scheduler = new OneShotScheduler("LibraryWindow properties",              on_update_properties_now); diff --git a/src/main.vala b/src/main.vala index 25a0690..e619178 100644 --- a/src/main.vala +++ b/src/main.vala @@ -420,6 +420,8 @@ const OptionEntry[] entries = {  }  void main(string[] args) { +    Application.timezone = new TimeZone.local(); +      // Call AppDirs init *before* calling Gtk.init_with_args, as it will strip the      // exec file from the array      AppDirs.init(args[0]); @@ -563,9 +565,9 @@ void main(string[] args) {          message("Shotwell %s %s",              is_string_empty(filename) ? Resources.APP_LIBRARY_ROLE : Resources.APP_DIRECT_ROLE,              Resources.APP_VERSION); -    debug ("Shotwell is running in timezone %s", new -           DateTime.now_local().get_timezone_abbreviation ()); -         + +    debug ("Shotwell is running in timezone %s", Application.timezone.get_identifier()); +    message ("Shotwell is runing inside %s", AppDirs.get_runtime().to_string());      // Have a filename here?  If so, configure ourselves for direct      // mode, otherwise, default to library mode.      Application.init(!is_string_empty(filename)); @@ -591,6 +593,7 @@ void main(string[] args) {      // set up GLib environment      GLib.Environment.set_application_name(Resources.APP_TITLE); +    GLib.Environment.set_prgname("org.gnome.Shotwell");      // in both the case of running as the library or an editor, Resources is always      // initialized diff --git a/src/metadata/MetadataDateTime.vala b/src/metadata/MetadataDateTime.vala index 9dae99b..648d44d 100644 --- a/src/metadata/MetadataDateTime.vala +++ b/src/metadata/MetadataDateTime.vala @@ -6,6 +6,7 @@ public errordomain MetadataDateTimeError {  public class MetadataDateTime {      private DateTime timestamp; +    private static TimeZone local = new TimeZone.local();      public MetadataDateTime(DateTime timestamp) {          this.timestamp = timestamp; @@ -63,7 +64,7 @@ public class MetadataDateTime {          if (tm.year <= 1900 || tm.month <= 0 || tm.day < 0 || tm.hour < 0 || tm.minute < 0 || tm.second < 0)              return false; -        timestamp = new DateTime.local(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); +        timestamp = new DateTime(local, tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);          return true;      } diff --git a/src/photos/WebPSupport.vala b/src/photos/WebPSupport.vala index b467b24..543c889 100644 --- a/src/photos/WebPSupport.vala +++ b/src/photos/WebPSupport.vala @@ -209,8 +209,18 @@ private class WebpReader : PhotoFileReader {          uint8[] buffer;          FileUtils.get_data(this.get_filepath(), out buffer); +        var features = WebP.BitstreamFeatures(); +        WebP.GetFeatures(buffer, out features); + +        if (features.has_animation) { +            throw new IOError.INVALID_DATA("Animated WebP files are not yet supported"); +        } +                  int width, height;          var pixdata = WebP.DecodeRGBA(buffer, out width, out height); +        if (pixdata == null) { +            throw new IOError.INVALID_DATA("Failed to decode WebP file"); +        }          pixdata.length = width * height * 4;          return new Gdk.Pixbuf.from_data(pixdata, Gdk.Colorspace.RGB, true, 8, width, height, width * 4); diff --git a/src/searches/SavedSearchDialog.vala b/src/searches/SavedSearchDialog.vala index b08c8a8..b96a324 100644 --- a/src/searches/SavedSearchDialog.vala +++ b/src/searches/SavedSearchDialog.vala @@ -557,11 +557,11 @@ public class SavedSearchDialog : Gtk.Dialog {          }          private DateTime get_date_one() { -            return new DateTime.local(cal_one.year, cal_one.month + 1, cal_one.day, 0, 0, 0.0); +            return new DateTime(Application.timezone, cal_one.year, cal_one.month + 1, cal_one.day, 0, 0, 0.0);          }          private DateTime get_date_two() { -            return new DateTime.local(cal_two.year, cal_two.month + 1, cal_two.day, 0, 0, 0.0); +            return new DateTime(Application.timezone, cal_two.year, cal_two.month + 1, cal_two.day, 0, 0, 0.0);          }          private void set_date_one(DateTime date) { diff --git a/src/sidebar/Tree.vala b/src/sidebar/Tree.vala index aae81a0..b6c7f6f 100644 --- a/src/sidebar/Tree.vala +++ b/src/sidebar/Tree.vala @@ -75,6 +75,8 @@ public class Sidebar.Tree : Gtk.TreeView {      private bool is_internal_drag_in_progress = false;      private Sidebar.Entry? internal_drag_source_entry = null;      private Gtk.TreeRowReference? old_path_ref = null; +    private Gee.ArrayList<unowned Branch> expand_to_child = new Gee.ArrayList<unowned Branch>(); +    private Gee.ArrayList<unowned Branch> expand_to_element = new Gee.ArrayList<unowned Branch>();      public signal void entry_selected(Sidebar.SelectableEntry selectable); @@ -92,8 +94,7 @@ public class Sidebar.Tree : Gtk.TreeView {      public Tree(Gtk.TargetEntry[] target_entries, Gdk.DragAction actions,          ExternalDropHandler drop_handler) { -        set_model(store); -         +          Gtk.TreeViewColumn text_column = new Gtk.TreeViewColumn();          text_column.set_expand(true);          Gtk.CellRendererPixbuf icon_renderer = new Gtk.CellRendererPixbuf(); @@ -155,6 +156,18 @@ public class Sidebar.Tree : Gtk.TreeView {          text_renderer.editing_canceled.disconnect(on_editing_canceled);          text_renderer.editing_started.disconnect(on_editing_started);      } + +    public void finish() { +        set_model(store); +        foreach (var branch in expand_to_child) { +            expand_to_first_child(branch.get_root()); +        } +        expand_to_child.clear(); +        foreach (var branch in expand_to_element) { +            expand_to_entry(branch.get_root()); +        } +        expand_to_element.clear(); +    }      public void icon_renderer_function(Gtk.CellLayout layout, Gtk.CellRenderer renderer, Gtk.TreeModel model, Gtk.TreeIter iter) {          EntryWrapper? wrapper = get_wrapper_at_iter(iter); @@ -399,11 +412,14 @@ public class Sidebar.Tree : Gtk.TreeView {          if (branch.get_show_branch()) {              associate_branch(branch); -            if (branch.is_startup_expand_to_first_child()) -                expand_to_first_child(branch.get_root()); +            if (branch.is_startup_expand_to_first_child()) { +                expand_to_child.add(branch); +                 +            } -            if (branch.is_startup_open_grouping()) -                expand_to_entry(branch.get_root()); +            if (branch.is_startup_open_grouping()) { +                expand_to_element.add(branch); +            }          }          branch.entry_added.connect(on_branch_entry_added); @@ -587,9 +603,8 @@ public class Sidebar.Tree : Gtk.TreeView {              selected_wrapper = null;          Sidebar.Entry entry = wrapper.entry; -                  entry.pruned(this); -         +          entry.sidebar_tooltip_changed.disconnect(on_sidebar_tooltip_changed);          entry.sidebar_icon_changed.disconnect(on_sidebar_icon_changed); diff --git a/src/util/string.vala b/src/util/string.vala index 976f8ee..5ca4680 100644 --- a/src/util/string.vala +++ b/src/util/string.vala @@ -177,30 +177,6 @@ public inline bool contains_char(string haystack, unichar needle) {      return haystack.index_of_char(needle) >= 0;  } -public inline bool contains_str(string haystack, string needle) { -    return haystack.index_of(needle) >= 0; -} - -public inline string? sliced_at(string str, int index) { -    return (index >= 0) ? str[index:str.length] : null; -} - -public inline string? sliced_at_first_str(string haystack, string needle, int start_index = 0) { -    return sliced_at(haystack, haystack.index_of(needle, start_index)); -} - -public inline string? sliced_at_last_str(string haystack, string needle, int start_index = 0) { -    return sliced_at(haystack, haystack.last_index_of(needle, start_index)); -} - -public inline string? sliced_at_first_char(string haystack, unichar ch, int start_index = 0) { -    return sliced_at(haystack, haystack.index_of_char(ch, start_index)); -} - -public inline string? sliced_at_last_char(string haystack, unichar ch, int start_index = 0) { -    return sliced_at(haystack, haystack.last_index_of_char(ch, start_index)); -} -  // Note that this method currently turns a word of all zeros into empty space ("000" -> "")  public string strip_leading_zeroes(string str) {      StringBuilder stripped = new StringBuilder(); diff --git a/src/video-support/AVIMetadataLoader.vala b/src/video-support/AVIMetadataLoader.vala index 2b507e2..31945e9 100644 --- a/src/video-support/AVIMetadataLoader.vala +++ b/src/video-support/AVIMetadataLoader.vala @@ -1,5 +1,7 @@  public class AVIMetadataLoader { +    public static TimeZone local = new TimeZone.local(); +      private File file = null;      // A numerical date string, i.e 2010:01:28 14:54:25 @@ -167,7 +169,7 @@ public class AVIMetadataLoader {                    out min, out sec, out year)) {                  return null; // Error              } -            parsed_date = new DateTime.local(year, month_from_string((string)monthstr), day, hour, min, sec); +            parsed_date = new DateTime(AVIMetadataLoader.local, year, month_from_string((string)monthstr), day, hour, min, sec);          }          return parsed_date; | 
