Fix start menu style

This commit is contained in:
daleclack 2024-03-21 20:09:32 +08:00
parent 62d2b7e800
commit 49eb39f669
6 changed files with 40 additions and 15 deletions

View File

@ -1,8 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.12.1 --> <!-- Created with Cambalache 0.16.0 -->
<interface> <interface>
<!-- interface-name windows.ui --> <!-- interface-name windows.ui -->
<requires lib="gtk" version="4.10"/> <requires lib="gtk" version="4.12"/>
<template class="AboutWin" parent="GtkWindow"> <template class="AboutWin" parent="GtkWindow">
<property name="halign">baseline</property> <property name="halign">baseline</property>
<property name="height-request">400</property> <property name="height-request">400</property>
@ -46,7 +46,7 @@
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="halign">start</property> <property name="halign">start</property>
<property name="label">4.5 The Flying Wing</property> <property name="label">4.4 The Flying Wing</property>
</object> </object>
</child> </child>
<child> <child>

View File

@ -1,10 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.12.1 --> <!-- Created with Cambalache 0.16.0 -->
<interface> <interface>
<requires lib="gtk" version="4.10"/> <requires lib="gtk" version="4.0"/>
<object class="GtkWindow"> <object class="GtkWindow">
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="css-classes">test</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
</object> </object>
</child> </child>

View File

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?> <?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd"> <!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
<cambalache-project version="0.12.0" target_tk="gtk-4.0"> <cambalache-project version="0.13.1" target_tk="gtk-4.0">
<ui> <ui>
(1,1,"windows.ui","aboutwin.ui",None,None,None,None,None,None,None), (1,1,"windows.ui","aboutwin.ui",None,None,None,None,None,None,None),
(2,None,None,"temp.ui",None,None,None,None,None,None,None) (2,None,None,"temp.ui",None,None,None,None,None,None,None)
@ -57,6 +57,7 @@
(1,16,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None), (1,16,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None),
(1,17,"GtkLabel","label"," The project is to memorize the FlWin and the flos project. \nFlWin project started in 2016, in 2017, the name is changed \nto flos. In 2018, the project name is reset to FlWin. The last \nversion of FlWin/Flos is FlWin 5.x, and tested in the start of \n2019, which is never been released.\n I think the flos 2.0 is the best release of that project, \nso the idea is base on the flos 2.0 build.",None,None,None,None,None,None,None,None,None), (1,17,"GtkLabel","label"," The project is to memorize the FlWin and the flos project. \nFlWin project started in 2016, in 2017, the name is changed \nto flos. In 2018, the project name is reset to FlWin. The last \nversion of FlWin/Flos is FlWin 5.x, and tested in the start of \n2019, which is never been released.\n I think the flos 2.0 is the best release of that project, \nso the idea is base on the flos 2.0 build.",None,None,None,None,None,None,None,None,None),
(1,17,"GtkLabel","selectable","True",None,None,None,None,None,None,None,None,None), (1,17,"GtkLabel","selectable","True",None,None,None,None,None,None,None,None,None),
(2,2,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None) (2,2,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
(2,2,"GtkWidget","css-classes","test",None,None,None,None,None,None,None,None,None)
</object_property> </object_property>
</cambalache-project> </cambalache-project>

View File

@ -24,7 +24,11 @@
} }
.main_style popover { .main_style popover {
background-color: alpha(gray, 0.7); background-color: alpha(gray, 0.8);
}
.main_style popover contents {
background-color: transparent;
} }
.main_style separator { .main_style separator {
@ -40,6 +44,18 @@
color: white; color: white;
} }
.dock_button {
background-color: transparent;
}
.dock_button box {
background-color: transparent;
}
.dock_button:hover {
background-color: alpha(gray, 0.7);
}
.default_style box { .default_style box {
background-color: transparent; background-color: transparent;
} }
@ -47,3 +63,8 @@
.default_style separator { .default_style separator {
background-color: transparent; background-color: transparent;
} }
.btn_style{
background-color: transparent;
color: white;
}

