[gnome-builder] vcsui: Drop dead code for project tree VCS indicator color



commit c5eabdf22d42a7de2e9860fa9e29b71d2c04f873
Author: vanadiae <vanadiae35 gmail com>
Date:   Tue Jun 29 20:55:39 2021 +0200

    vcsui: Drop dead code for project tree VCS indicator color
    
    vcs-added and vcs-changed (initially found in the CSS) were only
    mentioned in the vcsui tree addin, where the only state that changed,
    the two rgba colors in the struct, weren't ever used.
    
    Effectively those were dead code, so this commit removes them. It's
    likely that the colored status indicator feature was dropped at one
    point, but that this part of the code was missed.

 src/plugins/project-tree/themes/shared.css |  8 -----
 src/plugins/vcsui/gbp-vcsui-tree-addin.c   | 47 ------------------------------
 2 files changed, 55 deletions(-)
---
diff --git a/src/plugins/project-tree/themes/shared.css b/src/plugins/project-tree/themes/shared.css
index a6c2bd476..79880fb6d 100644
--- a/src/plugins/project-tree/themes/shared.css
+++ b/src/plugins/project-tree/themes/shared.css
@@ -5,11 +5,3 @@ ideeditorsidebar treeview.project-tree {
   -gtk-icon-source: none;
   padding-left: 6px;
 }
-
-.vcs-added {
-  color: @success_color;
-}
-
-.vcs-changed {
-  color: @warning_color;
-}
diff --git a/src/plugins/vcsui/gbp-vcsui-tree-addin.c b/src/plugins/vcsui/gbp-vcsui-tree-addin.c
index 9d9feaa52..e5b051ed8 100644
--- a/src/plugins/vcsui/gbp-vcsui-tree-addin.c
+++ b/src/plugins/vcsui/gbp-vcsui-tree-addin.c
@@ -41,40 +41,8 @@ struct _GbpVcsuiTreeAddin
   IdeTreeModel  *model;
   IdeVcs        *vcs;
   IdeVcsMonitor *monitor;
-
-  GdkRGBA        added_color;
-  GdkRGBA        changed_color;
 };
 
-static void
-get_foreground_for_class (GtkStyleContext   *style_context,
-                          const gchar       *name,
-                          GdkRGBA           *rgba)
-{
-  GtkStateFlags state;
-
-  g_assert (GTK_IS_STYLE_CONTEXT (style_context));
-  g_assert (name != NULL);
-  g_assert (rgba != NULL);
-
-  state = gtk_style_context_get_state (style_context);
-  gtk_style_context_save (style_context);
-  gtk_style_context_add_class (style_context, name);
-  gtk_style_context_get_color (style_context, state, rgba);
-  gtk_style_context_restore (style_context);
-}
-
-static void
-on_tree_style_changed_cb (GbpVcsuiTreeAddin *self,
-                          GtkStyleContext   *context)
-{
-  g_assert (GBP_IS_VCSUI_TREE_ADDIN (self));
-  g_assert (GTK_IS_STYLE_CONTEXT (context));
-
-  get_foreground_for_class (context, "vcs-added", &self->added_color);
-  get_foreground_for_class (context, "vcs-changed", &self->changed_color);
-}
-
 static void
 gbp_vcsui_tree_addin_switch_branch_cb (GObject      *object,
                                        GAsyncResult *result,
@@ -178,7 +146,6 @@ gbp_vcsui_tree_addin_load (IdeTreeAddin *addin,
 {
   GbpVcsuiTreeAddin *self = (GbpVcsuiTreeAddin *)addin;
   g_autoptr(GSimpleActionGroup) group = NULL;
-  GtkStyleContext *style_context;
   IdeWorkbench *workbench;
   IdeVcsMonitor *monitor;
   IdeVcs *vcs;
@@ -204,14 +171,6 @@ gbp_vcsui_tree_addin_load (IdeTreeAddin *addin,
                                   "vcsui",
                                   G_ACTION_GROUP (group));
 
-  style_context = gtk_widget_get_style_context (GTK_WIDGET (tree));
-  g_signal_connect_object (style_context,
-                           "changed",
-                           G_CALLBACK (on_tree_style_changed_cb),
-                           self,
-                           G_CONNECT_SWAPPED);
-  on_tree_style_changed_cb (self, style_context);
-
   if ((workbench = ide_widget_get_workbench (GTK_WIDGET (tree))) &&
       (vcs = ide_workbench_get_vcs (workbench)) &&
       (monitor = ide_workbench_get_vcs_monitor (workbench)))
@@ -232,7 +191,6 @@ gbp_vcsui_tree_addin_unload (IdeTreeAddin *addin,
                              IdeTreeModel *model)
 {
   GbpVcsuiTreeAddin *self = (GbpVcsuiTreeAddin *)addin;
-  GtkStyleContext *style_context;
 
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (GBP_IS_VCSUI_TREE_ADDIN (self));
@@ -241,11 +199,6 @@ gbp_vcsui_tree_addin_unload (IdeTreeAddin *addin,
 
   gtk_widget_insert_action_group (GTK_WIDGET (tree), "vcsui", NULL);
 
-  style_context = gtk_widget_get_style_context (GTK_WIDGET (tree));
-  g_signal_handlers_disconnect_by_func (style_context,
-                                        G_CALLBACK (on_tree_style_changed_cb),
-                                        self);
-
   g_clear_object (&self->monitor);
   g_clear_object (&self->vcs);
   self->model = NULL;


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