diff --git a/.circleci/config.yml b/.circleci/config.yml index 09807970..52b0f0de 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,9 @@ version: 2.0 jobs: - ubuntu2304: + ubuntu2404: docker: - - image: ubuntu:23.04 + - image: ubuntu:24.04 steps: - checkout - run: apt update && DEBIAN_FRONTEND=noninteractive apt -y install git gcc clang cmake libgcrypt20-dev libgtk-3-dev libzip-dev libjansson-dev libpng-dev libzbar-dev libprotobuf-c-dev libsecret-1-dev uuid-dev libprotobuf-dev libqrencode-dev @@ -50,7 +50,7 @@ workflows: version: 2 build: jobs: - - ubuntu2304 + - ubuntu2404 - ubuntuLatestRolling - debianLatestStable - fedoraLatestStable diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bdcf854..d846d7ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(OTPClient VERSION "3.5.0" LANGUAGES "C") +project(OTPClient VERSION "3.5.1" LANGUAGES "C") include(GNUInstallDirs) configure_file("src/common/version.h.in" "version.h") @@ -264,6 +264,8 @@ install(FILES data/com.github.paolostivanin.OTPClient.desktop DESTINATION share/ install(FILES data/com.github.paolostivanin.OTPClient.appdata.xml DESTINATION share/metainfo) install(FILES src/ui/otpclient.ui DESTINATION share/otpclient) +install(FILES src/ui/add_popover.ui DESTINATION share/otpclient) +install(FILES src/ui/settings_popover.ui DESTINATION share/otpclient) install(FILES src/ui/shortcuts.ui DESTINATION share/otpclient) install(FILES man/otpclient.1.gz DESTINATION share/man/man1) diff --git a/data/com.github.paolostivanin.OTPClient.appdata.xml b/data/com.github.paolostivanin.OTPClient.appdata.xml index f851dea6..11f400dc 100644 --- a/data/com.github.paolostivanin.OTPClient.appdata.xml +++ b/data/com.github.paolostivanin.OTPClient.appdata.xml @@ -89,7 +89,17 @@ - + + +

OTPClient 3.5.1 brings a small improvement and some code clean-up:

+
    +
  • NEW: add back buttons to the various popover menus
  • +
  • FIX: split popovers into their own UI files
  • +
  • FIX: remove upgrade message when upgrading from a version older than 2.6.0
  • +
+
+
+

OTPClient 3.5.0 brings some new features and improvements:

    diff --git a/.github/workflows/codeql-analysis.yml b/github_workflow_disabled/workflows/codeql-analysis.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to github_workflow_disabled/workflows/codeql-analysis.yml diff --git a/src/app.c b/src/app.c index 33ec1aed..e304fa87 100644 --- a/src/app.c +++ b/src/app.c @@ -46,18 +46,6 @@ static void create_main_window (gint width, gint height, AppData *app_data); -static gboolean show_upgrade_msg (void); - -static void set_info_bar (AppData *app_data, - const gchar *msg); - -static void on_bar_response (GtkInfoBar *ib, - gint response_id, - gpointer user_data); - -static gboolean set_action_group (GtkBuilder *builder, - AppData *app_data); - static void get_window_size_cb (GtkWidget *window, GtkAllocation *allocation, gpointer user_data); @@ -116,6 +104,8 @@ activate (GtkApplication *app, // open_db_file_action is set only on first startup and not when the db is deleted but the cfg file is there, therefore we need a default action app_data->open_db_file_action = GTK_FILE_CHOOSER_ACTION_SAVE; app_data->builder = get_builder_from_partial_path (UI_PARTIAL_PATH); + app_data->add_popover_builder = get_builder_from_partial_path (AP_PARTIAL_PATH); + app_data->settings_popover_builder = get_builder_from_partial_path (SP_PARTIAL_PATH); set_config_data (&width, &height, app_data); @@ -285,13 +275,6 @@ activate (GtkApplication *app, app_data->source_id_last_activity = g_timeout_add_seconds (1, check_inactivity, app_data); gtk_widget_show_all (app_data->main_window); - - app_data->info_bar = GTK_WIDGET(gtk_builder_get_object (app_data->builder, "info_bar_id")); - if (show_upgrade_msg ()) { - set_info_bar (app_data, _("Not asking for password? Please check the 'Secret Service Integration' new feature HERE")); - } else { - gtk_widget_hide (app_data->info_bar); - } } @@ -444,9 +427,9 @@ set_warn_data (gboolean show_warning) static void -create_main_window (gint width, - gint height, - AppData *app_data) +create_main_window (gint width, + gint height, + AppData *app_data) { app_data->main_window = GTK_WIDGET(gtk_builder_get_object (app_data->builder, "appwindow_id")); gtk_window_set_icon_name (GTK_WINDOW(app_data->main_window), "otpclient"); @@ -460,76 +443,6 @@ create_main_window (gint width, gtk_widget_set_sensitive (lock_btn, FALSE); } - set_action_group (app_data->builder, app_data); -} - - -static gboolean -show_upgrade_msg (void) -{ - gboolean show_msg = TRUE; - GKeyFile *kf = get_kf_ptr (); - if (kf != NULL) { - gchar *up_msg = g_key_file_get_string (kf, "config", "upgrade_msg", NULL); - if (up_msg == NULL) { - show_msg = TRUE; - } else { - show_msg = (g_strcmp0 (up_msg, "v2_6") == 0) ? FALSE : TRUE; - } - } - - g_key_file_free (kf); - - return show_msg; -} - - -static void -set_info_bar (AppData *app_data, - const gchar *msg) -{ - GtkWidget *label = GTK_WIDGET(gtk_builder_get_object (app_data->builder, "info_bar_label_id")); - - g_signal_connect (app_data->info_bar, "response", G_CALLBACK(on_bar_response), NULL); - - gtk_label_set_markup (GTK_LABEL(label), msg); - gtk_info_bar_set_message_type (GTK_INFO_BAR(app_data->info_bar), GTK_MESSAGE_INFO); - gtk_widget_show (app_data->info_bar); -} - - -static void -on_bar_response (GtkInfoBar *ib, - gint response_id __attribute__((unused)), - gpointer user_data __attribute__((unused))) -{ - GError *err = NULL; - GKeyFile *kf = get_kf_ptr (); - if (kf != NULL) { - g_key_file_set_string (kf, "config", "upgrade_msg", "v2_6"); - gchar *cfg_file_path; -#ifndef USE_FLATPAK_APP_FOLDER - cfg_file_path = g_build_filename (g_get_user_config_dir (), "otpclient.cfg", NULL); -#else - cfg_file_path = g_build_filename (g_get_user_data_dir (), "otpclient.cfg", NULL); -#endif - if (!g_key_file_save_to_file (kf, cfg_file_path, &err)) { - g_printerr ("%s\n", err->message); - g_clear_error (&err); - } - g_free (cfg_file_path); - } - - g_key_file_free (kf); - - gtk_widget_hide (GTK_WIDGET(ib)); -} - - -static gboolean -set_action_group (GtkBuilder *builder, - AppData *app_data) -{ static GActionEntry settings_menu_entries[] = { { .name = ANDOTP_IMPORT_ACTION_NAME, .activate = select_file_cb }, { .name = ANDOTP_IMPORT_PLAIN_ACTION_NAME, .activate = select_file_cb }, @@ -569,20 +482,20 @@ set_action_group (GtkBuilder *builder, { .name = "manual", .activate = manual_add_cb } }; - GtkWidget *settings_popover = GTK_WIDGET (gtk_builder_get_object (builder, "settings_pop_id")); + GtkWidget *settings_popover = GTK_WIDGET(gtk_builder_get_object (app_data->settings_popover_builder, "settings_pop_id")); + gtk_menu_button_set_popover (GTK_MENU_BUTTON(gtk_builder_get_object (app_data->builder, "settings_btn_id")), settings_popover); GActionGroup *settings_actions = (GActionGroup *)g_simple_action_group_new (); - g_action_map_add_action_entries (G_ACTION_MAP (settings_actions), settings_menu_entries, G_N_ELEMENTS (settings_menu_entries), app_data); + g_action_map_add_action_entries (G_ACTION_MAP(settings_actions), settings_menu_entries, G_N_ELEMENTS (settings_menu_entries), app_data); gtk_widget_insert_action_group (settings_popover, "settings_menu", settings_actions); - GtkWidget *add_popover = GTK_WIDGET (gtk_builder_get_object (builder, "add_pop_id")); + GtkWidget *add_popover = GTK_WIDGET(gtk_builder_get_object (app_data->add_popover_builder, "add_pop_id")); + gtk_menu_button_set_popover (GTK_MENU_BUTTON(gtk_builder_get_object (app_data->builder, "add_btn_main_id")), add_popover); GActionGroup *add_actions = (GActionGroup *)g_simple_action_group_new (); - g_action_map_add_action_entries (G_ACTION_MAP (add_actions), add_menu_entries, G_N_ELEMENTS (add_menu_entries), app_data); + g_action_map_add_action_entries (G_ACTION_MAP(add_actions), add_menu_entries, G_N_ELEMENTS (add_menu_entries), app_data); gtk_widget_insert_action_group (add_popover, "add_menu", add_actions); gtk_popover_set_constrain_to (GTK_POPOVER(add_popover), GTK_POPOVER_CONSTRAINT_NONE); gtk_popover_set_constrain_to (GTK_POPOVER(settings_popover), GTK_POPOVER_CONSTRAINT_NONE); - - return TRUE; } @@ -765,6 +678,8 @@ destroy_cb (GtkWidget *window, #pragma GCC diagnostic pop save_window_size (w, h); g_object_unref (app_data->builder); + g_object_unref (app_data->add_popover_builder); + g_object_unref (app_data->settings_popover_builder); g_free (app_data); gcry_control (GCRYCTL_TERM_SECMEM); } diff --git a/src/data.h b/src/data.h index 6d3d33a9..5aa60aa8 100644 --- a/src/data.h +++ b/src/data.h @@ -29,6 +29,8 @@ typedef struct db_data_t { typedef struct app_data_t { GtkBuilder *builder; + GtkBuilder *add_popover_builder; + GtkBuilder *settings_popover_builder; GtkWidget *main_window; GtkWidget *info_bar; diff --git a/src/get-builder.h b/src/get-builder.h index b3c55258..c301c857 100644 --- a/src/get-builder.h +++ b/src/get-builder.h @@ -3,6 +3,8 @@ G_BEGIN_DECLS #define UI_PARTIAL_PATH "share/otpclient/otpclient.ui" +#define AP_PARTIAL_PATH "share/otpclient/add_popover.ui" +#define SP_PARTIAL_PATH "share/otpclient/settings_popover.ui" GtkBuilder *get_builder_from_partial_path (const gchar *partial_path); diff --git a/src/ui/add_popover.ui b/src/ui/add_popover.ui new file mode 100644 index 00000000..42d29005 --- /dev/null +++ b/src/ui/add_popover.ui @@ -0,0 +1,116 @@ + + + + + + False + + + True + False + vertical + + + True + True + True + True + True + main + Back + + + False + True + 0 + + + + + True + True + True + add_menu.import_qr_file + From file + + + False + True + 1 + + + + + True + True + True + add_menu.import_qr_clipboard + From clipboard + + + False + True + 2 + + + + + import_qr_menu + 1 + + + + + True + False + vertical + + + True + True + True + add_menu.webcam + Scan using webcam + + + False + True + 0 + + + + + True + True + True + Using a QR Code + import_qr_menu + + + False + True + 2 + + + + + True + True + True + add_menu.manual + Manually + + + False + True + 3 + + + + + main + 2 + + + + \ No newline at end of file diff --git a/src/ui/otpclient.ui b/src/ui/otpclient.ui index 4d2eb7ff..e6458751 100644 --- a/src/ui/otpclient.ui +++ b/src/ui/otpclient.ui @@ -2,101 +2,6 @@ - - False - - - True - False - vertical - - - True - True - True - add_menu.import_qr_file - From file - - - False - True - 0 - - - - - True - True - True - add_menu.import_qr_clipboard - From clipboard - - - False - True - 2 - - - - - import_qr_menu - 1 - - - - - True - False - vertical - - - True - True - True - add_menu.webcam - Scan using webcam - - - False - True - 0 - - - - - True - True - True - Using a QR Code - import_qr_menu - - - False - True - 2 - - - - - True - True - True - add_menu.manual - Manually - - - False - True - 3 - - - - - main - 2 - - - False 5 @@ -2134,502 +2039,6 @@ but not the number of digits and/or the period/counter. settings_diag_ok_btn_id - - False - - - True - False - vertical - - - True - True - True - settings_menu.import_andotp - andOTP (encrypted) - - - False - True - 0 - - - - - True - True - True - settings_menu.import_andotp_plain - andOTP (plain) - - - False - True - 1 - - - - - True - True - True - settings_menu.import_freeotpplus - FreeOTP+ (key URI) - - - False - True - 2 - - - - - True - True - True - settings_menu.import_aegis_enc - Aegis (encrypted json) - - - False - True - 3 - - - - - True - True - True - settings_menu.import_aegis - Aegis (plain json) - - - False - True - 4 - - - - - True - True - True - settings_menu.import_authpro_enc - Authenticator Pro (encrypted) - - - False - True - 5 - - - - - True - True - True - settings_menu.import_authpro_plain - Authenticator Pro (plain json) - - - False - True - 6 - - - - - True - True - True - settings_menu.import_twofas_enc - 2FAS (encrypted json) - - - False - True - 7 - - - - - True - True - True - settings_menu.import_twofas_plain - 2FAS (plain json) - - - False - True - 8 - - - - - - True - True - True - Google Migration QR - import_google_qr_menu - - - False - True - 9 - - - - - import_menu - 1 - - - - - True - False - vertical - - - True - True - True - settings_menu.export_andotp - andOTP (encrypted) - - - False - True - 0 - - - - - True - True - True - settings_menu.export_andotp_plain - andOTP (plain) - - - False - True - 1 - - - - - True - True - True - settings_menu.export_freeotpplus - FreeOTP+ (key URI) - - - False - True - 2 - - - - - True - True - True - settings_menu.export_aegis - Aegis (encrypted json) - - - False - True - 3 - - - - - True - True - True - settings_menu.export_aegis_plain - Aegis (plain json) - - - False - True - 4 - - - - - True - True - True - settings_menu.export_authpro_enc - Authenticator Pro (encrypted) - - - False - True - 5 - - - - - True - True - True - settings_menu.export_authpro_plain - Authenticator Pro (plain json) - - - False - True - 6 - - - - - True - True - True - settings_menu.export_twofas_enc - 2FAS (encrypted json) - - - False - True - 7 - - - - - True - True - True - settings_menu.export_twofas_plain - 2FAS (plain json) - - - False - True - 8 - - - - - export_menu - 2 - - - - - True - False - vertical - - - True - True - True - Import - import_menu - - - False - True - 0 - - - - - True - True - True - Export - export_menu - - - False - True - 1 - - - - - True - True - True - settings_menu.create_newdb - New database - - - False - True - 2 - - - - - True - True - True - settings_menu.change_db - Change database - - - False - True - 3 - - - - - True - True - True - settings_menu.change_pwd - Change password - - - False - True - 4 - - - - - True - True - True - settings_menu.edit_row - Edit row - - - False - True - 5 - - - - - True - True - True - settings_menu.show_qr - Show QR-Code - - - False - True - 6 - - - - - True - True - True - settings_menu.settings - Settings - - - False - True - 7 - - - - - True - True - True - settings_menu.shortcuts - Keyboard shortcuts - - - False - True - 8 - - - - - True - True - True - settings_menu.dbinfo - Database info - - - False - True - 9 - - - - - True - True - True - settings_menu.about - About - - - False - True - 10 - - - - - main - 3 - - - - - True - False - vertical - - - True - True - True - settings_menu.import_google_qr_file - From file - - - False - True - 0 - - - - - True - True - True - settings_menu.import_google_qr_webcam - From webcam - - - False - True - 1 - - - - - import_google_qr_menu - 4 - - - False center @@ -2641,67 +2050,6 @@ but not the number of digits and/or the period/counter. True False vertical - - - False - vertical - - - False - 6 - end - - - OK - True - True - True - - - True - True - 0 - - - - - False - False - 0 - - - - - False - 16 - - - True - False - - - False - True - 0 - - - - - False - False - 0 - - - - info_bar_ok_btn_id - - - - False - False - 0 - - True @@ -2750,7 +2098,6 @@ but not the number of digits and/or the period/counter. True True Add token - add_pop_id True @@ -2805,7 +2152,6 @@ but not the number of digits and/or the period/counter. True True Settings - settings_pop_id True diff --git a/src/ui/settings_popover.ui b/src/ui/settings_popover.ui new file mode 100644 index 00000000..729e320b --- /dev/null +++ b/src/ui/settings_popover.ui @@ -0,0 +1,548 @@ + + + + + + False + + + True + False + vertical + + + True + True + True + True + True + main + Back + + + False + True + 0 + + + + + True + True + True + settings_menu.import_andotp + andOTP (encrypted) + + + False + True + 1 + + + + + True + True + True + settings_menu.import_andotp_plain + andOTP (plain) + + + False + True + 2 + + + + + True + True + True + settings_menu.import_freeotpplus + FreeOTP+ (key URI) + + + False + True + 3 + + + + + True + True + True + settings_menu.import_aegis_enc + Aegis (encrypted json) + + + False + True + 4 + + + + + True + True + True + settings_menu.import_aegis + Aegis (plain json) + + + False + True + 5 + + + + + True + True + True + settings_menu.import_authpro_enc + Authenticator Pro (encrypted) + + + False + True + 6 + + + + + True + True + True + settings_menu.import_authpro_plain + Authenticator Pro (plain json) + + + False + True + 7 + + + + + True + True + True + settings_menu.import_twofas_enc + 2FAS (encrypted json) + + + False + True + 8 + + + + + True + True + True + settings_menu.import_twofas_plain + 2FAS (plain json) + + + False + True + 9 + + + + + True + True + True + Google Migration QR + import_google_qr_menu + + + False + True + 10 + + + + + import_menu + 1 + + + + + True + False + vertical + + + True + True + True + True + True + main + Back + + + False + True + 0 + + + + + True + True + True + settings_menu.export_andotp + andOTP (encrypted) + + + False + True + 1 + + + + + True + True + True + settings_menu.export_andotp_plain + andOTP (plain) + + + False + True + 2 + + + + + True + True + True + settings_menu.export_freeotpplus + FreeOTP+ (key URI) + + + False + True + 3 + + + + + True + True + True + settings_menu.export_aegis + Aegis (encrypted json) + + + False + True + 4 + + + + + True + True + True + settings_menu.export_aegis_plain + Aegis (plain json) + + + False + True + 5 + + + + + True + True + True + settings_menu.export_authpro_enc + Authenticator Pro (encrypted) + + + False + True + 6 + + + + + True + True + True + settings_menu.export_authpro_plain + Authenticator Pro (plain json) + + + False + True + 7 + + + + + True + True + True + settings_menu.export_twofas_enc + 2FAS (encrypted json) + + + False + True + 8 + + + + + True + True + True + settings_menu.export_twofas_plain + 2FAS (plain json) + + + False + True + 9 + + + + + export_menu + 2 + + + + + True + False + vertical + + + True + True + True + Import + import_menu + + + False + True + 0 + + + + + True + True + True + Export + export_menu + + + False + True + 1 + + + + + True + True + True + settings_menu.create_newdb + New database + + + False + True + 2 + + + + + True + True + True + settings_menu.change_db + Change database + + + False + True + 3 + + + + + True + True + True + settings_menu.change_pwd + Change password + + + False + True + 4 + + + + + True + True + True + settings_menu.edit_row + Edit row + + + False + True + 5 + + + + + True + True + True + settings_menu.show_qr + Show QR-Code + + + False + True + 6 + + + + + True + True + True + settings_menu.settings + Settings + + + False + True + 7 + + + + + True + True + True + settings_menu.shortcuts + Keyboard shortcuts + + + False + True + 8 + + + + + True + True + True + settings_menu.dbinfo + Database info + + + False + True + 9 + + + + + True + True + True + settings_menu.about + About + + + False + True + 10 + + + + + main + 3 + + + + + True + False + vertical + + + True + True + True + True + True + import_menu + Back + + + False + True + 0 + + + + + True + True + True + settings_menu.import_google_qr_file + From file + + + False + True + 1 + + + + + True + True + True + settings_menu.import_google_qr_webcam + From webcam + + + False + True + 2 + + + + + import_google_qr_menu + 4 + + + + \ No newline at end of file