commit 1de05a83d54cb363199c2767e56267533cc11f0d
parent 88224d5f616f4daaf28d8034765c3acd8ac87af2
Author: TheJackiMonster <thejackimonster@gmail.com>
Date: Mon, 14 Feb 2022 17:24:05 +0100
Added dialog to pick account
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat:
22 files changed, 906 insertions(+), 557 deletions(-)
diff --git a/Makefile b/Makefile
@@ -24,9 +24,9 @@ SOURCES = messenger_gtk.c\
ui/new_contact.c\
ui/new_group.c\
ui/new_platform.c\
- ui/new_profile.c\
+ ui/new_account.c\
ui/picker.c\
- ui/profile_entry.c\
+ ui/account_entry.c\
ui/send_file.c\
ui/settings.c
diff --git a/resources/ui.gresource.xml b/resources/ui.gresource.xml
@@ -15,10 +15,11 @@
<file compressed="true">ui/new_contact.ui</file>
<file compressed="true">ui/new_group.ui</file>
<file compressed="true">ui/new_platform.ui</file>
- <file compressed="true">ui/new_profile.ui</file>
+ <file compressed="true">ui/new_account.ui</file>
<file compressed="true">ui/picker.ui</file>
- <file compressed="true">ui/profile_entry.ui</file>
+ <file compressed="true">ui/account_entry.ui</file>
<file compressed="true">ui/send_file.ui</file>
<file compressed="true">ui/settings.ui</file>
+ <file compressed="true">ui/accounts.ui</file>
</gresource>
</gresources>
diff --git a/resources/ui/account_entry.ui b/resources/ui/account_entry.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2
+
+Copyright (C) 2021 GNUnet e.V.
+
+GNUnet is free software: you can redistribute it and/or modify it
+under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License,
+or (at your option) any later version.
+
+GNUnet 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
+Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SPDX-License-Identifier: AGPL3.0-or-later
+Author: Tobias Frisch
+
+-->
+<interface>
+ <requires lib="gtk+" version="3.24"/>
+ <requires lib="libhandy" version="1.2"/>
+ <object class="GtkBox" id="entry_box">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="HdyAvatar" id="entry_avatar">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="size">36</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="entry_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="wrap">True</property>
+ <property name="wrap-mode">word-char</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="account-entry"/>
+ </style>
+ </object>
+</interface>
diff --git a/resources/ui/accounts.ui b/resources/ui/accounts.ui
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface>
+ <requires lib="gtk+" version="3.24"/>
+ <object class="GtkDialog" id="accounts_dialog">
+ <property name="can-focus">False</property>
+ <property name="type-hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can-focus">False</property>
+ <property name="layout-style">end</property>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="label" translatable="yes">Close</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="shadow-type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkListBox" id="accounts_listbox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="selectable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkImage">
+ <property name="width-request">36</property>
+ <property name="height-request">36</property>
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">list-add-symbolic</property>
+ <property name="icon_size">3</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes">Add Account</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="account-entry"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui
@@ -373,7 +373,7 @@ Author: Tobias Frisch
</packing>
</child>
<style>
- <class name="profile-entry"/>
+ <class name="account-entry"/>
</style>
</object>
</child>
diff --git a/resources/ui/new_account.ui b/resources/ui/new_account.ui
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2
+
+Copyright (C) 2021 GNUnet e.V.
+
+GNUnet is free software: you can redistribute it and/or modify it
+under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License,
+or (at your option) any later version.
+
+GNUnet 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
+Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SPDX-License-Identifier: AGPL3.0-or-later
+Author: Tobias Frisch
+
+-->
+<interface>
+ <requires lib="gtk+" version="3.24"/>
+ <requires lib="libhandy" version="1.2"/>
+ <object class="GtkDialog" id="new_account_dialog">
+ <property name="can-focus">False</property>
+ <property name="modal">True</property>
+ <property name="window-position">center-on-parent</property>
+ <property name="type-hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can-focus">False</property>
+ <property name="layout-style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label" translatable="yes">Cancel</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="confirm_button">
+ <property name="label" translatable="yes">Confirm</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">center</property>
+ <property name="border-width">8</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="HdyAvatar" id="account_avatar">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">center</property>
+ <property name="margin-top">8</property>
+ <property name="margin-bottom">8</property>
+ <property name="icon-name">avatar-default-symbolic</property>
+ <property name="size">128</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes">Name:</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="account_entry">
+ <property name="width-request">250</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="account_avatar_file">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="title" translatable="yes"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/resources/ui/new_profile.ui b/resources/ui/new_profile.ui
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2
-
-Copyright (C) 2021 GNUnet e.V.
-
-GNUnet is free software: you can redistribute it and/or modify it
-under the terms of the GNU Affero General Public License as published
-by the Free Software Foundation, either version 3 of the License,
-or (at your option) any later version.
-
-GNUnet 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
-Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-SPDX-License-Identifier: AGPL3.0-or-later
-Author: Tobias Frisch
-
--->
-<interface>
- <requires lib="gtk+" version="3.24"/>
- <requires lib="libhandy" version="1.2"/>
- <object class="GtkDialog" id="new_profile_dialog">
- <property name="can-focus">False</property>
- <property name="modal">True</property>
- <property name="window-position">center-on-parent</property>
- <property name="type-hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox">
- <property name="can-focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox">
- <property name="can-focus">False</property>
- <property name="layout-style">end</property>
- <child>
- <object class="GtkButton" id="cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="confirm_button">
- <property name="label" translatable="yes">Confirm</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">center</property>
- <property name="border-width">8</property>
- <property name="orientation">vertical</property>
- <property name="spacing">4</property>
- <child>
- <object class="HdyAvatar" id="profile_avatar">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">center</property>
- <property name="margin-top">8</property>
- <property name="margin-bottom">8</property>
- <property name="icon-name">avatar-default-symbolic</property>
- <property name="size">128</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes">Name:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="profile_entry">
- <property name="width-request">250</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkFileChooserButton" id="profile_avatar_file">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="title" translatable="yes"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/resources/ui/profile_entry.ui b/resources/ui/profile_entry.ui
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2
-
-Copyright (C) 2021 GNUnet e.V.
-
-GNUnet is free software: you can redistribute it and/or modify it
-under the terms of the GNU Affero General Public License as published
-by the Free Software Foundation, either version 3 of the License,
-or (at your option) any later version.
-
-GNUnet 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
-Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-SPDX-License-Identifier: AGPL3.0-or-later
-Author: Tobias Frisch
-
--->
-<interface>
- <requires lib="gtk+" version="3.24"/>
- <requires lib="libhandy" version="1.2"/>
- <object class="GtkBox" id="entry_box">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="spacing">8</property>
- <child>
- <object class="HdyAvatar" id="entry_avatar">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="size">36</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="entry_label">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="wrap">True</property>
- <property name="wrap-mode">word-char</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="pack-type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
- <style>
- <class name="profile-entry"/>
- </style>
- </object>
-</interface>
diff --git a/src/application.h b/src/application.h
@@ -30,13 +30,14 @@
#include "chat/messenger.h"
+#include "ui/accounts.h"
#include "ui/contacts.h"
#include "ui/invite_contact.h"
#include "ui/messenger.h"
+#include "ui/new_account.h"
#include "ui/new_contact.h"
#include "ui/new_group.h"
#include "ui/new_platform.h"
-#include "ui/new_profile.h"
#include "ui/send_file.h"
#include "ui/settings.h"
@@ -82,8 +83,9 @@ typedef struct MESSENGER_Application
UI_NEW_CONTACT_Handle new_contact;
UI_NEW_GROUP_Handle new_group;
UI_NEW_PLATFORM_Handle new_platform;
- UI_NEW_PROFILE_Handle new_profile;
+ UI_NEW_ACCOUNT_Handle new_account;
+ UI_ACCOUNTS_Handle accounts;
UI_CONTACTS_Handle contacts;
UI_SETTINGS_Handle settings;
} ui;
diff --git a/src/event.c b/src/event.c
@@ -26,11 +26,11 @@
#include "contact.h"
#include "file.h"
+#include "ui/account_entry.h"
#include "ui/chat_entry.h"
#include "ui/contact_entry.h"
#include "ui/message.h"
-#include "ui/profile_entry.h"
static void
_close_notification(NotifyNotification* notification,
@@ -100,15 +100,15 @@ _iterate_accounts(void *cls,
const gchar *name = GNUNET_CHAT_account_get_name(account);
- UI_PROFILE_ENTRY_Handle *profile = ui_profile_entry_new(app);
+ UI_ACCOUNT_ENTRY_Handle *entry = ui_account_entry_new(app);
- hdy_avatar_set_text(profile->entry_avatar, name);
- gtk_label_set_text(profile->entry_label, name);
+ hdy_avatar_set_text(entry->entry_avatar, name);
+ gtk_label_set_text(entry->entry_label, name);
- gtk_list_box_prepend(ui->accounts_listbox, profile->entry_box);
+ gtk_list_box_prepend(ui->accounts_listbox, entry->entry_box);
GtkListBoxRow *row = GTK_LIST_BOX_ROW(
- gtk_widget_get_parent(profile->entry_box)
+ gtk_widget_get_parent(entry->entry_box)
);
g_hash_table_insert(ui->bindings, row, account);
@@ -117,7 +117,7 @@ _iterate_accounts(void *cls,
((app->chat.identity) && (0 == g_strcmp0(app->chat.identity, name))))
gtk_widget_activate(GTK_WIDGET(row));
- ui_profile_entry_delete(profile);
+ ui_account_entry_delete(entry);
return GNUNET_YES;
}
diff --git a/src/ui/account_entry.c b/src/ui/account_entry.c
@@ -0,0 +1,59 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2021--2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/*
+ * @author Tobias Frisch
+ * @file ui/account_entry.c
+ */
+
+#include "account_entry.h"
+
+#include "../application.h"
+
+UI_ACCOUNT_ENTRY_Handle*
+ui_account_entry_new(MESSENGER_Application *app)
+{
+ UI_ACCOUNT_ENTRY_Handle* handle = g_malloc(sizeof(UI_ACCOUNT_ENTRY_Handle));
+
+ handle->builder = gtk_builder_new_from_resource(
+ application_get_resource_path(app, "ui/account_entry.ui")
+ );
+
+ handle->entry_box = GTK_WIDGET(
+ gtk_builder_get_object(handle->builder, "entry_box")
+ );
+
+ handle->entry_avatar = HDY_AVATAR(
+ gtk_builder_get_object(handle->builder, "entry_avatar")
+ );
+
+ handle->entry_label = GTK_LABEL(
+ gtk_builder_get_object(handle->builder, "entry_label")
+ );
+
+ return handle;
+}
+
+void
+ui_account_entry_delete(UI_ACCOUNT_ENTRY_Handle *handle)
+{
+ g_object_unref(handle->builder);
+
+ g_free(handle);
+}
diff --git a/src/ui/account_entry.h b/src/ui/account_entry.h
@@ -0,0 +1,46 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2021--2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/*
+ * @author Tobias Frisch
+ * @file ui/account_entry.h
+ */
+
+#ifndef UI_ACCOUNT_ENTRY_H_
+#define UI_ACCOUNT_ENTRY_H_
+
+#include "messenger.h"
+
+typedef struct UI_ACCOUNT_ENTRY_Handle
+{
+ GtkBuilder *builder;
+
+ GtkWidget *entry_box;
+
+ HdyAvatar *entry_avatar;
+ GtkLabel *entry_label;
+} UI_ACCOUNT_ENTRY_Handle;
+
+UI_ACCOUNT_ENTRY_Handle*
+ui_account_entry_new(MESSENGER_Application *app);
+
+void
+ui_account_entry_delete(UI_ACCOUNT_ENTRY_Handle *handle);
+
+#endif /* UI_ACCOUNT_ENTRY_H_ */
diff --git a/src/ui/accounts.c b/src/ui/accounts.c
@@ -0,0 +1,190 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/*
+ * @author Tobias Frisch
+ * @file ui/accounts.c
+ */
+
+#include "accounts.h"
+
+#include "account_entry.h"
+#include "../application.h"
+
+static void
+handle_close_button_click(UNUSED GtkButton *button,
+ gpointer user_data)
+{
+ GtkDialog *dialog = GTK_DIALOG(user_data);
+ gtk_window_close(GTK_WINDOW(dialog));
+}
+
+static gboolean
+_open_new_account_dialog(gpointer user_data)
+{
+ MESSENGER_Application *app = (MESSENGER_Application*) user_data;
+
+ ui_new_account_dialog_init(app, &(app->ui.new_account));
+
+ gtk_widget_show(GTK_WIDGET(app->ui.new_account.dialog));
+ return FALSE;
+}
+
+static void
+handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox,
+ GtkListBoxRow* row,
+ gpointer user_data)
+{
+ MESSENGER_Application *app = (MESSENGER_Application*) user_data;
+
+ if (!gtk_list_box_row_get_selectable(row))
+ {
+ g_idle_add(G_SOURCE_FUNC(_open_new_account_dialog), app);
+ goto close_dialog;
+ }
+
+ struct GNUNET_CHAT_Account *account = (struct GNUNET_CHAT_Account*) (
+ g_hash_table_lookup(app->ui.bindings, row)
+ );
+
+ if (!account)
+ goto close_dialog;
+
+ // TODO
+
+close_dialog:
+ gtk_window_close(GTK_WINDOW(app->ui.accounts.dialog));
+}
+
+static void
+handle_dialog_destroy(UNUSED GtkWidget *window,
+ gpointer user_data)
+{
+ ui_accounts_dialog_cleanup((UI_ACCOUNTS_Handle*) user_data);
+}
+
+static int
+_iterate_accounts(void *cls,
+ const struct GNUNET_CHAT_Handle *handle,
+ struct GNUNET_CHAT_Account *account)
+{
+ MESSENGER_Application *app = (MESSENGER_Application*) cls;
+ UI_MESSENGER_Handle *ui = &(app->ui.messenger);
+
+ const gchar *name = GNUNET_CHAT_account_get_name(account);
+
+ UI_ACCOUNT_ENTRY_Handle *entry = ui_account_entry_new(app);
+
+ hdy_avatar_set_text(entry->entry_avatar, name);
+ gtk_label_set_text(entry->entry_label, name);
+
+ gtk_list_box_prepend(ui->accounts_listbox, entry->entry_box);
+
+ GtkListBoxRow *row = GTK_LIST_BOX_ROW(
+ gtk_widget_get_parent(entry->entry_box)
+ );
+
+ g_hash_table_insert(ui->bindings, row, account);
+
+ ui.accounts.account_entries = g_list_append(
+ ui.accounts.account_entries,
+ entry
+ );
+
+ return GNUNET_YES;
+}
+
+void
+ui_accounts_dialog_init(MESSENGER_Application *app,
+ UI_ACCOUNTS_Handle *handle)
+{
+ handle->account_entries = NULL;
+ handle->bindings = app->ui.bindings;
+
+ handle->builder = gtk_builder_new_from_resource(
+ application_get_resource_path(app, "ui/accounts.ui")
+ );
+
+ handle->dialog = GTK_DIALOG(
+ gtk_builder_get_object(handle->builder, "accounts_dialog")
+ );
+
+ gtk_window_set_title(
+ GTK_WINDOW(handle->dialog),
+ _("Contacts")
+ );
+
+ gtk_window_set_transient_for(
+ GTK_WINDOW(handle->dialog),
+ GTK_WINDOW(app->ui.messenger.main_window)
+ );
+
+ handle->accounts_listbox = GTK_LIST_BOX(
+ gtk_builder_get_object(handle->builder, "accounts_listbox")
+ );
+
+ g_signal_connect(
+ handle->accounts_listbox,
+ "row-activated",
+ G_CALLBACK(handle_accounts_listbox_row_activated),
+ app
+ );
+
+ handle->close_button = GTK_BUTTON(
+ gtk_builder_get_object(handle->builder, "close_button")
+ );
+
+ g_signal_connect(
+ handle->close_button,
+ "clicked",
+ G_CALLBACK(handle_close_button_click),
+ handle->dialog
+ );
+
+ g_signal_connect(
+ handle->dialog,
+ "destroy",
+ G_CALLBACK(handle_dialog_destroy),
+ handle
+ );
+
+ GNUNET_CHAT_iterate_accounts(
+ app->chat.messenger.handle,
+ _iterate_accounts,
+ app
+ );
+}
+
+void
+ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle)
+{
+ g_object_unref(handle->builder);
+
+ GList *list = handle->account_entries;
+
+ while (list) {
+ if (list->data)
+ ui_account_entry_delete((UI_ACCOUNT_ENTRY_Handle*) list->data);
+
+ list = list->next;
+ }
+
+ if (handle->account_entries)
+ g_list_free(handle->account_entries);
+}
diff --git a/src/ui/accounts.h b/src/ui/accounts.h
@@ -0,0 +1,50 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/*
+ * @author Tobias Frisch
+ * @file ui/accounts.h
+ */
+
+#ifndef UI_ACCOUNTS_H_
+#define UI_ACCOUNTS_H_
+
+#include "messenger.h"
+
+typedef struct UI_ACCOUNTS_Handle
+{
+ GList *account_entries;
+ GHashTable *bindings;
+
+ GtkBuilder *builder;
+ GtkDialog *dialog;
+
+ GtkListBox *accounts_listbox;
+
+ GtkButton *close_button;
+} UI_ACCOUNTS_Handle;
+
+void
+ui_accounts_dialog_init(MESSENGER_Application *app,
+ UI_ACCOUNTS_Handle *handle);
+
+void
+ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle);
+
+#endif /* UI_ACCOUNTS_H_ */
diff --git a/src/ui/chat.c b/src/ui/chat.c
@@ -30,10 +30,9 @@
#include "message.h"
#include "messenger.h"
#include "picker.h"
-#include "profile_entry.h"
-
#include "../application.h"
#include "../contact.h"
+#include "account_entry.h"
static gboolean
_flap_reveal_switch(gpointer user_data)
@@ -638,7 +637,7 @@ iterate_ui_chat_update_group_contacts(void *cls,
);
GtkListBox *listbox = closure->listbox;
- UI_PROFILE_ENTRY_Handle* entry = ui_profile_entry_new(closure->app);
+ UI_ACCOUNT_ENTRY_Handle* entry = ui_account_entry_new(closure->app);
const char *name = GNUNET_CHAT_contact_get_name(contact);
@@ -653,7 +652,7 @@ iterate_ui_chat_update_group_contacts(void *cls,
g_hash_table_insert(closure->bindings, row, contact);
- ui_profile_entry_delete(entry);
+ ui_account_entry_delete(entry);
return GNUNET_YES;
}
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
+ Copyright (C) 2021--2022 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -88,9 +88,9 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox,
{
hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
- ui_new_profile_dialog_init(app, &(app->ui.new_profile));
+ ui_new_account_dialog_init(app, &(app->ui.new_account));
- gtk_widget_show(GTK_WIDGET(app->ui.new_profile.dialog));
+ gtk_widget_show(GTK_WIDGET(app->ui.new_account.dialog));
return;
}
diff --git a/src/ui/new_account.c b/src/ui/new_account.c
@@ -0,0 +1,174 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2021--2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/*
+ * @author Tobias Frisch
+ * @file ui/new_account.c
+ */
+
+#include "new_account.h"
+
+#include "../application.h"
+
+static void
+_open_new_account(GtkEntry *entry, MESSENGER_Application *app)
+{
+ const gchar *name = gtk_entry_get_text(entry);
+
+ if (GNUNET_OK != GNUNET_CHAT_account_create(app->chat.messenger.handle, name))
+ return;
+
+ gtk_list_box_unselect_all(app->ui.messenger.accounts_listbox);
+
+ if (app->chat.identity)
+ GNUNET_free(app->chat.identity);
+
+ app->chat.identity = GNUNET_strdup(name);
+}
+
+static void
+handle_account_entry_changed(GtkEditable *editable,
+ gpointer user_data)
+{
+ HdyAvatar *avatar = HDY_AVATAR(user_data);
+ GtkEntry *entry = GTK_ENTRY(editable);
+
+ hdy_avatar_set_text(avatar, gtk_entry_get_text(entry));
+}
+
+static void
+handle_account_entry_activate(UNUSED GtkEntry *entry,
+ gpointer user_data)
+{
+ MESSENGER_Application *app = (MESSENGER_Application*) user_data;
+
+ _open_new_account(app->ui.new_account.account_entry, app);
+
+ gtk_window_close(GTK_WINDOW(app->ui.new_account.dialog));
+}
+
+static void
+handle_cancel_button_click(UNUSED GtkButton *button,
+ gpointer user_data)
+{
+ GtkDialog *dialog = GTK_DIALOG(user_data);
+ gtk_window_close(GTK_WINDOW(dialog));
+}
+
+static void
+handle_confirm_button_click(UNUSED GtkButton *button,
+ gpointer user_data)
+{
+ MESSENGER_Application *app = (MESSENGER_Application*) user_data;
+
+ _open_new_account(app->ui.new_account.account_entry, app);
+
+ gtk_window_close(GTK_WINDOW(app->ui.new_account.dialog));
+}
+
+static void
+handle_dialog_destroy(UNUSED GtkWidget *window,
+ gpointer user_data)
+{
+ ui_new_account_dialog_cleanup((UI_NEW_ACCOUNT_Handle*) user_data);
+}
+
+void
+ui_new_account_dialog_init(MESSENGER_Application *app,
+ UI_NEW_ACCOUNT_Handle *handle)
+{
+ handle->builder = gtk_builder_new_from_resource(
+ application_get_resource_path(app, "ui/new_account.ui")
+ );
+
+ handle->dialog = GTK_DIALOG(
+ gtk_builder_get_object(handle->builder, "new_account_dialog")
+ );
+
+ gtk_window_set_title(
+ GTK_WINDOW(handle->dialog),
+ _("New Profile")
+ );
+
+ gtk_window_set_transient_for(
+ GTK_WINDOW(handle->dialog),
+ GTK_WINDOW(app->ui.messenger.main_window)
+ );
+
+ handle->account_avatar = HDY_AVATAR(
+ gtk_builder_get_object(handle->builder, "account_avatar")
+ );
+
+ handle->account_avatar_file = GTK_FILE_CHOOSER_BUTTON(
+ gtk_builder_get_object(handle->builder, "account_avatar_file")
+ );
+
+ handle->account_entry = GTK_ENTRY(
+ gtk_builder_get_object(handle->builder, "account_entry")
+ );
+
+ g_signal_connect(
+ handle->account_entry,
+ "changed",
+ G_CALLBACK(handle_account_entry_changed),
+ handle->account_avatar
+ );
+
+ g_signal_connect(
+ handle->account_entry,
+ "activate",
+ G_CALLBACK(handle_account_entry_activate),
+ app
+ );
+
+ handle->cancel_button = GTK_BUTTON(
+ gtk_builder_get_object(handle->builder, "cancel_button")
+ );
+
+ g_signal_connect(
+ handle->cancel_button,
+ "clicked",
+ G_CALLBACK(handle_cancel_button_click),
+ handle->dialog
+ );
+
+ handle->confirm_button = GTK_BUTTON(
+ gtk_builder_get_object(handle->builder, "confirm_button")
+ );
+
+ g_signal_connect(
+ handle->confirm_button,
+ "clicked",
+ G_CALLBACK(handle_confirm_button_click),
+ app
+ );
+
+ g_signal_connect(
+ handle->dialog,
+ "destroy",
+ G_CALLBACK(handle_dialog_destroy),
+ handle
+ );
+}
+
+void
+ui_new_account_dialog_cleanup(UI_NEW_ACCOUNT_Handle *handle)
+{
+ g_object_unref(handle->builder);
+}
diff --git a/src/ui/new_account.h b/src/ui/new_account.h
@@ -0,0 +1,51 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2021--2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/*
+ * @author Tobias Frisch
+ * @file ui/new_account.h
+ */
+
+#ifndef UI_NEW_ACCOUNT_H_
+#define UI_NEW_ACCOUNT_H_
+
+#include "messenger.h"
+
+typedef struct UI_NEW_ACCOUNT_Handle
+{
+ GtkBuilder *builder;
+ GtkDialog *dialog;
+
+ HdyAvatar *account_avatar;
+ GtkFileChooserButton *account_avatar_file;
+
+ GtkEntry *account_entry;
+
+ GtkButton *cancel_button;
+ GtkButton *confirm_button;
+} UI_NEW_ACCOUNT_Handle;
+
+void
+ui_new_account_dialog_init(MESSENGER_Application *app,
+ UI_NEW_ACCOUNT_Handle *handle);
+
+void
+ui_new_account_dialog_cleanup(UI_NEW_ACCOUNT_Handle *handle);
+
+#endif /* UI_NEW_ACCOUNT_H_ */
diff --git a/src/ui/new_profile.c b/src/ui/new_profile.c
@@ -1,174 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2021--2022 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/*
- * @author Tobias Frisch
- * @file ui/new_profile.c
- */
-
-#include "new_profile.h"
-
-#include "../application.h"
-
-static void
-_open_new_profile(GtkEntry *entry, MESSENGER_Application *app)
-{
- const gchar *name = gtk_entry_get_text(entry);
-
- if (GNUNET_OK != GNUNET_CHAT_account_create(app->chat.messenger.handle, name))
- return;
-
- gtk_list_box_unselect_all(app->ui.messenger.accounts_listbox);
-
- if (app->chat.identity)
- GNUNET_free(app->chat.identity);
-
- app->chat.identity = GNUNET_strdup(name);
-}
-
-static void
-handle_profile_entry_changed(GtkEditable *editable,
- gpointer user_data)
-{
- HdyAvatar *avatar = HDY_AVATAR(user_data);
- GtkEntry *entry = GTK_ENTRY(editable);
-
- hdy_avatar_set_text(avatar, gtk_entry_get_text(entry));
-}
-
-static void
-handle_profile_entry_activate(UNUSED GtkEntry *entry,
- gpointer user_data)
-{
- MESSENGER_Application *app = (MESSENGER_Application*) user_data;
-
- _open_new_profile(app->ui.new_profile.profile_entry, app);
-
- gtk_window_close(GTK_WINDOW(app->ui.new_profile.dialog));
-}
-
-static void
-handle_cancel_button_click(UNUSED GtkButton *button,
- gpointer user_data)
-{
- GtkDialog *dialog = GTK_DIALOG(user_data);
- gtk_window_close(GTK_WINDOW(dialog));
-}
-
-static void
-handle_confirm_button_click(UNUSED GtkButton *button,
- gpointer user_data)
-{
- MESSENGER_Application *app = (MESSENGER_Application*) user_data;
-
- _open_new_profile(app->ui.new_profile.profile_entry, app);
-
- gtk_window_close(GTK_WINDOW(app->ui.new_profile.dialog));
-}
-
-static void
-handle_dialog_destroy(UNUSED GtkWidget *window,
- gpointer user_data)
-{
- ui_new_profile_dialog_cleanup((UI_NEW_PROFILE_Handle*) user_data);
-}
-
-void
-ui_new_profile_dialog_init(MESSENGER_Application *app,
- UI_NEW_PROFILE_Handle *handle)
-{
- handle->builder = gtk_builder_new_from_resource(
- application_get_resource_path(app, "ui/new_profile.ui")
- );
-
- handle->dialog = GTK_DIALOG(
- gtk_builder_get_object(handle->builder, "new_profile_dialog")
- );
-
- gtk_window_set_title(
- GTK_WINDOW(handle->dialog),
- _("New Profile")
- );
-
- gtk_window_set_transient_for(
- GTK_WINDOW(handle->dialog),
- GTK_WINDOW(app->ui.messenger.main_window)
- );
-
- handle->profile_avatar = HDY_AVATAR(
- gtk_builder_get_object(handle->builder, "profile_avatar")
- );
-
- handle->profile_avatar_file = GTK_FILE_CHOOSER_BUTTON(
- gtk_builder_get_object(handle->builder, "profile_avatar_file")
- );
-
- handle->profile_entry = GTK_ENTRY(
- gtk_builder_get_object(handle->builder, "profile_entry")
- );
-
- g_signal_connect(
- handle->profile_entry,
- "changed",
- G_CALLBACK(handle_profile_entry_changed),
- handle->profile_avatar
- );
-
- g_signal_connect(
- handle->profile_entry,
- "activate",
- G_CALLBACK(handle_profile_entry_activate),
- app
- );
-
- handle->cancel_button = GTK_BUTTON(
- gtk_builder_get_object(handle->builder, "cancel_button")
- );
-
- g_signal_connect(
- handle->cancel_button,
- "clicked",
- G_CALLBACK(handle_cancel_button_click),
- handle->dialog
- );
-
- handle->confirm_button = GTK_BUTTON(
- gtk_builder_get_object(handle->builder, "confirm_button")
- );
-
- g_signal_connect(
- handle->confirm_button,
- "clicked",
- G_CALLBACK(handle_confirm_button_click),
- app
- );
-
- g_signal_connect(
- handle->dialog,
- "destroy",
- G_CALLBACK(handle_dialog_destroy),
- handle
- );
-}
-
-void
-ui_new_profile_dialog_cleanup(UI_NEW_PROFILE_Handle *handle)
-{
- g_object_unref(handle->builder);
-}
diff --git a/src/ui/new_profile.h b/src/ui/new_profile.h
@@ -1,51 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/*
- * @author Tobias Frisch
- * @file ui/new_profile.h
- */
-
-#ifndef UI_NEW_PROFILE_H_
-#define UI_NEW_PROFILE_H_
-
-#include "messenger.h"
-
-typedef struct UI_NEW_PROFILE_Handle
-{
- GtkBuilder *builder;
- GtkDialog *dialog;
-
- HdyAvatar *profile_avatar;
- GtkFileChooserButton *profile_avatar_file;
-
- GtkEntry *profile_entry;
-
- GtkButton *cancel_button;
- GtkButton *confirm_button;
-} UI_NEW_PROFILE_Handle;
-
-void
-ui_new_profile_dialog_init(MESSENGER_Application *app,
- UI_NEW_PROFILE_Handle *handle);
-
-void
-ui_new_profile_dialog_cleanup(UI_NEW_PROFILE_Handle *handle);
-
-#endif /* UI_NEW_PROFILE_H_ */
diff --git a/src/ui/profile_entry.c b/src/ui/profile_entry.c
@@ -1,59 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/*
- * @author Tobias Frisch
- * @file ui/profile_entry.c
- */
-
-#include "profile_entry.h"
-
-#include "../application.h"
-
-UI_PROFILE_ENTRY_Handle*
-ui_profile_entry_new(MESSENGER_Application *app)
-{
- UI_PROFILE_ENTRY_Handle* handle = g_malloc(sizeof(UI_PROFILE_ENTRY_Handle));
-
- handle->builder = gtk_builder_new_from_resource(
- application_get_resource_path(app, "ui/profile_entry.ui")
- );
-
- handle->entry_box = GTK_WIDGET(
- gtk_builder_get_object(handle->builder, "entry_box")
- );
-
- handle->entry_avatar = HDY_AVATAR(
- gtk_builder_get_object(handle->builder, "entry_avatar")
- );
-
- handle->entry_label = GTK_LABEL(
- gtk_builder_get_object(handle->builder, "entry_label")
- );
-
- return handle;
-}
-
-void
-ui_profile_entry_delete(UI_PROFILE_ENTRY_Handle *handle)
-{
- g_object_unref(handle->builder);
-
- g_free(handle);
-}
diff --git a/src/ui/profile_entry.h b/src/ui/profile_entry.h
@@ -1,46 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/*
- * @author Tobias Frisch
- * @file ui/profile_entry.h
- */
-
-#ifndef UI_PROFILE_ENTRY_H_
-#define UI_PROFILE_ENTRY_H_
-
-#include "messenger.h"
-
-typedef struct UI_PROFILE_ENTRY_Handle
-{
- GtkBuilder *builder;
-
- GtkWidget *entry_box;
-
- HdyAvatar *entry_avatar;
- GtkLabel *entry_label;
-} UI_PROFILE_ENTRY_Handle;
-
-UI_PROFILE_ENTRY_Handle*
-ui_profile_entry_new(MESSENGER_Application *app);
-
-void
-ui_profile_entry_delete(UI_PROFILE_ENTRY_Handle *handle);
-
-#endif /* UI_PROFILE_ENTRY_H_ */