malcontent-control: Use HdyWindow and HdyHeaderBar

This commit is contained in:
Christopher Davis 2021-02-08 03:27:59 -08:00 committed by Georges Basile Stavracas Neto
parent f11d91da3a
commit d80ed10592
3 changed files with 265 additions and 255 deletions

View File

@ -27,6 +27,7 @@
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <libhandy-1/handy.h>
#include <libmalcontent-ui/malcontent-ui.h>
#include <polkit/polkit.h>
@ -250,6 +251,8 @@ mct_application_startup (GApplication *application)
/* Chain up. */
G_APPLICATION_CLASS (mct_application_parent_class)->startup (application);
hdy_init ();
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries,
G_N_ELEMENTS (app_entries), application);

View File

@ -2,74 +2,124 @@
<!-- Copyright © 2019, 2020 Endless Mobile, Inc. -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkApplicationWindow" id="main_window">
<object class="HdyApplicationWindow" id="main_window">
<property name="default-width">540</property>
<property name="default-height">580</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="show-close-button">True</property>
<!-- Translators: This is the title of the main window -->
<property name="title" translatable="yes">Parental Controls</property>
<property name="visible">True</property>
<child>
<object class="GtkMenuButton" id="primary_menu">
<property name="visible">True</property>
<property name="direction">none</property>
<property name="can-focus">True</property>
<property name="use-popover">True</property>
<property name="menu-model">primary-menu</property>
<accelerator key="F10" signal="activate"/>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="main_stack">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<object class="HdyHeaderBar" id="header">
<property name="show-close-button">True</property>
<!-- Translators: This is the title of the main window -->
<property name="title" translatable="yes">Parental Controls</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="border_width">0</property>
<child>
<object class="MctUserSelector" id="user_selector">
<object class="GtkMenuButton" id="primary_menu">
<property name="visible">True</property>
<property name="user-manager">user_manager</property>
<property name="show-administrators">False</property>
<accessibility>
<relation target="user_controls" type="controller-for"/>
</accessibility>
<property name="direction">none</property>
<property name="can-focus">True</property>
<property name="use-popover">True</property>
<property name="menu-model">primary-menu</property>
<accelerator key="F10" signal="activate"/>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="fill">False</property>
<property name="expand">False</property>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<child>
<object class="GtkScrolledWindow">
<object class="GtkBox">
<property name="visible">True</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">370</property>
<property name="orientation">vertical</property>
<property name="border_width">0</property>
<child>
<object class="GtkBox">
<property name="margin">18</property>
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<object class="MctUserSelector" id="user_selector">
<property name="visible">True</property>
<property name="user-manager">user_manager</property>
<property name="show-administrators">False</property>
<accessibility>
<relation target="user_controls" type="controller-for"/>
</accessibility>
</object>
<packing>
<property name="fill">False</property>
<property name="expand">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">370</property>
<child>
<object class="GtkLabel" id="help_label">
<!-- Content is set in code; this string is just a placeholder -->
<property name="label">Its recommended that restrictions are set as part of an ongoing conversation with $name. Read guidance on what to consider.</property>
<object class="GtkBox">
<property name="margin">18</property>
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<property name="yalign">0.0</property>
<child>
<object class="GtkLabel" id="help_label">
<!-- Content is set in code; this string is just a placeholder -->
<property name="label">Its recommended that restrictions are set as part of an ongoing conversation with $name. Read guidance on what to consider.</property>
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<property name="yalign">0.0</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="MctUserControls" id="user_controls">
<property name="halign">center</property>
<property name="visible">True</property>
<property name="dbus-connection">dbus_connection</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
</object>
<packing>
<property name="name">controls</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Permission Required</property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
@ -78,221 +128,177 @@
</object>
</child>
<child>
<object class="MctUserControls" id="user_controls">
<property name="halign">center</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="dbus-connection">dbus_connection</property>
<property name="label" translatable="yes">Permission is required to view and change user parental controls settings.</property>
<property name="wrap">True</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLockButton" id="lock_button">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="can-focus">True</property>
<!-- Give 18px spacing between the label and the button -->
<property name="margin-top">6</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="name">unlock</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin">18</property>
<child>
<object class="GtkImage">
<property name="icon-name">system-users-symbolic</property>
<property name="pixel-size">96</property>
<property name="visible">True</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">No Standard User Accounts</property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="justify">center</property>
<property name="label" translatable="yes">Parental controls can only be applied to standard user
accounts. These can be created in the user settings.</property>
<property name="wrap">True</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="user_accounts_panel_button">
<property name="visible">True</property>
<property name="label" translatable="yes">_User Settings</property>
<property name="halign">center</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="use-underline">True</property>
<property name="can-focus">True</property>
<!-- Give 18px spacing between the label and the button -->
<property name="margin-top">6</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">no-other-users</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Loading…</property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">loading</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="error_title">
<property name="visible">True</property>
<property name="label"></property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel" id="error_message">
<property name="visible">True</property>
<property name="label"></property>
</object>
</child>
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">alert</property>
</object>
</child>
</object>
<packing>
<property name="name">error</property>
</packing>
</child>
</object>
<packing>
<property name="name">controls</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Permission Required</property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Permission is required to view and change user parental controls settings.</property>
<property name="wrap">True</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLockButton" id="lock_button">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="can-focus">True</property>
<!-- Give 18px spacing between the label and the button -->
<property name="margin-top">6</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">unlock</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin">18</property>
<child>
<object class="GtkImage">
<property name="icon-name">system-users-symbolic</property>
<property name="pixel-size">96</property>
<property name="visible">True</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">No Standard User Accounts</property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="justify">center</property>
<property name="label" translatable="yes">Parental controls can only be applied to standard user
accounts. These can be created in the user settings.</property>
<property name="wrap">True</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="user_accounts_panel_button">
<property name="visible">True</property>
<property name="label" translatable="yes">_User Settings</property>
<property name="halign">center</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="use-underline">True</property>
<property name="can-focus">True</property>
<!-- Give 18px spacing between the label and the button -->
<property name="margin-top">6</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">no-other-users</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Loading…</property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">loading</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="error_title">
<property name="visible">True</property>
<property name="label"></property>
<attributes>
<attribute name="scale" value="1.4"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel" id="error_message">
<property name="visible">True</property>
<property name="label"></property>
</object>
</child>
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">alert</property>
</object>
</child>
</object>
<packing>
<property name="name">error</property>
</packing>
</child>
</object>
</child>

View File

@ -28,6 +28,7 @@ malcontent_control = executable('malcontent-control',
dependency('glib-2.0', version: '>= 2.54.2'),
dependency('gobject-2.0', version: '>= 2.54'),
dependency('gtk+-3.0'),
dependency('libhandy-1', version: '>=1.1.0'),
dependency('polkit-gobject-1'),
libmalcontent_dep,
libmalcontent_ui_dep,