[gnome-todo] window: Remove old obsolete "mode" property



commit 8417ee4984b9bfd02fcb1eebb4b88978e7bcf737
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Apr 27 23:46:37 2020 -0300

    window: Remove old obsolete "mode" property
    
    This doesn't exist for more than 3 years now.

 data/org.gnome.todo.gschema.xml |   5 --
 src/gtd-enums.h                 |  14 +----
 src/gtd-window.c                | 133 ----------------------------------------
 src/gtd-window.h                |   5 --
 src/gtd-window.ui               |  10 ---
 5 files changed, 1 insertion(+), 166 deletions(-)
---
diff --git a/data/org.gnome.todo.gschema.xml b/data/org.gnome.todo.gschema.xml
index ac6f30c..1daa741 100644
--- a/data/org.gnome.todo.gschema.xml
+++ b/data/org.gnome.todo.gschema.xml
@@ -26,11 +26,6 @@
             <summary>List of active extensions</summary>
             <description>The list of active extensions</description>
         </key>
-        <key name="view" enum="org.gnome.todo.GtdListSelectorViewType">
-            <default>'grid'</default>
-            <summary>The current list selector</summary>
-            <description>The current list selector. Can be “grid” or “list”.</description>
-        </key>
         <key name="sidebar-revealed" type="b">
             <default>true</default>
             <summary>Sidebar revealed</summary>
diff --git a/src/gtd-enums.h b/src/gtd-enums.h
index baf349d..6be7660 100644
--- a/src/gtd-enums.h
+++ b/src/gtd-enums.h
@@ -1,6 +1,6 @@
 /* gtd-enums.h
  *
- * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ * Copyright (C) 2015-2020 Georges Basile Stavracas Neto <georges stavracas gmail com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,18 +23,6 @@
 
 G_BEGIN_DECLS
 
-typedef enum
-{
-  GTD_WINDOW_MODE_NORMAL,
-  GTD_WINDOW_MODE_SELECTION
-} GtdWindowMode;
-
-typedef enum
-{
-  GTD_LIST_SELECTOR_VIEW_GRID,
-  GTD_LIST_SELECTOR_VIEW_LIST
-} GtdListSelectorViewType;
-
 G_END_DECLS
 
 #endif /* GTD_ENUMS_H */
diff --git a/src/gtd-window.c b/src/gtd-window.c
index bea2e93..06ee817 100644
--- a/src/gtd-window.c
+++ b/src/gtd-window.c
@@ -57,7 +57,6 @@ struct _GtdWindow
 {
   GtkApplicationWindow application;
 
-  GtkWidget          *cancel_selection_button;
   GtkHeaderBar       *headerbar;
   GtkStack           *stack;
   GtkWidget          *workspace_box_end;
@@ -68,9 +67,6 @@ struct _GtdWindow
   GPtrArray          *workspace_header_widgets;
 
   GtdWorkspace       *current_workspace;
-
-  /* mode */
-  GtdWindowMode       mode;
 };
 
 typedef struct
@@ -84,13 +80,6 @@ typedef struct
 G_DEFINE_TYPE (GtdWindow, gtd_window, GTK_TYPE_APPLICATION_WINDOW)
 
 
-enum
-{
-  PROP_0,
-  PROP_MODE,
-  LAST_PROP
-};
-
 
 static void
 setup_development_build (GtdWindow *self)
@@ -221,13 +210,6 @@ remove_all_workspace_header_widgets (GtdWindow *self)
  * Callbacks
  */
 
-static void
-on_cancel_selection_button_clicked (GtkWidget *button,
-                                    GtdWindow *self)
-{
-  gtd_window_set_mode (self, GTD_WINDOW_MODE_NORMAL);
-}
-
 static void
 on_stack_visible_child_cb (GtkStack   *stack,
                            GParamSpec *pspec,
@@ -384,44 +366,6 @@ gtd_window_constructed (GObject *object)
   g_signal_connect (manager, "workspace-removed", G_CALLBACK (on_manager_workspace_removed_cb), self);
 }
 
