[totem/wip/hadess/bvw-template: 6/6] main: Merge controls.ui into totem.ui




commit 958426b264b5a36d9f9d83bc51213aab6790abb5
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 9 15:20:13 2022 +0100

    main: Merge controls.ui into totem.ui

 data/controls.ui    | 184 ---------------------------------------------------
 data/meson.build    |   1 -
 data/totem.ui       | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in      |   1 -
 src/totem-object.c  |  28 +++-----
 src/totem-private.h |   3 +-
 6 files changed, 194 insertions(+), 208 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 3bd9ac254..3462b90dd 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -37,7 +37,6 @@ else
 endif
 
 ui_files = files(
-  'controls.ui',
   'playlist.ui',
   'shortcuts.ui',
   'totem.ui',
diff --git a/data/totem.ui b/data/totem.ui
index a8921e5fb..afcdae2e0 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -210,6 +210,191 @@
                     <property name="height">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkToolbar" id="toolbar">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">0</property>
+                    <property name="opacity">0.86</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="valign">end</property>
+                    <style>
+                      <class name="osd"/>
+                      <class name="bottom"/>
+                      </style>
+                    <child>
+                      <object class="GtkToolItem" id="controls_toolbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkBox" id="controls_box">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <style>
+                              <class name="linked"/>
+                              </style>
+                            <child>
+                              <placeholder/>
+                              </child>
+                            </object>
+                          </child>
+                        </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">False</property>
+                        </packing>
+                      </child>
+                    <child>
+                      <object class="GtkToolItem" id="slider_toolbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkBox" id="bottom_row">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="border_width">0</property>
+                            <property name="spacing">4</property>
+                            <child>
+                              <object class="BaconTimeLabel" id="time_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="margin_start">16</property>
+                                </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                                </packing>
+                              </child>
+                            <child>
+                              <object class="GtkScale" id="seek_scale">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="can_focus">True</property>
+                                <property name="draw_value">False</property>
+                                <property name="restrict-to-fill-level">False</property>
+                                </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                                </packing>
+                              </child>
+                            <child>
+                              <object class="BaconTimeLabel" id="time_rem_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="remaining">True</property>
+                                <property name="margin_end">16</property>
+                                </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                                </packing>
+                              </child>
+                            </object>
+                          </child>
+                        </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="homogeneous">False</property>
+                        </packing>
+                      </child>
+                    <child>
+                      <object class="GtkToolItem" id="box_toolbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkBox" id="box2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkMenuButton" id="go_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="relief">normal</property>
+                                <property name="valign">center</property>
+                                <property name="use-popover">True</property>
+                                <style>
+                                  <class name="image-button"/>
+                                  </style>
+                                <child>
+                                  <object class="GtkImage" id="go_button_image">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="icon_name">go-jump-symbolic</property>
+                                    </object>
+                                  </child>
+                                </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                                </packing>
+                              </child>
+                            </object>
+                          </child>
+                        </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                        </packing>
+                      </child>
+                    <child>
+                      <object class="GtkToolItem" id="volume_toolbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkBox" id="box1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkVolumeButton" id="volume_button">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="has_tooltip">True</property>
+                                <property name="relief">none</property>
+                                <property name="focus_on_click">False</property>
+                                <property name="orientation">vertical</property>
+                                <property name="valign">center</property>
+                                <property name="icons">audio-volume-muted-symbolic
+                                  audio-volume-high-symbolic
+                                  audio-volume-low-symbolic
+                                  audio-volume-medium-symbolic</property>
+                                <property name="use_symbolic">True</property>
+                                <style>
+                                  <class name="image-button"/>
+                                  </style>
+                                </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                                </packing>
+                              </child>
+                            </object>
+                          </child>
+                        </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                        </packing>
+                      </child>
+                    </object>
+                    <packing>
+                      <property name="left-attach">0</property>
+                      <property name="top-attach">2</property>
+                      <property name="width">3</property>
+                      <property name="height">1</property>
+                    </packing>
+                  </child>
               </object>
             </child>
           </object>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f314d64e7..db9973a19 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,6 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
 data/appdata/org.gnome.Totem.appdata.xml.in.in
-data/controls.ui
 data/org.gnome.Totem.desktop.in.in
 data/org.gnome.totem.gschema.xml.in
 data/playlist.ui
diff --git a/src/totem-object.c b/src/totem-object.c
index 50ba1738d..f42fd5c62 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -215,25 +215,13 @@ totem_object_app_activate (GApplication *app)
 
        totem->controls_visibility = TOTEM_CONTROLS_UNDEFINED;
 
-       totem->controls = gtk_builder_new ();
-       const char *objects[] = { "toolbar", NULL };
-       GError *error = NULL;
-        if (gtk_builder_add_objects_from_file (totem->controls, DATADIR "/totem/controls.ui", (gchar **) 
objects, &error) == 0)
-               g_assert_not_reached ();
-       gtk_grid_attach (GTK_GRID (totem->bvw_grid),
-                        GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")),
-                        0, 2, 3, 1);
-       gtk_widget_set_hexpand (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), TRUE);
-       gtk_widget_set_vexpand (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), TRUE);
-       gtk_widget_set_valign (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), 
GTK_ALIGN_END);
-
        totem->spinner = GTK_WIDGET (gtk_builder_get_object (totem->xml, "spinner"));
 
