[geary/wip/778728-split-composer: 5/13] Remove GTK 3.20/3.22 source defines and the conditionals using them.



commit a57753fec457e09e9d9d959ad278d2bdca4168f2
Author: Michael James Gratton <mike vee net>
Date:   Wed Oct 4 17:38:56 2017 +1100

    Remove GTK 3.20/3.22 source defines and the conditionals using them.

 src/CMakeLists.txt                                 |   14 ---------
 src/client/application/geary-application.vala      |    6 ----
 src/client/application/geary-controller.vala       |   20 -------------
 .../conversation-viewer/conversation-list-box.vala |   31 --------------------
 .../conversation-viewer/conversation-message.vala  |    6 ----
 src/client/dialogs/attachment-dialog.vala          |   16 ++--------
 6 files changed, 3 insertions(+), 90 deletions(-)
---
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2b877de..4e8a0c4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -587,20 +587,6 @@ else ()
     message(STATUS "Reference tracking: OFF")
 endif ()
 
-if (NOT DEPS_gtk+-3.0_VERSION VERSION_LESS 3.20)
-    set(EXTRA_VALA_OPTIONS
-        ${EXTRA_VALA_OPTIONS}
-        -D GTK_3_20
-    )
-endif()
-
-if (NOT DEPS_gtk+-3.0_VERSION VERSION_LESS 3.22)
-    set(EXTRA_VALA_OPTIONS
-        ${EXTRA_VALA_OPTIONS}
-        -D GTK_3_22
-    )
-endif()
-
 if (DISABLE_POODLE)
     message(STATUS "POODLE SSLv3 fix: OFF")
     set(EXTRA_VALA_OPTIONS
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index cc326cb..857cffb 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -379,18 +379,12 @@ public class GearyApplication : Gtk.Application {
      */
     public void show_uri(string uri) throws Error {
         Gtk.Window? window = get_active_window();
-#if !GTK_3_22
         bool success = Gtk.show_uri(
             window != null ? window.get_screen() : null, uri, Gdk.CURRENT_TIME
         );
         if (!success) {
             throw new IOError.FAILED("gtk_show_uri() returned false");
         }
-#else
-        if (!Gtk.show_uri_on_window(window, uri, Gdk.CURRENT_TIME)) {
-            throw new IOError.FAILED("gtk_show_uri_on_window() returned false");
-        }
-#endif
     }
 
     // This call will fire "exiting" only if it's not already been fired.
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index a2f36e4..8f4e164 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -2039,11 +2039,7 @@ public class GearyController : Geary.BaseObject {
     }
 
     private async void save_attachments_to_file(Gee.Collection<Geary.Attachment> attachments) {
-#if GTK_3_20
         Gtk.FileChooserNative dialog = new_save_chooser(Gtk.FileChooserAction.SELECT_FOLDER);
-#else
-        Gtk.FileChooserDialog dialog = new_save_chooser(Gtk.FileChooserAction.SELECT_FOLDER);
-#endif
 
         bool accepted = (dialog.run() == Gtk.ResponseType.ACCEPT);
         string? filename = dialog.get_filename();
@@ -2079,11 +2075,7 @@ public class GearyController : Geary.BaseObject {
 
     private async void prompt_save_buffer(string? filename, Geary.Memory.Buffer buffer)
     throws Error {
-#if GTK_3_20
         Gtk.FileChooserNative dialog = new_save_chooser(Gtk.FileChooserAction.SAVE);
-#else
-        Gtk.FileChooserDialog dialog = new_save_chooser(Gtk.FileChooserAction.SAVE);
-#endif
         if (!Geary.String.is_empty(filename))
             dialog.set_current_name(filename);
         dialog.set_do_overwrite_confirmation(true);
@@ -2128,7 +2120,6 @@ public class GearyController : Geary.BaseObject {
         return (dialog.run() == Gtk.ResponseType.OK);
     }
 
-#if GTK_3_20
     private inline Gtk.FileChooserNative new_save_chooser(Gtk.FileChooserAction action) {
         Gtk.FileChooserNative dialog = new Gtk.FileChooserNative(
             null,
@@ -2137,17 +2128,6 @@ public class GearyController : Geary.BaseObject {
             Stock._SAVE,
             Stock._CANCEL
         );
-#else
-    private inline Gtk.FileChooserDialog new_save_chooser(Gtk.FileChooserAction action) {
-        Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog(
-            null,
-            this.main_window,
-            action,
-            Stock._CANCEL, Gtk.ResponseType.CANCEL,
-            Stock._SAVE, Gtk.ResponseType.ACCEPT,
-            null
-        );
-#endif
         string? dir = this.application.config.attachments_dir;
         if (!Geary.String.is_empty(dir))
             dialog.set_current_folder(dir);
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 46ea1a6..9dc7caf 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -50,11 +50,6 @@ public class ConversationListBox : Gtk.ListBox {
         protected const string EXPANDED_CLASS = "geary-expanded";
         private const string FIRST_CLASS = "geary-first";
         private const string LAST_CLASS = "geary-last";
-#if !GTK_3_20
-        // GTK < 3.20+ style workarounds. Keep this in sync
-        // with geary.css.
-        private const int CANT_USE_PADDING_WORKAROUND = 18;
-#endif
 
         // The email being displayed by this row, if any
         public Geary.Email? email { get; private set; default = null; }
@@ -65,11 +60,6 @@ public class ConversationListBox : Gtk.ListBox {
                 return this._is_expanded;
             }
             protected set {
-#if !GTK_3_20
-                // GTK+ < 3.20 style workaround. Keep this in sync
-                // with geary.css
-                this.margin_bottom = value ? 6 : 0;
-#endif
                 this._is_expanded = value;
             }
         }
@@ -81,11 +71,6 @@ public class ConversationListBox : Gtk.ListBox {
         internal bool is_first {
             set {
                 set_style_context_class(FIRST_CLASS, value);
-#if !GTK_3_20
-                // GTK < 3.20+ style workarounds. Keep this in sync
-                // with geary.css.
-                this.margin_top = CANT_USE_PADDING_WORKAROUND;
-#endif
             }
         }
 
@@ -95,11 +80,6 @@ public class ConversationListBox : Gtk.ListBox {
         internal bool is_last {
             set {
                 set_style_context_class(LAST_CLASS, value);
-#if !GTK_3_20
-                // GTK < 3.20+ style workarounds. Keep this in sync
-                // with geary.css.
-                this.margin_bottom = CANT_USE_PADDING_WORKAROUND;
-#endif
             }
         }
 
@@ -113,13 +93,6 @@ public class ConversationListBox : Gtk.ListBox {
         public ConversationRow(Geary.Email? email) {
             this.email = email;
             show();
-
-#if !GTK_3_20
-            // GTK < 3.20+ style workarounds. Keep this in sync with
-            // geary.css.
-            this.margin_start = CANT_USE_PADDING_WORKAROUND;
-            this.margin_end = CANT_USE_PADDING_WORKAROUND;
-#endif
         }
 
         // Request the row be expanded, if supported.
@@ -427,10 +400,6 @@ public class ConversationListBox : Gtk.ListBox {
 
         get_style_context().add_class("background");
         get_style_context().add_class("conversation-listbox");
-#if !GTK_3_20
-        // GTK < 3.20+ style workaround
-        get_style_context().remove_class("list");
-#endif
 
         set_adjustment(adjustment);
         set_selection_mode(Gtk.SelectionMode.NONE);
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 036ba09..5de36c5 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -275,12 +275,6 @@ public class ConversationMessage : Gtk.Grid {
         this.message = message;
         this.is_loading_images = load_remote_images;
 
-#if !GTK_3_20
-        // GTK < 3.20+ style workarounds. Keep this in sync with
-        // geary.css.
-        this.summary.border_width = 12;
-#endif
-
         // Actions
 
         add_action(ACTION_COPY_EMAIL, true, VariantType.STRING)
diff --git a/src/client/dialogs/attachment-dialog.vala b/src/client/dialogs/attachment-dialog.vala
index ecf1d68..421ddb7 100644
--- a/src/client/dialogs/attachment-dialog.vala
+++ b/src/client/dialogs/attachment-dialog.vala
@@ -4,6 +4,9 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
+/**
+ * A FileChooser-like object for choosing attachments for a message.
+ */
 public class AttachmentDialog : Object {
 
     private const int PREVIEW_SIZE = 180;
@@ -11,11 +14,7 @@ public class AttachmentDialog : Object {
 
     private Configuration config;
 
-#if GTK_3_20
     private Gtk.FileChooserNative? chooser = null;
-#else
-    private Gtk.FileChooserDialog? chooser = null;
-#endif
 
     private Gtk.Image preview_image = new Gtk.Image();
 
@@ -23,12 +22,7 @@ public class AttachmentDialog : Object {
 
     public AttachmentDialog(Gtk.Window? parent, Configuration config) {
         this.config = config;
-
-#if GTK_3_20
         this.chooser = new Gtk.FileChooserNative(_("Choose a file"), parent, Gtk.FileChooserAction.OPEN, 
_("_Attach"), Stock._CANCEL);
-#else
-        this.chooser = new Gtk.FileChooserDialog(_("Choose a file"), parent, Gtk.FileChooserAction.OPEN, 
Stock._CANCEL, Gtk.ResponseType.CANCEL, _("_Attach"), Gtk.ResponseType.ACCEPT);
-#endif
 
         string? dir = config.attachments_dir;
         if (!Geary.String.is_empty(dir)) {
@@ -45,10 +39,6 @@ public class AttachmentDialog : Object {
         this.chooser.update_preview.connect(on_update_preview);
     }
 
-    // XXX Once we depend on GTK+ 3.20 as a minimum, convert this
-    // class to a subclass of FileChooserNative and remove these API
-    // compat classes.
-
     public void add_filter(owned Gtk.FileFilter filter) {
         this.chooser.add_filter(filter);
     }


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