From 13123dced135746b74f1f40148bfa9cef0c57dc0 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 15 Sep 2024 19:20:34 +0200 Subject: Use Adwaita 1.2, bump CI to Ubuntu 24.04 --- .github/workflows/build.yml | 6 +++--- CMakeLists.txt | 1 + main/CMakeLists.txt | 3 --- main/meson.build | 3 --- main/src/ui/application.vala | 8 +------- .../conversation_view.vala | 9 -------- .../account_preferences_subpage.vala | 21 +------------------ meson.build | 2 +- plugins/omemo/CMakeLists.txt | 5 +---- plugins/omemo/meson.build | 3 --- .../omemo/src/ui/encryption_preferences_entry.vala | 24 +++++----------------- 11 files changed, 13 insertions(+), 72 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8408c28a..524320cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: [pull_request, push] jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 with: @@ -15,7 +15,7 @@ jobs: - run: build/xmpp-vala-test - run: build/omemo-test build-meson: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 with: @@ -26,7 +26,7 @@ jobs: - run: meson setup build - run: meson compile -C build build-flatpak: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: bilelmoussaoui/flatpak-github-actions:gnome-44 options: --privileged diff --git a/CMakeLists.txt b/CMakeLists.txt index 1365b6d2..fad4e2ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(GLib_GLOBAL_VERSION 2.38) set(ICU_GLOBAL_VERSION 57) +set(Adwaita_GLOBAL_VERSION 1.2) if (NOT VALA_EXECUTABLE) unset(VALA_EXECUTABLE CACHE) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 2c533907..39b1320e 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -125,9 +125,6 @@ endif() if(GTK4_VERSION VERSION_GREATER_EQUAL "4.12") set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} GTK_4_12) endif() -if(Adwaita_VERSION VERSION_GREATER_EQUAL "1.2") - set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} Adw_1_2) -endif() if(Adwaita_VERSION VERSION_GREATER_EQUAL "1.3") set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} Adw_1_3) endif() diff --git a/main/meson.build b/main/meson.build index 95deabfd..69044a1f 100644 --- a/main/meson.build +++ b/main/meson.build @@ -113,9 +113,6 @@ c_args = [ vala_args = [ '--vapidir', meson.current_source_dir() / 'vapi', ] -if dep_libadwaita.version() == 'unknown' or dep_libadwaita.version().version_compare('>=1.2') - vala_args += ['-D', 'Adw_1_2'] -endif if dep_gtk4.version() == 'unknown' or dep_gtk4.version().version_compare('>=4.6') vala_args += ['-D', 'GTK_4_6'] endif diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index d0fde297..9d69c10b 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -259,17 +259,11 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application { case "0.4": version = @"$version - Ilulissat"; break; } } -#if Adw_1_2 + Adw.AboutWindow about_window = new Adw.AboutWindow(); about_window.application_icon = "im.dino.Dino"; about_window.application_name = "Dino"; about_window.issue_url = "https://github.com/dino/dino/issues"; -#else - Gtk.AboutDialog about_window = new Gtk.AboutDialog(); - about_window.logo_icon_name = "im.dino.Dino"; - about_window.program_name = "Dino"; - about_window.website_label = "dino.im"; -#endif about_window.destroy_with_parent = true; about_window.transient_for = window; about_window.modal = true; diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala index 519aa01f..27472585 100644 --- a/main/src/ui/conversation_content_view/conversation_view.vala +++ b/main/src/ui/conversation_content_view/conversation_view.vala @@ -301,18 +301,9 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug } private Adw.Animation scroll_animation(double target) { -#if ADW_1_2 return new Adw.TimedAnimation(scrolled, scrolled.vadjustment.value, target, 500, new Adw.PropertyAnimationTarget(scrolled.vadjustment, "value") ); -#else - return new Adw.TimedAnimation(scrolled, scrolled.vadjustment.value, target, 500, - new Adw.CallbackAnimationTarget(value => { - scrolled.vadjustment.value = value; - }) - ); -#endif - } public void initialize_around_message(Conversation conversation, ContentItem content_item) { diff --git a/main/src/windows/preferences_window/account_preferences_subpage.vala b/main/src/windows/preferences_window/account_preferences_subpage.vala index a1966e34..a462666d 100644 --- a/main/src/windows/preferences_window/account_preferences_subpage.vala +++ b/main/src/windows/preferences_window/account_preferences_subpage.vala @@ -52,10 +52,8 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { show_remove_account_dialog(); }); enter_password_button.clicked.connect(() => { - - var password = new PasswordEntry() { show_peek_icon=true }; -#if Adw_1_2 var dialog = new Adw.MessageDialog((Window)this.get_root(), "Enter password for %s".printf(account.bare_jid.to_string()), null); + var password = new PasswordEntry() { show_peek_icon=true }; dialog.response.connect((response) => { if (response == "connect") { account.password = password.text; @@ -66,23 +64,6 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { dialog.set_extra_child(password); dialog.add_response("cancel", _("Cancel")); dialog.add_response("connect", _("Connect")); -#else - Gtk.MessageDialog dialog = new Gtk.MessageDialog ( - (Window)this.get_root(), Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL, - Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, - "Enter password for %s", account.bare_jid.to_string()); - Button ok_button = dialog.get_widget_for_response(ResponseType.OK) as Button; - ok_button.label = _("Connect"); - - dialog.response.connect((response) => { - if (response == ResponseType.OK) { - account.password = password.text; - model.reconnect_account(account); - } - dialog.close(); - }); - dialog.get_content_area().append(password); -#endif dialog.present(); }); diff --git a/meson.build b/meson.build index 23a7b3d1..2a904c2c 100644 --- a/meson.build +++ b/meson.build @@ -31,7 +31,7 @@ dep_gstreamer_rtp = dependency('gstreamer-rtp-1.0', disabler: true, required: ge dep_gstreamer_video = dependency('gstreamer-video-1.0', disabler: true, required: get_option('plugin-rtp')) dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') -dep_libadwaita = dependency('libadwaita-1') +dep_libadwaita = dependency('libadwaita-1', version: '>=1.2') dep_libcanberra = dependency('libcanberra', disabler: true, required: get_option('plugin-notification-sound')) dep_libgcrypt = dependency('libgcrypt', disabler: true, required: plugin_crypto) dep_libqrencode = dependency('libqrencode', disabler: true, required: get_option('plugin-omemo')) diff --git a/plugins/omemo/CMakeLists.txt b/plugins/omemo/CMakeLists.txt index a8920d72..410d5712 100644 --- a/plugins/omemo/CMakeLists.txt +++ b/plugins/omemo/CMakeLists.txt @@ -3,7 +3,7 @@ find_package(Gettext) include(${GETTEXT_USE_FILE}) gettext_compile(${GETTEXT_PACKAGE} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/po TARGET_NAME ${GETTEXT_PACKAGE}-translations) -find_package(Adwaita REQUIRED) +find_package(Adwaita ${Adwaita_GLOBAL_VERSION} REQUIRED) find_package(Qrencode REQUIRED) find_packages(OMEMO_PACKAGES REQUIRED Adwaita @@ -35,9 +35,6 @@ compile_gresources( SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data ) set(OMEMO_DEFINITIONS) -if(Adwaita_VERSION VERSION_GREATER_EQUAL "1.2") - set(OMEMO_DEFINITIONS ${OMEMO_DEFINITIONS} Adw_1_2) -endif() vala_precompile(OMEMO_VALA_C SOURCES diff --git a/plugins/omemo/meson.build b/plugins/omemo/meson.build index 315f69f4..05d7c265 100644 --- a/plugins/omemo/meson.build +++ b/plugins/omemo/meson.build @@ -65,8 +65,5 @@ c_args = [ vala_args = [ '--vapidir', meson.current_source_dir() / 'vapi', ] -if dep_libadwaita.version() == 'unknown' or dep_libadwaita.version().version_compare('>=1.2') - vala_args += ['-D', 'Adw_1_2'] -endif lib_omemo = shared_library('omemo', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') dep_omemo = declare_dependency(link_with: lib_omemo, include_directories: include_directories('.')) diff --git a/plugins/omemo/src/ui/encryption_preferences_entry.vala b/plugins/omemo/src/ui/encryption_preferences_entry.vala index 7997f04d..71cd68ec 100644 --- a/plugins/omemo/src/ui/encryption_preferences_entry.vala +++ b/plugins/omemo/src/ui/encryption_preferences_entry.vala @@ -155,15 +155,10 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { copy_button.clicked.connect(() => { copy_button.get_clipboard().set_text(fingerprint); }); own_action_box.append(copy_button); - Adw.ActionRow action_row = new Adw.ActionRow(); - + Adw.ActionRow action_row = new Adw.ActionRow() { use_markup = true }; action_row.title = "This device"; - action_row.subtitle = format_fingerprint(fingerprint_from_base64(own_b64)); - action_row.add_suffix(own_action_box); -#if Adw_1_2 - action_row.use_markup = true; action_row.subtitle = fingerprint_markup(fingerprint_from_base64(own_b64)); -#endif + action_row.add_suffix(own_action_box); add_key_row(action_row); // Create and set QR code popover @@ -209,7 +204,7 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { } if (device[plugin.db.identity_meta.now_active]) { - Adw.ActionRow action_row = new Adw.ActionRow(); + Adw.ActionRow action_row = new Adw.ActionRow() { use_markup = true }; action_row.activated.connect(() => { Row updated_device = plugin.db.identity_meta.get_device(device[plugin.db.identity_meta.identity_id], device[plugin.db.identity_meta.address_name], device[plugin.db.identity_meta.device_id]); ManageKeyDialog manage_dialog = new ManageKeyDialog(updated_device, plugin.db); @@ -222,7 +217,7 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { }); action_row.activatable = true; action_row.title = "Other device"; - action_row.subtitle = format_fingerprint(fingerprint_from_base64(key_base64)); + action_row.subtitle = fingerprint_markup(fingerprint_from_base64(key_base64)); string trust_str = _("Accepted"); switch(trust) { case TrustLevel.UNTRUSTED: @@ -234,10 +229,6 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { } action_row.add_suffix(new Label(trust_str)); -#if Adw_1_2 - action_row.use_markup = true; - action_row.subtitle = fingerprint_markup(fingerprint_from_base64(key_base64)); -#endif add_key_row(action_row); } displayed_ids.add(device[plugin.db.identity_meta.device_id]); @@ -281,14 +272,9 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { } private void add_new_fingerprint(Row device) { - Adw.ActionRow action_row = new Adw.ActionRow(); + Adw.ActionRow action_row = new Adw.ActionRow() { use_markup = true }; action_row.title = _("New device"); - action_row.subtitle = format_fingerprint(fingerprint_from_base64(device[plugin.db.identity_meta.identity_key_public_base64])); - -#if Adw_1_2 - action_row.use_markup = true; action_row.subtitle = fingerprint_markup(fingerprint_from_base64(device[plugin.db.identity_meta.identity_key_public_base64])); -#endif Button accept_button = new Button() { visible = true, valign = Align.CENTER, hexpand = true }; accept_button.set_icon_name("emblem-ok-symbolic"); // using .image = sets .image-button. Together with .suggested/destructive action that breaks the button Adwaita -- cgit v1.2.3-70-g09d2