Skip to content

Commit

Permalink
Use GTK_IS_NATIVE_DIALOG() in tests instead of GTK_IS_WIDGET()
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed Jun 8, 2024
1 parent da3442e commit 4b1be9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions plugins/saveactions.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,19 +447,19 @@ void plugin_init(GeanyData *data)

static gint file_chooser_run(GtkFileChooser *dialog)
{
if (GTK_IS_WIDGET(dialog))
if (GTK_IS_NATIVE_DIALOG(dialog))
return gtk_native_dialog_run(GTK_NATIVE_DIALOG(dialog));
else
return gtk_dialog_run(GTK_DIALOG(dialog));

return gtk_native_dialog_run(GTK_NATIVE_DIALOG(dialog));
}


static void file_chooser_destroy(GtkFileChooser *dialog)
{
if (GTK_IS_WIDGET(dialog))
gtk_widget_destroy(GTK_WIDGET(dialog));
else
if (GTK_IS_NATIVE_DIALOG(dialog))
g_object_unref(dialog);
else
gtk_widget_destroy(GTK_WIDGET(dialog));
}


Expand Down
16 changes: 8 additions & 8 deletions src/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static gboolean open_file_dialog_handle_response(GtkFileChooser *dialog, gint re
const gchar *charset = NULL;
gboolean ro = (response == GEANY_RESPONSE_VIEW); /* View clicked */

if (GTK_IS_WIDGET(dialog))
if (!GTK_IS_NATIVE_DIALOG(dialog))
{
GtkWidget *expander = ui_lookup_widget(GTK_WIDGET(dialog), "more_options_expander");
GtkWidget *filetype_combo = ui_lookup_widget(GTK_WIDGET(dialog), "filetype_combo");
Expand Down Expand Up @@ -457,19 +457,19 @@ static void open_file_dialog_apply_settings(GtkWidget *dialog)

gint dialogs_file_chooser_run(GtkFileChooser *dialog)
{
if (GTK_IS_WIDGET(dialog))
if (GTK_IS_NATIVE_DIALOG(dialog))
return gtk_native_dialog_run(GTK_NATIVE_DIALOG(dialog));
else
return gtk_dialog_run(GTK_DIALOG(dialog));

return gtk_native_dialog_run(GTK_NATIVE_DIALOG(dialog));
}


void dialogs_file_chooser_destroy(GtkFileChooser *dialog)
{
if (GTK_IS_WIDGET(dialog))
gtk_widget_destroy(GTK_WIDGET(dialog));
else
if (GTK_IS_NATIVE_DIALOG(dialog))
g_object_unref(dialog);
else
gtk_widget_destroy(GTK_WIDGET(dialog));
}


Expand All @@ -490,7 +490,7 @@ void dialogs_show_open_file(void)
SETPTR(initdir, utils_get_locale_from_utf8(initdir));

dialog = create_open_file_dialog();
if (GTK_IS_WIDGET(dialog))
if (!GTK_IS_NATIVE_DIALOG(dialog))
open_file_dialog_apply_settings(GTK_WIDGET(dialog));

if (initdir != NULL && g_path_is_absolute(initdir))
Expand Down

0 comments on commit 4b1be9a

Please sign in to comment.