Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtk4: mark deprecated usage #1051

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ elseif (GUI)

if (GUI AND USE_GTK4 AND GTK4_FOUND)
set(GUI_FLAVOUR "gtk4")
set(GUI_OTHER_FLAGS -Wno-deprecated-declarations)
set(GUI_OTHER_FLAGS "")

find_program(GLIB_COMPILE_RESOURCES glib-compile-resources HINTS "/usr/bin")
if(${GLIB_COMPILE_RESOURCES} STREQUAL "GLIB_COMPILE_RESOURCES-NOTFOUND")
Expand Down
4 changes: 4 additions & 0 deletions src/gtk4/option_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ void OptionDialog::OnOkayButtonClicked() {
return;
}
config::SaveConfig();
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_dialog_response(GTK_DIALOG(impl_), GTK_RESPONSE_ACCEPT);
G_GNUC_END_IGNORE_DEPRECATIONS
}

void OptionDialog::OnCancelButtonClicked() {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_dialog_response(GTK_DIALOG(impl_), GTK_RESPONSE_CANCEL);
G_GNUC_END_IGNORE_DEPRECATIONS
}

void OptionDialog::run() {
Expand Down
17 changes: 14 additions & 3 deletions src/gtk4/yass_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,24 @@ YASSWindow::YASSWindow(GApplication* app) : app_(app), impl_(yass_window_new(YAS
#undef XX
};

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkComboBoxText* method = GTK_COMBO_BOX_TEXT(impl_->method);

for (const char* method_name : method_names) {
gtk_combo_box_text_append_text(method, method_name);
}
G_GNUC_END_IGNORE_DEPRECATIONS

gtk_check_button_set_active(GTK_CHECK_BUTTON(impl_->autostart), Utils::GetAutoStart());

gtk_check_button_set_active(GTK_CHECK_BUTTON(impl_->systemproxy), Utils::GetSystemProxy());

gtk_entry_set_visibility(GTK_ENTRY(impl_->password), false);

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkStatusbar* status_bar = GTK_STATUSBAR(impl_->status_bar);
gtk_statusbar_remove_all(status_bar, 0);
gtk_statusbar_push(status_bar, 0, _("READY"));
G_GNUC_END_IGNORE_DEPRECATIONS

LoadChanges();
}
Expand Down Expand Up @@ -264,7 +267,9 @@ std::string YASSWindow::GetPassword() {
}

std::string YASSWindow::GetMethod() {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gchar* active_method = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(impl_->method));
G_GNUC_END_IGNORE_DEPRECATIONS

return make_unique_ptr_gfree(active_method).get();
}
Expand Down Expand Up @@ -416,7 +421,9 @@ void YASSWindow::LoadChanges() {
break;
}

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_combo_box_set_active(GTK_COMBO_BOX(impl_->method), i);
G_GNUC_END_IGNORE_DEPRECATIONS

gtk_editable_set_text(GTK_EDITABLE(impl_->local_host), local_host_str.c_str());
gtk_editable_set_text(GTK_EDITABLE(impl_->local_port), local_port_str.c_str());
Expand All @@ -432,8 +439,12 @@ void YASSWindow::UpdateStatusBar() {
return;
}
last_status_msg_ = status_msg;
gtk_statusbar_remove_all(GTK_STATUSBAR(impl_->status_bar), 0);
gtk_statusbar_push(GTK_STATUSBAR(impl_->status_bar), 0, last_status_msg_.c_str());

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkStatusbar* status_bar = GTK_STATUSBAR(impl_->status_bar);
gtk_statusbar_remove_all(status_bar, 0);
gtk_statusbar_push(status_bar, 0, last_status_msg_.c_str());
G_GNUC_END_IGNORE_DEPRECATIONS
}

void YASSWindow::OnClose() {
Expand Down
Loading