aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-10-31 19:32:35 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2021-10-31 19:32:35 +0100
commit0def5106c1e92a2d43b9bdc755ba860ccc2f84f1 (patch)
tree3a258fe6863832f928c9c3f308118566f9ce16c1
parentb40c9fa60fd15152750c4361e3ed35be5f7ff9f0 (diff)
downloadmessenger-gtk-0def5106c1e92a2d43b9bdc755ba860ccc2f84f1.tar.gz
messenger-gtk-0def5106c1e92a2d43b9bdc755ba860ccc2f84f1.zip
Hooked up all important ui widgets from builder
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--resources/ui/messenger.ui101
-rw-r--r--src/application.c2
-rw-r--r--src/ui/messenger.c143
-rw-r--r--src/ui/messenger.h3
4 files changed, 116 insertions, 133 deletions
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui
index 1dd76c2..79b1186 100644
--- a/resources/ui/messenger.ui
+++ b/resources/ui/messenger.ui
@@ -397,7 +397,7 @@ Author: Tobias Frisch
397 <property name="can-focus">False</property> 397 <property name="can-focus">False</property>
398 <child> 398 <child>
399 <object class="GtkScrolledWindow"> 399 <object class="GtkScrolledWindow">
400 <property name="height-request">300</property> 400 <property name="height-request">250</property>
401 <property name="visible">True</property> 401 <property name="visible">True</property>
402 <property name="can-focus">True</property> 402 <property name="can-focus">True</property>
403 <child> 403 <child>
@@ -405,7 +405,7 @@ Author: Tobias Frisch
405 <property name="visible">True</property> 405 <property name="visible">True</property>
406 <property name="can-focus">False</property> 406 <property name="can-focus">False</property>
407 <child> 407 <child>
408 <object class="GtkListBox"> 408 <object class="GtkListBox" id="accounts_listbox">
409 <property name="visible">True</property> 409 <property name="visible">True</property>
410 <property name="can-focus">False</property> 410 <property name="can-focus">False</property>
411 <property name="selection-mode">none</property> 411 <property name="selection-mode">none</property>
@@ -472,7 +472,7 @@ Author: Tobias Frisch
472 <property name="can-focus">False</property> 472 <property name="can-focus">False</property>
473 <property name="orientation">vertical</property> 473 <property name="orientation">vertical</property>
474 <child> 474 <child>
475 <object class="GtkButton" id="new_group_button"> 475 <object class="GtkButton" id="new_contact_button">
476 <property name="visible">True</property> 476 <property name="visible">True</property>
477 <property name="can-focus">True</property> 477 <property name="can-focus">True</property>
478 <property name="receives-default">True</property> 478 <property name="receives-default">True</property>
@@ -491,7 +491,7 @@ Author: Tobias Frisch
491 <object class="GtkImage"> 491 <object class="GtkImage">
492 <property name="visible">True</property> 492 <property name="visible">True</property>
493 <property name="can-focus">False</property> 493 <property name="can-focus">False</property>
494 <property name="icon-name">system-users-symbolic</property> 494 <property name="icon-name">contact-new-symbolic</property>
495 <property name="icon_size">3</property> 495 <property name="icon_size">3</property>
496 </object> 496 </object>
497 <packing> 497 <packing>
@@ -501,61 +501,10 @@ Author: Tobias Frisch
501 </packing> 501 </packing>
502 </child> 502 </child>
503 <child> 503 <child>
504 <object class="GtkLabel" id="new-group-label"> 504 <object class="GtkLabel" id="new-contact-label">
505 <property name="visible">True</property> 505 <property name="visible">True</property>
506 <property name="can-focus">False</property> 506 <property name="can-focus">False</property>
507 <property name="label" translatable="yes">New Group</property> 507 <property name="label" translatable="yes">New Contact</property>
508 <property name="xalign">0</property>
509 </object>
510 <packing>
511 <property name="expand">False</property>
512 <property name="fill">True</property>
513 <property name="position">1</property>
514 </packing>
515 </child>
516 </object>
517 </child>
518 </object>
519 <packing>
520 <property name="expand">False</property>
521 <property name="fill">True</property>
522 <property name="position">0</property>
523 </packing>
524 </child>
525 <child>
526 <object class="GtkButton" id="new_platform_button">
527 <property name="visible">True</property>
528 <property name="can-focus">True</property>
529 <property name="receives-default">True</property>
530 <property name="relief">none</property>
531 <property name="always-show-image">True</property>
532 <child>
533 <object class="GtkBox">
534 <property name="visible">True</property>
535 <property name="can-focus">False</property>
536 <property name="margin-start">4</property>
537 <property name="margin-end">4</property>
538 <property name="margin-top">4</property>
539 <property name="margin-bottom">4</property>
540 <property name="spacing">16</property>
541 <child>
542 <object class="GtkImage">
543 <property name="visible">True</property>
544 <property name="can-focus">False</property>
545 <property name="icon-name">network-wired-symbolic</property>
546 <property name="icon_size">3</property>
547 </object>
548 <packing>
549 <property name="expand">False</property>
550 <property name="fill">True</property>
551 <property name="position">0</property>
552 </packing>
553 </child>
554 <child>
555 <object class="GtkLabel" id="new-platform-label">
556 <property name="visible">True</property>
557 <property name="can-focus">False</property>
558 <property name="label" translatable="yes">New Platform</property>
559 <property name="xalign">0</property> 508 <property name="xalign">0</property>
560 </object> 509 </object>
561 <packing> 510 <packing>
@@ -574,7 +523,7 @@ Author: Tobias Frisch
574 </packing> 523 </packing>
575 </child> 524 </child>
576 <child> 525 <child>
577 <object class="GtkButton" id="contacts_button"> 526 <object class="GtkButton" id="new_group_button">
578 <property name="visible">True</property> 527 <property name="visible">True</property>
579 <property name="can-focus">True</property> 528 <property name="can-focus">True</property>
580 <property name="receives-default">True</property> 529 <property name="receives-default">True</property>
@@ -593,7 +542,7 @@ Author: Tobias Frisch
593 <object class="GtkImage"> 542 <object class="GtkImage">
594 <property name="visible">True</property> 543 <property name="visible">True</property>
595 <property name="can-focus">False</property> 544 <property name="can-focus">False</property>
596 <property name="icon-name">avatar-default-symbolic</property> 545 <property name="icon-name">system-users-symbolic</property>
597 <property name="icon_size">3</property> 546 <property name="icon_size">3</property>
598 </object> 547 </object>
599 <packing> 548 <packing>
@@ -603,10 +552,10 @@ Author: Tobias Frisch
603 </packing> 552 </packing>
604 </child> 553 </child>
605 <child> 554 <child>
606 <object class="GtkLabel" id="contacts-label"> 555 <object class="GtkLabel" id="new-group-label">
607 <property name="visible">True</property> 556 <property name="visible">True</property>
608 <property name="can-focus">False</property> 557 <property name="can-focus">False</property>
609 <property name="label" translatable="yes">Contacts</property> 558 <property name="label" translatable="yes">New Group</property>
610 <property name="xalign">0</property> 559 <property name="xalign">0</property>
611 </object> 560 </object>
612 <packing> 561 <packing>
@@ -625,7 +574,7 @@ Author: Tobias Frisch
625 </packing> 574 </packing>
626 </child> 575 </child>
627 <child> 576 <child>
628 <object class="GtkButton" id="calls_button"> 577 <object class="GtkButton" id="new_platform_button">
629 <property name="visible">True</property> 578 <property name="visible">True</property>
630 <property name="can-focus">True</property> 579 <property name="can-focus">True</property>
631 <property name="receives-default">True</property> 580 <property name="receives-default">True</property>
@@ -644,7 +593,7 @@ Author: Tobias Frisch
644 <object class="GtkImage"> 593 <object class="GtkImage">
645 <property name="visible">True</property> 594 <property name="visible">True</property>
646 <property name="can-focus">False</property> 595 <property name="can-focus">False</property>
647 <property name="icon-name">call-start-symbolic</property> 596 <property name="icon-name">network-wired-symbolic</property>
648 <property name="icon_size">3</property> 597 <property name="icon_size">3</property>
649 </object> 598 </object>
650 <packing> 599 <packing>
@@ -654,10 +603,10 @@ Author: Tobias Frisch
654 </packing> 603 </packing>
655 </child> 604 </child>
656 <child> 605 <child>
657 <object class="GtkLabel" id="calls-label"> 606 <object class="GtkLabel" id="new-platform-label">
658 <property name="visible">True</property> 607 <property name="visible">True</property>
659 <property name="can-focus">False</property> 608 <property name="can-focus">False</property>
660 <property name="label" translatable="yes">Calls</property> 609 <property name="label" translatable="yes">New Platform</property>
661 <property name="xalign">0</property> 610 <property name="xalign">0</property>
662 </object> 611 </object>
663 <packing> 612 <packing>
@@ -676,7 +625,7 @@ Author: Tobias Frisch
676 </packing> 625 </packing>
677 </child> 626 </child>
678 <child> 627 <child>
679 <object class="GtkButton" id="settings_button"> 628 <object class="GtkButton" id="contacts_button">
680 <property name="visible">True</property> 629 <property name="visible">True</property>
681 <property name="can-focus">True</property> 630 <property name="can-focus">True</property>
682 <property name="receives-default">True</property> 631 <property name="receives-default">True</property>
@@ -695,7 +644,7 @@ Author: Tobias Frisch
695 <object class="GtkImage"> 644 <object class="GtkImage">
696 <property name="visible">True</property> 645 <property name="visible">True</property>
697 <property name="can-focus">False</property> 646 <property name="can-focus">False</property>
698 <property name="icon-name">emblem-system-symbolic</property> 647 <property name="icon-name">avatar-default-symbolic</property>
699 <property name="icon_size">3</property> 648 <property name="icon_size">3</property>
700 </object> 649 </object>
701 <packing> 650 <packing>
@@ -705,10 +654,10 @@ Author: Tobias Frisch
705 </packing> 654 </packing>
706 </child> 655 </child>
707 <child> 656 <child>
708 <object class="GtkLabel" id="settings-label"> 657 <object class="GtkLabel" id="contacts-label">
709 <property name="visible">True</property> 658 <property name="visible">True</property>
710 <property name="can-focus">False</property> 659 <property name="can-focus">False</property>
711 <property name="label" translatable="yes">Settings</property> 660 <property name="label" translatable="yes">Contacts</property>
712 <property name="xalign">0</property> 661 <property name="xalign">0</property>
713 </object> 662 </object>
714 <packing> 663 <packing>
@@ -727,7 +676,7 @@ Author: Tobias Frisch
727 </packing> 676 </packing>
728 </child> 677 </child>
729 <child> 678 <child>
730 <object class="GtkButton" id="night_mode_button"> 679 <object class="GtkButton" id="settings_button">
731 <property name="visible">True</property> 680 <property name="visible">True</property>
732 <property name="can-focus">True</property> 681 <property name="can-focus">True</property>
733 <property name="receives-default">True</property> 682 <property name="receives-default">True</property>
@@ -746,7 +695,7 @@ Author: Tobias Frisch
746 <object class="GtkImage"> 695 <object class="GtkImage">
747 <property name="visible">True</property> 696 <property name="visible">True</property>
748 <property name="can-focus">False</property> 697 <property name="can-focus">False</property>
749 <property name="icon-name">weather-clear-night-symbolic</property> 698 <property name="icon-name">emblem-system-symbolic</property>
750 <property name="icon_size">3</property> 699 <property name="icon_size">3</property>
751 </object> 700 </object>
752 <packing> 701 <packing>
@@ -756,10 +705,10 @@ Author: Tobias Frisch
756 </packing> 705 </packing>
757 </child> 706 </child>
758 <child> 707 <child>
759 <object class="GtkLabel" id="night-mode-label"> 708 <object class="GtkLabel" id="settings-label">
760 <property name="visible">True</property> 709 <property name="visible">True</property>
761 <property name="can-focus">False</property> 710 <property name="can-focus">False</property>
762 <property name="label" translatable="yes">Night Mode</property> 711 <property name="label" translatable="yes">Settings</property>
763 <property name="xalign">0</property> 712 <property name="xalign">0</property>
764 </object> 713 </object>
765 <packing> 714 <packing>
@@ -774,7 +723,7 @@ Author: Tobias Frisch
774 <packing> 723 <packing>
775 <property name="expand">False</property> 724 <property name="expand">False</property>
776 <property name="fill">True</property> 725 <property name="fill">True</property>
777 <property name="position">5</property> 726 <property name="position">6</property>
778 </packing> 727 </packing>
779 </child> 728 </child>
780 </object> 729 </object>
@@ -1686,18 +1635,18 @@ Author: Tobias Frisch
1686 <property name="can-focus">False</property> 1635 <property name="can-focus">False</property>
1687 <property name="title" translatable="yes">Messenger</property> 1636 <property name="title" translatable="yes">Messenger</property>
1688 <property name="subtitle" translatable="yes">GNUnet</property> 1637 <property name="subtitle" translatable="yes">GNUnet</property>
1638 <property name="show-close-button">True</property>
1689 <property name="interpolate-size">True</property> 1639 <property name="interpolate-size">True</property>
1690 </object> 1640 </object>
1691 </child> 1641 </child>
1692 </object> 1642 </object>
1693 <object class="GtkSizeGroup"> 1643 <object class="GtkSizeGroup">
1694 <widgets> 1644 <widgets>
1645 <widget name="new-contact-label"/>
1695 <widget name="new-group-label"/> 1646 <widget name="new-group-label"/>
1696 <widget name="new-platform-label"/> 1647 <widget name="new-platform-label"/>
1697 <widget name="contacts-label"/> 1648 <widget name="contacts-label"/>
1698 <widget name="calls-label"/>
1699 <widget name="settings-label"/> 1649 <widget name="settings-label"/>
1700 <widget name="night-mode-label"/>
1701 </widgets> 1650 </widgets>
1702 </object> 1651 </object>
1703 <object class="GtkSizeGroup"> 1652 <object class="GtkSizeGroup">
diff --git a/src/application.c b/src/application.c
index 4c69951..2bf9e09 100644
--- a/src/application.c
+++ b/src/application.c
@@ -56,6 +56,8 @@ application_init(MESSENGER_Application *app,
56 int argc, 56 int argc,
57 char **argv) 57 char **argv)
58{ 58{
59 memset(app, 0, sizeof(*app));
60
59 app->argc = argc; 61 app->argc = argc;
60 app->argv = argv; 62 app->argv = argv;
61 63
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
index 4bf3164..37827d8 100644
--- a/src/ui/messenger.c
+++ b/src/ui/messenger.c
@@ -103,71 +103,85 @@ ui_messenger_init(MESSENGER_Application *app,
103 GTK_WINDOW(handle->main_window) 103 GTK_WINDOW(handle->main_window)
104 ); 104 );
105 105
106 handle->profile_avatar = HDY_AVATAR( 106 gtk_window_set_default_size(
107 gtk_builder_get_object(builder, "profile_avatar") 107 GTK_WINDOW(handle->main_window),
108 1100, 700
108 ); 109 );
109 110
110 handle->profile_label = GTK_LABEL( 111 handle->leaflet_chat = HDY_LEAFLET(
111 gtk_builder_get_object(builder, "profile_label") 112 gtk_builder_get_object(builder, "leaflet_chat")
113 );
114
115 handle->flap_user_details = HDY_FLAP(
116 gtk_builder_get_object(builder, "flap_user_details")
117 );
118
119 handle->flap_chat_details = HDY_FLAP(
120 gtk_builder_get_object(builder, "flap_chat_details")
112 ); 121 );
113 122
114 handle->title_bar = HDY_HEADER_BAR( 123 handle->title_bar = HDY_HEADER_BAR(
115 gtk_builder_get_object(builder, "title_bar") 124 gtk_builder_get_object(builder, "title_bar")
116 ); 125 );
117 126
118 handle->leaflet_chat = HDY_LEAFLET( 127 g_object_bind_property(
119 gtk_builder_get_object(builder, "leaflet_chat") 128 handle->leaflet_chat,
129 "folded",
130 handle->title_bar,
131 "show-close-button",
132 G_BINDING_INVERT_BOOLEAN
120 ); 133 );
121 134
122 if (app->ui.mobile) 135 if (app->ui.mobile)
123 {
124 g_object_bind_property( 136 g_object_bind_property(
125 handle->leaflet_chat, 137 handle->leaflet_chat,
126 "folded", 138 "folded",
127 handle->title_bar, 139 handle->title_bar,
128 "visible", 140 "visible",
129 G_BINDING_SYNC_CREATE | 141 G_BINDING_SYNC_CREATE |
130 G_BINDING_INVERT_BOOLEAN 142 G_BINDING_INVERT_BOOLEAN
131 ); 143 );
132 }
133 144
134 hdy_leaflet_set_homogeneous(handle->leaflet_chat, FALSE, GTK_ORIENTATION_HORIZONTAL, FALSE); 145 handle->back_button = GTK_BUTTON(
146 gtk_builder_get_object(builder, "back_button")
147 );
135 148
136 handle->chats_listbox = GTK_LIST_BOX( 149 g_object_bind_property(
137 gtk_builder_get_object(builder, "chats_listbox") 150 handle->leaflet_chat,
151 "folded",
152 handle->back_button,
153 "visible",
154 G_BINDING_SYNC_CREATE
138 ); 155 );
139 156
140 g_signal_connect( 157 g_signal_connect(
141 handle->chats_listbox, 158 handle->back_button,
142 "row-activated", 159 "clicked",
143 G_CALLBACK(handle_chats_listbox_row_activated), 160 G_CALLBACK(handle_back_button_click),
144 handle->leaflet_chat 161 handle->leaflet_chat
145 ); 162 );
146 163
147 handle->user_details_button = GTK_BUTTON( 164 handle->profile_avatar = HDY_AVATAR(
148 gtk_builder_get_object(builder, "user_details_button") 165 gtk_builder_get_object(builder, "profile_avatar")
149 ); 166 );
150 167
151 handle->hide_user_details_button = GTK_BUTTON( 168 handle->profile_label = GTK_LABEL(
152 gtk_builder_get_object(builder, "hide_user_details_button") 169 gtk_builder_get_object(builder, "profile_label")
153 ); 170 );
154 171
155 handle->flap_user_details = HDY_FLAP( 172 handle->hide_user_details_button = GTK_BUTTON(
156 gtk_builder_get_object(builder, "flap_user_details") 173 gtk_builder_get_object(builder, "hide_user_details_button")
157 ); 174 );
158 175
159 g_signal_connect( 176 g_signal_connect(
160 handle->user_details_button, 177 handle->hide_user_details_button,
161 "clicked", 178 "clicked",
162 G_CALLBACK(handle_flap_via_button_click), 179 G_CALLBACK(handle_flap_via_button_click),
163 handle->flap_user_details 180 handle->flap_user_details
164 ); 181 );
165 182
166 g_signal_connect( 183 handle->favourites_button = GTK_BUTTON(
167 handle->hide_user_details_button, 184 gtk_builder_get_object(builder, "favourites_button")
168 "clicked",
169 G_CALLBACK(handle_flap_via_button_click),
170 handle->flap_user_details
171 ); 185 );
172 186
173 handle->account_details_button = GTK_BUTTON( 187 handle->account_details_button = GTK_BUTTON(
@@ -185,35 +199,54 @@ ui_messenger_init(MESSENGER_Application *app,
185 handle->account_details_revealer 199 handle->account_details_revealer
186 ); 200 );
187 201
188 handle->back_button = GTK_BUTTON( 202 handle->accounts_listbox = GTK_LIST_BOX(
189 gtk_builder_get_object(builder, "back_button") 203 gtk_builder_get_object(builder, "accounts_listbox")
204 );
205
206 handle->new_contact_button = GTK_BUTTON(
207 gtk_builder_get_object(builder, "new_contact_button")
208 );
209
210 handle->new_group_button = GTK_BUTTON(
211 gtk_builder_get_object(builder, "new_group_button")
212 );
213
214 handle->new_platform_button = GTK_BUTTON(
215 gtk_builder_get_object(builder, "new_platform_button")
216 );
217
218 handle->contacts_button = GTK_BUTTON(
219 gtk_builder_get_object(builder, "contacts_button")
220 );
221
222 handle->settings_button = GTK_BUTTON(
223 gtk_builder_get_object(builder, "settings_button")
224 );
225
226 handle->user_details_button = GTK_BUTTON(
227 gtk_builder_get_object(builder, "user_details_button")
190 ); 228 );
191 229
192 g_signal_connect( 230 g_signal_connect(
193 handle->back_button, 231 handle->user_details_button,
194 "clicked", 232 "clicked",
195 G_CALLBACK(handle_back_button_click), 233 G_CALLBACK(handle_flap_via_button_click),
196 handle->leaflet_chat 234 handle->flap_user_details
197 ); 235 );
198 236
199 g_object_bind_property( 237 handle->chats_search = GTK_SEARCH_ENTRY(
200 handle->leaflet_chat, 238 gtk_builder_get_object(builder, "chats_search")
201 "folded",
202 handle->back_button,
203 "visible",
204 G_BINDING_SYNC_CREATE
205 ); 239 );
206 240
207 g_object_bind_property( 241 handle->chats_listbox = GTK_LIST_BOX(
208 handle->leaflet_chat, 242 gtk_builder_get_object(builder, "chats_listbox")
209 "folded",
210 handle->title_bar,
211 "show-close-button",
212 G_BINDING_INVERT_BOOLEAN
213 ); 243 );
214 244
215 handle->flap_chat_details = HDY_FLAP( 245 g_signal_connect(
216 gtk_builder_get_object(builder, "flap_chat_details") 246 handle->chats_listbox,
247 "row-activated",
248 G_CALLBACK(handle_chats_listbox_row_activated),
249 handle->leaflet_chat
217 ); 250 );
218 251
219 handle->chat_title = GTK_LABEL( 252 handle->chat_title = GTK_LABEL(
@@ -228,10 +261,6 @@ ui_messenger_init(MESSENGER_Application *app,
228 gtk_builder_get_object(builder, "chat_details_button") 261 gtk_builder_get_object(builder, "chat_details_button")
229 ); 262 );
230 263
231 handle->hide_chat_details_button = GTK_BUTTON(
232 gtk_builder_get_object(builder, "hide_chat_details_button")
233 );
234
235 g_signal_connect( 264 g_signal_connect(
236 handle->chat_details_button, 265 handle->chat_details_button,
237 "clicked", 266 "clicked",
@@ -239,6 +268,10 @@ ui_messenger_init(MESSENGER_Application *app,
239 handle->flap_chat_details 268 handle->flap_chat_details
240 ); 269 );
241 270
271 handle->hide_chat_details_button = GTK_BUTTON(
272 gtk_builder_get_object(builder, "hide_chat_details_button")
273 );
274
242 g_signal_connect( 275 g_signal_connect(
243 handle->hide_chat_details_button, 276 handle->hide_chat_details_button,
244 "clicked", 277 "clicked",
diff --git a/src/ui/messenger.h b/src/ui/messenger.h
index efb5122..4174754 100644
--- a/src/ui/messenger.h
+++ b/src/ui/messenger.h
@@ -52,12 +52,11 @@ typedef struct UI_MESSENGER_Handle
52 GtkRevealer *account_details_revealer; 52 GtkRevealer *account_details_revealer;
53 GtkListBox *accounts_listbox; 53 GtkListBox *accounts_listbox;
54 54
55 GtkButton *new_contact_button;
55 GtkButton *new_group_button; 56 GtkButton *new_group_button;
56 GtkButton *new_platform_button; 57 GtkButton *new_platform_button;
57 GtkButton *contacts_button; 58 GtkButton *contacts_button;
58 GtkButton *calls_button;
59 GtkButton *settings_button; 59 GtkButton *settings_button;
60 GtkButton *night_mode_button;
61 60
62 GtkButton *user_details_button; 61 GtkButton *user_details_button;
63 GtkSearchEntry *chats_search; 62 GtkSearchEntry *chats_search;