[gnome-todo] window: Remove refresh code



commit 12fc41468672af381b760515e12db79e2847f7f3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Sep 18 15:25:22 2019 -0300

    window: Remove refresh code
    
    This turned out to be extremelly annoying, not because the
    behavior is inherently wrong, but because EDS removes and
    readds many task lists, and we run the migration code on
    them every time.

 src/gtd-window.c  | 68 -------------------------------------------------------
 src/gtd-window.ui |  1 -
 2 files changed, 69 deletions(-)
---
diff --git a/src/gtd-window.c b/src/gtd-window.c
index 2bbe1c0..59266f0 100644
--- a/src/gtd-window.c
+++ b/src/gtd-window.c
@@ -81,8 +81,6 @@ struct _GtdWindow
 
   /* mode */
   GtdWindowMode       mode;
-
-  guint               block_refresh_timeout_id;
 };
 
 typedef struct
@@ -93,9 +91,6 @@ typedef struct
 } ErrorData;
 
 
-static gboolean      block_refresh_cb                            (gpointer           data);
-
-
 G_DEFINE_TYPE (GtdWindow, gtd_window, GTK_TYPE_APPLICATION_WINDOW)
 
 
@@ -187,14 +182,6 @@ remove_widgets (GtdWindow *self,
     }
 }
 
-static void
-block_refresh (GtdWindow *self)
-{
-  g_debug ("Blocking refreshs triggered by window focus");
-
-  self->block_refresh_timeout_id = g_timeout_add_seconds (20, block_refresh_cb, self);
-}
-
 static void
 on_plugin_loaded_cb (GtdWindow      *self,
                      gpointer        unused_field,
@@ -338,47 +325,6 @@ load_geometry (GtdWindow *self)
     gtk_window_maximize (window);
 }
 
-static gboolean
-block_refresh_cb (gpointer data)
-{
-  GtdWindow *self = data;
-
-  g_debug ("Unblocking refreshs triggered by window focus");
-
-  self->block_refresh_timeout_id = 0;
-
-  return G_SOURCE_REMOVE;
-}
-
-static void
-on_active_state_changed_cb (GObject    *object,
-                            GParamSpec *pspec,
-                            GtdWindow  *self)
-{
-  g_autoptr (GList) providers = NULL;
-  GList *l;
-
-  GTD_ENTRY;
-
-  if (!gtk_window_is_active (GTK_WINDOW (self)) ||
-      self->block_refresh_timeout_id > 0)
-    {
-      GTD_RETURN ();
-    }
-
-  g_debug ("Window focused, refreshing providers");
-
-  providers = gtd_manager_get_providers (gtd_manager_get_default ());
-
-  /* Refresh all providers */
-  for (l = providers; l; l = l->next)
-    gtd_provider_refresh (l->data);
-
-  block_refresh (self);
-
-  GTD_EXIT;
-}
-
 static void
 on_action_activate_panel_activated_cb (GSimpleAction *simple,
                                        GVariant      *parameters,
@@ -614,16 +560,6 @@ gtd_window_constructed (GObject *object)
   g_signal_connect (gtd_manager_get_default (), "show-notification", G_CALLBACK (on_show_notification_cb), 
self);
 }
 
-static void
-gtd_window_finalize (GObject *object)
-{
-  GtdWindow *self = GTD_WINDOW (object);
-
-  G_OBJECT_CLASS (gtd_window_parent_class)->finalize (object);
-
-  g_clear_handle_id (&self->block_refresh_timeout_id, g_source_remove);
-}
-
 static void
 gtd_window_get_property (GObject    *object,
                          guint       prop_id,
@@ -669,7 +605,6 @@ gtd_window_class_init (GtdWindowClass *klass)
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
   object_class->constructed = gtd_window_constructed;
-  object_class->finalize = gtd_window_finalize;
   object_class->get_property = gtd_window_get_property;
   object_class->set_property = gtd_window_set_property;
 
@@ -709,7 +644,6 @@ gtd_window_class_init (GtdWindowClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, panel_box_end);
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, panel_box_start);
 
-  gtk_widget_class_bind_template_callback (widget_class, on_active_state_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_cancel_selection_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, on_stack_visible_child_cb);
 }
@@ -742,8 +676,6 @@ gtd_window_init (GtdWindow *self)
   /* Development build */
   if (is_development_build ())
     setup_development_build (self);
-
-  block_refresh (self);
 }
 
 GtkWidget*
diff --git a/src/gtd-window.ui b/src/gtd-window.ui
index 080ca8f..5cb6247 100644
--- a/src/gtd-window.ui
+++ b/src/gtd-window.ui
@@ -4,7 +4,6 @@
   <template class="GtdWindow" parent="GtkApplicationWindow">
     <property name="default_width">800</property>
     <property name="default_height">600</property>
-    <signal name="notify::is-active" handler="on_active_state_changed_cb" object="GtdWindow" swapped="no"/>
     <style>
       <class name="org-gnome-Todo"/>
     </style>


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