[california/wip/725768-colors: 8/9] Merge branch 'master' into wip/725768-colors



commit 7e698b3158213f8e4fb629cadfbcc2360f326d31
Merge: e356cf1 334bef8
Author: Jim Nelson <jim yorba org>
Date:   Fri Mar 14 17:35:02 2014 -0700

    Merge branch 'master' into wip/725768-colors
    
    Conflicts:
        src/backing/eds/backing-eds-calendar-source.vala

 configure.ac                                     |   27 +++
 po/LINGUAS                                       |    2 +
 po/cs.po                                         |  235 ++++++++++++++++++++
 po/es.po                                         |   49 +++--
 po/pt_BR.po                                      |  250 ++++++++++++++++++++++
 src/Makefile.am                                  |   15 ++
 src/application/california-application.vala      |   11 +
 src/backing/backing-manager.vala                 |    4 +-
 src/backing/backing-source.vala                  |   14 ++
 src/backing/eds/backing-eds-calendar-source.vala |   65 ++++++-
 src/california-resources.xml                     |    6 +
 src/host/host-calendar-popup.vala                |    6 +-
 src/host/host-create-update-event.vala           |    3 +
 src/host/host-interaction.vala                   |   10 +-
 src/host/host-main-window.vala                   |   45 +++--
 src/host/host-modal-window.vala                  |   72 ++++++
 src/host/host-popup.vala                         |    2 +-
 src/manager/manager-calendar-list-item.vala      |   34 +++
 src/manager/manager-calendar-list.vala           |   69 ++++++
 src/manager/manager-window.vala                  |   40 ++++
 src/manager/manager.vala                         |   30 +++
 src/rc/app-menu.interface                        |    7 +
 src/rc/calendar-manager-list-item.ui             |   50 +++++
 src/rc/calendar-manager-list.ui                  |   58 +++++
 src/util/util-string.vala                        |    4 +
 src/view/month/month-cell.vala                   |    3 +
 src/view/month/month-controllable.vala           |    1 +
 27 files changed, 1059 insertions(+), 53 deletions(-)
---
diff --cc src/backing/eds/backing-eds-calendar-source.vala
index 0a29375,8b31f90..7d627e0
--- a/src/backing/eds/backing-eds-calendar-source.vala
+++ b/src/backing/eds/backing-eds-calendar-source.vala
@@@ -27,32 -34,59 +34,82 @@@ internal class EdsCalendarSource : Cale
      }
      
      ~EdsCalendarSource() {
-         eds_calendar.notify["color"].disconnect(update_calendar_color);
+         cancel_source_write();
+     }
+     
+     private void on_visible_changed() {
+         // only schedule source writes if something actually changed
+         if (eds_calendar.selected == visible)
+             return;
+         
+         eds_calendar.selected = visible;
+         schedule_source_write("visible=%s".printf(visible.to_string()));
      }
      
 +    private void update_calendar_color() {
 +        Gdk.Color rgb;
 +        if (!Gdk.Color.parse(eds_calendar.color, out rgb)) {
 +            debug("Unable to parse calendar color for %s: %s", to_string(), eds_calendar.color.to_string());
 +            
 +            return;
 +        }
 +        
 +        Gdk.RGBA rgba = {
 +            red: conv(rgb.red),
 +            green: conv(rgb.green),
 +            blue: conv(rgb.blue),
 +            alpha: 1.0
 +        };
 +        
 +        color = rgba;
 +    }
 +    
 +    // compiler error if this calculation is done inline when initializing struct
 +    private inline double conv(uint16 value) {
 +        return (double) value / (double) uint16.MAX;
 +    }
 +    
+     private void schedule_source_write(string reason) {
+         cancel_source_write();
+         
+         debug("Scheduling update of %s due to %s...", to_string(), reason);
+         source_write_cancellable = new Cancellable();
+         source_write_id = Timeout.add(UPDATE_DELAY_MSEC, on_background_write_source, Priority.LOW);
+     }
+     
+     private void cancel_source_write() {
+         if (source_write_id != 0) {
+             GLib.Source.remove(source_write_id);
+             source_write_id = 0;
+         }
+         
+         if (source_write_cancellable != null) {
+             source_write_cancellable.cancel();
+             source_write_cancellable = null;
+         }
+     }
+     
+     private bool on_background_write_source() {
+         // in essence, say this is no longer scheduled ... for now, allow another write to be
+         // scheduled while this one is occurring
+         source_write_id = 0;
+         Cancellable? cancellable = source_write_cancellable;
+         source_write_cancellable = null;
+         
+         if (cancellable == null || cancellable.is_cancelled())
+             return false;
+         
+         try {
+             debug("Updating EDS source %s...", to_string());
+             // TODO: Fix bindings to use async variant
+             eds_source.write_sync(cancellable);
+         } catch (Error err) {
+             debug("Error updating EDS source %s: %s", to_string(), err.message);
+         }
+         
+         return false;
+     }
+     
      // Invoked by EdsStore prior to making it available outside of unit
      internal async void open_async(Cancellable? cancellable) throws Error {
          client = (E.CalClient) yield E.CalClient.connect(eds_source, E.CalClientSourceType.EVENTS,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]