messenger-gtk

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

commit 993e76af5614faecfeef2865b4e12c503f96819e
parent 673f8487f949bc5992592cea6762e6cc8366b0e9
Author: Jacki <jacki@thejackimonster.de>
Date:   Sat, 23 Mar 2024 03:12:08 +0100

Unselect messages after tagging

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Msrc/ui/chat.c | 14++++++++++----
Msrc/ui/new_tag.c | 8++++++--
Msrc/ui/new_tag.h | 8++++++--
3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/ui/chat.c b/src/ui/chat.c @@ -452,17 +452,19 @@ handle_chat_selection_close_button_click(UNUSED GtkButton *button, void _new_tag_callback(MESSENGER_Application *app, GList *selected, - const char *tag) + const char *tag, + gpointer user_data) { - g_assert(app); + g_assert((app) && (user_data)); + GtkListBox *listbox = GTK_LIST_BOX(user_data); GtkTextView *text_view = GTK_TEXT_VIEW(g_object_get_qdata( G_OBJECT(app->ui.new_tag.dialog), app->quarks.widget )); if (!text_view) - return; + goto unselect; struct GNUNET_CHAT_Context *context = (struct GNUNET_CHAT_Context*) ( g_object_get_qdata( @@ -506,6 +508,9 @@ cleanup: app->quarks.widget, NULL ); + +unselect: + gtk_list_box_unselect_all(listbox); } static void @@ -531,7 +536,8 @@ handle_chat_selection_tag_button_click(UNUSED GtkButton *button, ui_new_tag_dialog_link( &(app->ui.new_tag), _new_tag_callback, - selected + selected, + handle->messages_listbox ); gtk_widget_show(GTK_WIDGET(app->ui.new_tag.dialog)); diff --git a/src/ui/new_tag.c b/src/ui/new_tag.c @@ -41,7 +41,8 @@ _add_new_tag(MESSENGER_Application *app, handle->callback( app, handle->selected, - tag + tag, + handle->user_data ); if (tag) @@ -118,6 +119,7 @@ ui_new_tag_dialog_init(MESSENGER_Application *app, g_assert((app) && (handle)); handle->selected = NULL; + handle->user_data = NULL; handle->callback = NULL; handle->builder = gtk_builder_new_from_resource( @@ -188,11 +190,13 @@ ui_new_tag_dialog_init(MESSENGER_Application *app, void ui_new_tag_dialog_link(UI_NEW_TAG_Handle *handle, UI_NEW_TAG_Callback callback, - GList *selected) + GList *selected, + gpointer user_data) { g_assert((handle) && (callback)); handle->selected = selected; + handle->user_data = user_data; handle->callback = callback; } diff --git a/src/ui/new_tag.h b/src/ui/new_tag.h @@ -31,12 +31,14 @@ typedef void (*UI_NEW_TAG_Callback) ( MESSENGER_Application *app, GList *selected, - const char *tag + const char *tag, + gpointer user_data ); typedef struct UI_NEW_TAG_Handle { GList *selected; + gpointer user_data; UI_NEW_TAG_Callback callback; @@ -69,11 +71,13 @@ ui_new_tag_dialog_init(MESSENGER_Application *app, * @param handle New tag dialog handle * @param callback New tag callback * @param selected Selected messages + * @param user_data User data */ void ui_new_tag_dialog_link(UI_NEW_TAG_Handle *handle, UI_NEW_TAG_Callback callback, - GList *selected); + GList *selected, + gpointer user_data); /** * Cleans up the allocated resources and resets the