[gnome-boxes/gnome-3-20] notification: CancelFunc -> DismissFunc



commit bbd9097079226a16d88cc45dbca92aa5ea774cea
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Mar 17 14:32:45 2016 +0000

    notification: CancelFunc -> DismissFunc
    
    Rename CancelFunc to DismissFunc as not is the new name more
    appropriate, the 'Cancel' give the complete opposite idea to what it
    actually does in some cases, e.g deletion notification.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761479

 src/app.vala               |    2 +-
 src/auth-notification.vala |   14 +++++++-------
 src/machine.vala           |    4 ++--
 src/notification.vala      |   18 +++++++++---------
 src/notificationbar.vala   |   34 +++++++++++++++++-----------------
 src/ovirt-broker.vala      |    2 +-
 src/snapshot-list-row.vala |    2 +-
 7 files changed, 38 insertions(+), 38 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 636a687..96ab658 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -542,7 +542,7 @@ private class Boxes.App: Gtk.Application {
                 undo_notify_callback ();
         };
 
-        Notification.CancelFunc really_remove = () => {
+        Notification.DismissFunc really_remove = () => {
             debug ("User did not cancel deletion. Deleting now...");
             foreach (var item in items) {
                 if (!(item is Machine))
diff --git a/src/auth-notification.vala b/src/auth-notification.vala
index 7dbc2d0..d33ff9c 100644
--- a/src/auth-notification.vala
+++ b/src/auth-notification.vala
@@ -21,17 +21,17 @@ private class Boxes.AuthNotification: Gd.Notification {
 
     private Searchbar searchbar;
 
-    public AuthNotification (string                         auth_string,
-                             owned AuthFunc?                auth_func,
-                             owned Notification.CancelFunc? cancel_func,
-                             bool                           need_username,
-                             Searchbar                      searchbar) {
+    public AuthNotification (string                          auth_string,
+                             owned AuthFunc?                 auth_func,
+                             owned Notification.DismissFunc? dismiss_func,
+                             bool                            need_username,
+                             Searchbar                       searchbar) {
         show_close_button = false; // FIXME: Seems setting this from .UI file doesn't work
         title_label.label = auth_string;
 
         dismissed.connect (() => {
-            if (!auth_pressed && cancel_func != null)
-                cancel_func ();
+            if (!auth_pressed && dismiss_func != null)
+                dismiss_func ();
         });
 
         username_label.visible = need_username;
diff --git a/src/machine.vala b/src/machine.vala
index b7d7c91..ee55487 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -634,7 +634,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             auth_notification = null;
             try_connect_display.begin ();
         };
-        Notification.CancelFunc cancel_func = () => {
+        Notification.DismissFunc dismiss_func = () => {
             auth_notification = null;
             window.set_state (UIState.COLLECTION);
         };
@@ -643,7 +643,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
         var auth_string = _("'%s' requires authentication").printf (name);
         auth_notification = window.notificationbar.display_for_auth (auth_string,
                                                                          (owned) auth_func,
-                                                                         (owned) cancel_func,
+                                                                         (owned) dismiss_func,
                                                                          need_username);
     }
 
diff --git a/src/notification.vala b/src/notification.vala
index 645b318..015b34b 100644
--- a/src/notification.vala
+++ b/src/notification.vala
@@ -6,7 +6,7 @@ private class Boxes.Notification: Gd.Notification {
     public const int DEFAULT_TIMEOUT = 6;
 
     public delegate void OKFunc ();
-    public delegate void CancelFunc ();
+    public delegate void DismissFunc ();
 
     [GtkChild]
     private Gtk.Label message_label;
@@ -15,18 +15,18 @@ private class Boxes.Notification: Gd.Notification {
     [GtkChild]
     private Gtk.Button ok_button;
 
-    public Notification (string            message,
-                         MessageType       message_type,
-                         string?           ok_label,
-                         owned OKFunc?     ok_func,
-                         owned CancelFunc? cancel_func,
-                         int               timeout) {
+    public Notification (string             message,
+                         MessageType        message_type,
+                         string?            ok_label,
+                         owned OKFunc?      ok_func,
+                         owned DismissFunc? dismiss_func,
+                         int                timeout) {
         this.timeout = timeout;
 
         bool ok_pressed = false;
         dismissed.connect ( () => {
-            if (!ok_pressed && cancel_func != null)
-                cancel_func ();
+            if (!ok_pressed && dismiss_func != null)
+                dismiss_func ();
         });
 
         message_label.label = message;
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 5d78d8e..8cf0e24 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -28,34 +28,34 @@ private class Boxes.Notificationbar: Gtk.Grid {
         });
     }
 
-    public Gd.Notification display_for_action (string                         message,
-                                               string                         action_label,
-                                               owned Notification.OKFunc      action_func,
-                                               owned Notification.CancelFunc? ignore_func = null,
-                                               int                            timeout = DEFAULT_TIMEOUT) {
+    public Gd.Notification display_for_action (string                          message,
+                                               string                          action_label,
+                                               owned Notification.OKFunc       action_func,
+                                               owned Notification.DismissFunc? ignore_func = null,
+                                               int                             timeout = DEFAULT_TIMEOUT) {
         return display (message, MessageType.INFO, action_label, (owned) action_func, (owned) ignore_func, 
timeout);
     }
 
     public Gd.Notification display_for_optional_auth (string                           broker_name,
                                                       owned AuthNotification.AuthFunc? auth_func,
-                                                      owned Notification.CancelFunc?   cancel_func) {
+                                                      owned Notification.DismissFunc?  dismiss_func) {
         Notification.OKFunc next_auth_step = () => {
             var auth_string = "<span font-weight=\"bold\">" + _("Sign In to %s").printf(broker_name) + 
"</span>";
-            display_for_auth (auth_string, (owned) auth_func, (owned) cancel_func);
+            display_for_auth (auth_string, (owned) auth_func, (owned) dismiss_func);
         };
         return display_for_action (_("Not connected to %s").printf (broker_name),
                                    _("Sign In"),
                                    (owned) next_auth_step,
-                                   (owned) cancel_func, -1);
+                                   (owned) dismiss_func, -1);
     }
 
     public Gd.Notification display_for_auth (string                           auth_string,
                                              owned AuthNotification.AuthFunc? auth_func,
-                                             owned Notification.CancelFunc?   cancel_func,
+                                             owned Notification.DismissFunc?  dismiss_func,
                                              bool                             need_username = true) {
         var notification = new Boxes.AuthNotification (auth_string,
                                                        (owned) auth_func,
-                                                       (owned) cancel_func,
+                                                       (owned) dismiss_func,
                                                        need_username,
                                                        searchbar);
 
@@ -85,17 +85,17 @@ private class Boxes.Notificationbar: Gtk.Grid {
         add (w);
     }
 
-    private Gd.Notification display (string                         message,
-                                     MessageType                    message_type,
-                                     string?                        ok_label,
-                                     owned Notification.OKFunc?     ok_func,
-                                     owned Notification.CancelFunc? cancel_func,
-                                     int                            timeout) {
+    private Gd.Notification display (string                          message,
+                                     MessageType                     message_type,
+                                     string?                         ok_label,
+                                     owned Notification.OKFunc?      ok_func,
+                                     owned Notification.DismissFunc? dismiss_func,
+                                     int                             timeout) {
         var notification = new Boxes.Notification (message,
                                                    message_type,
                                                    ok_label,
                                                    (owned) ok_func,
-                                                   (owned) cancel_func,
+                                                   (owned) dismiss_func,
                                                    timeout);
 
         active_notifications.prepend (notification);
diff --git a/src/ovirt-broker.vala b/src/ovirt-broker.vala
index 648ea30..de60515 100644
--- a/src/ovirt-broker.vala
+++ b/src/ovirt-broker.vala
@@ -50,7 +50,7 @@ private class Boxes.OvirtBroker : Boxes.Broker {
                 proxy.password = password;
                 auth.unpause ();
             };
-            Notification.CancelFunc cancel_cb = () => {
+            Notification.DismissFunc cancel_cb = () => {
                 // Make sure we are not stuck waiting for authentication to
                 // finish, otherwise yield add_source() will never return
                 auth.unpause ();
diff --git a/src/snapshot-list-row.vala b/src/snapshot-list-row.vala
index e6fb5bf..02cad0c 100644
--- a/src/snapshot-list-row.vala
+++ b/src/snapshot-list-row.vala
@@ -179,7 +179,7 @@ private class Boxes.SnapshotListRow : Gtk.ListBoxRow {
             row = null;
         };
 
-        Notification.CancelFunc really_remove = () => {
+        Notification.DismissFunc really_remove = () => {
             this.snapshot.delete_async.begin (0, null, (obj, res) =>{
                 try {
                     this.snapshot.delete_async.end (res);


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