aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-14 14:55:59 +0100
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commit7e7dcedaf31ee35499875491c9f569c575d28435 (patch)
tree0c5fee2b28baf320775fbc92b3c252e97d9d054f /plugins
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'plugins')
-rw-r--r--plugins/http-files/CMakeLists.txt2
-rw-r--r--plugins/ice/CMakeLists.txt3
-rw-r--r--plugins/omemo/CMakeLists.txt3
-rw-r--r--plugins/omemo/data/contact_details_dialog.ui161
-rw-r--r--plugins/omemo/data/manage_key_dialog.ui223
-rw-r--r--plugins/omemo/src/logic/trust_manager.vala2
-rw-r--r--plugins/omemo/src/ui/account_settings_entry.vala54
-rw-r--r--plugins/omemo/src/ui/account_settings_widget.vala54
-rw-r--r--plugins/omemo/src/ui/bad_messages_populator.vala6
-rw-r--r--plugins/omemo/src/ui/contact_details_dialog.vala57
-rw-r--r--plugins/omemo/src/ui/contact_details_provider.vala6
-rw-r--r--plugins/omemo/src/ui/device_notification_populator.vala8
-rw-r--r--plugins/omemo/src/ui/encryption_list_entry.vala8
-rw-r--r--plugins/omemo/src/ui/manage_key_dialog.vala28
-rw-r--r--plugins/openpgp/CMakeLists.txt3
-rw-r--r--plugins/openpgp/data/account_settings_item.ui44
-rw-r--r--plugins/openpgp/src/account_settings_entry.vala156
-rw-r--r--plugins/openpgp/src/account_settings_widget.vala149
-rw-r--r--plugins/openpgp/src/contact_details_provider.vala2
-rw-r--r--plugins/openpgp/src/encryption_list_entry.vala6
-rw-r--r--plugins/rtp/CMakeLists.txt2
-rw-r--r--plugins/rtp/src/plugin.vala2
-rw-r--r--plugins/rtp/src/video_widget.vala12
23 files changed, 454 insertions, 537 deletions
diff --git a/plugins/http-files/CMakeLists.txt b/plugins/http-files/CMakeLists.txt
index 2da46731..b29cfda3 100644
--- a/plugins/http-files/CMakeLists.txt
+++ b/plugins/http-files/CMakeLists.txt
@@ -11,7 +11,7 @@ find_packages(HTTP_FILES_PACKAGES REQUIRED
GLib
GModule
GObject
- GTK3
+ GTK4
${Soup}
)
diff --git a/plugins/ice/CMakeLists.txt b/plugins/ice/CMakeLists.txt
index 4783cea6..57ca69e3 100644
--- a/plugins/ice/CMakeLists.txt
+++ b/plugins/ice/CMakeLists.txt
@@ -5,7 +5,8 @@ find_packages(ICE_PACKAGES REQUIRED
GLib
GModule
GObject
- GTK3
+ GIO
+ GDKPixbuf2
)
vala_precompile(ICE_VALA_C
diff --git a/plugins/omemo/CMakeLists.txt b/plugins/omemo/CMakeLists.txt
index 195001cb..dc9a93b0 100644
--- a/plugins/omemo/CMakeLists.txt
+++ b/plugins/omemo/CMakeLists.txt
@@ -9,7 +9,7 @@ find_packages(OMEMO_PACKAGES REQUIRED
GLib
GModule
GObject
- GTK3
+ GTK4
)
set(RESOURCE_LIST
@@ -53,7 +53,6 @@ SOURCES
src/protocol/stream_module.vala
src/ui/account_settings_entry.vala
- src/ui/account_settings_widget.vala
src/ui/bad_messages_populator.vala
src/ui/call_encryption_entry.vala
src/ui/contact_details_provider.vala
diff --git a/plugins/omemo/data/contact_details_dialog.ui b/plugins/omemo/data/contact_details_dialog.ui
index 62aded6b..fdb9f1cf 100644
--- a/plugins/omemo/data/contact_details_dialog.ui
+++ b/plugins/omemo/data/contact_details_dialog.ui
@@ -1,28 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="DinoPluginsOmemoContactDetailsDialog">
<property name="modal">True</property>
<property name="resizable">False</property>
- <child internal-child="vbox">
+ <child internal-child="content_area">
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">12</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame">
- <property name="visible">True</property>
- <child>
+ <property name="child">
<object class="GtkListBox">
- <property name="visible">True</property>
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow">
- <property name="visible">True</property>
- <property name="activatable">False</property>
- <child>
+ <property name="activatable">0</property>
+ <property name="child">
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">14</property>
@@ -30,27 +28,25 @@
<property name="spacing">40</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
<property name="orientation">vertical</property>
- <property name="hexpand">True</property>
+ <property name="hexpand">1</property>
<child>
<object class="GtkLabel" id="automatically_accept_new_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<attributes>
- <attribute name="scale" value="1.1"/>
+ <attribute name="scale" value="1.1"></attribute>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel" id="automatically_accept_new_descr">
- <property name="visible">True</property>
<property name="max_width_chars">1</property>
- <property name="expand">True</property>
+ <property name="hexpand">1</property>
+ <property name="vexpand">1</property>
<property name="xalign">0</property>
- <property name="wrap">True</property>
+ <property name="wrap">1</property>
<attributes>
- <attribute name="scale" value="0.8"/>
+ <attribute name="scale" value="0.8"></attribute>
</attributes>
<style>
<class name="dim-label"/>
@@ -61,92 +57,73 @@
</child>
<child>
<object class="GtkSwitch" id="auto_accept_switch">
- <property name="visible">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
<child>
<object class="GtkBox" id="own_fingerprint_container">
- <property name="visible">False</property>
+ <property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="own_key_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<attributes>
- <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
+ <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
</attributes>
</object>
</child>
<child>
<object class="GtkFrame">
- <property name="visible">True</property>
- <child>
+ <property name="child">
<object class="GtkListBox">
- <property name="visible">True</property>
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow">
- <property name="visible">True</property>
- <property name="activatable">False</property>
- <property name="hexpand">True</property>
- <child>
+ <property name="activatable">0</property>
+ <property name="hexpand">1</property>
+ <property name="child">
<object class="GtkBox">
- <property name="visible">True</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">14</property>
<property name="spacing">40</property>
<property name="margin-bottom">14</property>
- <property name="orientation">horizontal</property>
- <property name="hexpand">True</property>
+ <property name="hexpand">1</property>
<child>
<object class="GtkLabel" id="own_fingerprint_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<property name="justify">right</property>
- <property name="hexpand">True</property>
+ <property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <property name="hexpand">True</property>
+ <property name="hexpand">1</property>
<property name="spacing">5</property>
<child>
- <object class="GtkButton" id="show_qrcode_button">
- <property name="visible">True</property>
+ <object class="GtkMenuButton" id="show_qrcode_button">
+ <property name="icon-name">dino-qr-code-symbolic</property>
<property name="halign">start</property>
- <property name="hexpand">True</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">dino-qr-code-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
+ <property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkButton" id="copy_button">
- <property name="visible">True</property>
<property name="halign">end</property>
- <property name="hexpand">True</property>
+ <property name="hexpand">1</property>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-size">1</property>
+ <property name="icon-size">normal</property>
<property name="icon-name">edit-copy-symbolic</property>
</object>
</child>
@@ -155,114 +132,99 @@
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="new_keys_container">
- <property name="visible">False</property>
+ <property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="new_keys_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<attributes>
- <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
+ <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
</attributes>
</object>
</child>
<child>
<object class="GtkFrame">
- <property name="visible">True</property>
- <child>
+ <property name="child">
<object class="GtkScrolledWindow">
<property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="visible">True</property>
- <property name="propagate_natural_height">True</property>
- <child>
+ <property name="propagate_natural_height">1</property>
+ <property name="child">
<object class="GtkListBox" id="new_keys_listbox">
- <property name="visible">True</property>
<property name="selection-mode">none</property>
</object>
- </child>
+ </property>
</object>
- </child>
+ </property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="keys_container">
- <property name="visible">False</property>
+ <property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="associated_keys_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<attributes>
- <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
+ <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
</attributes>
</object>
</child>
<child>
<object class="GtkFrame">
- <property name="visible">True</property>
- <child>
+ <property name="child">
<object class="GtkScrolledWindow">
<property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="visible">True</property>
- <property name="propagate_natural_height">True</property>
- <child>
+ <property name="propagate_natural_height">1</property>
+ <property name="child">
<object class="GtkListBox" id="keys_listbox">
- <property name="visible">True</property>
<property name="selection-mode">none</property>
</object>
- </child>
+ </property>
</object>
- </child>
+ </property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkExpander" id="inactive_keys_expander">
- <property name="visible">False</property>
+ <property name="visible">0</property>
<child type="label">
<object class="GtkLabel" id="inactive_expander_label">
- <property name="visible">True</property>
<attributes>
- <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
+ <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
</attributes>
</object>
</child>
<child>
<object class="GtkFrame">
- <property name="visible">True</property>
<property name="margin-top">2</property>
- <child>
+ <property name="child">
<object class="GtkScrolledWindow">
<property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="visible">True</property>
- <property name="propagate_natural_height">True</property>
- <child>
+ <property name="propagate_natural_height">1</property>
+ <property name="child">
<object class="GtkListBox" id="inactive_keys_listbox">
- <property name="visible">True</property>
<property name="selection-mode">none</property>
</object>
- </child>
+ </property>
</object>
- </child>
+ </property>
</object>
</child>
</object>
@@ -271,19 +233,18 @@
</child>
</template>
<object class="GtkPopover" id="qrcode_popover">
- <property name="visible">False</property>
- <property name="relative-to">show_qrcode_button</property>
<property name="position">left</property>
- <property name="modal">True</property>
- <child>
+ <property name="child">
<object class="GtkBox">
<property name="visible">True</property>
+ <property name="margin-start">10</property>
+ <property name="margin-end">10</property>
+ <property name="margin-top">10</property>
+ <property name="margin-bottom">10</property>
<child>
- <object class="GtkImage" id="qrcode_image">
- <property name="visible">True</property>
- </object>
+ <object class="GtkImage" id="qrcode_image"/>
</child>
</object>
- </child>
+ </property>
</object>
</interface>
diff --git a/plugins/omemo/data/manage_key_dialog.ui b/plugins/omemo/data/manage_key_dialog.ui
index dcec4c90..37f158da 100644
--- a/plugins/omemo/data/manage_key_dialog.ui
+++ b/plugins/omemo/data/manage_key_dialog.ui
@@ -1,164 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="DinoPluginsOmemoManageKeyDialog">
<property name="modal">True</property>
<property name="resizable">False</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
- <property name="visible">True</property>
- <property name="show_close_button">False</property>
+ <property name="show_title_buttons">0</property>
<child>
- <object class="GtkButton" id="cancel_button">
- <property name="sensitive">True</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
+ <object class="GtkButton" id="cancel_button"/>
</child>
- <child>
+ <child type="end">
<object class="GtkButton" id="ok_button">
- <property name="has_default">True</property>
- <property name="can_default">True</property>
- <property name="sensitive">False</property>
- <property name="visible">True</property>
+ <property name="sensitive">0</property>
<style>
<class name="suggested-action"/>
</style>
</object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child internal-child="content_area">
<object class="GtkBox">
- <property name="visible">True</property>
<child>
<object class="GtkStack" id="manage_stack">
- <property name="visible">True</property>
<property name="transition-type">slide-left-right</property>
<child>
- <object class="GtkBox" id="main_screen">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel" id="main_desc_label">
- <property name="visible">True</property>
- <property name="wrap">True</property>
- <property name="xalign">0</property>
- <property name="max-width-chars">1</property>
- </object>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
+ <object class="GtkStackPage">
+ <property name="name">main</property>
+ <property name="child">
+ <object class="GtkBox" id="main_screen">
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="spacing">12</property>
+ <property name="orientation">vertical</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="main_desc_label">
+ <property name="wrap">1</property>
+ <property name="xalign">0</property>
+ <property name="max-width-chars">1</property>
+ </object>
+ </child>
<child>
- <object class="GtkListBox" id="main_action_list">
- <property name="visible">True</property>
- <property name="selection-mode">none</property>
+ <object class="GtkFrame">
+ <property name="child">
+ <object class="GtkListBox" id="main_action_list">
+ <property name="selection-mode">none</property>
+ </object>
+ </property>
</object>
</child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">main</property>
- </packing>
</child>
<child>
- <object class="GtkBox" id="verify_screen">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel" id="compare_fingerprint_label">
- <property name="visible">True</property>
- <property name="wrap">True</property>
- <property name="xalign">0.5</property>
- <property name="max-width-chars">45</property>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="margin-left">12</property>
- <property name="margin-right">12</property>
+ <object class="GtkStackPage">
+ <property name="name">verify</property>
+ <property name="child">
+ <object class="GtkBox" id="verify_screen">
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
<property name="spacing">12</property>
- <property name="hexpand">False</property>
- <property name="halign">center</property>
- <child>
- <object class="GtkLabel" id="verify_label">
- <property name="visible">True</property>
- <property name="margin-top">12</property>
- <property name="margin-bottom">12</property>
- <property name="justify">right</property>
- </object>
- </child>
+ <property name="orientation">vertical</property>
+ <property name="valign">center</property>
<child>
- <object class="GtkButton" id="verify_no_button">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
+ <object class="GtkLabel" id="compare_fingerprint_label">
+ <property name="wrap">1</property>
+ <property name="max-width-chars">45</property>
</object>
</child>
<child>
- <object class="GtkButton" id="verify_yes_button">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="spacing">12</property>
+ <property name="hexpand">0</property>
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkLabel" id="verify_label">
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="justify">right</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="verify_no_button">
+ <property name="hexpand">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="verify_yes_button">
+ <property name="hexpand">1</property>
+ </object>
+ </child>
</object>
</child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">verify</property>
- </packing>
</child>
<child>
- <object class="GtkBox" id="confirm_screen">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkImage" id="confirm_image">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="confirm_title_label">
- <property name="visible">True</property>
- <attributes>
- <attribute name="scale" value="1.1"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="confirm_desc_label">
- <property name="visible">True</property>
- <property name="justify">center</property>
- <property name="wrap">True</property>
- <property name="max-width-chars">40</property>
- <attributes>
- <attribute name="scale" value="0.8"/>
- </attributes>
- <style>
- <class name="dim-label"/>
- </style>
+ <object class="GtkStackPage">
+ <property name="name">confirm</property>
+ <property name="child">
+ <object class="GtkBox" id="confirm_screen">
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="spacing">12</property>
+ <property name="orientation">vertical</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkImage" id="confirm_image"/>
+ </child>
+ <child>
+ <object class="GtkLabel" id="confirm_title_label">
+ <attributes>
+ <attribute name="scale" value="1.1"></attribute>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="confirm_desc_label">
+ <property name="justify">center</property>
+ <property name="wrap">1</property>
+ <property name="max-width-chars">40</property>
+ <attributes>
+ <attribute name="scale" value="0.8"></attribute>
+ </attributes>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">confirm</property>
- </packing>
</child>
</object>
</child>
diff --git a/plugins/omemo/src/logic/trust_manager.vala b/plugins/omemo/src/logic/trust_manager.vala
index 20076a43..cae88eef 100644
--- a/plugins/omemo/src/logic/trust_manager.vala
+++ b/plugins/omemo/src/logic/trust_manager.vala
@@ -109,7 +109,7 @@ public class TrustManager {
// TODO: Handling of files
- ContentItem? content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item(conversation, 1, message.id);
+ ContentItem? content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item_by_foreign(conversation, 1, message.id);
if (content_item != null && device_id != 0) {
Jid jid = content_item.jid;
diff --git a/plugins/omemo/src/ui/account_settings_entry.vala b/plugins/omemo/src/ui/account_settings_entry.vala
index 3866febe..8736260b 100644
--- a/plugins/omemo/src/ui/account_settings_entry.vala
+++ b/plugins/omemo/src/ui/account_settings_entry.vala
@@ -1,26 +1,58 @@
+using Dino.Entities;
+using Gtk;
+
namespace Dino.Plugins.Omemo {
public class AccountSettingsEntry : Plugins.AccountSettingsEntry {
private Plugin plugin;
+ private Account account;
+
+ private Box box = new Box(Orientation.HORIZONTAL, 0);
+ private Label fingerprint = new Label("...") { xalign=0 };
+ private Button btn = new Button.from_icon_name("view-list-symbolic") { has_frame=false, valign=Align.CENTER, visible=false };
+
+ public override string id { get { return "omemo_identity_key"; }}
+
+ public override string name { get { return "OMEMO"; }}
public AccountSettingsEntry(Plugin plugin) {
this.plugin = plugin;
- }
- public override string id { get {
- return "omemo_identity_key";
- }}
+ Border border = new Button().get_style_context().get_padding();
+ fingerprint.margin_top = border.top + 1;
+ fingerprint.margin_start = border.left + 1;
+ fingerprint.visible = true;
+ box.append(fingerprint);
- public override string name { get {
- return "OMEMO";
- }}
+ btn.clicked.connect(() => {
+ activated();
+ ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, account, account.bare_jid);
+ dialog.set_transient_for((Window) box.get_root());
+ dialog.present();
+ });
+ // TODO expand=false?
+ box.append(btn);
+ }
+
+ public override Object? get_widget(WidgetType type) {
+ if (type != WidgetType.GTK4) return null;
+ return box;
+ }
- public override Plugins.AccountSettingsWidget? get_widget(WidgetType type) {
- if (type == WidgetType.GTK) {
- return new AccountSettingWidget(plugin);
+ public override void set_account(Account account) {
+ this.account = account;
+ btn.visible = false;
+ Qlite.Row? row = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id).inner;
+ if (row == null) {
+ fingerprint.set_markup("%s\n<span font='8'>%s</span>".printf(_("Own fingerprint"), _("Will be generated on first connection")));
+ } else {
+ string res = fingerprint_markup(fingerprint_from_base64(((!)row)[plugin.db.identity.identity_key_public_base64]));
+ fingerprint.set_markup("%s\n<span font_family='monospace' font='8'>%s</span>".printf(_("Own fingerprint"), res));
+ btn.visible = true;
}
- return null;
}
+
+ public override void deactivate() { }
}
} \ No newline at end of file
diff --git a/plugins/omemo/src/ui/account_settings_widget.vala b/plugins/omemo/src/ui/account_settings_widget.vala
deleted file mode 100644
index cc562221..00000000
--- a/plugins/omemo/src/ui/account_settings_widget.vala
+++ /dev/null
@@ -1,54 +0,0 @@
-using Gtk;
-using Dino.Entities;
-
-namespace Dino.Plugins.Omemo {
-
-public class AccountSettingWidget : Plugins.AccountSettingsWidget, Box {
- private Plugin plugin;
- private Label fingerprint;
- private Account account;
- private Button btn;
-
- public AccountSettingWidget(Plugin plugin) {
- this.plugin = plugin;
-
- fingerprint = new Label("...");
- fingerprint.xalign = 0;
- Border border = new Button().get_style_context().get_padding(StateFlags.NORMAL);
- fingerprint.margin_top = border.top + 1;
- fingerprint.margin_start = border.left + 1;
- fingerprint.visible = true;
- pack_start(fingerprint);
-
- btn = new Button();
- btn.image = new Image.from_icon_name("view-list-symbolic", IconSize.BUTTON);
- btn.relief = ReliefStyle.NONE;
- btn.visible = false;
- btn.valign = Align.CENTER;
- btn.clicked.connect(() => {
- activated();
- ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, account, account.bare_jid);
- dialog.set_transient_for((Window) get_toplevel());
- dialog.present();
- });
- pack_start(btn, false);
- }
-
- public void set_account(Account account) {
- this.account = account;
- btn.visible = false;
- Qlite.Row? row = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id).inner;
- if (row == null) {
- fingerprint.set_markup("%s\n<span font='8'>%s</span>".printf(_("Own fingerprint"), _("Will be generated on first connection")));
- } else {
- string res = fingerprint_markup(fingerprint_from_base64(((!)row)[plugin.db.identity.identity_key_public_base64]));
- fingerprint.set_markup("%s\n<span font_family='monospace' font='8'>%s</span>".printf(_("Own fingerprint"), res));
- btn.visible = true;
- }
- }
-
- public void deactivate() {
- }
-}
-
-}
diff --git a/plugins/omemo/src/ui/bad_messages_populator.vala b/plugins/omemo/src/ui/bad_messages_populator.vala
index bd2474f2..ca0bd35d 100644
--- a/plugins/omemo/src/ui/bad_messages_populator.vala
+++ b/plugins/omemo/src/ui/bad_messages_populator.vala
@@ -123,7 +123,7 @@ public class BadMessageItem : Plugins.MetaConversationItem {
this.badness_type = badness_type;
}
- public override Object? get_widget(Plugins.WidgetType widget_type) {
+ public override Object? get_widget(Plugins.ConversationItemWidgetInterface outer, Plugins.WidgetType widget_type) {
return new BadMessagesWidget(plugin, conversation, problem_jid, badness_type);
}
@@ -161,12 +161,12 @@ public class BadMessagesWidget : Box {
}
Label label = new Label(warning_text) { margin_start=70, margin_end=70, justify=Justification.CENTER, use_markup=true, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, visible=true };
label.get_style_context().add_class("dim-label");
- this.add(label);
+ this.append(label);
label.activate_link.connect(() => {
if (badness_type == BadnessType.UNTRUSTED) {
ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, conversation.account, jid);
- dialog.set_transient_for((Window) get_toplevel());
+ dialog.set_transient_for((Window) get_root());
dialog.present();
}
diff --git a/plugins/omemo/src/ui/contact_details_dialog.vala b/plugins/omemo/src/ui/contact_details_dialog.vala
index b4d6d8f0..80943824 100644
--- a/plugins/omemo/src/ui/contact_details_dialog.vala
+++ b/plugins/omemo/src/ui/contact_details_dialog.vala
@@ -37,10 +37,12 @@ public class ContactDetailsDialog : Gtk.Dialog {
[GtkChild] private unowned ListBox inactive_keys_listbox;
[GtkChild] private unowned Switch auto_accept_switch;
[GtkChild] private unowned Button copy_button;
- [GtkChild] private unowned Button show_qrcode_button;
+ [GtkChild] private unowned MenuButton show_qrcode_button;
[GtkChild] private unowned Image qrcode_image;
[GtkChild] private unowned Popover qrcode_popover;
+ private ArrayList<Widget> new_keys_listbox_children = new ArrayList<Widget>();
+
construct {
// If we set the strings in the .ui file, they don't get translated
title = _("OMEMO Key Management");
@@ -59,7 +61,7 @@ public class ContactDetailsDialog : Gtk.Dialog {
this.jid = jid;
if (Environment.get_variable("GTK_CSD") != "0") {
- ((HeaderBar) get_header_bar()).set_subtitle(jid.bare_jid.to_string());
+// ((HeaderBar) get_header_bar()).set_subtitle(jid.bare_jid.to_string());
}
keys_listbox.row_activated.connect(on_key_entry_clicked);
@@ -89,7 +91,7 @@ public class ContactDetailsDialog : Gtk.Dialog {
string fingerprint = fingerprint_from_base64(own_b64);
own_fingerprint_label.set_markup(fingerprint_markup(fingerprint));
- copy_button.clicked.connect(() => {Clipboard.get_default(get_display()).set_text(fingerprint, fingerprint.length);});
+ copy_button.clicked.connect(() => { copy_button.get_clipboard().set_text(fingerprint); });
int sid = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id)[plugin.db.identity.device_id];
var iri_query = @"omemo-sid-$(sid)=$(fingerprint)";
@@ -104,12 +106,12 @@ public class ContactDetailsDialog : Gtk.Dialog {
const int MODULE_SIZE_PX = 4; // arbitrary
var qr_pixbuf = new QRcode(iri, 2)
.to_pixbuf(MODULE_SIZE_PX * qrcode_image.scale_factor);
- qrcode_image.set_from_surface(
- Gdk.cairo_surface_create_from_pixbuf(qr_pixbuf,0,get_window()));
- qrcode_image.margin = QUIET_ZONE_MODULES*MODULE_SIZE_PX;
+ qrcode_image.set_from_pixbuf(qr_pixbuf);
+ qrcode_image.margin_top = qrcode_image.margin_end =
+ qrcode_image.margin_bottom = qrcode_image.margin_start = QUIET_ZONE_MODULES*MODULE_SIZE_PX;
qrcode_popover.get_style_context().add_class("qrcode-container");
- show_qrcode_button.clicked.connect(qrcode_popover.popup);
+ show_qrcode_button.popover = qrcode_popover;
}
new_keys_listbox.set_header_func(header_function);
@@ -196,10 +198,10 @@ public class ContactDetailsDialog : Gtk.Dialog {
if (device[plugin.db.identity_meta.now_active]) {
keys_container.visible = true;
- keys_listbox.add(fingerprint_row);
+ keys_listbox.append(fingerprint_row);
} else {
inactive_keys_expander.visible=true;
- inactive_keys_listbox.add(fingerprint_row);
+ inactive_keys_listbox.append(fingerprint_row);
}
displayed_ids.add(device[plugin.db.identity_meta.device_id]);
}
@@ -210,7 +212,7 @@ public class ContactDetailsDialog : Gtk.Dialog {
Row updated_device = plugin.db.identity_meta.get_device(fingerprint_row.row[plugin.db.identity_meta.identity_id], fingerprint_row.row[plugin.db.identity_meta.address_name], fingerprint_row.row[plugin.db.identity_meta.device_id]);
ManageKeyDialog manage_dialog = new ManageKeyDialog(updated_device, plugin.db);
- manage_dialog.set_transient_for((Gtk.Window) get_toplevel());
+ manage_dialog.set_transient_for((Gtk.Window) get_root());
manage_dialog.present();
manage_dialog.response.connect((response) => {
fingerprint_row.update_trust_state(response, fingerprint_row.row[plugin.db.identity_meta.now_active]);
@@ -257,12 +259,12 @@ public class ContactDetailsDialog : Gtk.Dialog {
Box box = new Box(Gtk.Orientation.HORIZONTAL, 40) { visible = true, margin_start = 20, margin_end = 20, margin_top = 14, margin_bottom = 14, hexpand = true };
Button accept_button = new Button() { visible = true, valign = Align.CENTER, hexpand = true };
- accept_button.add(new Image.from_icon_name("emblem-ok-symbolic", IconSize.BUTTON) { visible=true }); // using .image = sets .image-button. Together with .suggested/destructive action that breaks the button Adwaita
+ accept_button.set_icon_name("emblem-ok-symbolic"); // using .image = sets .image-button. Together with .suggested/destructive action that breaks the button Adwaita
accept_button.get_style_context().add_class("suggested-action");
accept_button.tooltip_text = _("Accept key");
Button reject_button = new Button() { visible = true, valign = Align.CENTER, hexpand = true };
- reject_button.add(new Image.from_icon_name("action-unavailable-symbolic", IconSize.BUTTON) { visible=true });
+ reject_button.set_icon_name("action-unavailable-symbolic");
reject_button.get_style_context().add_class("destructive-action");
reject_button.tooltip_text = _("Reject key");
@@ -270,35 +272,38 @@ public class ContactDetailsDialog : Gtk.Dialog {
plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.TRUSTED);
add_fingerprint(device, TrustLevel.TRUSTED);
new_keys_listbox.remove(lbr);
- if (new_keys_listbox.get_children().length() < 1) new_keys_container.visible = false;
+ new_keys_listbox_children.remove(lbr);
+ if (new_keys_listbox_children.size < 1) new_keys_container.visible = false;
});
reject_button.clicked.connect(() => {
plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.UNTRUSTED);
add_fingerprint(device, TrustLevel.UNTRUSTED);
new_keys_listbox.remove(lbr);
- if (new_keys_listbox.get_children().length() < 1) new_keys_container.visible = false;
+ new_keys_listbox_children.remove(lbr);
+ if (new_keys_listbox_children.size < 1) new_keys_container.visible = false;
});
string res = fingerprint_markup(fingerprint_from_base64(device[plugin.db.identity_meta.identity_key_public_base64]));
Label fingerprint_label = new Label(res) { use_markup=true, justify=Justification.RIGHT, visible=true, halign = Align.START, valign = Align.CENTER, hexpand = false };
- box.add(fingerprint_label);
+ box.append(fingerprint_label);
Box control_box = new Box(Gtk.Orientation.HORIZONTAL, 0) { visible = true, hexpand = true };
- control_box.add(accept_button);
- control_box.add(reject_button);
+ control_box.append(accept_button);
+ control_box.append(reject_button);
control_box.get_style_context().add_class("linked"); // .linked: Visually link the accept / reject buttons
- box.add(control_box);
+ box.append(control_box);
- lbr.add(box);
- new_keys_listbox.add(lbr);
+ lbr.set_child(box);
+ new_keys_listbox.append(lbr);
+ new_keys_listbox_children.add(lbr);
displayed_ids.add(device[plugin.db.identity_meta.device_id]);
}
}
public class FingerprintRow : ListBoxRow {
- private Image trust_image = new Image() { visible = true, halign = Align.END, icon_size = IconSize.BUTTON };
+ private Image trust_image = new Image() { visible = true, halign = Align.END };
private Label fingerprint_label = new Label("") { use_markup=true, justify=Justification.RIGHT, visible=true, halign = Align.START, valign = Align.CENTER, hexpand = false };
private Label trust_label = new Label(null) { visible = true, hexpand = true, xalign = 0 };
@@ -308,13 +313,13 @@ public class FingerprintRow : ListBoxRow {
Box box = new Box(Gtk.Orientation.HORIZONTAL, 40) { visible = true, margin_start = 20, margin_end = 20, margin_top = 14, margin_bottom = 14, hexpand = true };
Box status_box = new Box(Gtk.Orientation.HORIZONTAL, 5) { visible = true, hexpand = true };
- box.add(fingerprint_label);
- box.add(status_box);
+ box.append(fingerprint_label);
+ box.append(status_box);
- status_box.add(trust_label);
- status_box.add(trust_image);
+ status_box.append(trust_label);
+ status_box.append(trust_image);
- this.add(box);
+ this.set_child(box);
}
public FingerprintRow(Row row, string key_base64, int trust, bool now_active) {
diff --git a/plugins/omemo/src/ui/contact_details_provider.vala b/plugins/omemo/src/ui/contact_details_provider.vala
index 7250d135..822294cc 100644
--- a/plugins/omemo/src/ui/contact_details_provider.vala
+++ b/plugins/omemo/src/ui/contact_details_provider.vala
@@ -15,7 +15,7 @@ public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object {
}
public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) {
- if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK) {
+ if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK4) {
int identity_id = plugin.db.identity.get_id(conversation.account.id);
if (identity_id < 0) return;
@@ -28,11 +28,11 @@ public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object {
}
if (i > 0) {
- Button btn = new Button.from_icon_name("view-list-symbolic") { visible = true, valign = Align.CENTER, relief = ReliefStyle.NONE };
+ Button btn = new Button.from_icon_name("view-list-symbolic") { visible = true, valign = Align.CENTER, has_frame = false };
btn.clicked.connect(() => {
btn.activate();
ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, conversation.account, conversation.counterpart);
- dialog.set_transient_for((Window) btn.get_toplevel());
+ dialog.set_transient_for((Window) btn.get_root());
dialog.response.connect((response_type) => {
plugin.device_notification_populator.should_hide();
});
diff --git a/plugins/omemo/src/ui/device_notification_populator.vala b/plugins/omemo/src/ui/device_notification_populator.vala
index 2f276f2b..9f40353d 100644
--- a/plugins/omemo/src/ui/device_notification_populator.vala
+++ b/plugins/omemo/src/ui/device_notification_populator.vala
@@ -70,18 +70,18 @@ private class ConversationNotification : MetaConversationNotification {
this.account = account;
Box box = new Box(Orientation.HORIZONTAL, 5) { visible=true };
- Button manage_button = new Button() { label=_("Manage"), visible=true };
+ Button manage_button = new Button.with_label(_("Manage")) { visible=true };
manage_button.clicked.connect(() => {
manage_button.activate();
ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, account, jid);
- dialog.set_transient_for((Window) manage_button.get_toplevel());
+ dialog.set_transient_for((Window) manage_button.get_root());
dialog.response.connect((response_type) => {
should_hide();
});
dialog.present();
});
- box.add(new Label(_("This contact has new devices")) { margin_end=10, visible=true });
- box.add(manage_button);
+ box.append(new Label(_("This contact has new devices")) { margin_end=10, visible=true });
+ box.append(manage_button);
widget = box;
}
diff --git a/plugins/omemo/src/ui/encryption_list_entry.vala b/plugins/omemo/src/ui/encryption_list_entry.vala
index a0e6bb0f..b262ef81 100644
--- a/plugins/omemo/src/ui/encryption_list_entry.vala
+++ b/plugins/omemo/src/ui/encryption_list_entry.vala
@@ -22,9 +22,11 @@ public class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
return "OMEMO";
}}
- public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON2", 17, 12);
-
public Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item) {
+ return null;
+ }
+
+ public string? get_encryption_icon_name(Entities.Conversation conversation, ContentItem content_item) {
if (content_item.encryption != encryption) return null;
RowOption row = db.content_item_meta.select( { db.identity_meta.trust_level } ).with(db.content_item_meta.content_item_id, "=", content_item.id)
@@ -33,7 +35,7 @@ public class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
if (row.is_present() && (TrustLevel) row[db.identity_meta.trust_level] == TrustLevel.VERIFIED) {
- return new Image.from_icon_name("dino-security-high-symbolic", ICON_SIZE_HEADER) { opacity=0.4, visible = true };
+ return "dino-security-high-symbolic";
}
return null;
}
diff --git a/plugins/omemo/src/ui/manage_key_dialog.vala b/plugins/omemo/src/ui/manage_key_dialog.vala
index 9bdaaaee..a4b61f70 100644
--- a/plugins/omemo/src/ui/manage_key_dialog.vala
+++ b/plugins/omemo/src/ui/manage_key_dialog.vala
@@ -32,7 +32,7 @@ public class ManageKeyDialog : Gtk.Dialog {
construct {
// If we set the strings in the .ui file, they don't get translated
- headerbar.title = _("Manage Key");
+ this.title = _("Manage Key");
compare_fingerprint_label.label = _("Compare the fingerprint, character by character, with the one shown on your contact's device.");
verify_no_button.label = _("Fingerprints differ");
verify_yes_button.label = _("Fingerprints match");
@@ -56,7 +56,7 @@ public class ManageKeyDialog : Gtk.Dialog {
});
verify_yes_button.clicked.connect(() => {
- confirm_image.set_from_icon_name("security-high-symbolic", IconSize.DIALOG);
+ confirm_image.set_from_icon_name("security-high-symbolic");
confirm_title_label.label = _("Verify key");
confirm_desc_label.set_markup(_("Future messages sent by %s from the device that uses this key will be highlighted accordingly in the chat window.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
manage_stack.set_visible_child_name("confirm");
@@ -67,7 +67,7 @@ public class ManageKeyDialog : Gtk.Dialog {
verify_no_button.clicked.connect(() => {
return_to_main = false;
- confirm_image.set_from_icon_name("dialog-warning-symbolic", IconSize.DIALOG);
+ confirm_image.set_from_icon_name("dialog-warning-symbolic");
confirm_title_label.label = _("Fingerprints do not match");
confirm_desc_label.set_markup(_("Please verify that you are comparing the correct fingerprint. If fingerprints do not match, %s's account may be compromised and you should consider rejecting this key.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
manage_stack.set_visible_child_name("confirm");
@@ -107,8 +107,8 @@ public class ManageKeyDialog : Gtk.Dialog {
lbl_desc.attributes = desc_attrs;
lbl_desc.get_style_context().add_class("dim-label");
- box.add(lbl_title);
- box.add(lbl_desc);
+ box.append(lbl_title);
+ box.append(lbl_desc);
return box;
}
@@ -121,25 +121,25 @@ public class ManageKeyDialog : Gtk.Dialog {
});
ListBoxRow verify_row = new ListBoxRow() { visible = true };
- verify_row.add(make_action_box(_("Verify key fingerprint"), _("Compare this key's fingerprint with the fingerprint displayed on the contact's device.")));
+ verify_row.set_child(make_action_box(_("Verify key fingerprint"), _("Compare this key's fingerprint with the fingerprint displayed on the contact's device.")));
ListBoxRow reject_row = new ListBoxRow() { visible = true };
- reject_row.add(make_action_box(_("Reject key"), _("Block encrypted communication with the contact's device that uses this key.")));
+ reject_row.set_child(make_action_box(_("Reject key"), _("Block encrypted communication with the contact's device that uses this key.")));
ListBoxRow accept_row = new ListBoxRow() {visible = true };
- accept_row.add(make_action_box(_("Accept key"), _("Allow encrypted communication with the contact's device that uses this key.")));
+ accept_row.set_child(make_action_box(_("Accept key"), _("Allow encrypted communication with the contact's device that uses this key.")));
switch((TrustLevel) device[db.identity_meta.trust_level]) {
case TrustLevel.TRUSTED:
main_desc_label.set_markup(_("This key is currently %s.").printf("<span color='#1A63D9'>"+_("accepted")+"</span>")+" "+_("This means it can be used by %s to receive and send encrypted messages.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
- main_action_list.add(verify_row);
- main_action_list.add(reject_row);
+ main_action_list.append(verify_row);
+ main_action_list.append(reject_row);
break;
case TrustLevel.VERIFIED:
main_desc_label.set_markup(_("This key is currently %s.").printf("<span color='#1A63D9'>"+_("verified")+"</span>")+" "+_("This means it can be used by %s to receive and send encrypted messages.").printf(@"<b>$(device[db.identity_meta.address_name])</b>") + " " + _("Additionally it has been verified to match the key on the contact's device."));
- main_action_list.add(reject_row);
+ main_action_list.append(reject_row);
break;
case TrustLevel.UNTRUSTED:
main_desc_label.set_markup(_("This key is currently %s.").printf("<span color='#D91900'>"+_("rejected")+"</span>")+" "+_("This means it cannot be used by %s to decipher your messages, and you won't see messages encrypted with it.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
- main_action_list.add(accept_row);
+ main_action_list.append(accept_row);
break;
}
@@ -148,7 +148,7 @@ public class ManageKeyDialog : Gtk.Dialog {
if(row == verify_row) {
manage_stack.set_visible_child_name("verify");
} else if (row == reject_row) {
- confirm_image.set_from_icon_name("action-unavailable-symbolic", IconSize.DIALOG);
+ confirm_image.set_from_icon_name("action-unavailable-symbolic");
confirm_title_label.label = _("Reject key");
confirm_desc_label.set_markup(_("You won't see encrypted messages from the device of %s that uses this key. Conversely, that device won't be able to decipher your messages anymore.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
manage_stack.set_visible_child_name("confirm");
@@ -156,7 +156,7 @@ public class ManageKeyDialog : Gtk.Dialog {
return_to_main = true;
current_response = TrustLevel.UNTRUSTED;
} else if (row == accept_row) {
- confirm_image.set_from_icon_name("emblem-ok-symbolic", IconSize.DIALOG);
+ confirm_image.set_from_icon_name("emblem-ok-symbolic");
confirm_title_label.label = _("Accept key");
confirm_desc_label.set_markup(_("You will be able to exchange encrypted messages with the device of %s that uses this key.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
manage_stack.set_visible_child_name("confirm");
diff --git a/plugins/openpgp/CMakeLists.txt b/plugins/openpgp/CMakeLists.txt
index 769d517d..649a55ad 100644
--- a/plugins/openpgp/CMakeLists.txt
+++ b/plugins/openpgp/CMakeLists.txt
@@ -9,7 +9,7 @@ find_packages(OPENPGP_PACKAGES REQUIRED
GLib
GModule
GObject
- GTK3
+ GTK4
)
set(RESOURCE_LIST
@@ -32,7 +32,6 @@ SOURCES
src/file_transfer/file_encryptor.vala
src/account_settings_entry.vala
- src/account_settings_widget.vala
src/contact_details_provider.vala
src/database.vala
src/encryption_list_entry.vala
diff --git a/plugins/openpgp/data/account_settings_item.ui b/plugins/openpgp/data/account_settings_item.ui
index f9757c2b..56808be0 100644
--- a/plugins/openpgp/data/account_settings_item.ui
+++ b/plugins/openpgp/data/account_settings_item.ui
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="DinoPluginsOpenPgpAccountSettingsWidget">
- <property name="visible">True</property>
+ <requires lib="gtk" version="4.0"/>
+ <object class="GtkStack" id="stack">
<child>
- <object class="GtkButton" id="button">
- <property name="relief">none</property>
- <property name="sensitive">False</property>
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label">
- <property name="xalign">0</property>
- <property name="visible">True</property>
+ <object class="GtkStackPage">
+ <property name="name">label</property>
+ <property name="child">
+ <object class="GtkButton" id="button">
+ <property name="has-frame">0</property>
+ <property name="sensitive">0</property>
+ <child>
+ <object class="GtkLabel" id="label">
+ <property name="xalign">0</property>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">label</property>
- </packing>
</child>
<child>
- <object class="GtkComboBox" id="combobox">
- <property name="hexpand">True</property>
- <property name="visible">True</property>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">entry</property>
- </packing>
+ <property name="child">
+ <object class="GtkComboBox" id="combobox">
+ <property name="hexpand">1</property>
+ </object>
+ </property>
+ </object>
</child>
- </template>
+ </object>
</interface> \ No newline at end of file
diff --git a/plugins/openpgp/src/account_settings_entry.vala b/plugins/openpgp/src/account_settings_entry.vala
index 75220c30..d2e5ac23 100644
--- a/plugins/openpgp/src/account_settings_entry.vala
+++ b/plugins/openpgp/src/account_settings_entry.vala
@@ -1,27 +1,161 @@
+using Dino.Entities;
+using Gtk;
+
namespace Dino.Plugins.OpenPgp {
public class AccountSettingsEntry : Plugins.AccountSettingsEntry {
+ private Label label;
+ private Button button;
+ private ComboBox combobox;
+ private Stack stack;
+
private Plugin plugin;
+ private Account current_account;
+ private Gee.List<GPG.Key> keys = null;
+ private Gtk.ListStore list_store = new Gtk.ListStore(2, typeof(string), typeof(string?));
+
+ public override string id { get { return "pgp_key_picker"; }}
+
+ public override string name { get { return "OpenPGP"; }}
public AccountSettingsEntry(Plugin plugin) {
this.plugin = plugin;
+
+ Builder builder = new Builder.from_resource("/im/dino/Dino/openpgp/account_settings_item.ui");
+ stack = (Stack) builder.get_object("stack");
+ label = (Label) builder.get_object("label");
+ button = (Button) builder.get_object("button");
+ combobox = (ComboBox) builder.get_object("combobox");
+
+ CellRendererText renderer = new CellRendererText();
+ renderer.set_padding(0, 0);
+ combobox.pack_start(renderer, true);
+ combobox.add_attribute(renderer, "markup", 0);
+ combobox.set_model(list_store);
+
+ button.clicked.connect(on_button_clicked);
+ combobox.changed.connect(key_changed);
}
- public override string id { get {
- return "pgp_key_picker";
- }}
+ public override void deactivate() {
+ stack.set_visible_child_name("label");
+ }
- public override string name { get {
- return "OpenPGP";
- }}
+ public override void set_account(Account account) {
+ set_account_.begin(account);
+ }
- public override Plugins.AccountSettingsWidget? get_widget(WidgetType type) {
- if (type == WidgetType.GTK) {
- return new AccountSettingsWidget(plugin);
+ private async void set_account_(Account account) {
+ this.current_account = account;
+ if (keys == null) {
+ yield fetch_keys();
+ populate_list_store();
}
- return null;
+ activate_current_account();
}
-}
+ private void on_button_clicked() {
+ activated();
+ stack.set_visible_child_name("entry");
+ combobox.grab_focus();
+ combobox.popup();
+ }
+
+ private void activate_current_account() {
+ combobox.changed.disconnect(key_changed);
+ if (keys == null) {
+ label.set_markup(build_markup_string(_("Key publishing disabled"), _("Error in GnuPG")));
+ return;
+ }
+ if (keys.size == 0) {
+ label.set_markup(build_markup_string(_("Key publishing disabled"), _("No keys available. Generate one!")));
+ return;
+ }
+
+ string? account_key = plugin.db.get_account_key(current_account);
+ int activate_index = 0;
+ for (int i = 0; i < keys.size; i++) {
+ GPG.Key key = keys[i];
+ if (key.fpr == account_key) {
+ activate_index = i + 1;
+ }
+ }
+ combobox.active = activate_index;
+
+ TreeIter selected;
+ combobox.get_active_iter(out selected);
+ set_label_active(selected);
+
+ combobox.changed.connect(key_changed);
+ }
+
+ private void populate_list_store() {
+ if (keys == null || keys.size == 0) {
+ return;
+ }
+
+ list_store.clear();
+ TreeIter iter;
+ list_store.append(out iter);
+ list_store.set(iter, 0, build_markup_string(_("Key publishing disabled"), _("Select key") + "<span font_family='monospace' font='8'> \n </span>"), 1, "");
+ for (int i = 0; i < keys.size; i++) {
+ list_store.append(out iter);
+ list_store.set(iter, 0, @"$(Markup.escape_text(keys[i].uids[0].uid))\n<span font_family='monospace' font='8'>$(markup_colorize_id(keys[i].fpr, true))</span><span font='8'> </span>");
+ list_store.set(iter, 1, keys[i].fpr);
+ if (keys[i].fpr == plugin.db.get_account_key(current_account)) {
+ set_label_active(iter, i + 1);
+ }
+ }
+ button.sensitive = true;
+ }
+
+ private async void fetch_keys() {
+ label.set_markup(build_markup_string(_("Loading…"), _("Querying GnuPG")));
+
+ SourceFunc callback = fetch_keys.callback;
+ new Thread<void*> (null, () => { // Querying GnuPG might take some time
+ try {
+ keys = GPGHelper.get_keylist(null, true);
+ } catch (Error e) { }
+ Idle.add((owned)callback);
+ return null;
+ });
+ yield;
+ }
+
+ private void set_label_active(TreeIter iter, int i = -1) {
+ Value text;
+ list_store.get_value(iter, 0, out text);
+ label.set_markup((string) text);
+ if (i != -1) combobox.active = i;
+ }
+
+ private void key_changed() {
+ TreeIter selected;
+ bool iter_valid = combobox.get_active_iter(out selected);
+ if (iter_valid) {
+ Value key_value;
+ list_store.get_value(selected, 1, out key_value);
+ string? key_id = key_value as string;
+ if (key_id != null) {
+ if (plugin.modules.has_key(current_account)) {
+ plugin.modules[current_account].set_private_key_id(key_id);
+ }
+ plugin.db.set_account_key(current_account, key_id);
+ }
+ set_label_active(selected);
+ deactivate();
+ }
+ }
+
+ private string build_markup_string(string primary, string secondary) {
+ return @"$(Markup.escape_text(primary))\n<span font='8'>$secondary</span>";
+ }
+
+ public override Object? get_widget(WidgetType type) {
+ if (type != WidgetType.GTK4) return null;
+ return stack;
+ }
+}
} \ No newline at end of file
diff --git a/plugins/openpgp/src/account_settings_widget.vala b/plugins/openpgp/src/account_settings_widget.vala
deleted file mode 100644
index 7c417001..00000000
--- a/plugins/openpgp/src/account_settings_widget.vala
+++ /dev/null
@@ -1,149 +0,0 @@
-using Gee;
-using Gtk;
-
-using Dino.Entities;
-
-namespace Dino.Plugins.OpenPgp {
-
-[GtkTemplate (ui = "/im/dino/Dino/openpgp/account_settings_item.ui")]
-
-private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
- [GtkChild] private unowned Label label;
- [GtkChild] private unowned Button button;
- [GtkChild] private unowned ComboBox combobox;
-
- private Plugin plugin;
- private Account current_account;
- private Gee.List<GPG.Key> keys = null;
- private Gtk.ListStore list_store = new Gtk.ListStore(2, typeof(string), typeof(string?));
-
- public AccountSettingsWidget(Plugin plugin) {
- this.plugin = plugin;
-
- CellRendererText renderer = new CellRendererText();
- renderer.set_padding(0, 0);
- combobox.pack_start(renderer, true);
- combobox.add_attribute(renderer, "markup", 0);
- combobox.set_model(list_store);
-
- button.clicked.connect(on_button_clicked);
- combobox.changed.connect(key_changed);
- }
-
- public void deactivate() {
- set_visible_child_name("label");
- }
-
- public void set_account(Account account) {
- set_account_.begin(account);
- }
-
- private async void set_account_(Account account) {
- this.current_account = account;
- if (keys == null) {
- yield fetch_keys();
- populate_list_store();
- }
- activate_current_account();
- }
-
- private void on_button_clicked() {
- activated();
- set_visible_child_name("entry");
- combobox.grab_focus();
- combobox.popup();
- }
-
- private void activate_current_account() {
- combobox.changed.disconnect(key_changed);
- if (keys == null) {
- label.set_markup(build_markup_string(_("Key publishing disabled"), _("Error in GnuPG")));
- return;
- }
- if (keys.size == 0) {
- label.set_markup(build_markup_string(_("Key publishing disabled"), _("No keys available. Generate one!")));
- return;
- }
-
- string? account_key = plugin.db.get_account_key(current_account);
- int activate_index = 0;
- for (int i = 0; i < keys.size; i++) {
- GPG.Key key = keys[i];
- if (key.fpr == account_key) {
- activate_index = i + 1;
- }
- }
- combobox.active = activate_index;
-
- TreeIter selected;
- combobox.get_active_iter(out selected);
- set_label_active(selected);
-
- combobox.changed.connect(key_changed);
- }
-
- private void populate_list_store() {
- if (keys == null || keys.size == 0) {
- return;
- }
-
- list_store.clear();
- TreeIter iter;
- list_store.append(out iter);
- list_store.set(iter, 0, build_markup_string(_("Key publishing disabled"), _("Select key") + "<span font_family='monospace' font='8'> \n </span>"), 1, "");
- for (int i = 0; i < keys.size; i++) {
- list_store.append(out iter);
- list_store.set(iter, 0, @"$(Markup.escape_text(keys[i].uids[0].uid))\n<span font_family='monospace' font='8'>$(markup_colorize_id(keys[i].fpr, true))</span><span font='8'> </span>");
- list_store.set(iter, 1, keys[i].fpr);
- if (keys[i].fpr == plugin.db.get_account_key(current_account)) {
- set_label_active(iter, i + 1);
- }
- }
- button.sensitive = true;
- }
-
- private async void fetch_keys() {
- label.set_markup(build_markup_string(_("Loading…"), _("Querying GnuPG")));
-
- SourceFunc callback = fetch_keys.callback;
- new Thread<void*> (null, () => { // Querying GnuPG might take some time
- try {
- keys = GPGHelper.get_keylist(null, true);
- } catch (Error e) { }
- Idle.add((owned)callback);
- return null;
- });
- yield;
- }
-
- private void set_label_active(TreeIter iter, int i = -1) {
- Value text;
- list_store.get_value(iter, 0, out text);
- label.set_markup((string) text);
- if (i != -1) combobox.active = i;
- }
-
- private void key_changed() {
- TreeIter selected;
- bool iter_valid = combobox.get_active_iter(out selected);
- if (iter_valid) {
- Value key_value;
- list_store.get_value(selected, 1, out key_value);
- string? key_id = key_value as string;
- if (key_id != null) {
- if (plugin.modules.has_key(current_account)) {
- plugin.modules[current_account].set_private_key_id(key_id);
- }
- plugin.db.set_account_key(current_account, key_id);
- }
- set_label_active(selected);
- deactivate();
- }
- }
-
- private string build_markup_string(string primary, string secondary) {
- return @"$(Markup.escape_text(primary))\n<span font='8'>$secondary</span>";
- }
-}
-
-}
diff --git a/plugins/openpgp/src/contact_details_provider.vala b/plugins/openpgp/src/contact_details_provider.vala
index aa2b1c47..db085a4d 100644
--- a/plugins/openpgp/src/contact_details_provider.vala
+++ b/plugins/openpgp/src/contact_details_provider.vala
@@ -14,7 +14,7 @@ public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object {
}
public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) {
- if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK) {
+ if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK4) {
string? key_id = stream_interactor.get_module(Manager.IDENTITY).get_key_id(conversation.account, conversation.counterpart);
if (key_id != null) {
Label label = new Label("") { use_markup=true, justify=Justification.RIGHT, selectable=true, visible=true };
diff --git a/plugins/openpgp/src/encryption_list_entry.vala b/plugins/openpgp/src/encryption_list_entry.vala
index 4169a2a2..cf5da8c4 100644
--- a/plugins/openpgp/src/encryption_list_entry.vala
+++ b/plugins/openpgp/src/encryption_list_entry.vala
@@ -24,12 +24,14 @@ private class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
return "OpenPGP";
}}
- public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON3", 17, 12);
-
public Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item) {
return null;
}
+ public string? get_encryption_icon_name(Entities.Conversation conversation, ContentItem content_item) {
+ return null;
+ }
+
public void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus input_status_callback) {
try {
GPGHelper.get_public_key(db.get_account_key(conversation.account) ?? "");
diff --git a/plugins/rtp/CMakeLists.txt b/plugins/rtp/CMakeLists.txt
index c8652c54..61d53c97 100644
--- a/plugins/rtp/CMakeLists.txt
+++ b/plugins/rtp/CMakeLists.txt
@@ -7,7 +7,7 @@ find_packages(RTP_PACKAGES REQUIRED
GModule
GnuTLS
GObject
- GTK3
+ GTK4
Gst
GstApp
GstAudio
diff --git a/plugins/rtp/src/plugin.vala b/plugins/rtp/src/plugin.vala
index dc446530..aefe41ff 100644
--- a/plugins/rtp/src/plugin.vala
+++ b/plugins/rtp/src/plugin.vala
@@ -297,7 +297,7 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
public VideoCallWidget? create_widget(WidgetType type) {
init_call_pipe();
- if (type == WidgetType.GTK) {
+ if (type == WidgetType.GTK4) {
return new VideoWidget(this);
}
return null;
diff --git a/plugins/rtp/src/video_widget.vala b/plugins/rtp/src/video_widget.vala
index 82693b09..7a56f787 100644
--- a/plugins/rtp/src/video_widget.vala
+++ b/plugins/rtp/src/video_widget.vala
@@ -3,7 +3,7 @@
private static extern void gst_value_set_fraction(ref GLib.Value value, int numerator, int denominator);
#endif
-public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidget {
+public class Dino.Plugins.Rtp.VideoWidget : Gtk.Widget, Dino.Plugins.VideoCallWidget {
private const int RECAPS_AFTER_CHANGE = 5;
private static uint last_id = 0;
@@ -29,7 +29,7 @@ public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidge
this.plugin = plugin;
id = last_id++;
- sink = Gst.ElementFactory.make("gtksink", @"video_widget_$id") as Gst.Base.Sink;
+// sink = Gst.ElementFactory.make("gtksink", @"video_widget_$id") as Gst.Base.Sink;
if (sink != null) {
Gtk.Widget widget;
sink.@get("widget", out widget);
@@ -37,13 +37,13 @@ public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidge
sink.@set("sync", true);
sink.@set("ignore-alpha", false);
this.widget = widget;
- this.widget.draw.connect_after(fix_caps_issues);
- add(widget);
- widget.visible = true;
+// this.widget.draw.connect_after(fix_caps_issues);
+ this.widget.insert_after(this, null);
+ this.widget.visible = true;
} else {
warning("Could not create GTK video sink. Won't display videos.");
}
- size_allocate.connect_after(after_size_allocate);
+// size_allocate.connect_after(after_size_allocate);
}
public void input_caps_changed(GLib.Object pad, ParamSpec spec) {