messenger-gtk

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

chat_title.h (3416B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2024 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/chat_title.h
     23  */
     24 
     25 #ifndef UI_CHAT_TITLE_H_
     26 #define UI_CHAT_TITLE_H_
     27 
     28 #include <gtk-3.0/gtk/gtk.h>
     29 #include <libhandy-1/handy.h>
     30 
     31 #include <gnunet/gnunet_chat_lib.h>
     32 
     33 typedef struct MESSENGER_Application MESSENGER_Application;
     34 typedef struct UI_CHAT_Handle UI_CHAT_Handle;
     35 typedef struct UI_FILE_LOAD_ENTRY_Handle UI_FILE_LOAD_ENTRY_Handle;
     36 
     37 typedef struct UI_CHAT_TITLE_Handle
     38 {
     39   const struct GNUNET_CHAT_Contact *contact;
     40 
     41   UI_CHAT_Handle *chat;
     42   GList *loads;
     43 
     44   GtkBuilder *builder;
     45   GtkWidget *chat_title_box;
     46 
     47   GtkButton *back_button;
     48 
     49   GtkStack *chat_title_stack;
     50   GtkWidget *title_box;
     51   GtkWidget *selection_box;
     52 
     53   HdyAvatar *chat_avatar;
     54   GtkLabel *chat_title;
     55   GtkLabel *chat_subtitle;
     56 
     57   GtkButton *chat_load_button;
     58   GtkPopover *chat_load_popover;
     59   GtkListBox *chat_load_listbox;
     60 
     61   GtkButton *chat_search_button;
     62   GtkButton *chat_details_button;
     63 
     64   GtkButton *selection_close_button;
     65   GtkLabel *selection_count_label;
     66   GtkButton *selection_tag_button;
     67   GtkButton *selection_delete_button; 
     68 } UI_CHAT_TITLE_Handle;
     69 
     70 /**
     71  * Allocates and creates a new chat title 
     72  * handle to manage a chat for a given 
     73  * messenger application.
     74  *
     75  * @param app Messenger application
     76  * @param chat Chat handle
     77  * @return New chat title handle
     78  */
     79 UI_CHAT_TITLE_Handle*
     80 ui_chat_title_new(MESSENGER_Application *app,
     81                   UI_CHAT_Handle *chat);
     82 
     83 /**
     84  * Updates a given chat title handle with 
     85  * the current state of a messenger application 
     86  * and the chat context the chat is representing.
     87  *
     88  * @param handle Chat title handle
     89  * @param app Messenger application
     90  * @param subtitle Default subtitle value
     91  */
     92 void
     93 ui_chat_title_update(UI_CHAT_TITLE_Handle *handle,
     94                      MESSENGER_Application *app,
     95                      const gchar *subtitle);
     96 
     97 /**
     98  * Frees its resources and destroys a given
     99  * chat handle.
    100  *
    101  * @param handle Chat title handle
    102  */
    103 void
    104 ui_chat_title_delete(UI_CHAT_TITLE_Handle *handle);
    105 
    106 /**
    107  * Add a file load entry handle to a given chat 
    108  * title handle to get listed by it.
    109  *
    110  * @param handle Chat title handle
    111  * @param file_load File load entry handle
    112  */
    113 void
    114 ui_chat_title_add_file_load(UI_CHAT_TITLE_Handle *handle,
    115                             UI_FILE_LOAD_ENTRY_Handle *file_load);
    116 
    117 /**
    118  * Removes a file load entry handle from a given
    119  * chat title handle to remove it from its list.
    120  *
    121  * @param handle Chat title handle
    122  * @param file_load File load entry handle
    123  */
    124 void
    125 ui_chat_title_remove_file_load(UI_CHAT_TITLE_Handle *handle,
    126                                UI_FILE_LOAD_ENTRY_Handle *file_load);
    127 
    128 #endif /* UI_CHAT_H_ */