diff options
Diffstat (limited to 'src/ui/messenger.c')
-rw-r--r-- | src/ui/messenger.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index 26b1993..058fcbf 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -57,24 +57,33 @@ handle_flap_via_button_click(UNUSED GtkButton* button, | |||
57 | } | 57 | } |
58 | 58 | ||
59 | static void | 59 | static void |
60 | _switch_details_revealer_visibility(UI_MESSENGER_Handle *handle, | ||
61 | gboolean state) | ||
62 | { | ||
63 | GtkRevealer *revealer = handle->account_details_revealer; | ||
64 | GtkImage *symbol = handle->account_details_symbol; | ||
65 | |||
66 | gtk_revealer_set_reveal_child(revealer, state); | ||
67 | gtk_image_set_from_icon_name( | ||
68 | symbol, | ||
69 | state? | ||
70 | "go-up-symbolic" : | ||
71 | "go-down-symbolic", | ||
72 | GTK_ICON_SIZE_BUTTON | ||
73 | ); | ||
74 | } | ||
75 | |||
76 | static void | ||
60 | handle_account_details_button_click(UNUSED GtkButton* button, | 77 | handle_account_details_button_click(UNUSED GtkButton* button, |
61 | gpointer user_data) | 78 | gpointer user_data) |
62 | { | 79 | { |
63 | UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; | 80 | UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; |
64 | 81 | ||
65 | GtkRevealer *revealer = handle->account_details_revealer; | 82 | GtkRevealer *revealer = handle->account_details_revealer; |
66 | GtkImage *symbol = handle->account_details_symbol; | ||
67 | 83 | ||
68 | gboolean old_state = gtk_revealer_get_reveal_child(revealer); | 84 | gboolean old_state = gtk_revealer_get_reveal_child(revealer); |
69 | 85 | ||
70 | gtk_revealer_set_reveal_child(revealer, !old_state); | 86 | _switch_details_revealer_visibility(handle, !old_state); |
71 | gtk_image_set_from_icon_name( | ||
72 | symbol, | ||
73 | old_state? | ||
74 | "go-down-symbolic" : | ||
75 | "go-up-symbolic", | ||
76 | GTK_ICON_SIZE_BUTTON | ||
77 | ); | ||
78 | } | 87 | } |
79 | 88 | ||
80 | static void | 89 | static void |
@@ -86,6 +95,7 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox, | |||
86 | 95 | ||
87 | if (row == app->ui.messenger.add_account_listbox_row) | 96 | if (row == app->ui.messenger.add_account_listbox_row) |
88 | { | 97 | { |
98 | _switch_details_revealer_visibility(&(app->ui.messenger), FALSE); | ||
89 | hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); | 99 | hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); |
90 | 100 | ||
91 | ui_new_account_dialog_init(app, &(app->ui.new_account)); | 101 | ui_new_account_dialog_init(app, &(app->ui.new_account)); |
@@ -101,6 +111,7 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox, | |||
101 | if (!account) | 111 | if (!account) |
102 | return; | 112 | return; |
103 | 113 | ||
114 | _switch_details_revealer_visibility(&(app->ui.messenger), FALSE); | ||
104 | hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); | 115 | hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); |
105 | 116 | ||
106 | GNUNET_CHAT_connect(app->chat.messenger.handle, account); | 117 | GNUNET_CHAT_connect(app->chat.messenger.handle, account); |
@@ -206,8 +217,6 @@ handle_chats_listbox_filter_func(GtkListBoxRow *row, | |||
206 | { | 217 | { |
207 | UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; | 218 | UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; |
208 | 219 | ||
209 | printf("-- %lu\n", (uint64_t) row); | ||
210 | |||
211 | if ((!gtk_list_box_row_get_selectable(row)) || | 220 | if ((!gtk_list_box_row_get_selectable(row)) || |
212 | (gtk_list_box_row_is_selected(row))) | 221 | (gtk_list_box_row_is_selected(row))) |
213 | return TRUE; | 222 | return TRUE; |
@@ -469,6 +478,10 @@ ui_messenger_init(MESSENGER_Application *app, | |||
469 | gtk_builder_get_object(handle->builder, "chats_stack") | 478 | gtk_builder_get_object(handle->builder, "chats_stack") |
470 | ); | 479 | ); |
471 | 480 | ||
481 | handle->no_chat_box = GTK_WIDGET( | ||
482 | gtk_builder_get_object(handle->builder, "no_chat_box") | ||
483 | ); | ||
484 | |||
472 | g_signal_connect( | 485 | g_signal_connect( |
473 | handle->main_window, | 486 | handle->main_window, |
474 | "destroy", | 487 | "destroy", |