commit 1ef0dc0013ce7df914f7416a8936c014cbd4fb6d
parent 619371fa3bd73a0996c5336228450d54ed9f5bbb
Author: Jacki <jacki@thejackimonster.de>
Date: Wed, 3 Jan 2024 15:15:50 +0100
Show whether a message is private
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
5 files changed, 83 insertions(+), 12 deletions(-)
diff --git a/resources/ui/message-sent.ui b/resources/ui/message-sent.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2
+<!-- Generated with glade 3.40.0
Copyright (C) 2021 GNUnet e.V.
@@ -60,12 +60,37 @@ Author: Tobias Frisch
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="sender_label">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <attributes>
- <attribute name="weight" value="semibold"/>
- </attributes>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="sender_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="semibold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="private_image">
+ <property name="can-focus">False</property>
+ <property name="yalign">1</property>
+ <property name="icon-name">network-wireless-encrypted-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
<style>
diff --git a/resources/ui/message-status.ui b/resources/ui/message-status.ui
@@ -116,9 +116,11 @@ Author: Tobias Frisch
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
+ <property name="hexpand">True</property>
<property name="spacing">4</property>
<child>
<object class="HdyAvatar" id="sender_avatar">
+ <property name="visible">True</property>
<property name="can-focus">False</property>
<property name="size">24</property>
</object>
@@ -143,6 +145,18 @@ Author: Tobias Frisch
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkImage" id="private_image">
+ <property name="can-focus">False</property>
+ <property name="icon-name">network-wireless-encrypted-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
<style>
diff --git a/resources/ui/message.ui b/resources/ui/message.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2
+<!-- Generated with glade 3.40.0
Copyright (C) 2021 GNUnet e.V.
@@ -59,12 +59,37 @@ Author: Tobias Frisch
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="sender_label">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <attributes>
- <attribute name="weight" value="semibold"/>
- </attributes>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="sender_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="semibold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="private_image">
+ <property name="can-focus">False</property>
+ <property name="yalign">1</property>
+ <property name="icon-name">network-wireless-encrypted-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
<style>
diff --git a/src/ui/message.c b/src/ui/message.c
@@ -324,6 +324,10 @@ ui_message_new(MESSENGER_Application *app,
gtk_builder_get_object(handle->builder[0], "sender_label")
);
+ handle->private_image = GTK_IMAGE(
+ gtk_builder_get_object(handle->builder[0], "private_image")
+ );
+
if (UI_MESSAGE_STATUS == handle->type)
{
handle->deny_revealer = GTK_REVEALER(
@@ -678,8 +682,8 @@ file_content:
void
ui_message_update(UI_MESSAGE_Handle *handle,
- MESSENGER_Application *app,
- const struct GNUNET_CHAT_Message *msg)
+ MESSENGER_Application *app,
+ const struct GNUNET_CHAT_Message *msg)
{
struct GNUNET_CHAT_File *file = NULL;
struct GNUNET_CHAT_Invitation *invitation = NULL;
@@ -695,6 +699,8 @@ ui_message_update(UI_MESSAGE_Handle *handle,
handle->content_stack,
GTK_WIDGET(handle->whisper_box)
);
+ else if (GNUNET_YES == GNUNET_CHAT_message_is_private(msg))
+ gtk_widget_show(GTK_WIDGET(handle->private_image));
invitation = GNUNET_CHAT_message_get_invitation(msg);
file = GNUNET_CHAT_message_get_file(msg);
diff --git a/src/ui/message.h b/src/ui/message.h
@@ -53,6 +53,7 @@ typedef struct UI_MESSAGE_Handle
HdyAvatar *sender_avatar;
GtkLabel *sender_label;
+ GtkImage *private_image;
GtkRevealer *deny_revealer;
GtkRevealer *accept_revealer;