diff options
author | Maximiliano Sandoval R <msandova@gnome.org> | 2021-10-11 10:29:56 +0200 |
---|---|---|
committer | David King <amigadave@amigadave.com> | 2022-03-28 17:11:49 +0100 |
commit | ee9f97bc41284b31954ee90f0300ebb8c4ef634c (patch) | |
tree | d76f71f555c8c5031494aaf96e14f3b0f9274c58 | |
parent | 8d6260db1359a143f9bad22ed807d157e7ae7837 (diff) | |
download | gnome-logs-ee9f97bc41284b31954ee90f0300ebb8c4ef634c.tar.gz |
Use gtk_widget_{add,remove}_css_class
-rw-r--r-- | src/gl-eventviewlist.c | 12 | ||||
-rw-r--r-- | src/gl-eventviewrow.c | 22 |
2 files changed, 11 insertions, 23 deletions
diff --git a/src/gl-eventviewlist.c b/src/gl-eventviewlist.c index 00e435e..205a583 100644 --- a/src/gl-eventviewlist.c +++ b/src/gl-eventviewlist.c @@ -362,7 +362,6 @@ on_listbox_row_activated (GtkListBox *listbox, GtkWidget *event_detail_popover; GtkWidget *category_label; GtkWidget *time_label; - GtkStyleContext *context; event_detail_popover = gl_event_view_detail_new (priv->entry, priv->clock_format); gtk_widget_set_parent (event_detail_popover, GTK_WIDGET (row)); @@ -370,17 +369,12 @@ on_listbox_row_activated (GtkListBox *listbox, category_label = gl_event_view_row_get_category_label (GL_EVENT_VIEW_ROW (row)); if (category_label) - { - context = gtk_widget_get_style_context (category_label); - gtk_style_context_remove_class (context, "dim-label"); - } + gtk_widget_remove_css_class (category_label, "dim-label"); time_label = gl_event_view_row_get_time_label (GL_EVENT_VIEW_ROW (row)); - context = gtk_widget_get_style_context (time_label); - gtk_style_context_remove_class (context, "dim-label"); + gtk_widget_remove_css_class (time_label, "dim-label"); - context = gtk_widget_get_style_context (GTK_WIDGET (row)); - gtk_style_context_add_class (context, "popover-activated-row"); + gtk_widget_add_css_class (GTK_WIDGET (row), "popover-activated-row"); g_signal_connect (event_detail_popover, "closed", G_CALLBACK (popover_closed), NULL); gtk_popover_popup (GTK_POPOVER (event_detail_popover)); diff --git a/src/gl-eventviewrow.c b/src/gl-eventviewrow.c index 02e3566..0d8d1b6 100644 --- a/src/gl-eventviewrow.c +++ b/src/gl-eventviewrow.c @@ -258,7 +258,6 @@ gl_event_view_row_replace_newline (const gchar *message) static void gl_event_view_row_constructed (GObject *object) { - GtkStyleContext *context; GtkWidget *grid; gchar *time; const gchar *message; @@ -279,8 +278,7 @@ gl_event_view_row_constructed (GObject *object) rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL); - context = gtk_widget_get_style_context (GTK_WIDGET (row)); - gtk_style_context_add_class (context, "event"); + gtk_widget_add_css_class (GTK_WIDGET (row), "event"); grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid); @@ -295,9 +293,8 @@ gl_event_view_row_constructed (GObject *object) { gl_event_view_row_construct_category_label (row, entry); - context = gtk_widget_get_style_context (GTK_WIDGET (priv->category_label)); - gtk_style_context_add_class (context, "dim-label"); - gtk_style_context_add_class (context, "event-monospace"); + gtk_widget_add_css_class (GTK_WIDGET (priv->category_label), "dim-label"); + gtk_widget_add_css_class (GTK_WIDGET (priv->category_label), "event-monospace"); gtk_label_set_xalign (GTK_LABEL (priv->category_label), 0); gtk_grid_attach (GTK_GRID (grid), priv->category_label, rtl ? 2 : 0, 0, 1, 1); @@ -323,8 +320,7 @@ gl_event_view_row_constructed (GObject *object) } gtk_widget_set_direction (priv->message_label, GTK_TEXT_DIR_LTR); - context = gtk_widget_get_style_context (GTK_WIDGET (priv->message_label)); - gtk_style_context_add_class (context, "event-monospace"); + gtk_widget_add_css_class (GTK_WIDGET (priv->message_label), "event-monospace"); gtk_widget_set_halign (priv->message_label, GTK_ALIGN_START); gtk_label_set_ellipsize (GTK_LABEL (priv->message_label), PANGO_ELLIPSIZE_END); @@ -349,8 +345,7 @@ gl_event_view_row_constructed (GObject *object) compressed_entries_label = gtk_label_new (compressed_entries_string); gtk_widget_set_direction (compressed_entries_label, GTK_TEXT_DIR_LTR); - context = gtk_widget_get_style_context (GTK_WIDGET (compressed_entries_label)); - gtk_style_context_add_class (context, "compressed-entries-label"); + gtk_widget_add_css_class (GTK_WIDGET (compressed_entries_label), "compressed-entries-label"); gtk_widget_set_halign (compressed_entries_label, GTK_ALIGN_START); gtk_label_set_xalign (GTK_LABEL (compressed_entries_label), 0); @@ -383,10 +378,9 @@ gl_event_view_row_constructed (GObject *object) priv->time_label = gtk_label_new (" "); } - context = gtk_widget_get_style_context (GTK_WIDGET (priv->time_label)); - gtk_style_context_add_class (context, "dim-label"); - gtk_style_context_add_class (context, "event-monospace"); - gtk_style_context_add_class (context, "event-time"); + gtk_widget_add_css_class (GTK_WIDGET (priv->time_label), "dim-label"); + gtk_widget_add_css_class (GTK_WIDGET (priv->time_label), "event-monospace"); + gtk_widget_add_css_class (GTK_WIDGET (priv->time_label), "event-time"); gtk_widget_set_halign (priv->time_label, GTK_ALIGN_END); gtk_widget_set_hexpand (priv->time_label, TRUE); gtk_label_set_xalign (GTK_LABEL (priv->time_label), 1); |