[fractal] fractal-gtk: Migrate to GtkSourceView4



commit 57945eecad4820939024af81f907aede332cb22a
Author: Christopher Davis <brainblasted disroot org>
Date:   Sat Aug 10 19:00:17 2019 -0700

    fractal-gtk: Migrate to GtkSourceView4
    
    GtkSourceView3 is no longer updated.

 Cargo.lock                                  | 46 ++++++++++++++---------------
 flatpak/org.gnome.Fractal.json              |  7 ++---
 fractal-gtk/Cargo.toml                      |  2 +-
 fractal-gtk/res/ui/msg_src_window.ui        |  2 +-
 fractal-gtk/src/app/connect/markdown.rs     |  7 ++---
 fractal-gtk/src/app/connect/send.rs         |  2 +-
 fractal-gtk/src/widgets/autocomplete.rs     |  5 ++--
 fractal-gtk/src/widgets/source_dialog.rs    | 11 ++++---
 fractal-gtk/src/widgets/sourceview_entry.rs | 10 +++----
 meson.build                                 |  2 +-
 10 files changed, 43 insertions(+), 51 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 394fdf23..fb3a4074 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -578,7 +578,7 @@ dependencies = [
  "secret-service 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
- "sourceview 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "sourceview4 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -1048,23 +1048,6 @@ dependencies = [
  "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "gtk-source-sys"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-dependencies = [
- "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "gtk-sys"
 version = "0.9.0"
@@ -2279,15 +2262,14 @@ version = "0.6.10"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
-name = "sourceview"
-version = "0.7.0"
+name = "sourceview4"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2295,10 +2277,26 @@ dependencies = [
  "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gtk-source-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
  "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "sourceview4-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "sourceview4-sys"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -2844,7 +2842,6 @@ dependencies = [
 "checksum gstreamer-video 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"faf8385a79aceb3e2fe492fc5b457ba0db5b38a49fe6e6f6277e5275f71c0b51"
 "checksum gstreamer-video-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6b8fcb1e577de93d1ad1e5117234ce64d40f215143d752140719923651608983"
 "checksum gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"709f1074259d4685b96133f92b75c7f35b504715b0fcdc96ec95de2607296a60"
-"checksum gtk-source-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"108a5225a1bdc30b28d700ec1f330969da05dddb1c3d4a77ef22de448840de5e"
 "checksum gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"bbd9395497ae1d1915d1d6e522d51ae8745bf613906c34ac191c411250fc4025"
 "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = 
"a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
 "checksum hkdf 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"35e8f9d776bbe83f1ff24951f7cc19140fb7ff8d0378463c4c4955f6b0d3e503"
@@ -2971,7 +2968,8 @@ dependencies = [
 "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
 "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
 "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = 
"ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
-"checksum sourceview 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"70a85127dfe81f8645861877f75d6bd4cefad29e23d7b624553a0c6a394ef93d"
+"checksum sourceview4 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"183e1580e60707f075da7a32c7d3f3ae2e078767490dcf8598b2d6e5f89b5bcc"
+"checksum sourceview4-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6ff9823451380b49520f2e3b140c01866d3ebf7d340177beb37b020f4904e5c8"
 "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
 "checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d"
 "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423"
diff --git a/flatpak/org.gnome.Fractal.json b/flatpak/org.gnome.Fractal.json
index 13304460..4474804d 100644
--- a/flatpak/org.gnome.Fractal.json
+++ b/flatpak/org.gnome.Fractal.json
@@ -60,14 +60,11 @@
         },
         {
             "name" : "gtksourceview",
-            "config-opts" : [
-                "--disable-Werror"
-            ],
+            "buildsystem" : "meson",
             "sources" : [
                 {
                     "type" : "git",
-                    "url" : "https://gitlab.gnome.org/GNOME/gtksourceview.git";,
-                    "branch" : "gnome-3-24"
+                    "url" : "https://gitlab.gnome.org/GNOME/gtksourceview.git";
                 }
             ]
         },
diff --git a/fractal-gtk/Cargo.toml b/fractal-gtk/Cargo.toml
index 261566a3..6917def1 100644
--- a/fractal-gtk/Cargo.toml
+++ b/fractal-gtk/Cargo.toml
@@ -30,7 +30,7 @@ rand = "0.6.1"
 regex = "1.1.0"
 secret-service = "1.0.0"
 serde_json = "1.0.33"
-sourceview = "0.7.0"
+sourceview4 = "0.1.0"
 url = "1.7.2"
 
 [dependencies.gst]
diff --git a/fractal-gtk/res/ui/msg_src_window.ui b/fractal-gtk/res/ui/msg_src_window.ui
index 5c445504..f38c229c 100644
--- a/fractal-gtk/res/ui/msg_src_window.ui
+++ b/fractal-gtk/res/ui/msg_src_window.ui
@@ -2,7 +2,7 @@
 <!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
-  <requires lib="gtksourceview" version="3.0"/>
+  <requires lib="gtksourceview" version="4.0"/>
 
   <object class="GtkSourceBuffer" id="source_buffer">
   </object>
diff --git a/fractal-gtk/src/app/connect/markdown.rs b/fractal-gtk/src/app/connect/markdown.rs
index 8f0ad6d7..bafb40e1 100644
--- a/fractal-gtk/src/app/connect/markdown.rs
+++ b/fractal-gtk/src/app/connect/markdown.rs
@@ -1,7 +1,6 @@
 use gtk;
 use gtk::prelude::*;
-use sourceview;
-use sourceview::prelude::*;
+use sourceview4::prelude::*;
 
 use crate::util;
 
@@ -31,7 +30,7 @@ impl App {
             .get_object("tutorial_text_box")
             .expect("Couldn't find tutorial_text_box in ui file.");
 
-        let md_lang = sourceview::LanguageManager::get_default()
+        let md_lang = sourceview4::LanguageManager::get_default()
             .map_or(None, |lm| lm.get_language("markdown"));
 
         md_popover_btn.set_popover(Some(&popover));
@@ -65,7 +64,7 @@ impl App {
                     txt.get_style_context().add_class("dim-label");
                     util::set_markdown_schema(false);
 
-                    let lang: Option<&sourceview::Language> = None;
+                    let lang: Option<&sourceview4::Language> = None;
                     buffer.set_highlight_matching_brackets(false);
                     buffer.set_language(lang);
                     buffer.set_highlight_syntax(false);
diff --git a/fractal-gtk/src/app/connect/send.rs b/fractal-gtk/src/app/connect/send.rs
index c13fb5bf..0e168ece 100644
--- a/fractal-gtk/src/app/connect/send.rs
+++ b/fractal-gtk/src/app/connect/send.rs
@@ -3,7 +3,7 @@ use fractal_api::clone;
 use gdk;
 use gtk;
 use gtk::prelude::*;
-use sourceview::BufferExt;
+use sourceview4::BufferExt;
 
 use crate::app::App;
 
diff --git a/fractal-gtk/src/widgets/autocomplete.rs b/fractal-gtk/src/widgets/autocomplete.rs
index f9c09b1c..0406f425 100644
--- a/fractal-gtk/src/widgets/autocomplete.rs
+++ b/fractal-gtk/src/widgets/autocomplete.rs
@@ -10,7 +10,6 @@ use glib;
 use gtk;
 use gtk::prelude::*;
 use gtk::TextTag;
-use sourceview;
 
 use crate::types::Member;
 
@@ -18,7 +17,7 @@ use crate::appop::AppOp;
 use crate::widgets;
 
 pub struct Autocomplete {
-    entry: sourceview::View,
+    entry: sourceview4::View,
     listbox: gtk::ListBox,
     popover: gtk::Popover,
     window: gtk::Window,
@@ -33,7 +32,7 @@ impl Autocomplete {
     pub fn new(
         op: Arc<Mutex<AppOp>>,
         window: gtk::Window,
-        msg_entry: sourceview::View,
+        msg_entry: sourceview4::View,
         popover: gtk::Popover,
         listbox: gtk::ListBox,
     ) -> Autocomplete {
diff --git a/fractal-gtk/src/widgets/source_dialog.rs b/fractal-gtk/src/widgets/source_dialog.rs
index 0d3c3a3d..5ac49a0a 100644
--- a/fractal-gtk/src/widgets/source_dialog.rs
+++ b/fractal-gtk/src/widgets/source_dialog.rs
@@ -1,13 +1,12 @@
 use gtk;
 use gtk::prelude::*;
-use sourceview;
-use sourceview::prelude::*;
+use sourceview4::prelude::*;
 
 struct Widgets {
     msg_src_window: gtk::Window,
     copy_src_button: gtk::Button,
     close_src_button: gtk::Button,
-    source_buffer: sourceview::Buffer,
+    source_buffer: sourceview4::Buffer,
 }
 
 impl Widgets {
@@ -29,7 +28,7 @@ impl Widgets {
             .get_object("close_src_button")
             .expect("Can't find close_src_button in ui file.");
 
-        let source_buffer: sourceview::Buffer = builder
+        let source_buffer: sourceview4::Buffer = builder
             .get_object("source_buffer")
             .expect("Can't find source_buffer in ui file.");
 
@@ -95,7 +94,7 @@ impl SourceDialog {
         });
 
         let json_lang =
-            sourceview::LanguageManager::get_default().map_or(None, |lm| lm.get_language("json"));
+            sourceview4::LanguageManager::get_default().map_or(None, |lm| lm.get_language("json"));
 
         self.widgets
             .source_buffer
@@ -104,7 +103,7 @@ impl SourceDialog {
             self.widgets.source_buffer.set_language(Some(json_lang));
             self.widgets.source_buffer.set_highlight_syntax(true);
 
-            if let Some(scheme) = sourceview::StyleSchemeManager::get_default()
+            if let Some(scheme) = sourceview4::StyleSchemeManager::get_default()
                 .map_or(None, |scm| scm.get_scheme("kate"))
             {
                 self.widgets.source_buffer.set_style_scheme(Some(&scheme));
diff --git a/fractal-gtk/src/widgets/sourceview_entry.rs b/fractal-gtk/src/widgets/sourceview_entry.rs
index 2c2ef8d7..f7d70fbe 100644
--- a/fractal-gtk/src/widgets/sourceview_entry.rs
+++ b/fractal-gtk/src/widgets/sourceview_entry.rs
@@ -1,6 +1,6 @@
 use gtk::prelude::*;
 use libhandy::{Column, ColumnExt};
-use sourceview::ViewExt;
+use sourceview4::ViewExt;
 // This alias is necessary to avoid conflict with gtk's TextViewExt
 use gspell::TextViewExt as GspellTextViewExt;
 
@@ -13,8 +13,8 @@ pub struct SVEntry {
     pub markdown_img: gtk::Image,
     pub entry_box: gtk::Box,
     pub scroll: gtk::ScrolledWindow,
-    pub view: sourceview::View,
-    pub buffer: sourceview::Buffer,
+    pub view: sourceview4::View,
+    pub buffer: sourceview4::Buffer,
 }
 
 impl Default for SVEntry {
@@ -66,8 +66,8 @@ impl Default for SVEntry {
         let scroll = gtk::ScrolledWindow::new(hadjust, vadjust);
 
         let tag_table: Option<&gtk::TextTagTable> = None;
-        let buffer = sourceview::Buffer::new(tag_table);
-        let view = sourceview::View::new_with_buffer(&buffer);
+        let buffer = sourceview4::Buffer::new(tag_table);
+        let view = sourceview4::View::new_with_buffer(&buffer);
         view.set_wrap_mode(gtk::WrapMode::WordChar);
         view.set_indent_on_tab(false);
 
diff --git a/meson.build b/meson.build
index d7367276..56f96afb 100644
--- a/meson.build
+++ b/meson.build
@@ -13,7 +13,7 @@ dependency('cairo', version: '>= 1.16')
 dependency('gdk-pixbuf-2.0')
 dependency('gtk+-3.0', version: '>= 3.24.7')
 dependency('libhandy-0.0', version: '>= 0.0.10')
-dependency('gtksourceview-3.0', version: '>= 3.22')
+dependency('gtksourceview-4', version: '>= 4.0')
 dependency('gspell-1', version: '>= 1.8')
 
 dependency('gstreamer-1.0', version: '>= 1.12')


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