Linux + iPhone Continuity / iMessage / SMS
Redesign GTK desktop UI and fix narrow device panels
David Boulay916b6cd1b1bc
diff --git a/src/gtk/calls_view.cpp b/src/gtk/calls_view.cppindex 13d24ca..e383db7 100644--- a/src/gtk/calls_view.cpp+++ b/src/gtk/calls_view.cpp@@ -247,7 +247,7 @@ namespace tether::ui {GtkWidget* root = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);GtkWidget* dial_bar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);- gtk_container_set_border_width(GTK_CONTAINER(dial_bar), 10);+ gtk_container_set_border_width(GTK_CONTAINER(dial_bar), 24);g_calls.entry = gtk_entry_new();gtk_entry_set_placeholder_text(GTK_ENTRY(g_calls.entry), _("Number to call"));set_accessible_name(g_calls.entry, _("Number to call"));@@ -278,6 +278,8 @@ namespace tether::ui {GTK_BOX(status_box), gtk_image_new_from_icon_name("call-start", GTK_ICON_SIZE_DIALOG), FALSE, FALSE, 0);g_calls.status_label = gtk_label_new(_("Waiting for the iPhone."));gtk_label_set_line_wrap(GTK_LABEL(g_calls.status_label), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_calls.status_label), 42);+ style(status_box, "tether-empty");gtk_label_set_justify(GTK_LABEL(g_calls.status_label), GTK_JUSTIFY_CENTER);gtk_style_context_add_class(gtk_widget_get_style_context(g_calls.status_label), "muted");gtk_box_pack_start(GTK_BOX(status_box), g_calls.status_label, FALSE, FALSE, 0);@@ -286,6 +288,7 @@ namespace tether::ui {GtkWidget* scroll = gtk_scrolled_window_new(nullptr, nullptr);gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);g_calls.list = gtk_list_box_new();+ gtk_style_context_add_class(gtk_widget_get_style_context(g_calls.list), "tether-feed");gtk_list_box_set_selection_mode(GTK_LIST_BOX(g_calls.list), GTK_SELECTION_NONE);gtk_container_add(GTK_CONTAINER(scroll), g_calls.list);gtk_stack_add_named(GTK_STACK(g_calls.stack), scroll, "list");diff --git a/src/gtk/contacts_view.cpp b/src/gtk/contacts_view.cppindex 56bcc0f..eed7b48 100644--- a/src/gtk/contacts_view.cpp+++ b/src/gtk/contacts_view.cpp@@ -156,7 +156,10 @@ namespace tether::ui {gtk_label_set_xalign(GTK_LABEL(title), 0.0);gtk_label_set_ellipsize(GTK_LABEL(title), PANGO_ELLIPSIZE_END);gtk_label_set_max_width_chars(GTK_LABEL(title), 28);- gtk_expander_set_label_widget(GTK_EXPANDER(expander), title);+ GtkWidget* identity = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 14);+ gtk_box_pack_start(GTK_BOX(identity), avatar(name), FALSE, FALSE, 0);+ gtk_box_pack_start(GTK_BOX(identity), title, TRUE, TRUE, 0);+ gtk_expander_set_label_widget(GTK_EXPANDER(expander), identity);GtkWidget* addresses = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);gtk_widget_set_margin_top(addresses, 6);@@ -225,12 +228,9 @@ namespace tether::ui {GtkWidget* status_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);gtk_widget_set_valign(status_box, GTK_ALIGN_CENTER);+ style(status_box, "tether-empty");gtk_widget_set_halign(status_box, GTK_ALIGN_CENTER);- gtk_box_pack_start(GTK_BOX(status_box),- gtk_image_new_from_icon_name("avatar-default-symbolic", GTK_ICON_SIZE_DIALOG),- FALSE,- FALSE,- 0);+ gtk_box_pack_start(GTK_BOX(status_box), navigation_icon("contacts", 56), FALSE, FALSE, 0);g_contacts.status_label = gtk_label_new(_("No contacts yet. Check the Bluetooth link on the Devices page."));gtk_label_set_line_wrap(GTK_LABEL(g_contacts.status_label), TRUE);gtk_label_set_justify(GTK_LABEL(g_contacts.status_label), GTK_JUSTIFY_CENTER);@@ -243,9 +243,9 @@ namespace tether::ui {g_contacts.search_entry = gtk_search_entry_new();gtk_entry_set_placeholder_text(GTK_ENTRY(g_contacts.search_entry), _("Search contacts"));set_accessible_name(g_contacts.search_entry, _("Search contacts"));- gtk_widget_set_margin_top(g_contacts.search_entry, 8);- gtk_widget_set_margin_start(g_contacts.search_entry, 8);- gtk_widget_set_margin_end(g_contacts.search_entry, 8);+ gtk_widget_set_margin_top(g_contacts.search_entry, 24);+ gtk_widget_set_margin_start(g_contacts.search_entry, 24);+ gtk_widget_set_margin_end(g_contacts.search_entry, 24);g_signal_connect(g_contacts.search_entry, "search-changed", G_CALLBACK(on_search_changed), nullptr);g_signal_connect(g_contacts.search_entry,"stop-search",@@ -256,6 +256,7 @@ namespace tether::ui {GtkWidget* scroll = gtk_scrolled_window_new(nullptr, nullptr);gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);g_contacts.list = gtk_list_box_new();+ gtk_style_context_add_class(gtk_widget_get_style_context(g_contacts.list), "tether-feed");gtk_list_box_set_selection_mode(GTK_LIST_BOX(g_contacts.list), GTK_SELECTION_NONE);gtk_list_box_set_filter_func(GTK_LIST_BOX(g_contacts.list), contact_visible, nullptr, nullptr);gtk_container_add(GTK_CONTAINER(scroll), g_contacts.list);diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cppindex be67ee6..f1f7640 100644--- a/src/gtk/devices_view.cpp+++ b/src/gtk/devices_view.cpp@@ -963,6 +963,8 @@ namespace tether::ui {GtkWidget* title = gtk_label_new(nullptr);gtk_label_set_markup(GTK_LABEL(title), ("<b>" + escape_markup(name) + "</b>").c_str());gtk_label_set_xalign(GTK_LABEL(title), 0.0);+ gtk_label_set_ellipsize(GTK_LABEL(title), PANGO_ELLIPSIZE_END);+ gtk_label_set_max_width_chars(GTK_LABEL(title), 18);gtk_box_pack_start(GTK_BOX(labels), title, FALSE, FALSE, 0);GtkWidget* subtitle =@@ -1003,6 +1005,8 @@ namespace tether::ui {GtkWidget* title = gtk_label_new(nullptr);gtk_label_set_markup(GTK_LABEL(title), ("<b>" + escape_markup(name) + "</b>").c_str());gtk_label_set_xalign(GTK_LABEL(title), 0.0);+ gtk_label_set_ellipsize(GTK_LABEL(title), PANGO_ELLIPSIZE_END);+ gtk_label_set_max_width_chars(GTK_LABEL(title), 18);gtk_box_pack_start(GTK_BOX(labels), title, FALSE, FALSE, 0);// "Partially connected" is about the iPhone's message and notification@@ -1465,23 +1469,35 @@ namespace tether::ui {GtkWidget* left_scroll = gtk_scrolled_window_new(nullptr, nullptr);gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(left_scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);gtk_widget_set_size_request(left_scroll, 220, -1);+ style(left_scroll, "tether-thread-pane");g_devices.list_devices = gtk_list_box_new();+ gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.list_devices), "tether-list");g_signal_connect(g_devices.list_devices, "row-selected", G_CALLBACK(on_device_selected), nullptr);gtk_container_add(GTK_CONTAINER(left_scroll), g_devices.list_devices);gtk_paned_pack1(GTK_PANED(paned), left_scroll, FALSE, FALSE);// Right Paneg_devices.right_pane_stack = gtk_stack_new();+ // A hidden device page must not impose its minimum width on this one.+ gtk_stack_set_hhomogeneous(GTK_STACK(g_devices.right_pane_stack), FALSE);+ gtk_stack_set_vhomogeneous(GTK_STACK(g_devices.right_pane_stack), FALSE);gtk_stack_set_transition_type(GTK_STACK(g_devices.right_pane_stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);// Placeholder, which on a machine with nothing paired is the first thing// anyone sees: it explains both routes rather than saying "select a device".GtkWidget* placeholder = gtk_box_new(GTK_ORIENTATION_VERTICAL, 24);gtk_container_set_border_width(GTK_CONTAINER(placeholder), 24);- gtk_widget_set_valign(placeholder, GTK_ALIGN_CENTER);+ gtk_widget_set_valign(placeholder, GTK_ALIGN_START);+ GtkWidget* hero = navigation_icon("devices", 48);+ style(hero, "tether-hero-icon");+ gtk_widget_set_halign(hero, GTK_ALIGN_CENTER);+ gtk_box_pack_start(GTK_BOX(placeholder), hero, FALSE, FALSE, 0);GtkWidget* welcome_title = gtk_label_new(nullptr);+ style(welcome_title, "tether-hero-title");+ gtk_label_set_line_wrap(GTK_LABEL(welcome_title), TRUE);+ gtk_label_set_justify(GTK_LABEL(welcome_title), GTK_JUSTIFY_CENTER);set_markup(welcome_title, "<big><b>" + escape_markup(_("Connect your iPhone")) + "</b></big>");gtk_box_pack_start(GTK_BOX(placeholder), welcome_title, FALSE, FALSE, 0);@@ -1500,6 +1516,7 @@ namespace tether::ui {[](const char* icon_name, const char* title, const char* steps, GtkWidget** status_out) {GtkWidget* block = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);gtk_widget_set_valign(block, GTK_ALIGN_START);+ style(block, "tether-card");GtkWidget* heading = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);gtk_box_pack_start(@@ -1548,6 +1565,7 @@ namespace tether::ui {// One button for both routes: scanning is what refreshes either list.GtkWidget* welcome_scan = gtk_button_new_with_label(_("Scan for devices"));gtk_widget_set_halign(welcome_scan, GTK_ALIGN_CENTER);+ style(welcome_scan, "suggested-action");g_signal_connect(welcome_scan,"clicked",G_CALLBACK(+[](GtkWidget*, gpointer) { devices_view_trigger_discovery(); }),@@ -1557,10 +1575,15 @@ namespace tether::ui {// AirPods: battery and the listening mode, which is all the buds expose.GtkWidget* airpods_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16);- gtk_container_set_border_width(GTK_CONTAINER(airpods_box), 32);- gtk_widget_set_valign(airpods_box, GTK_ALIGN_CENTER);+ gtk_container_set_border_width(GTK_CONTAINER(airpods_box), 8);+ gtk_widget_set_valign(airpods_box, GTK_ALIGN_START);+ style(airpods_box, "tether-detail");g_devices.chk_airpods_enabled = gtk_check_button_new_with_label(_("Manage AirPods from Tether"));+ GtkWidget* chk_airpods_enabled_label = gtk_bin_get_child(GTK_BIN(g_devices.chk_airpods_enabled));+ gtk_label_set_line_wrap(GTK_LABEL(chk_airpods_enabled_label), TRUE);+ gtk_label_set_line_wrap_mode(GTK_LABEL(chk_airpods_enabled_label), PANGO_WRAP_WORD_CHAR);+ gtk_label_set_max_width_chars(GTK_LABEL(chk_airpods_enabled_label), 28);gtk_widget_set_tooltip_text(g_devices.chk_airpods_enabled,_("The AirPods channel takes one program per computer. Turning this off ""releases it, so another AirPods program can use it."));@@ -1568,6 +1591,10 @@ namespace tether::ui {gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.chk_airpods_enabled, FALSE, FALSE, 0);g_devices.lbl_airpods_name = gtk_label_new(nullptr);+ style(g_devices.lbl_airpods_name, "tether-hero-title");+ gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_airpods_name), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_airpods_name), 24);+ gtk_label_set_line_wrap_mode(GTK_LABEL(g_devices.lbl_airpods_name), PANGO_WRAP_WORD_CHAR);gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_name), 0.0);gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_name, FALSE, FALSE, 0);@@ -1586,8 +1613,11 @@ namespace tether::ui {set_markup(lbl_mode_title, "<b>" + escape_markup(_("Listening mode")) + "</b>");gtk_box_pack_start(GTK_BOX(airpods_box), lbl_mode_title, FALSE, FALSE, 0);- GtkWidget* modes = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);- gtk_style_context_add_class(gtk_widget_get_style_context(modes), "linked");+ GtkWidget* modes = gtk_grid_new();+ gtk_grid_set_column_homogeneous(GTK_GRID(modes), TRUE);+ gtk_grid_set_row_spacing(GTK_GRID(modes), 6);+ gtk_grid_set_column_spacing(GTK_GRID(modes), 6);+ style(modes, "tether-modes");AtkObject* modes_a11y = gtk_widget_get_accessible(modes);atk_object_set_role(modes_a11y, ATK_ROLE_PANEL);atk_object_add_relationship(modes_a11y, ATK_RELATION_LABELLED_BY, gtk_widget_get_accessible(lbl_mode_title));@@ -1600,13 +1630,17 @@ namespace tether::ui {group = button;g_signal_connect(button, "toggled", G_CALLBACK(on_airpods_mode_toggled), GINT_TO_POINTER(i));g_devices.airpods_mode_buttons[i] = button;- gtk_box_pack_start(GTK_BOX(modes), button, TRUE, TRUE, 0);+ gtk_grid_attach(GTK_GRID(modes), button, i % 2, i / 2, 1, 1);}- gtk_box_pack_start(GTK_BOX(airpods_box), modes, FALSE, FALSE, 0);+ GtkWidget* listening_card = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);+ style(listening_card, "tether-card");+ gtk_box_pack_start(GTK_BOX(listening_card), modes, FALSE, FALSE, 0);+ gtk_box_pack_start(GTK_BOX(airpods_box), listening_card, FALSE, FALSE, 0);g_devices.lbl_airpods_reason = gtk_label_new(nullptr);gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_reason), 0.0);gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_airpods_reason), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_airpods_reason), 30);gtk_label_set_line_wrap_mode(GTK_LABEL(g_devices.lbl_airpods_reason), PANGO_WRAP_WORD_CHAR);gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_reason), "muted");gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_reason, FALSE, FALSE, 0);@@ -1622,7 +1656,7 @@ namespace tether::ui {gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_worn), "muted");gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_worn, FALSE, FALSE, 0);- GtkWidget* pause_row = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);+ GtkWidget* pause_row = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);GtkWidget* pause_label = gtk_label_new(_("Pause playback when:"));gtk_box_pack_start(GTK_BOX(pause_row), pause_label, FALSE, FALSE, 0);g_devices.cmb_airpods_pause = gtk_combo_box_text_new();@@ -1644,6 +1678,10 @@ namespace tether::ui {g_devices.chk_airpods_handoff =gtk_check_button_new_with_label(_("Hand the AirPods to the iPhone during a call"));+ GtkWidget* chk_airpods_handoff_label = gtk_bin_get_child(GTK_BIN(g_devices.chk_airpods_handoff));+ gtk_label_set_line_wrap(GTK_LABEL(chk_airpods_handoff_label), TRUE);+ gtk_label_set_line_wrap_mode(GTK_LABEL(chk_airpods_handoff_label), PANGO_WRAP_WORD_CHAR);+ gtk_label_set_max_width_chars(GTK_LABEL(chk_airpods_handoff_label), 28);gtk_widget_set_tooltip_text(g_devices.chk_airpods_handoff,_("Pauses playback and disconnects the AirPods so the iPhone can take them, ""then reconnects them when the call ends. Needs call control, and only "@@ -1654,6 +1692,7 @@ namespace tether::ui {g_devices.lbl_airpods_apple_id = gtk_label_new(nullptr);gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_apple_id), 0.0);gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_airpods_apple_id), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_airpods_apple_id), 30);gtk_label_set_line_wrap_mode(GTK_LABEL(g_devices.lbl_airpods_apple_id), PANGO_WRAP_WORD_CHAR);gtk_label_set_selectable(GTK_LABEL(g_devices.lbl_airpods_apple_id), TRUE);gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_apple_id), "muted");@@ -1663,10 +1702,15 @@ namespace tether::ui {// BluetoothGtkWidget* bt_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16);- gtk_container_set_border_width(GTK_CONTAINER(bt_box), 32);- gtk_widget_set_valign(bt_box, GTK_ALIGN_CENTER);+ gtk_container_set_border_width(GTK_CONTAINER(bt_box), 8);+ gtk_widget_set_valign(bt_box, GTK_ALIGN_START);+ style(bt_box, "tether-detail");g_devices.lbl_bt_name = gtk_label_new(nullptr);+ style(g_devices.lbl_bt_name, "tether-hero-title");+ gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_bt_name), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_bt_name), 24);+ gtk_label_set_line_wrap_mode(GTK_LABEL(g_devices.lbl_bt_name), PANGO_WRAP_WORD_CHAR);gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_bt_name), 0.0);gtk_box_pack_start(GTK_BOX(bt_box), g_devices.lbl_bt_name, FALSE, FALSE, 0);@@ -1707,10 +1751,14 @@ namespace tether::ui {g_devices.lbl_bt_mode = gtk_label_new(nullptr);gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_bt_mode), 0.0);gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_bt_mode), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_bt_mode), 30);gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_bt_mode), "muted");gtk_box_pack_start(GTK_BOX(bt_box), g_devices.lbl_bt_mode, FALSE, FALSE, 0);- GtkWidget* capabilities = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);+ GtkWidget* capabilities = gtk_box_new(GTK_ORIENTATION_VERTICAL, 14);+ style(capabilities, "tether-card");+ const char* capability_icons[] = {"devices", "messages", "contacts", "notifications"};+ size_t capability_index = 0;for (GtkWidget** label : {&g_devices.lbl_bt_link,&g_devices.lbl_bt_messages,&g_devices.lbl_bt_contacts,@@ -1718,11 +1766,19 @@ namespace tether::ui {*label = gtk_label_new(nullptr);gtk_label_set_xalign(GTK_LABEL(*label), 0.0);gtk_label_set_line_wrap(GTK_LABEL(*label), TRUE);- gtk_box_pack_start(GTK_BOX(capabilities), *label, FALSE, FALSE, 0);+ GtkWidget* capability_row = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);+ gtk_box_pack_start(+ GTK_BOX(capability_row), navigation_icon(capability_icons[capability_index++]), FALSE, FALSE, 0);+ gtk_box_pack_start(GTK_BOX(capability_row), *label, TRUE, TRUE, 0);+ gtk_box_pack_start(GTK_BOX(capabilities), capability_row, FALSE, FALSE, 0);}gtk_box_pack_start(GTK_BOX(bt_box), capabilities, FALSE, FALSE, 0);g_devices.chk_bt_enabled = gtk_check_button_new_with_label(_("Connect to this iPhone over Bluetooth"));+ GtkWidget* chk_bt_enabled_label = gtk_bin_get_child(GTK_BIN(g_devices.chk_bt_enabled));+ gtk_label_set_line_wrap(GTK_LABEL(chk_bt_enabled_label), TRUE);+ gtk_label_set_line_wrap_mode(GTK_LABEL(chk_bt_enabled_label), PANGO_WRAP_WORD_CHAR);+ gtk_label_set_max_width_chars(GTK_LABEL(chk_bt_enabled_label), 28);gtk_widget_set_tooltip_text(g_devices.chk_bt_enabled,_("Keep the Bluetooth link to the iPhone up, reconnecting whenever it drops. ""Turning this off stops Tether reconnecting; a link that is already up stays "@@ -1733,6 +1789,7 @@ namespace tether::ui {g_devices.lbl_bt_reason = gtk_label_new(nullptr);gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_bt_reason), 0.0);gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_bt_reason), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_bt_reason), 30);gtk_label_set_line_wrap_mode(GTK_LABEL(g_devices.lbl_bt_reason), PANGO_WRAP_WORD_CHAR);gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_bt_reason), "muted");gtk_box_pack_start(GTK_BOX(bt_box), g_devices.lbl_bt_reason, FALSE, FALSE, 0);@@ -1769,6 +1826,7 @@ namespace tether::ui {gtk_widget_set_valign(pair_box, GTK_ALIGN_CENTER);gtk_widget_set_halign(pair_box, GTK_ALIGN_CENTER);g_devices.lbl_unpaired_name = gtk_label_new(nullptr);+ style(g_devices.lbl_unpaired_name, "tether-hero-title");gtk_box_pack_start(GTK_BOX(pair_box), g_devices.lbl_unpaired_name, FALSE, FALSE, 0);g_devices.lbl_unpaired_ip = gtk_label_new(nullptr);gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_unpaired_ip), "muted");@@ -1788,14 +1846,19 @@ namespace tether::ui {// ActionGtkWidget* action_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 24);- gtk_container_set_border_width(GTK_CONTAINER(action_box), 32);- gtk_widget_set_valign(action_box, GTK_ALIGN_CENTER);+ gtk_container_set_border_width(GTK_CONTAINER(action_box), 8);+ gtk_widget_set_valign(action_box, GTK_ALIGN_START);+ style(action_box, "tether-detail");g_devices.lbl_action_name = gtk_label_new(nullptr);+ style(g_devices.lbl_action_name, "tether-hero-title");+ gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_action_name), TRUE);+ gtk_label_set_max_width_chars(GTK_LABEL(g_devices.lbl_action_name), 24);+ gtk_label_set_line_wrap_mode(GTK_LABEL(g_devices.lbl_action_name), PANGO_WRAP_WORD_CHAR);gtk_widget_set_halign(g_devices.lbl_action_name, GTK_ALIGN_CENTER);gtk_box_pack_start(GTK_BOX(action_box), g_devices.lbl_action_name, FALSE, FALSE, 0);- GtkWidget* btn_grid = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);+ GtkWidget* btn_grid = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);gtk_widget_set_halign(btn_grid, GTK_ALIGN_CENTER);g_devices.btn_grid = btn_grid;@@ -1805,6 +1868,8 @@ namespace tether::ui {g_devices.dropzone = dropzone;gtk_box_pack_start(GTK_BOX(btn_grid), dropzone, FALSE, FALSE, 0);+ GtkWidget* transfer_icon = gtk_image_new_from_icon_name("folder-download-symbolic", GTK_ICON_SIZE_DIALOG);+ gtk_box_pack_start(GTK_BOX(dropzone), transfer_icon, FALSE, FALSE, 0);GtkWidget* lbl_drop = gtk_label_new(_("Drop files here to send"));gtk_style_context_add_class(gtk_widget_get_style_context(lbl_drop), "muted");gtk_box_pack_start(GTK_BOX(dropzone), lbl_drop, FALSE, FALSE, 0);@@ -1824,7 +1889,15 @@ namespace tether::ui {set_status_action(_("Clipboard sync requested..."));}),nullptr);- gtk_box_pack_start(GTK_BOX(btn_grid), btn_send_clip, FALSE, FALSE, 0);+ GtkWidget* clipboard_card = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 16);+ style(clipboard_card, "tether-card");+ gtk_box_pack_start(GTK_BOX(clipboard_card),+ gtk_image_new_from_icon_name("edit-paste-symbolic", GTK_ICON_SIZE_LARGE_TOOLBAR),+ FALSE,+ FALSE,+ 0);+ gtk_box_pack_start(GTK_BOX(clipboard_card), btn_send_clip, TRUE, TRUE, 0);+ gtk_box_pack_start(GTK_BOX(btn_grid), clipboard_card, FALSE, FALSE, 0);gtk_box_pack_start(GTK_BOX(action_box), btn_grid, FALSE, FALSE, 0);@@ -1869,8 +1942,8 @@ namespace tether::ui {gtk_stack_add_named(GTK_STACK(g_devices.right_pane_stack), action_page, "action");GtkWidget* right_scroll = gtk_scrolled_window_new(nullptr, nullptr);- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(right_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);- gtk_scrolled_window_set_propagate_natural_width(GTK_SCROLLED_WINDOW(right_scroll), TRUE);+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(right_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);+ gtk_scrolled_window_set_propagate_natural_width(GTK_SCROLLED_WINDOW(right_scroll), FALSE);gtk_container_add(GTK_CONTAINER(right_scroll), g_devices.right_pane_stack);gtk_paned_pack2(GTK_PANED(paned), right_scroll, TRUE, FALSE);gtk_stack_set_visible_child_name(GTK_STACK(g_devices.right_pane_stack), "placeholder");diff --git a/src/gtk/main.cpp b/src/gtk/main.cppindex 2b1ecf7..1808769 100644--- a/src/gtk/main.cpp+++ b/src/gtk/main.cpp@@ -24,6 +24,7 @@ namespace {GtkWidget* g_refresh_button = nullptr;GtkWidget* g_stack = nullptr;GtkWidget* g_calls_page = nullptr;+ GtkWidget* g_calls_nav = nullptr;gboolean g_start_hidden = FALSE;// what the current invocation asked to see@@ -36,6 +37,8 @@ namespace {if (!g_calls_page)return;gtk_widget_set_visible(g_calls_page, enabled);+ if (g_calls_nav)+ gtk_widget_set_visible(g_calls_nav, enabled);if (enabled || !g_stack)return;const gchar* name = gtk_stack_get_visible_child_name(GTK_STACK(g_stack));@@ -195,9 +198,10 @@ namespace {GtkWidget* window = gtk_application_window_new(app);gtk_window_set_title(GTK_WINDOW(window), _("Tether"));gtk_window_set_default_size(- GTK_WINDOW(window), prefs().value("window_width", 820), prefs().value("window_height", 560));+ GTK_WINDOW(window), prefs().value("window_width", 1040), prefs().value("window_height", 680));if (prefs().value("window_maximized", false))gtk_window_maximize(GTK_WINDOW(window));+ gtk_style_context_add_class(gtk_widget_get_style_context(window), "tether-app");set_main_window(window);g_signal_connect(window, "delete-event", G_CALLBACK(on_window_delete), nullptr);g_signal_connect(@@ -225,27 +229,103 @@ namespace {GtkWidget* stack = gtk_stack_new();g_stack = stack;gtk_stack_set_transition_type(GTK_STACK(stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);- gtk_stack_add_titled(GTK_STACK(stack), devices_view_new(), "devices", _("Devices"));+ gtk_stack_add_titled(+ GTK_STACK(stack), page_frame(devices_view_new(), _("Devices"), "devices"), "devices", _("Devices"));gtk_stack_add_titled(GTK_STACK(stack), messages_view_new(), "messages", _("Messages"));- gtk_stack_add_titled(GTK_STACK(stack), notifications_view_new(), "notifications", _("Notifications"));- g_calls_page = calls_view_new();+ gtk_stack_add_titled(GTK_STACK(stack),+ page_frame(notifications_view_new(), _("Notifications"), "notifications"),+ "notifications",+ _("Notifications"));+ g_calls_page = page_frame(calls_view_new(), _("Calls"), "calls");gtk_stack_add_titled(GTK_STACK(stack), g_calls_page, "calls", _("Calls"));gtk_stack_add_titled(GTK_STACK(stack),- contacts_view_new([](const std::string& thread_key) {- show_view("messages");- messages_view_open_thread(thread_key);- }),+ page_frame(contacts_view_new([](const std::string& thread_key) {+ show_view("messages");+ messages_view_open_thread(thread_key);+ }),+ _("Contacts"),+ "contacts"),"contacts",_("Contacts"));- GtkWidget* switcher = gtk_stack_switcher_new();- gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(switcher), GTK_STACK(stack));- gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header_bar), switcher);+ GtkWidget* sidebar = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);+ gtk_style_context_add_class(gtk_widget_get_style_context(sidebar), "tether-nav");+ GtkWidget* logo = navigation_icon("logo", 42);+ gtk_widget_set_halign(logo, GTK_ALIGN_START);+ gtk_widget_set_margin_start(logo, 12);+ gtk_widget_set_margin_bottom(logo, 8);+ set_accessible_name(logo, _("Tether"));+ gtk_box_pack_start(GTK_BOX(sidebar), logo, FALSE, FALSE, 0);+ GtkWidget* brand = gtk_label_new(_("Tether"));+ gtk_label_set_xalign(GTK_LABEL(brand), 0);+ gtk_style_context_add_class(gtk_widget_get_style_context(brand), "tether-brand");+ gtk_box_pack_start(GTK_BOX(sidebar), brand, FALSE, FALSE, 0);++ struct NavItem {+ const char* name;+ const char* title;+ };+ const NavItem items[] = {+ {"devices", _("Devices")},+ {"messages", _("Messages")},+ {"notifications", _("Notifications")},+ {"contacts", _("Contacts")},+ {"calls", _("Calls")},+ };+ GtkRadioButton* group = nullptr;+ for (const auto& item : items) {+ GtkWidget* button = gtk_radio_button_new_from_widget(group);+ if (!group)+ group = GTK_RADIO_BUTTON(button);+ gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);+ gtk_style_context_add_class(gtk_widget_get_style_context(button), "tether-nav-item");+ GtkWidget* content = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);+ gtk_box_pack_start(GTK_BOX(content), navigation_icon(item.name), FALSE, FALSE, 0);+ GtkWidget* label = gtk_label_new(item.title);+ gtk_label_set_xalign(GTK_LABEL(label), 0);+ gtk_box_pack_start(GTK_BOX(content), label, TRUE, TRUE, 0);+ gtk_container_add(GTK_CONTAINER(button), content);+ set_accessible_name(button, item.title);+ g_object_set_data(G_OBJECT(button), "view-name", const_cast<char*>(item.name));+ g_signal_connect(button,+ "toggled",+ G_CALLBACK(+[](GtkToggleButton* button, gpointer) {+ if (gtk_toggle_button_get_active(button))+ show_view(+ static_cast<const char*>(g_object_get_data(G_OBJECT(button), "view-name")));+ }),+ nullptr);+ g_signal_connect(stack,+ "notify::visible-child-name",+ G_CALLBACK(+[](GObject* stack, GParamSpec*, gpointer data) {+ auto* button = GTK_TOGGLE_BUTTON(data);+ const char* name =+ static_cast<const char*>(g_object_get_data(G_OBJECT(button), "view-name"));+ if (g_strcmp0(name, gtk_stack_get_visible_child_name(GTK_STACK(stack))) == 0)+ gtk_toggle_button_set_active(button, TRUE);+ }),+ button);+ gtk_box_pack_start(GTK_BOX(sidebar), button, FALSE, FALSE, 0);+ if (g_strcmp0(item.name, "calls") == 0) {+ g_calls_nav = button;+ gtk_widget_set_no_show_all(button, TRUE);+ gtk_widget_show_all(content);+ }+ }+ GtkWidget* settings = gtk_button_new_with_label(_("Settings"));+ gtk_button_set_image(GTK_BUTTON(settings), navigation_icon("settings"));+ gtk_button_set_always_show_image(GTK_BUTTON(settings), TRUE);+ gtk_style_context_add_class(gtk_widget_get_style_context(settings), "tether-nav-item");+ gtk_actionable_set_action_name(GTK_ACTIONABLE(settings), "win.settings");+ gtk_box_pack_end(GTK_BOX(sidebar), settings, FALSE, FALSE, 0);g_signal_connect(stack, "notify::visible-child-name", G_CALLBACK(on_visible_view_changed), nullptr);GtkWidget* root = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);- gtk_box_pack_start(GTK_BOX(root), stack, TRUE, TRUE, 0);+ GtkWidget* body = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);+ gtk_box_pack_start(GTK_BOX(body), sidebar, FALSE, FALSE, 0);+ gtk_box_pack_start(GTK_BOX(body), stack, TRUE, TRUE, 0);+ gtk_box_pack_start(GTK_BOX(root), body, TRUE, TRUE, 0);gtk_box_pack_start(GTK_BOX(root), create_route_bar(), FALSE, FALSE, 0);gtk_container_add(GTK_CONTAINER(window), root);diff --git a/src/gtk/messages_view.cpp b/src/gtk/messages_view.cppindex 523282f..3136a71 100644--- a/src/gtk/messages_view.cpp+++ b/src/gtk/messages_view.cpp@@ -220,6 +220,7 @@ namespace tether::ui {GtkWidget* box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);gtk_container_set_border_width(GTK_CONTAINER(box), 10);+ gtk_box_pack_start(GTK_BOX(box), avatar(name), FALSE, FALSE, 0);GtkWidget* labels = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);@@ -1074,14 +1075,15 @@ namespace tether::ui {GtkWidget* paned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);g_messages.paned = paned;- gtk_paned_set_position(GTK_PANED(paned), prefs().value("sidebar_width", 260));+ gtk_paned_set_position(GTK_PANED(paned), prefs().value("sidebar_width", 300));gtk_box_pack_start(GTK_BOX(root), paned, TRUE, TRUE, 0);GtkWidget* thread_scroll = gtk_scrolled_window_new(nullptr, nullptr);g_messages.thread_scroll = thread_scroll;gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(thread_scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);- gtk_widget_set_size_request(thread_scroll, 240, -1);+ gtk_widget_set_size_request(thread_scroll, 270, -1);g_messages.thread_list = gtk_list_box_new();+ gtk_style_context_add_class(gtk_widget_get_style_context(g_messages.thread_list), "tether-list");g_messages.thread_selected_handler =g_signal_connect(g_messages.thread_list, "row-selected", G_CALLBACK(on_thread_selected), nullptr);g_signal_connect(g_messages.thread_list, "row-activated", G_CALLBACK(on_thread_activated), nullptr);@@ -1089,6 +1091,8 @@ namespace tether::ui {gtk_container_add(GTK_CONTAINER(thread_scroll), g_messages.thread_list);GtkWidget* thread_side = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);+ style(thread_side, "tether-thread-pane");+ gtk_box_pack_start(GTK_BOX(thread_side), page_header(_("Messages"), "messages"), FALSE, FALSE, 0);g_messages.search_entry = gtk_search_entry_new();gtk_entry_set_placeholder_text(GTK_ENTRY(g_messages.search_entry), _("Search conversations"));@@ -1113,6 +1117,7 @@ namespace tether::ui {gtk_button_set_image(GTK_BUTTON(new_message),gtk_image_new_from_icon_name("list-add-symbolic", GTK_ICON_SIZE_BUTTON));gtk_button_set_always_show_image(GTK_BUTTON(new_message), TRUE);+ style(new_message, "suggested-action");gtk_widget_set_margin_top(new_message, 8);gtk_widget_set_margin_bottom(new_message, 8);gtk_widget_set_margin_start(new_message, 8);@@ -1126,8 +1131,10 @@ namespace tether::ui {GtkWidget* placeholder = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);gtk_widget_set_valign(placeholder, GTK_ALIGN_CENTER);+ style(placeholder, "tether-empty");gtk_widget_set_halign(placeholder, GTK_ALIGN_CENTER);g_messages.placeholder_icon = gtk_image_new_from_icon_name("mail-unread-symbolic", GTK_ICON_SIZE_DIALOG);+ style(g_messages.placeholder_icon, "tether-hero-icon");gtk_box_pack_start(GTK_BOX(placeholder), g_messages.placeholder_icon, FALSE, FALSE, 0);g_messages.placeholder_label = gtk_label_new(_("Select a conversation"));gtk_style_context_add_class(gtk_widget_get_style_context(g_messages.placeholder_label), "muted");@@ -1174,6 +1181,8 @@ namespace tether::ui {gtk_widget_set_no_show_all(g_messages.compose_bar, TRUE);GtkWidget* conversation_header_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);+ gtk_style_context_add_class(gtk_widget_get_style_context(conversation_header_box),+ "tether-conversation-header");gtk_container_set_border_width(GTK_CONTAINER(conversation_header_box), 10);g_messages.conversation_header = gtk_label_new(nullptr);gtk_label_set_xalign(GTK_LABEL(g_messages.conversation_header), 0.0);@@ -1186,6 +1195,7 @@ namespace tether::ui {gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(g_messages.conversation_scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);g_messages.conversation = gtk_list_box_new();+ gtk_style_context_add_class(gtk_widget_get_style_context(g_messages.conversation), "tether-conversation");gtk_list_box_set_selection_mode(GTK_LIST_BOX(g_messages.conversation), GTK_SELECTION_NONE);gtk_container_add(GTK_CONTAINER(g_messages.conversation_scroll), g_messages.conversation);if (GtkAdjustment* adjustment = conversation_adjustment()) {@@ -1195,6 +1205,7 @@ namespace tether::ui {gtk_box_pack_start(GTK_BOX(conversation_box), g_messages.conversation_scroll, TRUE, TRUE, 0);GtkWidget* composer_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);+ gtk_style_context_add_class(gtk_widget_get_style_context(composer_box), "tether-composer");gtk_container_set_border_width(GTK_CONTAINER(composer_box), 8);g_messages.composer = gtk_text_view_new();set_accessible_name(g_messages.composer, _("Message"));@@ -1210,7 +1221,7 @@ namespace tether::ui {gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(composer_frame), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);// Without a border the box floats in the panel with nothing marking it as// somewhere to type.- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(composer_frame), GTK_SHADOW_IN);+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(composer_frame), GTK_SHADOW_NONE);gtk_scrolled_window_set_max_content_height(GTK_SCROLLED_WINDOW(composer_frame), 140);gtk_container_add(GTK_CONTAINER(composer_frame), g_messages.composer);gtk_box_pack_start(GTK_BOX(composer_box), composer_frame, TRUE, TRUE, 0);diff --git a/src/gtk/notifications_view.cpp b/src/gtk/notifications_view.cppindex 5ef57c8..04b9f70 100644--- a/src/gtk/notifications_view.cpp+++ b/src/gtk/notifications_view.cpp@@ -64,7 +64,7 @@ namespace tether::ui {GtkWidget* row = gtk_list_box_row_new();gtk_list_box_row_set_selectable(GTK_LIST_BOX_ROW(row), FALSE);- GtkWidget* box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);+ GtkWidget* box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);gtk_container_set_border_width(GTK_CONTAINER(box), 10);GtkWidget* header = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);@@ -179,6 +179,7 @@ namespace tether::ui {GtkWidget* status_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);gtk_widget_set_valign(status_box, GTK_ALIGN_CENTER);+ style(status_box, "tether-empty");gtk_widget_set_halign(status_box, GTK_ALIGN_CENTER);GtkWidget* icon =gtk_image_new_from_icon_name("preferences-system-notifications-symbolic", GTK_ICON_SIZE_DIALOG);@@ -194,6 +195,7 @@ namespace tether::ui {GtkWidget* scroll = gtk_scrolled_window_new(nullptr, nullptr);gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);g_notifications.list = gtk_list_box_new();+ gtk_style_context_add_class(gtk_widget_get_style_context(g_notifications.list), "tether-feed");gtk_list_box_set_selection_mode(GTK_LIST_BOX(g_notifications.list), GTK_SELECTION_NONE);gtk_container_add(GTK_CONTAINER(scroll), g_notifications.list);gtk_stack_add_named(GTK_STACK(g_notifications.stack), scroll, "list");diff --git a/src/gtk/settings_view.cpp b/src/gtk/settings_view.cppindex 381e991..1e355d7 100644--- a/src/gtk/settings_view.cpp+++ b/src/gtk/settings_view.cpp@@ -55,6 +55,10 @@ namespace tether::ui {GtkWidget* text = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);GtkWidget* title_label = gtk_label_new(title.c_str());+ style(title_label, "tether-setting-title");+ gtk_label_set_line_wrap(GTK_LABEL(title_label), TRUE);+ gtk_label_set_line_wrap_mode(GTK_LABEL(title_label), PANGO_WRAP_WORD_CHAR);+ gtk_label_set_max_width_chars(GTK_LABEL(title_label), 42);gtk_label_set_xalign(GTK_LABEL(title_label), 0.0);gtk_box_pack_start(GTK_BOX(text), title_label, FALSE, FALSE, 0);// Lets screen readers name the control after the row title.@@ -81,6 +85,7 @@ namespace tether::ui {// Heading, optional one-line explanation, and the framed list the rows go in.GtkWidget* add_group(GtkWidget* column, const std::string& heading, const std::string& description) {GtkWidget* heading_label = gtk_label_new(nullptr);+ style(heading_label, "tether-settings-heading");gtk_label_set_xalign(GTK_LABEL(heading_label), 0.0);set_markup(heading_label, "<b>" + escape_markup(heading) + "</b>");gtk_widget_set_margin_top(heading_label, 8);@@ -205,8 +210,13 @@ namespace tether::ui {void build_window() {GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);+ gtk_style_context_add_class(gtk_widget_get_style_context(window), "tether-settings");g_settings.window = window;gtk_window_set_title(GTK_WINDOW(window), _("Settings"));+ GtkWidget* header = gtk_header_bar_new();+ gtk_header_bar_set_title(GTK_HEADER_BAR(header), _("Settings"));+ gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header), TRUE);+ gtk_window_set_titlebar(GTK_WINDOW(window), header);gtk_window_set_default_size(GTK_WINDOW(window), 540, 760);gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);if (GtkWidget* parent = main_window())@@ -229,10 +239,13 @@ namespace tether::ui {GtkWidget* scroll = gtk_scrolled_window_new(nullptr, nullptr);gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);- gtk_container_add(GTK_CONTAINER(window), scroll);+ GtkWidget* layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);+ gtk_container_add(GTK_CONTAINER(window), layout);+ gtk_box_pack_start(GTK_BOX(layout), page_header(_("Settings"), "settings"), FALSE, FALSE, 0);+ gtk_box_pack_start(GTK_BOX(layout), scroll, TRUE, TRUE, 0);GtkWidget* column = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);- gtk_container_set_border_width(GTK_CONTAINER(column), 18);+ gtk_container_set_border_width(GTK_CONTAINER(column), 28);gtk_container_add(GTK_CONTAINER(scroll), column);g_settings.lbl_bt_hint = gtk_label_new(_("No iPhone is paired over Bluetooth, so the Bluetooth "diff --git a/src/gtk/ui_util.cpp b/src/gtk/ui_util.cppindex 8d7093c..4b81362 100644--- a/src/gtk/ui_util.cpp+++ b/src/gtk/ui_util.cpp@@ -25,18 +25,62 @@ namespace tether::ui {RouteIndicator& indicator(Route route) { return g_routes[route == Route::WiFi ? 0 : 1]; }constexpr const char* STYLE = R"CSS(+.tether-app { background-color: @theme_bg_color; }+.tether-app .tether-nav {+ background-color: mix(@theme_bg_color, @theme_fg_color, 0.045);+ border-right: 1px solid alpha(@theme_fg_color, 0.09);+ padding: 20px 10px 16px;+ min-width: 142px;+}+.tether-brand { font-size: 23px; font-weight: bold; padding: 2px 12px 26px; }+.tether-nav-item { border: none; box-shadow: none; background: transparent; border-radius: 10px; padding: 12px; }+.tether-nav-item:hover { background-color: alpha(@theme_fg_color, 0.07); }+.tether-nav-item:checked { background-color: alpha(@theme_selected_bg_color, 0.20); color: @theme_fg_color; font-weight: bold; }+.tether-app headerbar { min-height: 42px; box-shadow: none; border-bottom: 1px solid alpha(@theme_fg_color, 0.08); }+.tether-page-header { padding: 22px 24px; border-bottom: 1px solid alpha(@theme_fg_color, 0.08); }+.tether-page-title { font-size: 22px; font-weight: bold; }+.tether-hero-title { font-size: 23px; font-weight: bold; }+.tether-hero-icon { color: @theme_selected_bg_color; background-color: alpha(@theme_selected_bg_color, 0.10); border-radius: 20px; padding: 18px; }+.tether-card { background-color: mix(@theme_bg_color, @theme_fg_color, 0.045); border: 1px solid alpha(@theme_fg_color, 0.09); border-radius: 16px; padding: 22px; }+.tether-detail { margin: 24px; }+.tether-modes button { border-radius: 8px; padding: 10px; }+.tether-app .tether-list { background: transparent; padding: 8px; }+.tether-app .tether-list row { padding: 0; margin: 3px 0; border-radius: 12px; border: 1px solid transparent; }+.tether-app .tether-list row:hover { background-color: alpha(@theme_fg_color, 0.055); }+.tether-app .tether-list row:selected { background-color: alpha(@theme_selected_bg_color, 0.14); border-color: alpha(@theme_selected_bg_color, 0.28); color: @theme_fg_color; }+.tether-avatar { min-width: 36px; min-height: 36px; border-radius: 24px; background-color: alpha(@theme_selected_bg_color, 0.15); color: @theme_fg_color; font-size: 16px; font-weight: bold; }+.tether-app .tether-feed { padding: 12px 24px 24px; }+.tether-app .tether-feed row { background-color: mix(@theme_bg_color, @theme_fg_color, 0.035); border: 1px solid alpha(@theme_fg_color, 0.09); border-radius: 14px; margin: 0 0 10px; padding: 8px; }+.tether-app entry { border-radius: 10px; min-height: 34px; box-shadow: none; }+.tether-thread-pane { background-color: alpha(@theme_fg_color, 0.025); border-right: 1px solid alpha(@theme_fg_color, 0.08); }+.tether-app .tether-conversation { padding: 16px 12px; background: transparent; }+.tether-app .tether-conversation row { background: transparent; }+.tether-conversation-header { padding: 14px 10px; font-size: 120%; background-color: alpha(@theme_fg_color, 0.025); }+.tether-composer { margin: 12px 16px 16px; border: 1px solid alpha(@theme_fg_color, 0.14); background-color: alpha(@theme_fg_color, 0.03); border-radius: 16px; padding: 8px; }+.tether-composer scrolledwindow, .tether-composer textview, .tether-composer textview text { border: none; box-shadow: none; background: transparent; }+.tether-composer button { border-radius: 10px; min-height: 32px; }+.tether-settings { background-color: @theme_bg_color; }+.tether-settings list { background-color: mix(@theme_bg_color, @theme_fg_color, 0.035); border: 1px solid alpha(@theme_fg_color, 0.10); border-radius: 14px; }+.tether-settings list row { background: transparent; padding: 5px 8px; border-bottom: 1px solid alpha(@theme_fg_color, 0.06); }+.tether-settings list row:last-child { border-bottom: none; }+.tether-settings-heading { font-size: 115%; padding: 18px 0 6px; }+.tether-setting-title { font-weight: bold; }+.tether-empty { padding: 36px; }+.tether-empty label { font-size: 110%; }+.tether-app button.suggested-action { border-radius: 10px; padding: 9px 16px; }.muted {opacity: 0.75;font-size: 90%;}.tether-bubble {- padding: 8px 12px;- border-radius: 14px;+ padding: 11px 16px;+ border-radius: 18px;}.tether-bubble-in {- background-color: alpha(@theme_fg_color, 0.10);+ background-color: mix(@theme_bg_color, @theme_fg_color, 0.09);+ border: 1px solid alpha(@theme_fg_color, 0.08);}.tether-bubble-out {@@ -45,7 +89,9 @@ namespace tether::ui {}.tether-route-bar {- border-top: 1px solid alpha(@theme_fg_color, 0.12);+ border-top: 1px solid alpha(@theme_fg_color, 0.09);+ padding: 5px 12px;+ font-size: 90%;}.tether-route-off {@@ -84,7 +130,7 @@ namespace tether::ui {.tether-dropzone {border: 2px dashed alpha(@theme_fg_color, 0.28);border-radius: 12px;- padding: 20px 28px;+ padding: 32px;}.tether-dropzone-active {@@ -140,6 +186,150 @@ namespace tether::ui {}} // namespace+ void style(GtkWidget* widget, const char* name) {+ gtk_style_context_add_class(gtk_widget_get_style_context(widget), name);+ }++ GtkWidget* navigation_icon(const char* name, int size) {+ GtkWidget* icon = gtk_drawing_area_new();+ gtk_widget_set_size_request(icon, size, size);+ gtk_widget_set_valign(icon, GTK_ALIGN_CENTER);+ g_object_set_data_full(G_OBJECT(icon), "icon-name", g_strdup(name), g_free);+ g_signal_connect(icon,+ "draw",+ G_CALLBACK(+[](GtkWidget* widget, cairo_t* cr, gpointer) -> gboolean {+ GtkStyleContext* context = gtk_widget_get_style_context(widget);+ const int width = gtk_widget_get_allocated_width(widget);+ const int height = gtk_widget_get_allocated_height(widget);+ gtk_render_background(context, cr, 0, 0, width, height);+ gtk_render_frame(context, cr, 0, 0, width, height);+ GdkRGBA color;+ gtk_style_context_get_color(+ gtk_widget_get_style_context(widget), gtk_widget_get_state_flags(widget), &color);+ gdk_cairo_set_source_rgba(cr, &color);+ cairo_scale(cr,+ gtk_widget_get_allocated_width(widget) / 24.0,+ gtk_widget_get_allocated_height(widget) / 24.0);+ cairo_set_line_width(cr, 1.7);+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);+ cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);+ const std::string name =+ static_cast<const char*>(g_object_get_data(G_OBJECT(widget), "icon-name"));+ if (name == "logo") {+ // The two linked rings from tether-symbolic.svg.+ cairo_set_line_width(cr, 2.4);+ cairo_arc(cr, 7.35, 12, 3.9, 0, 6.283185);+ cairo_stroke(cr);+ cairo_arc(cr, 16.65, 12, 3.9, 0, 6.283185);+ } else if (name == "contacts") {+ cairo_arc(cr, 12, 7, 3.5, 0, 6.283185);+ cairo_stroke(cr);+ cairo_move_to(cr, 4, 21);+ cairo_curve_to(cr, 4, 11, 20, 11, 20, 21);+ } else if (name == "messages") {+ cairo_move_to(cr, 4, 4);+ cairo_line_to(cr, 20, 4);+ cairo_line_to(cr, 20, 17);+ cairo_line_to(cr, 10, 17);+ cairo_line_to(cr, 4, 21);+ cairo_close_path(cr);+ cairo_move_to(cr, 8, 9);+ cairo_line_to(cr, 16, 9);+ cairo_move_to(cr, 8, 13);+ cairo_line_to(cr, 13, 13);+ } else if (name == "notifications") {+ cairo_move_to(cr, 5, 17);+ cairo_line_to(cr, 7, 14);+ cairo_line_to(cr, 7, 9);+ cairo_curve_to(cr, 7, 2, 17, 2, 17, 9);+ cairo_line_to(cr, 17, 14);+ cairo_line_to(cr, 19, 17);+ cairo_close_path(cr);+ cairo_move_to(cr, 10, 21);+ cairo_line_to(cr, 14, 21);+ } else if (name == "settings") {+ cairo_arc(cr, 12, 12, 3, 0, 6.283185);+ cairo_stroke(cr);+ cairo_arc(cr, 12, 12, 7, 0, 6.283185);+ cairo_stroke(cr);+ for (int i = 0; i < 8; ++i) {+ cairo_save(cr);+ cairo_translate(cr, 12, 12);+ cairo_rotate(cr, i * 0.785398);+ cairo_move_to(cr, 0, 7);+ cairo_line_to(cr, 0, 10);+ cairo_stroke(cr);+ cairo_restore(cr);+ }+ } else if (name == "calls") {+ cairo_move_to(cr, 5, 3);+ cairo_line_to(cr, 9, 3);+ cairo_line_to(cr, 11, 8);+ cairo_line_to(cr, 8, 10);+ cairo_curve_to(cr, 10, 14, 11, 15, 15, 17);+ cairo_line_to(cr, 17, 14);+ cairo_line_to(cr, 21, 16);+ cairo_line_to(cr, 21, 20);+ cairo_curve_to(cr, 12, 25, -1, 12, 5, 3);+ } else {+ cairo_rectangle(cr, 6, 2, 12, 20);+ cairo_move_to(cr, 10, 5);+ cairo_line_to(cr, 14, 5);+ cairo_move_to(cr, 11, 19);+ cairo_line_to(cr, 13, 19);+ }+ cairo_stroke(cr);+ return FALSE;+ }),+ nullptr);+ return icon;+ }++ GtkWidget* avatar(const std::string& name) {+ std::string first;+ std::string last;+ bool in_word = false;+ for (const char* cursor = name.c_str(); *cursor; cursor = g_utf8_next_char(cursor)) {+ const gunichar character = g_utf8_get_char(cursor);+ if (g_unichar_isspace(character)) {+ in_word = false;+ } else if (!in_word) {+ const std::string initial(cursor, g_utf8_next_char(cursor) - cursor);+ if (first.empty())+ first = initial;+ else+ last = initial;+ in_word = true;+ }+ }+ const std::string initials = first + last;+ gchar* upper = g_utf8_strup(initials.c_str(), -1);+ GtkWidget* label = gtk_label_new(*upper ? upper : "•");+ g_free(upper);+ style(label, "tether-avatar");+ gtk_widget_set_valign(label, GTK_ALIGN_CENTER);+ return label;+ }++ GtkWidget* page_header(const std::string& title, const char* icon) {+ GtkWidget* header = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);+ style(header, "tether-page-header");+ gtk_box_pack_start(GTK_BOX(header), navigation_icon(icon, 26), FALSE, FALSE, 0);+ GtkWidget* label = gtk_label_new(title.c_str());+ gtk_label_set_xalign(GTK_LABEL(label), 0);+ style(label, "tether-page-title");+ gtk_box_pack_start(GTK_BOX(header), label, TRUE, TRUE, 0);+ return header;+ }++ GtkWidget* page_frame(GtkWidget* content, const std::string& title, const char* icon) {+ GtkWidget* page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);+ style(page, "tether-page");+ gtk_box_pack_start(GTK_BOX(page), page_header(title, icon), FALSE, FALSE, 0);+ gtk_box_pack_start(GTK_BOX(page), content, TRUE, TRUE, 0);+ return page;+ }+void follow_system_color_scheme() {// An explicit GTK_THEME overrides.if (g_getenv("GTK_THEME"))diff --git a/src/gtk/ui_util.hpp b/src/gtk/ui_util.hppindex 3d869d2..1bd2fb6 100644--- a/src/gtk/ui_util.hpp+++ b/src/gtk/ui_util.hpp@@ -5,6 +5,13 @@namespace tether::ui {+ // App-owned line icons avoid missing glyphs in third-party desktop themes.+ GtkWidget* navigation_icon(const char* name, int size = 20);+ GtkWidget* avatar(const std::string& name);+ GtkWidget* page_header(const std::string& title, const char* icon);+ GtkWidget* page_frame(GtkWidget* content, const std::string& title, const char* icon);+ void style(GtkWidget* widget, const char* name);+// Loads the application stylesheet.void install_style();