Initial headerbar support

This commit is contained in:
Patrick Ulbrich
2016-06-12 12:00:24 +02:00
parent 25aefb1c9f
commit aa963ad590
6 changed files with 185 additions and 309 deletions

View File

@@ -24,12 +24,11 @@
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GLib', '2.0')
import os
import shutil
import xdg.BaseDirectory as bd
from gi.repository import GLib, GdkPixbuf, Gdk, Gtk, GObject
from gi.repository import Gtk
from Mailnag.common.dist_cfg import PACKAGE_NAME, APP_VERSION, BIN_DIR, DESKTOP_FILE_DIR
from Mailnag.common.i18n import _
@@ -70,7 +69,6 @@ class ConfigWindow:
self._window = builder.get_object("config_window")
self._window.set_icon_name("mailnag")
self._load_stylesheet('config_window.css')
self._cfg = read_cfg()
self.daemon_enabled = False
@@ -82,16 +80,6 @@ class ConfigWindow:
self._box_navigation = builder.get_object("box_navigation")
self._box_navigation.get_children()[0].set_active(True)
#
# general page
#
# The dimension of the png is expected to be 180x180 px
pb = GdkPixbuf.Pixbuf.new_from_file(get_data_file("mailnag.png"))
pb = pb.new_subpixbuf(0, 10, 180, 146) # crop whitespace at the bottom
self._image_logo = builder.get_object("image_logo")
self._image_logo.set_from_pixbuf(pb)
self._label_app_desc = builder.get_object("label_app_desc")
self._label_app_desc.set_markup("<span font=\"24\"><b>Mailnag</b></span>\nVersion %s" % str(APP_VERSION))
self._switch_daemon_enabled = builder.get_object("switch_daemon_enabled")
#
@@ -148,14 +136,6 @@ class ConfigWindow:
# load config
self._load_config()
self._window.show()
def _load_stylesheet(self, stylesheet):
provider = Gtk.CssProvider()
provider.load_from_path(get_data_file(stylesheet))
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def _load_config(self):

View File

@@ -49,8 +49,7 @@ though make sure the requirements stated below are met.
* python2 (python3 won't work!)
* pygobject
* gir-notify (>= 0.7.6)
* gir-gtk-3.0
* gir-gdkpixbuf-2.0
* gir-gtk-3.0 (>= 3.10.8)
* gir-glib-2.0
* gir-gst-plugins-base-1.0
* python-dbus

View File

@@ -1,6 +0,0 @@
.bg-gradient {
background-image: linear-gradient(to bottom,
@theme_bg_color,
shade(@theme_bg_color, 0.94)
12%);
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.6"/>
<requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="liststore_accounts">
<columns>
<!-- column-name account_obj -->
@@ -26,36 +26,199 @@
</object>
<object class="GtkWindow" id="config_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Mailnag Configuration</property>
<property name="default_width">580</property>
<property name="default_height">420</property>
<signal name="delete-event" handler="config_window_deleted" swapped="no"/>
<child>
<object class="GtkBox" id="box1">
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<object class="GtkBox" id="box_navigation">
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">18</property>
<property name="margin_right">18</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="homogeneous">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToggleButton" id="btn_page1">
<property name="label" translatable="yes">General</property>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="toggled" handler="btn_page_toggled" swapped="no"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview_accounts">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore_accounts</property>
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
<property name="enable_search">False</property>
<property name="search_column">1</property>
<signal name="row-activated" handler="treeview_accounts_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">1</property>
<child>
<object class="GtkToolButton" id="btn_add_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Add Account</property>
<property name="icon_name">list-add-symbolic</property>
<signal name="clicked" handler="btn_add_account_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="btn_remove_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Remove Account</property>
<property name="icon_name">list-remove-symbolic</property>
<signal name="clicked" handler="btn_remove_account_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="btn_edit_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Account</property>
<property name="icon_name">text-editor-symbolic</property>
<signal name="clicked" handler="btn_edit_account_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview_plugins">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore_plugins</property>
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
<property name="enable_search">False</property>
<property name="search_column">1</property>
<signal name="cursor-changed" handler="treeview_plugins_cursor_changed" swapped="no"/>
<signal name="row-activated" handler="treeview_plugins_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection3"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="toolbar2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">1</property>
<child>
<object class="GtkToolButton" id="btn_edit_plugin">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Plugin</property>
<property name="icon_name">text-editor-symbolic</property>
<signal name="clicked" handler="btn_edit_plugin_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="show_close_button">True</property>
<child type="title">
<object class="GtkBox" id="box_navigation">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkToggleButton" id="btn_page2">
<property name="label" translatable="yes">Accounts</property>
@@ -88,274 +251,16 @@
<class name="linked"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<object class="GtkSwitch" id="switch_daemon_enabled">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<object class="GtkEventBox" id="eventbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_bottom">12</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="image_logo">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_app_desc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">APP_DESC</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">&lt;a href="https://github.com/pulb/mailnag"&gt;Mailnag&lt;/a&gt; - An extensible mail notification daemon.
Copyright (c) 2011 - 2016 Patrick Ulbrich
and contributors.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_daemon_enabled">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<style>
<class name="bg-gradient"/>
</style>
</object>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview_accounts">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore_accounts</property>
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
<property name="enable_search">False</property>
<property name="search_column">1</property>
<signal name="row-activated" handler="treeview_accounts_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">1</property>
<child>
<object class="GtkToolButton" id="btn_add_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Add Account</property>
<property name="icon_name">list-add-symbolic</property>
<signal name="clicked" handler="btn_add_account_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="btn_remove_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Remove Account</property>
<property name="icon_name">list-remove-symbolic</property>
<signal name="clicked" handler="btn_remove_account_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="btn_edit_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Account</property>
<property name="icon_name">text-editor-symbolic</property>
<signal name="clicked" handler="btn_edit_account_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview_plugins">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore_plugins</property>
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
<property name="enable_search">False</property>
<property name="search_column">1</property>
<signal name="cursor-changed" handler="treeview_plugins_cursor_changed" swapped="no"/>
<signal name="row-activated" handler="treeview_plugins_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection3"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="toolbar2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">1</property>
<child>
<object class="GtkToolButton" id="btn_edit_plugin">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Plugin</property>
<property name="icon_name">text-editor-symbolic</property>
<signal name="clicked" handler="btn_edit_plugin_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="pack_type">end</property>
</packing>
</child>
</object>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -116,9 +116,7 @@ setup(name=PACKAGE_NAME,
packages=['Mailnag', 'Mailnag.common', 'Mailnag.configuration', 'Mailnag.daemon', 'Mailnag.plugins'],
scripts=['mailnag', 'mailnag-config'],
data_files=[('share/mailnag', glob.glob('data/*.ui')),
('share/mailnag', ['data/config_window.css']),
('share/mailnag', ['data/mailnag.ogg']),
('share/mailnag', ['data/mailnag.png']),
('share/appdata', ['data/mailnag.appdata.xml']),
('share/applications', [os.path.join(BUILD_PATCH_DIR, 'mailnag.desktop'), os.path.join(BUILD_PATCH_DIR, 'mailnag-config.desktop')])],
cmdclass={'build': BuildData,