~elementary-apps/pantheon-files/trunk

« back to all changes in this revision

Viewing changes to libwidgets/Animations.vala

  • Committer: RabbitBot
  • Author(s): jeremy at elementaryos, Jeremy Wootten
  • Date: 2014-11-23 05:01:42 UTC
  • mfrom: (1459.1.202 all-views-vala)
  • Revision ID: rabbitbot-20141123050142-t685f3zxs1vayioq
* Convert Slot, Miller, DirectoryView, ListView, ColumnView and IconView to Vala.
* Use standard Gtk.TreeView and Gtk.IconView
* Address a number of bugs associated with the views.
* Some changes made to ViewContainer - new slots only made when view mode changes, not when location changes.
* For improved accessibility, helper emblem appears in all views but only when the icons are above a minimum size.
* Implemented bookmarking from context menu
* Implemented "Open in New Window" in context menu
* Context menu and app menu reimplemented without deprecated code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
namespace Marlin.Animation {
2
2
 
 
3
    private static uint timeout_source_id = 0;
3
4
    public static void smooth_adjustment_to (Gtk.Adjustment adj, int final) {
 
5
        if (timeout_source_id > 0) {
 
6
            GLib.Source.remove (timeout_source_id);
 
7
            timeout_source_id = 0;
 
8
        }
 
9
 
4
10
        var initial = adj.value;
5
11
        var to_do = final - initial;
6
12
 
11
17
        var newvalue = 0;
12
18
        var old_adj_value = adj.value;
13
19
 
14
 
        Timeout.add (1000 / 60, () => {
15
 
            /* If the user moves it at the same time, just stop the animation */
16
 
            if(old_adj_value != adj.value)
 
20
        timeout_source_id = Timeout.add (1000 / 60, () => {
 
21
            /* If the user move it at the same time, just stop the animation */
 
22
            if (old_adj_value != adj.value) {
 
23
                timeout_source_id = 0;
17
24
                return false;
 
25
            }
18
26
 
19
27
            if (newvalue >= to_do - 10) {
20
28
                /* to be sure that there is not a little problem */
21
29
                adj.value = final;
 
30
                timeout_source_id = 0;
22
31
                return false;
23
32
            }
24
33