diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-10-31 00:49:51 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-10-31 00:49:51 +0200 |
commit | 8e553e0324a970fb847b827b8f47f2d7c7b4f76a (patch) | |
tree | 2fa94b6564f1e0d4cbf538a0e8d65ed854e7eecd /src | |
parent | ee55ecb8712955fc1d982b3a271c909896eb0631 (diff) | |
download | messenger-gtk-8e553e0324a970fb847b827b8f47f2d7c7b4f76a.tar.gz messenger-gtk-8e553e0324a970fb847b827b8f47f2d7c7b4f76a.zip |
Added area optimization for mobile usage
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/application.c | 14 | ||||
-rw-r--r-- | src/application.h | 2 | ||||
-rw-r--r-- | src/event.c | 8 | ||||
-rw-r--r-- | src/ui/messenger.c | 12 |
4 files changed, 27 insertions, 9 deletions
diff --git a/src/application.c b/src/application.c index e597bfb..529ba55 100644 --- a/src/application.c +++ b/src/application.c | |||
@@ -58,6 +58,16 @@ application_init(MESSENGER_Application *app, | |||
58 | app->chat.tid = 0; | 58 | app->chat.tid = 0; |
59 | app->chat.signal = MESSENGER_NONE; | 59 | app->chat.signal = MESSENGER_NONE; |
60 | 60 | ||
61 | app->ui.mobile = FALSE; | ||
62 | |||
63 | for (int i = 0; i < app->argc; i++) { | ||
64 | if (0 == strcmp("--mobile", app->argv[i])) | ||
65 | { | ||
66 | app->ui.mobile = TRUE; | ||
67 | break; | ||
68 | } | ||
69 | } | ||
70 | |||
61 | ui_messenger_init(app, &(app->ui.messenger)); | 71 | ui_messenger_init(app, &(app->ui.messenger)); |
62 | } | 72 | } |
63 | 73 | ||
@@ -102,8 +112,6 @@ typedef struct MESSENGER_ApplicationEventCall | |||
102 | static gboolean | 112 | static gboolean |
103 | _application_event_call(gpointer user_data) | 113 | _application_event_call(gpointer user_data) |
104 | { | 114 | { |
105 | //printf("_application_event_call\n"); | ||
106 | |||
107 | MESSENGER_ApplicationEventCall *call; | 115 | MESSENGER_ApplicationEventCall *call; |
108 | 116 | ||
109 | call = (MESSENGER_ApplicationEventCall*) user_data; | 117 | call = (MESSENGER_ApplicationEventCall*) user_data; |
@@ -117,8 +125,6 @@ void | |||
117 | application_call_event(MESSENGER_Application *app, | 125 | application_call_event(MESSENGER_Application *app, |
118 | MESSENGER_ApplicationEvent event) | 126 | MESSENGER_ApplicationEvent event) |
119 | { | 127 | { |
120 | //printf("application_call_event\n"); | ||
121 | |||
122 | MESSENGER_ApplicationEventCall *call; | 128 | MESSENGER_ApplicationEventCall *call; |
123 | 129 | ||
124 | call = (MESSENGER_ApplicationEventCall*) GNUNET_malloc( | 130 | call = (MESSENGER_ApplicationEventCall*) GNUNET_malloc( |
diff --git a/src/application.h b/src/application.h index 6e35bf6..1c3d638 100644 --- a/src/application.h +++ b/src/application.h | |||
@@ -55,6 +55,8 @@ typedef struct MESSENGER_Application | |||
55 | } chat; | 55 | } chat; |
56 | 56 | ||
57 | struct { | 57 | struct { |
58 | gboolean mobile; | ||
59 | |||
58 | UI_MESSENGER_Handle messenger; | 60 | UI_MESSENGER_Handle messenger; |
59 | } ui; | 61 | } ui; |
60 | } MESSENGER_Application; | 62 | } MESSENGER_Application; |
diff --git a/src/event.c b/src/event.c index de009b4..851536f 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -27,15 +27,13 @@ | |||
27 | void | 27 | void |
28 | event_update_profile(MESSENGER_Application *app) | 28 | event_update_profile(MESSENGER_Application *app) |
29 | { | 29 | { |
30 | //printf("event_update_profile\n"); | 30 | UI_MESSENGER_Handle* ui = &(app->ui.messenger); |
31 | 31 | ||
32 | const char *name = GNUNET_CHAT_get_name(app->chat.messenger.handle); | 32 | const char *name = GNUNET_CHAT_get_name(app->chat.messenger.handle); |
33 | 33 | ||
34 | //printf("A: %s\n", name); | ||
35 | |||
36 | if (name) | 34 | if (name) |
37 | { | 35 | { |
38 | hdy_avatar_set_text(app->ui.messenger.profile_avatar, name); | 36 | hdy_avatar_set_text(ui->profile_avatar, name); |
39 | gtk_label_set_text(app->ui.messenger.profile_label, name); | 37 | gtk_label_set_text(ui->profile_label, name); |
40 | } | 38 | } |
41 | } | 39 | } |
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index 5a9796f..4479b4e 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -118,6 +118,18 @@ ui_messenger_init(MESSENGER_Application *app, | |||
118 | gtk_builder_get_object(builder, "leaflet_chat") | 118 | gtk_builder_get_object(builder, "leaflet_chat") |
119 | ); | 119 | ); |
120 | 120 | ||
121 | if (app->ui.mobile) | ||
122 | { | ||
123 | g_object_bind_property( | ||
124 | handle->leaflet_chat, | ||
125 | "folded", | ||
126 | handle->title_bar, | ||
127 | "visible", | ||
128 | G_BINDING_SYNC_CREATE | | ||
129 | G_BINDING_INVERT_BOOLEAN | ||
130 | ); | ||
131 | } | ||
132 | |||
121 | hdy_leaflet_set_homogeneous(handle->leaflet_chat, FALSE, GTK_ORIENTATION_HORIZONTAL, FALSE); | 133 | hdy_leaflet_set_homogeneous(handle->leaflet_chat, FALSE, GTK_ORIENTATION_HORIZONTAL, FALSE); |
122 | 134 | ||
123 | handle->chats_listbox = GTK_LIST_BOX( | 135 | handle->chats_listbox = GTK_LIST_BOX( |