[evolution] Set gtk+ CSS widget names for some widgets



commit 5ec33485062198272eef6d64d63ea4144831d918
Author: Milan Crha <mcrha redhat com>
Date:   Tue Feb 22 16:02:52 2022 +0100

    Set gtk+ CSS widget names for some widgets
    
    These are the most visible and some of them contain their own style
    properties. This will make is easier to reference them in the CSS file.
    
    Example `~/.config/gtk-3.0/gtk.css` content:
    
    ```css
    MessageList {
            -MessageList-new-mail-bg-color: orange;
            -ETree-vertical-spacing: 1px;
    }
    
    .EMFolderTree {
            background: orange;
    }
    ```

 src/calendar/gui/e-to-do-pane.c | 2 ++
 src/e-util/e-table.c            | 3 ++-
 src/e-util/e-tree.c             | 2 ++
 src/mail/em-folder-tree.c       | 4 ++++
 src/mail/message-list.c         | 2 ++
 5 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index 509a7bb2bc..460dfdd55b 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -2818,6 +2818,8 @@ e_to_do_pane_class_init (EToDoPaneClass *klass)
 
        g_type_class_add_private (klass, sizeof (EToDoPanePrivate));
 
+       gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "EToDoPane");
+
        object_class = G_OBJECT_CLASS (klass);
        object_class->set_property = e_to_do_pane_set_property;
        object_class->get_property = e_to_do_pane_get_property;
diff --git a/src/e-util/e-table.c b/src/e-util/e-table.c
index 2ca1a912ef..30834581c6 100644
--- a/src/e-util/e-table.c
+++ b/src/e-util/e-table.c
@@ -3200,9 +3200,10 @@ e_table_class_init (ETableClass *class)
        widget_class->get_preferred_width = et_get_preferred_width;
        widget_class->get_preferred_height = et_get_preferred_height;
        widget_class->style_updated = et_canvas_style_updated;
-
        widget_class->focus = et_focus;
 
+       gtk_widget_class_set_css_name (widget_class, "ETable");
+
        class->cursor_change = NULL;
        class->cursor_activated = NULL;
        class->selection_change = NULL;
diff --git a/src/e-util/e-tree.c b/src/e-util/e-tree.c
index be9f0a9d59..75e183b70b 100644
--- a/src/e-util/e-tree.c
+++ b/src/e-util/e-tree.c
@@ -2867,6 +2867,8 @@ e_tree_class_init (ETreeClass *class)
        widget_class->style_updated = et_canvas_style_updated;
        widget_class->focus = et_focus;
 
+       gtk_widget_class_set_css_name (widget_class, "ETree");
+
        class->start_drag = et_real_start_drag;
 
        signals[CURSOR_CHANGE] = g_signal_new (
diff --git a/src/mail/em-folder-tree.c b/src/mail/em-folder-tree.c
index 620bfeb81d..6583489f24 100644
--- a/src/mail/em-folder-tree.c
+++ b/src/mail/em-folder-tree.c
@@ -1350,6 +1350,7 @@ folder_tree_constructed (GObject *object)
        GtkCellRenderer *renderer;
        GtkTreeView *tree_view;
        GtkTreeModel *model;
+       GtkStyleContext *style_context;
        gulong handler_id;
 
        priv = EM_FOLDER_TREE_GET_PRIVATE (object);
@@ -1459,6 +1460,9 @@ folder_tree_constructed (GObject *object)
 
        g_signal_connect (tree_view, "row-collapsed",
                G_CALLBACK (folder_tree_reset_store_unread_value_cb), NULL);
+
+       style_context = gtk_widget_get_style_context (GTK_WIDGET (object));
+       gtk_style_context_add_class (style_context, "EMFolderTree");
 }
 
 static gboolean
diff --git a/src/mail/message-list.c b/src/mail/message-list.c
index 7f46260e8e..d60c064c20 100644
--- a/src/mail/message-list.c
+++ b/src/mail/message-list.c
@@ -4019,6 +4019,8 @@ message_list_class_init (MessageListClass *class)
        widget_class = GTK_WIDGET_CLASS (class);
        widget_class->get_preferred_width = message_list_get_preferred_width;
 
+       gtk_widget_class_set_css_name (widget_class, "MessageList");
+
        object_class = G_OBJECT_CLASS (class);
        object_class->set_property = message_list_set_property;
        object_class->get_property = message_list_get_property;


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