[gnome-software: 2/18] shell: Add the .narrow style class when narrow




commit 13ae1bbd3962e495efa956fc15a9d83819cd62da
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Aug 11 14:34:49 2021 +0200

    shell: Add the .narrow style class when narrow
    
    This will  help changing the syle when the window is narrow.

 src/gs-shell.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index dd8599841..5038e88df 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2480,6 +2480,7 @@ allocation_changed_cb (gpointer user_data)
        GsShell *shell = GS_SHELL (user_data);
        GtkAllocation allocation;
        gboolean is_narrow;
+       GtkStyleContext *context;
 
        gtk_widget_get_allocation (GTK_WIDGET (shell), &allocation);
 
@@ -2492,6 +2493,13 @@ allocation_changed_cb (gpointer user_data)
 
        shell->allocation_changed_cb_id = 0;
 
+       context = gtk_widget_get_style_context (GTK_WIDGET (shell));
+
+       if (is_narrow)
+               gtk_style_context_add_class (context, "narrow");
+       else
+               gtk_style_context_remove_class (context, "narrow");
+
        return G_SOURCE_REMOVE;
 }
 


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