-       totem->seek = GTK_WIDGET (gtk_builder_get_object (totem->controls, "seek_scale"));
+       totem->seek = GTK_WIDGET (gtk_builder_get_object (totem->xml, "seek_scale"));
        totem->seekadj = gtk_range_get_adjustment (GTK_RANGE (totem->seek));
-       totem->volume = GTK_WIDGET (gtk_builder_get_object (totem->controls, "volume_button"));
-       totem->time_label = BACON_TIME_LABEL (gtk_builder_get_object (totem->controls, "time_label"));
-       totem->time_rem_label = BACON_TIME_LABEL (gtk_builder_get_object (totem->controls, "time_rem_label"));
+       totem->volume = GTK_WIDGET (gtk_builder_get_object (totem->xml, "volume_button"));
+       totem->time_label = BACON_TIME_LABEL (gtk_builder_get_object (totem->xml, "time_label"));
+       totem->time_rem_label = BACON_TIME_LABEL (gtk_builder_get_object (totem->xml, "time_rem_label"));
        totem->pause_start = optionstate.pause;
 
        totem_callback_connect (totem);
@@ -1878,7 +1866,7 @@ set_controls_visibility (TotemObject      *totem,
                         gboolean          visible,
                         gboolean          animate)
 {
-       gtk_widget_set_visible (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), visible);
+       gtk_widget_set_visible (GTK_WIDGET (gtk_builder_get_object (totem->xml, "toolbar")), visible);
        gtk_widget_set_visible (totem->fullscreen_header, visible &&
                                totem->controls_visibility == TOTEM_CONTROLS_FULLSCREEN);
        bacon_video_widget_set_show_cursor (totem->bvw, visible);
@@ -1908,7 +1896,7 @@ unmark_popup_busy (TotemObject      *totem,
        g_debug ("Removing popup busy for reason %s", reason);
 
        if (g_hash_table_size (totem->busy_popup_ht) == 0 &&
-           gtk_widget_get_opacity (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar"))) != 0.0 
&&
+           gtk_widget_get_opacity (GTK_WIDGET (gtk_builder_get_object (totem->xml, "toolbar"))) != 0.0 &&
            g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (totem->stack)), "player") == 0) {
                g_debug ("Will hide popup soon");
                schedule_hiding_popup (totem);
@@ -3988,7 +3976,7 @@ totem_callback_connect (TotemObject *totem)
                                   g_variant_new_boolean (totem_playlist_get_repeat (totem->playlist)));
 
        /* Controls */
-       box = GTK_BOX (gtk_builder_get_object (totem->controls, "controls_box"));
+       box = GTK_BOX (gtk_builder_get_object (totem->xml, "controls_box"));
        gtk_widget_insert_action_group (GTK_WIDGET (box), "app", G_ACTION_GROUP (totem));
 
        /* Previous */
@@ -4029,7 +4017,7 @@ totem_callback_connect (TotemObject *totem)
                          G_CALLBACK (volume_button_menu_shown_cb), totem);
 
        /* Go button */
-       item = GTK_WIDGET (gtk_builder_get_object (totem->controls, "go_button"));
+       item = GTK_WIDGET (gtk_builder_get_object (totem->xml, "go_button"));
        menu = (GMenuModel *) gtk_builder_get_object (totem->xml, "gomenu");
        gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (item), menu);
        popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (item));
diff --git a/src/totem-private.h b/src/totem-private.h
index 12f31aa7c..ee56a7130 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -46,7 +46,7 @@
                widget = GTK_WIDGET (gtk_builder_get_object (xml, name));       \
                gtk_widget_set_sensitive (widget, state);                       \
        }
-#define totem_controls_set_sensitivity(name, state) gtk_widget_set_sensitive (GTK_WIDGET 
(gtk_builder_get_object (totem->controls, name)), state)
+#define totem_controls_set_sensitivity(name, state) gtk_widget_set_sensitive (GTK_WIDGET 
(gtk_builder_get_object (totem->xml, name)), state)
 
 #define totem_object_set_sensitivity2(name, state)                                     \
        {                                                                               \
@@ -82,7 +82,6 @@ struct _TotemObject {
 
        GtkWidget *grilo;
 
-       GtkBuilder *controls;
        GtkWidget *play_button;
        BaconTimeLabel *time_label;
        BaconTimeLabel *time_rem_label;


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