View File

@ -129,7 +129,7 @@ void add_dock(MainWin *win)
child != NULL; child != NULL;
child = gtk_widget_get_next_sibling(child)) child = gtk_widget_get_next_sibling(child))
{ {
gtk_widget_add_css_class(child, "main_style"); gtk_widget_add_css_class(child, "dock_button");
gtk_style_context_add_provider((child), gtk_style_context_add_provider((child),
main_win_get_style(win), G_MAXINT); main_win_get_style(win), G_MAXINT);
} }

View File

@ -50,11 +50,14 @@ void add_start(MainWin *win, GtkBox *box)
btn_more = (GtkMenuButton *)gtk_builder_get_object(startbuilder, "btn_more"); btn_more = (GtkMenuButton *)gtk_builder_get_object(startbuilder, "btn_more");
image_all = (GtkImage *)gtk_builder_get_object(startbuilder, "image_all"); image_all = (GtkImage *)gtk_builder_get_object(startbuilder, "image_all");
image_back = (GtkImage *)gtk_builder_get_object(startbuilder, "image_back"); image_back = (GtkImage *)gtk_builder_get_object(startbuilder, "image_back");
if(main_win_get_dark_mode(win)){ if (main_win_get_dark_mode(win))
{
gtk_menu_button_set_icon_name(btn_more, "arrow_right_dark"); gtk_menu_button_set_icon_name(btn_more, "arrow_right_dark");
gtk_image_set_from_icon_name(image_all, "arrow_right_dark"); gtk_image_set_from_icon_name(image_all, "arrow_right_dark");
gtk_image_set_from_icon_name(image_back, "arrow_left_dark"); gtk_image_set_from_icon_name(image_back, "arrow_left_dark");
}else{ }
else
{
gtk_menu_button_set_icon_name(btn_more, "arrow_right"); gtk_menu_button_set_icon_name(btn_more, "arrow_right");
gtk_image_set_from_icon_name(image_all, "arrow_right"); gtk_image_set_from_icon_name(image_all, "arrow_right");
gtk_image_set_from_icon_name(image_back, "arrow_left"); gtk_image_set_from_icon_name(image_back, "arrow_left");
@ -103,12 +106,11 @@ void add_start(MainWin *win, GtkBox *box)
ext_separator = (GtkWidget *)gtk_builder_get_object(startbuilder, "ext_separator"); ext_separator = (GtkWidget *)gtk_builder_get_object(startbuilder, "ext_separator");
start_box = (GtkWidget *)gtk_builder_get_object(startbuilder, "start_box"); start_box = (GtkWidget *)gtk_builder_get_object(startbuilder, "start_box");
search_entry = (GtkWidget *)gtk_builder_get_object(startbuilder, "search_entry"); search_entry = (GtkWidget *)gtk_builder_get_object(startbuilder, "search_entry");
gtk_widget_set_css_classes(start_menu, NULL);
gtk_widget_add_css_class(start_menu, "main_style");
gtk_widget_add_css_class(prim_separator, "default_style"); gtk_widget_add_css_class(prim_separator, "default_style");
gtk_widget_add_css_class(ext_separator, "default_style"); gtk_widget_add_css_class(ext_separator, "default_style");
gtk_widget_add_css_class(start_menu, "main_style");
gtk_widget_add_css_class(search_entry, "main_style");
gtk_widget_add_css_class(start_box, "default_style"); gtk_widget_add_css_class(start_box, "default_style");
// gtk_widget_add_css_class(menu_btn, "default_style");
gtk_style_context_add_provider((prim_separator), gtk_style_context_add_provider((prim_separator),
main_win_get_style(win), G_MAXINT); main_win_get_style(win), G_MAXINT);
gtk_style_context_add_provider((ext_separator), gtk_style_context_add_provider((ext_separator),