-static void
-gtd_window_get_property (GObject    *object,
-                         guint       prop_id,
-                         GValue     *value,
-                         GParamSpec *pspec)
-{
-  GtdWindow *self = GTD_WINDOW (object);
-
-  switch (prop_id)
-    {
-    case PROP_MODE:
-      g_value_set_enum (value, self->mode);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
-}
-
-static void
-gtd_window_set_property (GObject      *object,
-                         guint         prop_id,
-                         const GValue *value,
-                         GParamSpec   *pspec)
-{
-  GtdWindow *self = GTD_WINDOW (object);
-
-  switch (prop_id)
-    {
-    case PROP_MODE:
-      gtd_window_set_mode (self, g_value_get_enum (value));
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
-}
-
 static void
 gtd_window_class_init (GtdWindowClass *klass)
 {
@@ -429,38 +373,19 @@ gtd_window_class_init (GtdWindowClass *klass)
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
   object_class->constructed = gtd_window_constructed;
-  object_class->get_property = gtd_window_get_property;
-  object_class->set_property = gtd_window_set_property;
 
   widget_class->unmap = gtd_window_unmap;
 
-  /**
-   * GtdWindow::mode:
-   *
-   * The current interaction mode of the window.
-   */
-  g_object_class_install_property (
-        object_class,
-        PROP_MODE,
-        g_param_spec_enum ("mode",
-                           "Mode of this window",
-                           "The interaction mode of the window",
-                           GTD_TYPE_WINDOW_MODE,
-                           GTD_WINDOW_MODE_NORMAL,
-                           G_PARAM_READWRITE));
-
   g_type_ensure (GTD_TYPE_NOTIFICATION_WIDGET);
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/todo/ui/gtd-window.ui");
 
-  gtk_widget_class_bind_template_child (widget_class, GtdWindow, cancel_selection_button);
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, headerbar);
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, notification_widget);
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, stack);
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, workspace_box_end);
   gtk_widget_class_bind_template_child (widget_class, GtdWindow, workspace_box_start);
 
-  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);
 }
 
@@ -516,64 +441,6 @@ gtd_window_cancel_notification (GtdWindow       *self,
   gtd_notification_widget_cancel (self->notification_widget, notification);
 }
 
-/**
- * gtd_window_get_mode:
- * @window: a #GtdWindow
- *
- * Retrieves the current mode of @window.
- *
- * Returns: the #GtdWindow::mode property value
- */
-GtdWindowMode
-gtd_window_get_mode (GtdWindow *self)
-{
-  g_return_val_if_fail (GTD_IS_WINDOW (self), GTD_WINDOW_MODE_NORMAL);
-
-  return self->mode;
-}
-
-/**
- * gtd_window_set_mode:
- * @window: a #GtdWindow
- * @mode: a #GtdWindowMode
- *
- * Sets the current window mode to @mode.
- */
-void
-gtd_window_set_mode (GtdWindow     *self,
-                     GtdWindowMode  mode)
-{
-  g_return_if_fail (GTD_IS_WINDOW (self));
-
-  if (self->mode != mode)
-    {
-      GtkStyleContext *context;
-      gboolean is_selection_mode;
-
-      self->mode = mode;
-      context = gtk_widget_get_style_context (GTK_WIDGET (self->headerbar));
-      is_selection_mode = (mode == GTD_WINDOW_MODE_SELECTION);
-
-      gtk_widget_set_visible (self->cancel_selection_button, is_selection_mode);
-      gtk_header_bar_set_show_title_buttons (self->headerbar, !is_selection_mode);
-      gtk_header_bar_set_subtitle (self->headerbar, NULL);
-
-      if (is_selection_mode)
-        {
-          gtk_style_context_add_class (context, "selection-mode");
-          gtk_header_bar_set_custom_title (self->headerbar, NULL);
-          gtk_header_bar_set_title (self->headerbar, _("Click a task list to select"));
-        }
-      else
-        {
-          gtk_style_context_remove_class (context, "selection-mode");
-          gtk_header_bar_set_title (self->headerbar, _("To Do"));
-        }
-
-      g_object_notify (G_OBJECT (self), "mode");
-    }
-}
-
 /**
  * gtd_window_set_custom_title:
  * @window: a #GtdWindow
diff --git a/src/gtd-window.h b/src/gtd-window.h
index ed2cd66..cf6b656 100644
--- a/src/gtd-window.h
+++ b/src/gtd-window.h
@@ -40,11 +40,6 @@ void                      gtd_window_notify               (GtdWindow
 void                      gtd_window_cancel_notification  (GtdWindow             *window,
                                                            GtdNotification      *notification);
 
-GtdWindowMode             gtd_window_get_mode             (GtdWindow             *window);
-
-void                      gtd_window_set_mode             (GtdWindow             *window,
-                                                           GtdWindowMode          mode);
-
 void                      gtd_window_set_custom_title     (GtdWindow             *window,
                                                            const gchar           *title,
                                                            const gchar           *subtitle);
diff --git a/src/gtd-window.ui b/src/gtd-window.ui
index 6a67602..afd7375 100644
--- a/src/gtd-window.ui
+++ b/src/gtd-window.ui
@@ -45,16 +45,6 @@
                 <property name="spacing">6</property>
               </object>
             </child>
-            <child type="end">
-              <object class="GtkButton" id="cancel_selection_button">
-                <property name="label" translatable="yes">_Cancel</property>
-                <property name="use_underline">1</property>
-                <property name="visible">0</property>
-                <property name="can_focus">1</property>
-                <property name="receives_default">1</property>
-                <signal name="clicked" handler="on_cancel_selection_button_clicked" object="GtdWindow" 
swapped="no"/>
-              </object>
-            </child>
             <child type="end">
               <object class="GtkMenuButton">
                 <property name="menu-model">app-menu</property>


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