[totem/wip/hadess/more-gtkbuilder: 2/5] main: Move fullscreen toolbar to GtkBuilder




commit c300c477f3bcbb46b64a388674d40ef197659b38
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 9 19:28:45 2022 +0100

    main: Move fullscreen toolbar to GtkBuilder

 data/totem.ui         | 17 +++++++++++++++++
 src/totem-interface.c |  3 ++-
 src/totem-object.c    | 14 +-------------
 3 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/data/totem.ui b/data/totem.ui
index 69b3f5261..d076cea3d 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -194,6 +194,23 @@
                 <property name="visible">True</property>
                 <property name="halign">fill</property>
                 <property name="valign">fill</property>
+                <child>
+                  <object class="TotemMainToolbar" id="fullscreen_header">
+                    <property name="visible">False</property>
+                    <property name="show-search-button">False</property>
+                    <property name="show-select-button">False</property>
+                    <property name="show-back-button">True</property>
+                    <property name="opacity">0.86</property>
+                    <property name="halign">fill</property>
+                    <property name="hexpand">True</property>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
+                    <property name="width">3</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
                 <child>
                   <object class="GtkSpinner" id="spinner">
                     <property name="visible">False</property>
diff --git a/src/totem-interface.c b/src/totem-interface.c
index dbc1cf899..32399d0b8 100644
--- a/src/totem-interface.c
+++ b/src/totem-interface.c
@@ -242,12 +242,13 @@ totem_interface_create_header_button (GtkWidget  *header,
        gtk_style_context_add_class (context, "image-button");
        g_object_set (G_OBJECT (button), "valign", GTK_ALIGN_CENTER, NULL);
        if (GTK_IS_MENU_BUTTON (button))
-                     g_object_set (G_OBJECT (button), "use-popover", TRUE, NULL);
+               g_object_set (G_OBJECT (button), "use-popover", TRUE, NULL);
 
        if (pack_type == GTK_PACK_END)
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
        else
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
+       gtk_widget_show_all (button);
 
        return button;
 }
diff --git a/src/totem-object.c b/src/totem-object.c
index f42fd5c62..562ca584b 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -4170,12 +4170,7 @@ add_fullscreen_toolbar (TotemObject *totem,
        GtkWidget *item;
        GMenuModel *menu;
 
-       totem->fullscreen_header = g_object_new (TOTEM_TYPE_MAIN_TOOLBAR,
-                                                "show-search-button", FALSE,
-                                                "show-select-button", FALSE,
-                                                "show-back-button", TRUE,
-                                                "opacity", OVERLAY_OPACITY,
-                                                NULL);
+       totem->fullscreen_header = GTK_WIDGET (gtk_builder_get_object (totem->xml, "fullscreen_header"));
        g_object_bind_property (totem->header, "title",
                                totem->fullscreen_header, "title", 0);
        g_object_bind_property (totem->header, "subtitle",
@@ -4202,13 +4197,6 @@ add_fullscreen_toolbar (TotemObject *totem,
        g_signal_connect (G_OBJECT (item), "toggled",
                          G_CALLBACK (popup_menu_shown_cb), totem);
        totem->fullscreen_gear_button = item;
-
-       gtk_grid_attach (GTK_GRID (container), totem->fullscreen_header, 0, 0, 3, 1);
-       gtk_widget_set_halign (totem->fullscreen_header, GTK_ALIGN_FILL);
-       gtk_widget_set_hexpand (totem->fullscreen_header, TRUE);
-       gtk_widget_set_opacity (totem->fullscreen_header, OVERLAY_OPACITY);
-       gtk_widget_show_all (totem->fullscreen_header);
-       gtk_widget_hide (totem->fullscreen_header);
 }
 
 void


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