[geary/mjog/plugin-support: 13/13] Move InAppNotification class to components package



commit d5e7c05cbaa4c9b415e1c72cc61fd2f9aa6558fb
Author: Michael Gratton <mike vee net>
Date:   Fri Sep 27 19:29:17 2019 +1000

    Move InAppNotification class to components package
    
    It was the last class left in notifications, so not much point keeping
    it there. Also take the opportunity to add it to a package proper.

 po/POTFILES.in                                                      | 3 ++-
 src/client/accounts/accounts-editor-add-pane.vala                   | 2 +-
 src/client/accounts/accounts-editor-list-pane.vala                  | 6 ++++--
 src/client/accounts/accounts-editor-servers-pane.vala               | 2 +-
 src/client/accounts/accounts-editor.vala                            | 4 ++--
 src/client/application/application-controller.vala                  | 6 ++++--
 .../components-in-app-notification.vala}                            | 4 ++--
 src/client/components/main-window.vala                              | 2 +-
 src/client/meson.build                                              | 3 +--
 ui/{in-app-notification.ui => components-in-app-notification.ui}    | 2 +-
 ui/org.gnome.Geary.gresource.xml                                    | 2 +-
 11 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index aa20d8e4..bd269db8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -28,6 +28,7 @@ src/client/application/goa-mediator.vala
 src/client/application/main.vala
 src/client/application/secret-mediator.vala
 src/client/components/client-web-view.vala
+src/client/components/components-in-app-notification.vala
 src/client/components/components-inspector.vala
 src/client/components/components-placeholder-pane.vala
 src/client/components/components-validator.vala
@@ -411,6 +412,7 @@ ui/composer-headerbar.ui
 ui/composer-link-popover.ui
 ui/composer-menus.ui
 ui/composer-widget.ui
+ui/components-in-app-notification.ui
 ui/components-inspector-error-view.ui
 ui/components-inspector-log-view.ui
 ui/components-inspector.ui
@@ -425,7 +427,6 @@ ui/conversation-viewer.ui
 ui/find_bar.glade
 ui/folder-popover.ui
 ui/gtk/help-overlay.ui
-ui/in-app-notification.ui
 ui/main-toolbar.ui
 ui/main-toolbar-menus.ui
 ui/main-window.ui
