ManageAccounts: Window -> Dialog

This commit is contained in:
fiaxh 2017-05-09 16:09:06 +02:00
parent b0ac73914f
commit 31bbafa2c8
2 changed files with 256 additions and 249 deletions

View file

@ -3,6 +3,7 @@
<template class="DinoUiManageAccountsDialog"> <template class="DinoUiManageAccountsDialog">
<property name="width-request">700</property> <property name="width-request">700</property>
<property name="height-request">400</property> <property name="height-request">400</property>
<property name="modal">True</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="title" translatable="yes">Accounts</property> <property name="title" translatable="yes">Accounts</property>
@ -10,311 +11,316 @@
<property name="visible">True</property> <property name="visible">True</property>
</object> </object>
</child> </child>
<child> <child internal-child="vbox">
<object class="GtkStack" id="main_stack"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkStack" id="main_stack">
<property name="can_focus">True</property> <property name="visible">True</property>
<property name="expand">True</property>
<property name="visible">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="can_focus">True</property>
<property name="expand">True</property> <property name="expand">True</property>
<property name="orientation">horizontal</property>
<property name="margin">15</property>
<property name="spacing">20</property>
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">250</property>
<property name="vexpand">True</property>
<property name="hexpand">False</property>
<property name="visible">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="shadow-type">in</property>
<property name="expand">True</property>
<property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="visible">True</property>
<child>
<object class="GtkListBox" id="account_list">
<property name="expand">True</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolbar">
<style>
<class name="inline-toolbar"/>
</style>
<property name="icon-size">menu</property>
<property name="toolbar-style">icons</property>
<property name="visible">True</property>
<child>
<object class="GtkToolButton" id="add_button">
<property name="icon-name">list-add-symbolic</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="remove_button">
<property name="icon-name">list-remove-symbolic</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid" id="settings_list">
<property name="expand">True</property> <property name="expand">True</property>
<property name="column-spacing">10</property> <property name="orientation">horizontal</property>
<property name="row-spacing">5</property> <property name="margin">15</property>
<property name="spacing">20</property>
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">250</property>
<property name="vexpand">True</property>
<property name="hexpand">False</property>
<property name="visible">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="shadow-type">in</property>
<property name="expand">True</property>
<property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="visible">True</property>
<child>
<object class="GtkListBox" id="account_list">
<property name="expand">True</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolbar">
<style>
<class name="inline-toolbar"/>
</style>
<property name="icon-size">menu</property>
<property name="toolbar-style">icons</property>
<property name="visible">True</property>
<child>
<object class="GtkToolButton" id="add_button">
<property name="icon-name">list-add-symbolic</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="remove_button">
<property name="icon-name">list-remove-symbolic</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid" id="settings_list">
<property name="expand">True</property>
<property name="column-spacing">10</property>
<property name="row-spacing">5</property>
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="image_button">
<property name="relief">none</property>
<property name="visible">True</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="image">
<property name="height_request">50</property>
<property name="width_request">50</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="image_button"> <object class="GtkLabel" id="jid_label">
<property name="relief">none</property> <property name="xalign">0</property>
<property name="visible">True</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="state_label">
<property name="xalign">0</property>
<property name="visible">True</property> <property name="visible">True</property>
<style> <style>
<class name="image-button"/> <class name="dim-label"/>
</style> </style>
<child>
<object class="GtkImage" id="image">
<property name="height_request">50</property>
<property name="width_request">50</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
</child>
</object> </object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child> </child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="jid_label">
<property name="xalign">0</property>
<property name="visible">True</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="state_label">
<property name="xalign">0</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="active_switch">
<property name="visible">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Password</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkStack" id="password_stack">
<property name="visible">True</property>
<child> <child>
<object class="GtkButton" id="password_button"> <object class="GtkSwitch" id="active_switch">
<property name="relief">none</property> <property name="visible">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Password</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkStack" id="password_stack">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkLabel" id="password_label"> <object class="GtkButton" id="password_button">
<property name="xalign">0</property> <property name="relief">none</property>
<property name="visible">True</property> <property name="visible">True</property>
<child>
<object class="GtkLabel" id="password_label">
<property name="xalign">0</property>
<property name="visible">True</property>
</object>
</child>
</object> </object>
<packing>
<property name="name">label</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password_entry">
<property name="hexpand">True</property>
<property name="input_purpose">password</property>
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="visibility">False</property>
</object>
<packing>
<property name="name">entry</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
<property name="name">label</property> <property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="password_entry"> <object class="GtkLabel">
<property name="hexpand">True</property> <property name="label" translatable="yes">Local alias</property>
<property name="input_purpose">password</property> <property name="xalign">1</property>
<property name="width_request">200</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="visibility">False</property> <style>
<class name="dim-label"/>
</style>
</object> </object>
<packing> <packing>
<property name="name">entry</property> <property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Local alias</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkStack" id="alias_stack">
<property name="visible">True</property>
<child> <child>
<object class="GtkButton" id="alias_button"> <object class="GtkStack" id="alias_stack">
<property name="relief">none</property>
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkLabel" id="alias_label"> <object class="GtkButton" id="alias_button">
<property name="xalign">0</property> <property name="relief">none</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="alias_label">
<property name="xalign">0</property>
<property name="visible">True</property>
</object>
</child>
</object>
<packing>
<property name="name">label</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="alias_entry">
<property name="hexpand">True</property>
<property name="width_request">200</property>
<property name="visible">True</property> <property name="visible">True</property>
</object> </object>
<packing>
<property name="name">entry</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
<property name="name">label</property> <property name="left_attach">1</property>
</packing> <property name="top_attach">3</property>
</child> <property name="width">2</property>
<child> <property name="height">1</property>
<object class="GtkEntry" id="alias_entry">
<property name="hexpand">True</property>
<property name="width_request">200</property>
<property name="visible">True</property>
</object>
<packing>
<property name="name">entry</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child> </child>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="name">accounts_exist</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="valign">center</property>
<property name="visible">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">system-users-symbolic</property>
<property name="icon-size">4</property>
<property name="pixel-size">72</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">No accounts configured</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="no_accounts_add">
<property name="label" translatable="yes">Add an account</property>
<property name="halign">center</property>
<property name="visible">True</property>
<style>
<class name="text-button"/>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
<packing>
<property name="name">no_accounts</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="name">accounts_exist</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="valign">center</property>
<property name="visible">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">system-users-symbolic</property>
<property name="icon-size">4</property>
<property name="pixel-size">72</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">No accounts configured</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="no_accounts_add">
<property name="label" translatable="yes">Add an account</property>
<property name="halign">center</property>
<property name="visible">True</property>
<style>
<class name="text-button"/>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
<packing>
<property name="name">no_accounts</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View file

@ -8,7 +8,7 @@ using Dino.Entities;
namespace Dino.Ui.ManageAccounts { namespace Dino.Ui.ManageAccounts {
[GtkTemplate (ui = "/org/dino-im/manage_accounts/dialog.ui")] [GtkTemplate (ui = "/org/dino-im/manage_accounts/dialog.ui")]
public class Dialog : Gtk.Window { public class Dialog : Gtk.Dialog {
public signal void account_enabled(Account account); public signal void account_enabled(Account account);
public signal void account_disabled(Account account); public signal void account_disabled(Account account);
@ -75,6 +75,7 @@ public class Dialog : Gtk.Window {
} }
public Dialog(StreamInteractor stream_interactor, Database db) { public Dialog(StreamInteractor stream_interactor, Database db) {
Object(use_header_bar : 1);
this.db = db; this.db = db;
this.stream_interactor = stream_interactor; this.stream_interactor = stream_interactor;
foreach (Account account in db.get_accounts()) { foreach (Account account in db.get_accounts()) {