pidgin/resources/notification.ui

Tue, 17 Sep 2024 00:56:55 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 17 Sep 2024 00:56:55 -0500
changeset 42940
240eb66a3795
child 42946
25a2db55796d
permissions
-rw-r--r--

Create Pidgin.Notification to simplify the custom widgets

This should be much easier to maintain as it keeps everything encapsulated.

PidginNotificationAuthorizationRequest was removed as nothing creates these
notifications right now.

PidginNotificationConnectionError was removed as we are currently in the
process of reworking the way connection errors work and this is in the way of
that.

Testing Done:
Created a bunch of test notifications with the demo protocol plugin and called in the turtles.

Bugs closed: PIDGIN-17929, PIDGIN-17942

Reviewed at https://reviews.imfreedom.org/r/3480/

<?xml version="1.0" encoding="UTF-8"?>
<!--
Pidgin - Internet Messenger
Copyright (C) Pidgin Developers <devel@pidgin.im>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>.
-->
<interface>
  <requires lib="gtk" version="4.0"/>
  <requires lib="Adw" version="1.0"/>
  <!-- interface-license-type gplv2 -->
  <!-- interface-name Pidgin -->
  <!-- interface-description Internet Messenger -->
  <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
  <template class="PidginNotification" parent="GtkBox">
    <property name="orientation">horizontal</property>
    <property name="spacing">6</property>
    <property name="margin-start">2</property>
    <property name="margin-end">2</property>
    <property name="margin-top">2</property>
    <property name="margin-bottom">2</property>
    <child>
      <object class="GtkImage" id="icon">
        <property name="icon-size">large</property>
        <property name="halign">center</property>
        <property name="valign">center</property>
        <binding name="icon-name">
          <lookup name="icon-name" type="PurpleNotification">
            <lookup name="notification">PidginNotification</lookup>
          </lookup>
        </binding>
      </object>
    </child>
    <child>
      <object class="GtkBox" id="details">
        <property name="halign">fill</property>
        <property name="hexpand">true</property>
        <property name="orientation">vertical</property>
        <property name="spacing">0</property>
        <property name="valign">center</property>
        <child>
          <object class="GtkLabel">
            <property name="ellipsize">end</property>
            <property name="lines">3</property>
            <property name="xalign">0</property>
            <binding name="label">
              <lookup name="title" type="PurpleNotification">
                <lookup name="notification">PidginNotification</lookup>
              </lookup>
            </binding>
          </object>
        </child>
        <child>
          <object class="GtkLabel">
            <property name="ellipsize">end</property>
            <property name="lines">3</property>
            <property name="xalign">0</property>
            <binding name="label">
              <lookup name="subtitle" type="PurpleNotification">
                <lookup name="notification">PidginNotification</lookup>
              </lookup>
            </binding>
            <binding name="visible">
              <closure type="gboolean" function="pidgin_notification_show_subtitle">
                <lookup name="subtitle" type="PurpleNotification">
                  <lookup name="notification">PidginNotification</lookup>
                </lookup>
              </closure>
            </binding>
          </object>
        </child>
      </object>
    </child>
    <child>
      <object class="GtkButton">
        <property name="focusable">1</property>
        <property name="receives-default">1</property>
        <property name="icon-name">edit-delete-symbolic</property>
        <property name="halign">center</property>
        <property name="valign">center</property>
        <property name="action-name">notification.close</property>
        <style>
          <class name="flat"/>
        </style>
      </object>
    </child>
  </template>
</interface>

mercurial