diff --git a/src/client/accounts/accounts-editor-add-pane.vala 
b/src/client/accounts/accounts-editor-add-pane.vala
index 72f2517b..9a0d4400 100644
--- a/src/client/accounts/accounts-editor-add-pane.vala
+++ b/src/client/accounts/accounts-editor-add-pane.vala
@@ -298,7 +298,7 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
             }
             if (message != null) {
                 this.editor.add_notification(
-                    new InAppNotification(
+                    new Components.InAppNotification(
                         // Translators: In-app notification label, the
                         // string substitution is a more detailed reason.
                         _("Account not created: %s").printf(message)
diff --git a/src/client/accounts/accounts-editor-list-pane.vala 
b/src/client/accounts/accounts-editor-list-pane.vala
index ed6e1c51..17676098 100644
--- a/src/client/accounts/accounts-editor-list-pane.vala
+++ b/src/client/accounts/accounts-editor-list-pane.vala
@@ -243,7 +243,8 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane, CommandPane {
 
     private void on_execute(Application.Command command) {
         if (command.executed_label != null) {
-            InAppNotification ian = new InAppNotification(command.executed_label);
+            Components.InAppNotification ian =
+                new Components.InAppNotification(command.executed_label);
             ian.set_button(_("Undo"), "win." + GearyApplication.ACTION_UNDO);
             this.editor.add_notification(ian);
         }
@@ -251,7 +252,8 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane, CommandPane {
 
     private void on_undo(Application.Command command) {
         if (command.undone_label != null) {
-            InAppNotification ian = new InAppNotification(command.undone_label);
+            Components.InAppNotification ian =
+                new Components.InAppNotification(command.undone_label);
             ian.set_button(_("Redo"), "win." + GearyApplication.ACTION_REDO);
             this.editor.add_notification(ian);
         }
diff --git a/src/client/accounts/accounts-editor-servers-pane.vala 
b/src/client/accounts/accounts-editor-servers-pane.vala
index 0a742ec6..328d2aa6 100644
--- a/src/client/accounts/accounts-editor-servers-pane.vala
+++ b/src/client/accounts/accounts-editor-servers-pane.vala
@@ -371,7 +371,7 @@ internal class Accounts.EditorServersPane :
 
         if (!is_valid && message != null) {
             this.editor.add_notification(
-                new InAppNotification(
+                new Components.InAppNotification(
                     // Translators: In-app notification label, the
                     // string substitution is a more detailed reason.
                     _("Account not updated: %s").printf(message)
diff --git a/src/client/accounts/accounts-editor.vala b/src/client/accounts/accounts-editor.vala
index f2dafe4d..740de633 100644
--- a/src/client/accounts/accounts-editor.vala
+++ b/src/client/accounts/accounts-editor.vala
@@ -171,7 +171,7 @@ public class Accounts.Editor : Gtk.Dialog {
     }
 
     /** Displays an in-app notification in the dialog. */
-    internal void add_notification(InAppNotification notification) {
+    internal void add_notification(Components.InAppNotification notification) {
         this.notifications_pane.add_overlay(notification);
         notification.show();
     }
@@ -197,7 +197,7 @@ public class Accounts.Editor : Gtk.Dialog {
         } catch (Application.CertificateManagerError.STORE_FAILED err) {
             // XXX show error info bar rather than a notification?
             add_notification(
-                new InAppNotification(
+                new Components.InAppNotification(
                     // Translators: In-app notification label, when
                     // the app had a problem pinning an otherwise
                     // untrusted TLS certificate
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index 85df6134..1edf05e3 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -2368,7 +2368,8 @@ public class Application.Controller : Geary.BaseObject {
 
         if (this.main_window != null) {
             if (this.revokable != null && this.revokable_description != null) {
-                InAppNotification ian = new InAppNotification(this.revokable_description);
+                Components.InAppNotification ian =
+                    new Components.InAppNotification(this.revokable_description);
                 ian.set_button(_("Undo"), "win." + GearyApplication.ACTION_UNDO);
                 this.main_window.add_notification(ian);
             }
@@ -2453,7 +2454,8 @@ public class Application.Controller : Geary.BaseObject {
         string message = _(
             "Successfully sent mail to %s."
         ).printf(Util.Email.to_short_recipient_display(rfc822.to));
-        InAppNotification notification = new InAppNotification(message);
+        Components.InAppNotification notification =
+            new Components.InAppNotification(message);
         this.main_window.add_notification(notification);
         this.play_sound("message-sent-email");
     }
diff --git a/src/client/notification/in-app-notification.vala 
b/src/client/components/components-in-app-notification.vala
similarity index 93%
rename from src/client/notification/in-app-notification.vala
rename to src/client/components/components-in-app-notification.vala
index b2c34746..79ec67c7 100644
--- a/src/client/notification/in-app-notification.vala
+++ b/src/client/components/components-in-app-notification.vala
@@ -9,8 +9,8 @@
  *
  * Following the GNOME HIG, it should only contain a label and maybe a button.
  */
-[GtkTemplate (ui = "/org/gnome/Geary/in-app-notification.ui")]
-public class InAppNotification : Gtk.Revealer {
+[GtkTemplate (ui = "/org/gnome/Geary/components-in-app-notification.ui")]
+public class Components.InAppNotification : Gtk.Revealer {
 
     /** Length of the default timeout to close the notification. */
     public const uint DEFAULT_KEEPALIVE = 5;
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 8b145419..9ee97cda 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -342,7 +342,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
         }
     }
 
-    public void add_notification(InAppNotification notification) {
+    public void add_notification(Components.InAppNotification notification) {
         this.overlay.add_overlay(notification);
         notification.show();
     }
diff --git a/src/client/meson.build b/src/client/meson.build
index e1160fe4..37666c42 100644
--- a/src/client/meson.build
+++ b/src/client/meson.build
@@ -26,6 +26,7 @@ geary_client_vala_sources = files(
 
   'components/client-web-view.vala',
   'components/components-inspector.vala',
+  'components/components-in-app-notification.vala',
   'components/components-inspector-error-view.vala',
   'components/components-inspector-log-view.vala',
   'components/components-inspector-system-view.vala',
@@ -84,8 +85,6 @@ geary_client_vala_sources = files(
   'folder-list/folder-list-search-branch.vala',
   'folder-list/folder-list-special-grouping.vala',
 
-  'notification/in-app-notification.vala',
-
   'plugin/plugin-notification.vala',
 
   'sidebar/sidebar-branch.vala',
diff --git a/ui/in-app-notification.ui b/ui/components-in-app-notification.ui
similarity index 96%
rename from ui/in-app-notification.ui
rename to ui/components-in-app-notification.ui
index 087d794b..54a1dafd 100644
--- a/ui/in-app-notification.ui
+++ b/ui/components-in-app-notification.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="3.14"/>
-  <template class="InAppNotification" parent="GtkRevealer">
+  <template class="ComponentsInAppNotification" parent="GtkRevealer">
     <property name="visible">False</property>
     <property name="halign">center</property>
     <property name="valign">start</property>
diff --git a/ui/org.gnome.Geary.gresource.xml b/ui/org.gnome.Geary.gresource.xml
index 1883b4cd..358fe091 100644
--- a/ui/org.gnome.Geary.gresource.xml
+++ b/ui/org.gnome.Geary.gresource.xml
@@ -10,6 +10,7 @@
     <file compressed="true" preprocess="xml-stripblanks">certificate_warning_dialog.glade</file>
     <file compressed="true">client-web-view.js</file>
     <file compressed="true">client-web-view-allow-remote-images.js</file>
+    <file compressed="true" preprocess="xml-stripblanks">components-in-app-notification.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">components-inspector.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">components-inspector-error-view.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">components-inspector-log-view.ui</file>
@@ -33,7 +34,6 @@
     <file compressed="true" preprocess="xml-stripblanks">find_bar.glade</file>
     <file compressed="true" preprocess="xml-stripblanks">folder-popover.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
-    <file compressed="true" preprocess="xml-stripblanks">in-app-notification.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">main-toolbar.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">main-toolbar-menus.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">main-window.ui</file>


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