[fractal] Remove gtk deprecation warnings



commit 760a9293d3d575f34e07b9aa16ac93cbf324af96
Author: Alejandro Domínguez <adomu net-c com>
Date:   Wed Oct 7 03:18:58 2020 +0200

    Remove gtk deprecation warnings

 fractal-gtk/src/app/connect/direct.rs    |  4 ++--
 fractal-gtk/src/app/connect/invite.rs    |  4 ++--
 fractal-gtk/src/appop/message.rs         |  2 +-
 fractal-gtk/src/widgets/divider.rs       |  2 +-
 fractal-gtk/src/widgets/image.rs         |  2 +-
 fractal-gtk/src/widgets/inline_player.rs |  4 ++--
 fractal-gtk/src/widgets/media_viewer.rs  | 14 +++++++-------
 fractal-gtk/src/widgets/room_history.rs  |  6 +++---
 8 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/direct.rs b/fractal-gtk/src/app/connect/direct.rs
index fe7acd57..14e71019 100644
--- a/fractal-gtk/src/app/connect/direct.rs
+++ b/fractal-gtk/src/app/connect/direct.rs
@@ -62,7 +62,7 @@ impl App {
                 }
             }
 
-            let sid = gtk::timeout_add(500, clone!(
+            let sid = glib::timeout_add_local(500, clone!(
                 @strong op,
                 @strong entry,
                 @strong source_id
@@ -108,7 +108,7 @@ impl App {
 
         if let Some(buffer) = to_chat_entry.get_buffer() {
             buffer.connect_delete_range(clone!(@strong op => move |_, _, _| {
-                gtk::idle_add(clone!(@strong op => move || {
+                glib::idle_add_local(clone!(@strong op => move || {
                     op.lock().unwrap().detect_removed_invite();
                     Continue(false)
                 }));
diff --git a/fractal-gtk/src/app/connect/invite.rs b/fractal-gtk/src/app/connect/invite.rs
index e4206718..8c5f4166 100644
--- a/fractal-gtk/src/app/connect/invite.rs
+++ b/fractal-gtk/src/app/connect/invite.rs
@@ -96,7 +96,7 @@ impl App {
                 }
             }
 
-            let sid = gtk::timeout_add(500, clone!(
+            let sid = glib::timeout_add_local(500, clone!(
                 @strong op,
                 @strong entry,
                 @strong source_id
@@ -140,7 +140,7 @@ impl App {
 
         if let Some(buffer) = invite_entry.get_buffer() {
             buffer.connect_delete_range(clone!(@strong op => move |_, _, _| {
-                gtk::idle_add(clone!(@strong op => move || {
+                glib::idle_add_local(clone!(@strong op => move || {
                     op.lock().unwrap().detect_removed_invite();
                     Continue(false)
                 }));
diff --git a/fractal-gtk/src/appop/message.rs b/fractal-gtk/src/appop/message.rs
index d81e4af4..2e8ccf25 100644
--- a/fractal-gtk/src/appop/message.rs
+++ b/fractal-gtk/src/appop/message.rs
@@ -197,7 +197,7 @@ impl AppOp {
     }
 
     pub fn retry_send(&mut self) {
-        gtk::timeout_add(5000, move || {
+        glib::timeout_add_local(5000, move || {
             /* This will be removed once tmp messages are refactored */
             APPOP!(force_dequeue_message);
             Continue(false)
diff --git a/fractal-gtk/src/widgets/divider.rs b/fractal-gtk/src/widgets/divider.rs
index 708341a7..df33a1df 100644
--- a/fractal-gtk/src/widgets/divider.rs
+++ b/fractal-gtk/src/widgets/divider.rs
@@ -44,7 +44,7 @@ impl NewMessageDivider {
          * destroy the NewMessageDivider after it's added to the History with a couple of
          * seconds delay */
         row.connect_parent_set(clone!(@weak revealer => move |_, _| {
-            gtk::timeout_add(5000, clone!(
+            glib::timeout_add_local(5000, clone!(
                 @weak revealer as r
                 => @default-return Continue(false), move || {
                     /* when the user closes the room the divider gets destroyed and this timeout
diff --git a/fractal-gtk/src/widgets/image.rs b/fractal-gtk/src/widgets/image.rs
index 91b311e2..06aa70a2 100644
--- a/fractal-gtk/src/widgets/image.rs
+++ b/fractal-gtk/src/widgets/image.rs
@@ -361,7 +361,7 @@ pub fn load_animation(
     let anim = res.unwrap();
     let iter = anim.get_iter(glib::get_current_time());
 
-    gtk::timeout_add(iter.get_delay_time() as u32, move || {
+    glib::timeout_add_local(iter.get_delay_time() as u32, move || {
         iter.advance(glib::get_current_time());
 
         if widget.is_drawable() {
diff --git a/fractal-gtk/src/widgets/inline_player.rs b/fractal-gtk/src/widgets/inline_player.rs
index 0c77981c..d361c452 100644
--- a/fractal-gtk/src/widgets/inline_player.rs
+++ b/fractal-gtk/src/widgets/inline_player.rs
@@ -365,7 +365,7 @@ impl VideoPlayerWidget {
             });
 
         /* Sometimes, set_size_request() doesn't get captured visually. The following timeout takes care of 
that. */
-        gtk::timeout_add_seconds(
+        glib::timeout_add_seconds_local(
             1,
             clone!(
             @weak player_widget as player
@@ -407,7 +407,7 @@ impl VideoPlayerWidget {
                     When approaching the minimum fast, the last connect_size_allocate signal gets emitted 
before
                     reaching the minimum size. So without timeout, the values used to adjust the the video 
size
                     are bigger than they should be. */
-                    gtk::timeout_add(
+                    glib::timeout_add_local(
                         50,
                         clone!(
                         @strong bx,
diff --git a/fractal-gtk/src/widgets/media_viewer.rs b/fractal-gtk/src/widgets/media_viewer.rs
index 359f253e..43d52f3b 100644
--- a/fractal-gtk/src/widgets/media_viewer.rs
+++ b/fractal-gtk/src/widgets/media_viewer.rs
@@ -65,7 +65,7 @@ impl VideoWidget {
         self.inner_box.set_halign(gtk::Align::Fill);
 
         let bx = self.outer_box.clone();
-        gtk::timeout_add(50, move || {
+        glib::timeout_add_local(50, move || {
             bx.set_margin_top(0);
             bx.set_margin_bottom(0);
             Continue(false)
@@ -403,7 +403,7 @@ impl Data {
         control_revealer.add(&full_control_box);
         control_revealer.set_reveal_child(true);
         let source_id: Rc<RefCell<Option<glib::source::SourceId>>> = Rc::new(RefCell::new(None));
-        let first_sid = gtk::timeout_add_seconds(
+        let first_sid = glib::timeout_add_seconds_local(
             1,
             clone!(@strong source_id, @strong control_revealer => move || {
                 control_revealer.set_reveal_child(false);
@@ -426,7 +426,7 @@ impl Data {
             if let Some(sid) = source_id.borrow_mut().take() {
                 glib::source::source_remove(sid);
             }
-            let new_sid = gtk::timeout_add_seconds(
+            let new_sid = glib::timeout_add_seconds_local(
                 1,
                 clone!(
                     @strong source_id,
@@ -467,7 +467,7 @@ impl Data {
                     if player.is_playing() {
                         control_revealer.set_reveal_child(true);
                     } else {
-                        let new_sid = gtk::timeout_add_seconds(
+                        let new_sid = glib::timeout_add_seconds_local(
                             1,
                             clone!(
                                 @strong source_id,
@@ -505,13 +505,13 @@ impl Data {
                     let id = click_timeout_id.borrow_mut().take().unwrap();
                     glib::source::source_remove(id);
                 } else {
-                    let sid = gtk::timeout_add(
+                    let sid = glib::timeout_add_local(
                         250,
                         clone!(@strong player, @strong click_timeout_id => move || {
                             if player.is_playing() {
                                 revealer.set_reveal_child(true);
                             } else {
-                                let new_sid = gtk::timeout_add_seconds(
+                                let new_sid = glib::timeout_add_seconds_local(
                                     1,
                                     clone!(
                                         @strong source_id,
@@ -836,7 +836,7 @@ impl MediaViewer {
                     .expect("Cant find next_media_revealer in ui file.");
                 next_media_revealer.set_reveal_child(true);
 
-                let sid = gtk::timeout_add(
+                let sid = glib::timeout_add_local(
                     1000,
                     clone!(
                     @strong ui,
diff --git a/fractal-gtk/src/widgets/room_history.rs b/fractal-gtk/src/widgets/room_history.rs
index 951a992e..74edcc59 100644
--- a/fractal-gtk/src/widgets/room_history.rs
+++ b/fractal-gtk/src/widgets/room_history.rs
@@ -320,7 +320,7 @@ impl RoomHistory {
         self.add_new_messages_in_batch(thread_pool, user_info_cache, bottom);
 
         let rows = &self.rows;
-        let id = timeout_add(
+        let id = glib::timeout_add_local(
             250,
             clone!(
             @weak rows
@@ -348,7 +348,7 @@ impl RoomHistory {
         scrollbar.connect_value_changed(clone!(@weak rows => move |sb| {
             if !sb.get_state_flags().contains(gtk::StateFlags::BACKDROP) {
                 /* Fractal is focused */
-                let new_id = timeout_add(250, clone!(
+                let new_id = glib::timeout_add_local(250, clone!(
                     @weak rows
                     => @default-return Continue(false), move || {
                         rows.borrow_mut().update_videos();
@@ -449,7 +449,7 @@ impl RoomHistory {
             let source_id = self.source_id.clone();
             let server_url = self.server_url.clone();
             let access_token = self.access_token.clone();
-            *self.source_id.borrow_mut() = Some(gtk::idle_add(move || {
+            *self.source_id.borrow_mut() = Some(glib::idle_add_local(move || {
                 let mut data = queue.borrow_mut();
                 let mut edits = edit_buffer.borrow_mut();
                 if let Some(mut item) = data.pop_front() {


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