[libadwaita/wip/exalm/dark: 4/4] demo-window: Remove the dark switcher




commit 0baef32f455be9ef19ca2eaa785c88e44d91a9b5
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Aug 26 14:22:35 2021 +0500

    demo-window: Remove the dark switcher

 examples/adw-demo-window.c  | 36 ------------------------------------
 examples/adw-demo-window.ui |  5 -----
 2 files changed, 41 deletions(-)
---
diff --git a/examples/adw-demo-window.c b/examples/adw-demo-window.c
index 01fbc7b8..33863d30 100644
--- a/examples/adw-demo-window.c
+++ b/examples/adw-demo-window.c
@@ -11,7 +11,6 @@ struct _AdwDemoWindow
 
   AdwLeaflet *content_box;
   GtkBox *right_box;
-  GtkImage *theme_variant;
   GtkStackSidebar *sidebar;
   GtkStack *stack;
   AdwComboRow *leaflet_transition_row;
@@ -31,29 +30,6 @@ struct _AdwDemoWindow
 
 G_DEFINE_TYPE (AdwDemoWindow, adw_demo_window, ADW_TYPE_APPLICATION_WINDOW)
 
-static void
-theme_variant_button_clicked_cb (AdwDemoWindow *self)
-{
-  GtkSettings *settings = gtk_settings_get_default ();
-  gboolean prefer_dark_theme;
-
-  g_object_get (settings, "gtk-application-prefer-dark-theme", &prefer_dark_theme, NULL);
-  g_object_set (settings, "gtk-application-prefer-dark-theme", !prefer_dark_theme, NULL);
-}
-
-static gboolean
-prefer_dark_theme_to_icon_name_cb (GBinding     *binding,
-                                   const GValue *from_value,
-                                   GValue       *to_value,
-                                   gpointer      user_data)
-{
-  g_value_set_string (to_value,
-                      g_value_get_boolean (from_value) ? "light-mode-symbolic" :
-                                                         "dark-mode-symbolic");
-
-  return TRUE;
-}
-
 static void
 notify_visible_child_cb (GObject       *sender,
                          GParamSpec    *pspec,
@@ -402,7 +378,6 @@ adw_demo_window_class_init (AdwDemoWindowClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Adwaita/Demo/ui/adw-demo-window.ui");
   gtk_widget_class_bind_template_child (widget_class, AdwDemoWindow, content_box);
   gtk_widget_class_bind_template_child (widget_class, AdwDemoWindow, right_box);
-  gtk_widget_class_bind_template_child (widget_class, AdwDemoWindow, theme_variant);
   gtk_widget_class_bind_template_child (widget_class, AdwDemoWindow, sidebar);
   gtk_widget_class_bind_template_child (widget_class, AdwDemoWindow, stack);
   gtk_widget_class_bind_template_child (widget_class, AdwDemoWindow, leaflet_transition_row);
@@ -423,7 +398,6 @@ adw_demo_window_class_init (AdwDemoWindowClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, leaflet_transition_name);
   gtk_widget_class_bind_template_callback (widget_class, notify_leaflet_transition_cb);
   gtk_widget_class_bind_template_callback (widget_class, leaflet_go_next_row_activated_cb);
-  gtk_widget_class_bind_template_callback (widget_class, theme_variant_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, view_switcher_demo_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, notify_carousel_orientation_cb);
   gtk_widget_class_bind_template_callback (widget_class, notify_carousel_indicators_cb);
@@ -464,18 +438,8 @@ avatar_page_init (AdwDemoWindow *self)
 static void
 adw_demo_window_init (AdwDemoWindow *self)
 {
-  GtkSettings *settings = gtk_settings_get_default ();
-
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  g_object_bind_property_full (settings, "gtk-application-prefer-dark-theme",
-                               self->theme_variant, "icon-name",
-                               G_BINDING_SYNC_CREATE,
-                               prefer_dark_theme_to_icon_name_cb,
-                               NULL,
-                               NULL,
-                               NULL);
-
   avatar_page_init (self);
 
   adw_leaflet_set_visible_child (self->content_box, GTK_WIDGET (self->right_box));
diff --git a/examples/adw-demo-window.ui b/examples/adw-demo-window.ui
index f2fd2f14..47bac09c 100644
--- a/examples/adw-demo-window.ui
+++ b/examples/adw-demo-window.ui
@@ -30,11 +30,6 @@
                 <child>
                   <object class="AdwHeaderBar">
                     <property name="show-end-title-buttons" bind-source="content_box" bind-property="folded" 
bind-flags="sync-create"/>
-                    <child type="start">
-                      <object class="GtkButton" id="theme_variant">
-                        <signal name="clicked" handler="theme_variant_button_clicked_cb" swapped="yes"/>
-                      </object>
-                    </child>
                     <child type="end">
                       <object class="GtkMenuButton" id="menu_button">
                         <property name="menu-model">primary_menu</property>


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