diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-07 00:29:59 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-07 00:29:59 +0100 |
commit | 141e52eab14ae9f48844e175bc150753c8e3f002 (patch) | |
tree | 85167f6954fb962f628bcabe12bc92274eee678c /src/ui | |
parent | 53334c28a6a97e480299c6cef1e2e0402b4265ed (diff) | |
download | messenger-gtk-141e52eab14ae9f48844e175bc150753c8e3f002.tar.gz messenger-gtk-141e52eab14ae9f48844e175bc150753c8e3f002.zip |
Deactivated chats without other members
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/chat.c | 11 | ||||
-rw-r--r-- | src/ui/chat.h | 3 | ||||
-rw-r--r-- | src/ui/chat_entry.c | 6 | ||||
-rw-r--r-- | src/ui/chat_entry.h | 3 | ||||
-rw-r--r-- | src/ui/contacts.c | 45 |
5 files changed, 26 insertions, 42 deletions
diff --git a/src/ui/chat.c b/src/ui/chat.c index 42943c3..73e014c 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c | |||
@@ -272,6 +272,17 @@ ui_chat_new(MESSENGER_Application *app) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | void | 274 | void |
275 | ui_chat_activate(UI_CHAT_Handle *handle) | ||
276 | { | ||
277 | gtk_text_view_set_editable(handle->send_text_view, TRUE); | ||
278 | gtk_widget_set_sensitive(GTK_WIDGET(handle->send_text_view), TRUE); | ||
279 | |||
280 | gtk_widget_set_sensitive(GTK_WIDGET(handle->attach_file_button), TRUE); | ||
281 | gtk_widget_set_sensitive(GTK_WIDGET(handle->emoji_button), TRUE); | ||
282 | gtk_widget_set_sensitive(GTK_WIDGET(handle->send_record_button), TRUE); | ||
283 | } | ||
284 | |||
285 | void | ||
275 | ui_chat_delete(UI_CHAT_Handle *handle) | 286 | ui_chat_delete(UI_CHAT_Handle *handle) |
276 | { | 287 | { |
277 | ui_picker_delete(handle->picker); | 288 | ui_picker_delete(handle->picker); |
diff --git a/src/ui/chat.h b/src/ui/chat.h index 77e4553..68b2eb3 100644 --- a/src/ui/chat.h +++ b/src/ui/chat.h | |||
@@ -60,6 +60,9 @@ UI_CHAT_Handle* | |||
60 | ui_chat_new(MESSENGER_Application *app); | 60 | ui_chat_new(MESSENGER_Application *app); |
61 | 61 | ||
62 | void | 62 | void |
63 | ui_chat_activate(UI_CHAT_Handle *handle); | ||
64 | |||
65 | void | ||
63 | ui_chat_delete(UI_CHAT_Handle *handle); | 66 | ui_chat_delete(UI_CHAT_Handle *handle); |
64 | 67 | ||
65 | #endif /* UI_CHAT_H_ */ | 68 | #endif /* UI_CHAT_H_ */ |
diff --git a/src/ui/chat_entry.c b/src/ui/chat_entry.c index 21b793e..33d969c 100644 --- a/src/ui/chat_entry.c +++ b/src/ui/chat_entry.c | |||
@@ -62,6 +62,12 @@ ui_chat_entry_new(MESSENGER_Application *app) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | void | 64 | void |
65 | ui_chat_entry_activate(UI_CHAT_ENTRY_Handle *handle) | ||
66 | { | ||
67 | ui_chat_activate(handle->chat); | ||
68 | } | ||
69 | |||
70 | void | ||
65 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle) | 71 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle) |
66 | { | 72 | { |
67 | ui_chat_delete(handle->chat); | 73 | ui_chat_delete(handle->chat); |
diff --git a/src/ui/chat_entry.h b/src/ui/chat_entry.h index 48f3116..743429a 100644 --- a/src/ui/chat_entry.h +++ b/src/ui/chat_entry.h | |||
@@ -47,6 +47,9 @@ UI_CHAT_ENTRY_Handle* | |||
47 | ui_chat_entry_new(MESSENGER_Application *app); | 47 | ui_chat_entry_new(MESSENGER_Application *app); |
48 | 48 | ||
49 | void | 49 | void |
50 | ui_chat_entry_activate(UI_CHAT_ENTRY_Handle *handle); | ||
51 | |||
52 | void | ||
50 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); | 53 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); |
51 | 54 | ||
52 | #endif /* UI_CHAT_ENTRY_H_ */ | 55 | #endif /* UI_CHAT_ENTRY_H_ */ |
diff --git a/src/ui/contacts.c b/src/ui/contacts.c index 1a9b83b..842cfb5 100644 --- a/src/ui/contacts.c +++ b/src/ui/contacts.c | |||
@@ -71,50 +71,11 @@ handle_contacts_listbox_row_activated(UNUSED GtkListBox* listbox, | |||
71 | contact | 71 | contact |
72 | ); | 72 | ); |
73 | 73 | ||
74 | UI_MESSENGER_Handle *ui = &(app->ui.messenger); | 74 | if (!context) |
75 | |||
76 | char context_id [9]; | ||
77 | g_snprintf(context_id, sizeof(context_id), "%08lx", (gulong) context); | ||
78 | |||
79 | if (gtk_stack_get_child_by_name(ui->chats_stack, context_id)) | ||
80 | goto close_dialog; | 75 | goto close_dialog; |
81 | 76 | ||
82 | const char *title = GNUNET_CHAT_contact_get_name(contact); | 77 | if (GNUNET_SYSERR == GNUNET_CHAT_context_get_status(context)) |
83 | 78 | GNUNET_CHAT_context_request(context); | |
84 | UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app); | ||
85 | gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box); | ||
86 | GNUNET_CHAT_context_set_user_pointer(context, entry); | ||
87 | |||
88 | if (title) | ||
89 | { | ||
90 | gtk_label_set_text(entry->title_label, title); | ||
91 | hdy_avatar_set_text(entry->entry_avatar, title); | ||
92 | |||
93 | gtk_label_set_text(entry->chat->chat_title, title); | ||
94 | } | ||
95 | |||
96 | gtk_widget_set_name(entry->entry_box, context_id); | ||
97 | |||
98 | gtk_stack_add_named( | ||
99 | ui->chats_stack, | ||
100 | entry->chat->chat_box, | ||
101 | context_id | ||
102 | ); | ||
103 | |||
104 | g_hash_table_insert( | ||
105 | app->ui.bindings, | ||
106 | entry->chat->send_text_view, | ||
107 | context | ||
108 | ); | ||
109 | |||
110 | ui->chat_entries = g_list_append(ui->chat_entries, entry); | ||
111 | |||
112 | GtkListBoxRow *entry_row = GTK_LIST_BOX_ROW( | ||
113 | gtk_widget_get_parent(entry->entry_box) | ||
114 | ); | ||
115 | |||
116 | gtk_list_box_select_row(ui->chats_listbox, entry_row); | ||
117 | gtk_widget_activate(GTK_WIDGET(entry_row)); | ||
118 | 79 | ||
119 | close_dialog: | 80 | close_dialog: |
120 | gtk_window_close(GTK_WINDOW(app->ui.contacts.dialog)); | 81 | gtk_window_close(GTK_WINDOW(app->ui.contacts.dialog)); |