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 | |
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>
-rw-r--r-- | resources/ui/messenger.ui | 57 | ||||
-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 |
5 files changed, 48 insertions, 45 deletions
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui index d6e2b1d..1dd76c2 100644 --- a/resources/ui/messenger.ui +++ b/resources/ui/messenger.ui | |||
@@ -884,6 +884,26 @@ Author: Tobias Frisch | |||
884 | <property name="margin-bottom">8</property> | 884 | <property name="margin-bottom">8</property> |
885 | <property name="spacing">8</property> | 885 | <property name="spacing">8</property> |
886 | <child> | 886 | <child> |
887 | <object class="GtkButton" id="back_button"> | ||
888 | <property name="visible">True</property> | ||
889 | <property name="can-focus">True</property> | ||
890 | <property name="receives-default">True</property> | ||
891 | <property name="relief">none</property> | ||
892 | <child> | ||
893 | <object class="GtkImage"> | ||
894 | <property name="visible">True</property> | ||
895 | <property name="can-focus">False</property> | ||
896 | <property name="icon-name">go-previous-symbolic</property> | ||
897 | </object> | ||
898 | </child> | ||
899 | </object> | ||
900 | <packing> | ||
901 | <property name="expand">False</property> | ||
902 | <property name="fill">True</property> | ||
903 | <property name="position">0</property> | ||
904 | </packing> | ||
905 | </child> | ||
906 | <child> | ||
887 | <object class="GtkBox"> | 907 | <object class="GtkBox"> |
888 | <property name="visible">True</property> | 908 | <property name="visible">True</property> |
889 | <property name="can-focus">False</property> | 909 | <property name="can-focus">False</property> |
@@ -927,7 +947,7 @@ Author: Tobias Frisch | |||
927 | <packing> | 947 | <packing> |
928 | <property name="expand">True</property> | 948 | <property name="expand">True</property> |
929 | <property name="fill">True</property> | 949 | <property name="fill">True</property> |
930 | <property name="position">0</property> | 950 | <property name="position">1</property> |
931 | </packing> | 951 | </packing> |
932 | </child> | 952 | </child> |
933 | <child> | 953 | <child> |
@@ -951,27 +971,6 @@ Author: Tobias Frisch | |||
951 | <property name="position">1</property> | 971 | <property name="position">1</property> |
952 | </packing> | 972 | </packing> |
953 | </child> | 973 | </child> |
954 | <child> | ||
955 | <object class="GtkButton"> | ||
956 | <property name="visible">True</property> | ||
957 | <property name="can-focus">True</property> | ||
958 | <property name="receives-default">True</property> | ||
959 | <property name="relief">none</property> | ||
960 | <child> | ||
961 | <object class="GtkImage"> | ||
962 | <property name="visible">True</property> | ||
963 | <property name="can-focus">False</property> | ||
964 | <property name="icon-name">system-search-symbolic</property> | ||
965 | </object> | ||
966 | </child> | ||
967 | </object> | ||
968 | <packing> | ||
969 | <property name="expand">False</property> | ||
970 | <property name="fill">True</property> | ||
971 | <property name="pack-type">end</property> | ||
972 | <property name="position">2</property> | ||
973 | </packing> | ||
974 | </child> | ||
975 | </object> | 974 | </object> |
976 | <packing> | 975 | <packing> |
977 | <property name="expand">False</property> | 976 | <property name="expand">False</property> |
@@ -1688,20 +1687,6 @@ Author: Tobias Frisch | |||
1688 | <property name="title" translatable="yes">Messenger</property> | 1687 | <property name="title" translatable="yes">Messenger</property> |
1689 | <property name="subtitle" translatable="yes">GNUnet</property> | 1688 | <property name="subtitle" translatable="yes">GNUnet</property> |
1690 | <property name="interpolate-size">True</property> | 1689 | <property name="interpolate-size">True</property> |
1691 | <child> | ||
1692 | <object class="GtkButton" id="back_button"> | ||
1693 | <property name="visible">True</property> | ||
1694 | <property name="can-focus">True</property> | ||
1695 | <property name="receives-default">True</property> | ||
1696 | <child> | ||
1697 | <object class="GtkImage"> | ||
1698 | <property name="visible">True</property> | ||
1699 | <property name="can-focus">False</property> | ||
1700 | <property name="icon-name">go-previous-symbolic</property> | ||
1701 | </object> | ||
1702 | </child> | ||
1703 | </object> | ||
1704 | </child> | ||
1705 | </object> | 1690 | </object> |
1706 | </child> | 1691 | </child> |
1707 | </object> | 1692 | </object> |
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( |