Update start menu

This commit is contained in:
daleclack 2022-01-14 22:04:00 +08:00
parent ed04950c54
commit 36d43e601d
5 changed files with 55 additions and 15 deletions

3
.gitignore vendored
View File

@ -28,6 +28,9 @@ Makefile
*/src/resources.cpp
resources.cc
#music files
*.mp3
#backend source
backend/*

View File

@ -30,6 +30,7 @@ set(RESOURCE_LIST
reset.css
dock.ui
start.ui
Yanni-Nightingale.mp3
icons/16x16/actions/7zFM.png
icons/48x48/actions/My_GtkUI.png
icons/scalable/status/file-manager.svg

View File

View File

@ -26,7 +26,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -40,6 +39,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> 7-zip File Manager</property>
<property name="hexpand">1</property>
@ -54,7 +54,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -68,6 +67,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> File Manager</property>
<property name="hexpand">1</property>
@ -82,7 +82,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -96,6 +95,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> Glade</property>
<property name="hexpand">1</property>
@ -110,7 +110,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -124,6 +123,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> QEMU</property>
<property name="hexpand">1</property>
@ -138,7 +138,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -152,6 +151,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> QQMusic</property>
<property name="hexpand">1</property>
@ -166,7 +166,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -180,6 +179,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> Visual Studio Code</property>
<property name="hexpand">1</property>
@ -215,6 +215,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1">All Programs</property>
<property name="hexpand">1</property>
@ -241,7 +242,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -255,6 +255,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> 7-zip File Manager</property>
<property name="hexpand">1</property>
@ -269,7 +270,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -283,6 +283,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> BaiduNetDisk</property>
<property name="hexpand">1</property>
@ -297,7 +298,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -311,6 +311,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> File Manager</property>
<property name="hexpand">1</property>
@ -324,8 +325,7 @@
<object class="GtkButton">
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -339,6 +339,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> Glade</property>
<property name="hexpand">1</property>
@ -353,7 +354,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -367,6 +367,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> QEMU</property>
<property name="hexpand">1</property>
@ -381,7 +382,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -395,6 +395,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> QQ</property>
<property name="hexpand">1</property>
@ -409,7 +410,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -423,6 +423,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> QQMusic</property>
<property name="hexpand">1</property>
@ -437,7 +438,6 @@
<property name="visible">1</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<property name="halign">start</property>
<property name="has-frame">0</property>
<child>
<object class="GtkBox">
@ -451,6 +451,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1"> Visual Studio Code</property>
<property name="hexpand">1</property>
@ -480,6 +481,7 @@
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="visible">1</property>
<property name="label" translatable="1">Back</property>
<property name="hexpand">1</property>
@ -567,6 +569,22 @@
<property name="label">Computer</property>
</object>
</child>
<child>
<object class="GtkBox" id="music_box">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label">Yanni-Nightingale</property>
</object>
</child>
<child>
<object class="GtkMediaControls" id="media_ctrl">
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator" id="ext_separator">
<property name="visible">1</property>

View File

@ -8,6 +8,14 @@ static void btnback_clicked(GtkWidget * widget, GtkStack * stack){
gtk_stack_set_visible_child_name(stack,"page0");
}
static void btnmusic_clicked(GtkWidget * widget, GtkWidget * music_box){
if(gtk_widget_get_visible(music_box)){
gtk_widget_set_visible(music_box,FALSE);
}else{
gtk_widget_set_visible(music_box,TRUE);
}
}
void add_start(MainWin * win, GtkBox * box){
//Create a builder for menu
GtkBuilder * startbuilder = gtk_builder_new_from_resource("/org/gtk/daleclack/start.ui");
@ -37,6 +45,16 @@ void add_start(MainWin * win, GtkBox * box){
gtk_style_context_add_provider(gtk_widget_get_style_context(ext_separator),
main_win_get_style(win), G_MAXINT);
//Integrated Media Player
GtkWidget * music_box = (GtkWidget*)gtk_builder_get_object(startbuilder,"music_box");
GtkWidget * btn_music = (GtkWidget*)gtk_builder_get_object(startbuilder,"btnmusic");
GtkWidget * media_control = (GtkWidget*)gtk_builder_get_object(startbuilder,"media_ctrl");
g_signal_connect(btn_music,"clicked",G_CALLBACK(btnmusic_clicked),music_box);
//Add music resource
GtkMediaStream * media = gtk_media_file_new_for_resource("/org/gtk/daleclack/Yanni-Nightingale.mp3");
gtk_media_controls_set_media_stream(GTK_MEDIA_CONTROLS(media_control),media);
//Pack widgets
gtk_box_prepend(box,menu_btn);
gtk_box_prepend(box,label);