main: extend theming capabilities

This commit is contained in:
Marvin W 2017-08-29 21:55:15 +02:00
parent b428c3a627
commit b4b115df48
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
8 changed files with 25 additions and 67 deletions

View file

@ -34,7 +34,6 @@ set(RESOURCE_LIST
conversation_selector/conversation_row.ui
conversation_summary/message_item.ui
conversation_summary/view.ui
conversation_titlebar.ui
manage_accounts/account_row.ui
manage_accounts/add_account_dialog.ui
manage_accounts/dialog.ui
@ -46,6 +45,8 @@ set(RESOURCE_LIST
occupant_list_item.ui
settings_dialog.ui
unified_window_placeholder.ui
pre_theme.css
)
compile_gresources(

View file

@ -5,7 +5,7 @@
<property name="show_close_button">True</property>
<property name="visible">True</property>
<style>
<class name="left_toolbar"/>
<class name="dino-left"/>
</style>
<child>
<object class="GtkMenuButton" id="add_button">

View file

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="DinoUiConversationTitlebar" parent="GtkHeaderBar">
<property name="title"></property>
<property name="hexpand">True</property>
<property name="show_close_button">True</property>
<property name="visible">True</property>
<child>
<object class="GtkMenuButton" id="menu_button">
<property name="visible">True</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="encryption_button">
<property name="visible">False</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="groupchat_button">
<property name="visible">False</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">system-users-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</template>
</interface>

10
main/data/pre_theme.css Normal file
View file

@ -0,0 +1,10 @@
/**
* This theme file is applied before the operating system theme and any user configuration.
* It provides sane defaults for things that are very Dino-specific.
*/
window.dino-main headerbar.dino-left label.title {
opacity: 0;
font-size: 0;
color: transparent;
}

View file

@ -14,12 +14,15 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
public SearchPathGenerator? search_path_generator { get; set; }
public Application() throws Error {
Object(application_id: "im.dino.Dino", flags: ApplicationFlags.HANDLES_OPEN);
Object(application_id: "im.dino", flags: ApplicationFlags.HANDLES_OPEN);
init();
Notify.init("dino");
Environment.set_application_name("Dino");
Gtk.Window.set_default_icon_name("dino");
IconTheme.get_default().add_resource_path("/im/dino/icons");
Window.set_default_icon_name("dino");
CssProvider provider = new CssProvider();
provider.load_from_resource("/im/dino/pre_theme.css");
StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, STYLE_PROVIDER_PRIORITY_THEME - 1);
activate.connect(() => {
if (window == null) {

View file

@ -16,6 +16,10 @@ public class ConversationListTitlebar : Gtk.HeaderBar {
public ConversationListTitlebar(StreamInteractor stream_interactor, Window window) {
this.stream_interactor = stream_interactor;
custom_title = new Label("Dino") { visible = true, hexpand = true, xalign = 0 };
custom_title.get_style_context().add_class("title");
create_add_menu(window);
}

View file

@ -16,6 +16,7 @@ public class ConversationTitlebar : Gtk.HeaderBar {
this.stream_interactor = stream_interactor;
this.window = window;
this.get_style_context().add_class("dino-right");
show_close_button = true;
hexpand = true;

View file

@ -26,6 +26,7 @@ public class UnifiedWindow : Window {
Object(application : application, default_width : 1200, default_height : 700);
this.stream_interactor = stream_interactor;
this.get_style_context().add_class("dino-main");
setup_headerbar();
setup_unified();
setup_stack();