messenger-gtk

Gtk+3 graphical user interfaces for GNUnet Messenger
Log | Files | Refs | Submodules | README | LICENSE

contact_info.h (3659B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2022--2025 GNUnet e.V.
      4 
      5    GNUnet is free software: you can redistribute it and/or modify it
      6    under the terms of the GNU Affero General Public License as published
      7    by the Free Software Foundation, either version 3 of the License,
      8    or (at your option) any later version.
      9 
     10    GNUnet is distributed in the hope that it will be useful, but
     11    WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13    Affero General Public License for more details.
     14 
     15    You should have received a copy of the GNU Affero General Public License
     16    along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18    SPDX-License-Identifier: AGPL3.0-or-later
     19  */
     20 /*
     21  * @author Tobias Frisch
     22  * @file ui/contact_info.h
     23  */
     24 
     25 #ifndef UI_CONTACT_INFO_H_
     26 #define UI_CONTACT_INFO_H_
     27 
     28 #include "messenger.h"
     29 
     30 #include <cairo/cairo.h>
     31 #include <gdk/gdkpixbuf.h>
     32 #include <gnunet/gnunet_chat_lib.h>
     33 #include <qrencode.h>
     34 
     35 typedef struct UI_CONTACT_INFO_Handle
     36 {
     37   MESSENGER_Application *app;
     38 
     39   struct GNUNET_CHAT_Account *account;
     40   struct GNUNET_CHAT_Contact *contact;
     41 
     42   GtkBuilder *builder;
     43   GtkDialog *dialog;
     44 
     45   GtkStack *contact_info_stack;
     46 
     47   GtkWidget *details_box;
     48   HdyAvatar *contact_avatar;
     49   GtkEntry *contact_name_entry;
     50 
     51   GtkButton *contact_edit_button;
     52   GtkImage *contact_edit_symbol;
     53 
     54   GtkFileChooserButton *profile_chooser_button;
     55   GtkButton *reveal_identity_button;
     56   GtkButton *list_attributes_button;
     57   GtkButton *share_attributes_button;
     58   GtkButton *list_tags_button;
     59   GtkStack *block_stack;
     60   GtkButton *block_button;
     61   GtkButton *unblock_button;
     62   GtkButton *open_chat_button;
     63 
     64   GtkWidget *identity_box;
     65   GtkLabel *name_label;
     66 
     67   GtkDrawingArea *id_drawing_area;
     68   gulong id_draw_signal;
     69   GtkEntry *id_entry;
     70 
     71   GtkWidget *attributes_box;
     72   GtkTreeView *attributes_tree;
     73   GtkListStore *attributes_list;
     74   GtkCellRendererText *value_renderer;
     75   GtkWidget *new_attribute_box;
     76   GtkEntry *attribute_name_entry;
     77   GtkEntry *attribute_value_entry;
     78   GtkButton *add_attribute_button;
     79 
     80   GtkWidget *sharing_box;
     81   GtkTreeView *sharing_tree;
     82   GtkListStore *sharing_list;
     83   GtkCellRendererToggle *share_renderer;
     84 
     85   GtkWidget *tags_box;
     86   GtkTreeView *tags_tree;
     87   GtkTreeSelection *tags_tree_selection;
     88   GtkListStore *tags_list;
     89   GtkWidget *new_tag_box;
     90   GtkEntry *tag_name_entry;
     91   GtkButton *add_tag_button;
     92   GtkButton *remove_tag_button;
     93 
     94   GtkStack *open_chat_stack;
     95 
     96   GtkButton *back_button;
     97   GtkButton *close_button;
     98 
     99   QRcode *qr;
    100 } UI_CONTACT_INFO_Handle;
    101 
    102 /**
    103  * Initializes a handle for the contact info dialog
    104  * of a given messenger application.
    105  *
    106  * @param app Messenger application
    107  * @param handle Contact info dialog handle
    108  */
    109 void
    110 ui_contact_info_dialog_init(MESSENGER_Application *app,
    111                             UI_CONTACT_INFO_Handle *handle);
    112 
    113 /**
    114  * Updates a given contact info dialog handle with
    115  * current data of a certain chat contact and whether
    116  * their identity should be visually revealed in the
    117  * dialog.
    118  *
    119  * @param handle Contact info dialog handle
    120  * @param contact Chat contact
    121  * @param reveal Flag to reveal QR code of identity key
    122  */
    123 void
    124 ui_contact_info_dialog_update(UI_CONTACT_INFO_Handle *handle,
    125                               struct GNUNET_CHAT_Contact *contact,
    126                               gboolean reveal);
    127 
    128 /**
    129  * Cleans up the allocated resources and resets the
    130  * state of a given contact info dialog handle.
    131  *
    132  * @param handle Contact info dialog handle
    133  */
    134 void
    135 ui_contact_info_dialog_cleanup(UI_CONTACT_INFO_Handle *handle);
    136 
    137 #endif /* UI_CONTACT_INFO_H_ */