From aeda458164a1b87d7e993fd04d1c29262b4dc966 Mon Sep 17 00:00:00 2001 From: daleclack Date: Sat, 30 Mar 2024 23:21:19 +0800 Subject: [PATCH] Replace title bar for Media App --- Gtk4_Reset/src/media_app/MyMediaPlayer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gtk4_Reset/src/media_app/MyMediaPlayer.cpp b/Gtk4_Reset/src/media_app/MyMediaPlayer.cpp index dc48ae4..829a88a 100644 --- a/Gtk4_Reset/src/media_app/MyMediaPlayer.cpp +++ b/Gtk4_Reset/src/media_app/MyMediaPlayer.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "MyTitleBar.h" using json = nlohmann::json; typedef std::vector string_vector; @@ -12,6 +13,7 @@ typedef std::vector string_vector; struct _MyMediaPlayer { GtkApplicationWindow parent_instance; + MyTitleBar *title_bar; GtkWidget *video, *label_lyrics; GtkWidget *ctrl_box; GtkWidget *btn_priv, *btn_play, *btn_next, @@ -641,6 +643,8 @@ static gboolean my_media_player_check_dark_theme(MyMediaPlayer *player) static void my_media_player_init(MyMediaPlayer *self) { // Initalize window + self->title_bar = my_titlebar_new(); + my_titlebar_set_window(self->title_bar, self); gtk_window_set_icon_name(GTK_WINDOW(self), "media-app"); gtk_window_set_title(GTK_WINDOW(self), "Media Player"); gtk_window_set_default_size(GTK_WINDOW(self), 480, 270);