Replace title bar for Media App

This commit is contained in:
daleclack 2024-03-30 23:21:19 +08:00
parent a3d141173c
commit aeda458164
1 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#include <cstring> #include <cstring>
#include "MyTitleBar.h"
using json = nlohmann::json; using json = nlohmann::json;
typedef std::vector<std::string> string_vector; typedef std::vector<std::string> string_vector;
@ -12,6 +13,7 @@ typedef std::vector<std::string> string_vector;
struct _MyMediaPlayer struct _MyMediaPlayer
{ {
GtkApplicationWindow parent_instance; GtkApplicationWindow parent_instance;
MyTitleBar *title_bar;
GtkWidget *video, *label_lyrics; GtkWidget *video, *label_lyrics;
GtkWidget *ctrl_box; GtkWidget *ctrl_box;
GtkWidget *btn_priv, *btn_play, *btn_next, 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) static void my_media_player_init(MyMediaPlayer *self)
{ {
// Initalize window // 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_icon_name(GTK_WINDOW(self), "media-app");
gtk_window_set_title(GTK_WINDOW(self), "Media Player"); gtk_window_set_title(GTK_WINDOW(self), "Media Player");
gtk_window_set_default_size(GTK_WINDOW(self), 480, 270); gtk_window_set_default_size(GTK_WINDOW(self), 480, 270);