[gnome-software: 1/5] shell: Make gs_shell_modal_dialog_present() use GtkWindow
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/5] shell: Make gs_shell_modal_dialog_present() use GtkWindow
- Date: Tue, 27 Jul 2021 11:55:09 +0000 (UTC)
commit 7c76ba7b1d79fed36d87330739a915b345855cb7
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Jul 23 13:21:03 2021 +0200
shell: Make gs_shell_modal_dialog_present() use GtkWindow
There is no point in using GtkDialog for it. This is needed to later
make some pseudo-dialogs not inherit from GtkDialog.
src/gs-application.c | 4 ++--
src/gs-details-page.c | 6 +++---
src/gs-page.c | 6 +++---
src/gs-shell.c | 22 +++++++++++-----------
src/gs-shell.h | 2 +-
src/gs-updates-page.c | 6 +++---
src/gs-updates-section.c | 2 +-
7 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 76979c38d..2ddfaadfc 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -238,7 +238,7 @@ gs_application_show_first_run_dialog (GsApplication *app)
if (g_settings_get_boolean (app->settings, "first-run") == TRUE) {
dialog = gs_first_run_dialog_new ();
- gs_shell_modal_dialog_present (app->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (app->shell, GTK_WINDOW (dialog));
g_settings_set_boolean (app->settings, "first-run", FALSE);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
@@ -379,7 +379,7 @@ about_activated (GSimpleAction *action,
gtk_about_dialog_set_comments (dialog, _("A nice way to manage the "
"software on your system."));
- gs_shell_modal_dialog_present (app->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (app->shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 0060dd734..ded39af73 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -594,7 +594,7 @@ gs_details_page_history_cb (GtkLabel *label,
dialog = gs_history_dialog_new ();
gs_history_dialog_set_app (GS_HISTORY_DIALOG (dialog), self->app);
- gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
@@ -1238,7 +1238,7 @@ version_history_list_row_activated_cb (GtkListBox *list_box,
dialog = gs_app_version_history_dialog_new (GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET
(list_box), GTK_TYPE_WINDOW)),
self->app);
- gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
@@ -2001,7 +2001,7 @@ gs_details_page_write_review_cb (GtkButton *button,
dialog = gs_review_dialog_new ();
g_signal_connect (dialog, "response",
G_CALLBACK (gs_details_page_review_response_cb), self);
- gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
}
static void
diff --git a/src/gs-page.c b/src/gs-page.c
index 8792852f9..92a90d0ca 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -119,7 +119,7 @@ gs_page_show_update_message (GsPageHelper *helper, AsScreenshot *ss)
/* handle this async */
g_signal_connect (dialog, "response",
G_CALLBACK (gs_page_update_app_response_close_cb), helper);
- gs_shell_modal_dialog_present (priv->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (priv->shell, GTK_WINDOW (dialog));
}
static void
@@ -383,7 +383,7 @@ gs_page_needs_user_action (GsPageHelper *helper, AsScreenshot *ss)
/* handle this async */
g_signal_connect (dialog, "response",
G_CALLBACK (gs_page_update_app_response_cb), helper);
- gs_shell_modal_dialog_present (priv->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (priv->shell, GTK_WINDOW (dialog));
}
void
@@ -523,7 +523,7 @@ gs_page_remove_app (GsPage *page, GsApp *app, GCancellable *cancellable)
/* handle this async */
g_signal_connect (dialog, "response",
G_CALLBACK (gs_page_remove_app_response_cb), helper);
- gs_shell_modal_dialog_present (priv->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (priv->shell, GTK_WINDOW (dialog));
}
static void
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 0a4205e2f..24b43d12b 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -135,7 +135,7 @@ modal_dialog_unmapped_cb (GtkWidget *dialog,
}
void
-gs_shell_modal_dialog_present (GsShell *shell, GtkDialog *dialog)
+gs_shell_modal_dialog_present (GsShell *shell, GtkWindow *window)
{
GtkWindow *parent;
@@ -148,16 +148,16 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkDialog *dialog)
parent = GTK_WINDOW (shell);
g_debug ("using main window");
}
- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+ gtk_window_set_transient_for (window, parent);
/* add to stack, transfer ownership to here */
- g_ptr_array_add (shell->modal_dialogs, dialog);
- g_signal_connect (GTK_WIDGET (dialog), "unmap",
+ g_ptr_array_add (shell->modal_dialogs, window);
+ g_signal_connect (GTK_WIDGET (window), "unmap",
G_CALLBACK (modal_dialog_unmapped_cb), shell);
/* present the new one */
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_present (GTK_WINDOW (dialog));
+ gtk_window_set_modal (window, TRUE);
+ gtk_window_present (window);
}
void
@@ -265,7 +265,7 @@ gs_shell_metered_updates_bar_response_cb (GtkInfoBar *info_bar,
GtkDialog *dialog;
dialog = GTK_DIALOG (gs_metered_data_dialog_new (GTK_WINDOW (shell)));
- gs_shell_modal_dialog_present (shell, dialog);
+ gs_shell_modal_dialog_present (shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
@@ -407,7 +407,7 @@ gs_shell_basic_auth_start_cb (GsPluginLoader *plugin_loader,
GtkWidget *dialog;
dialog = gs_basic_auth_dialog_new (GTK_WINDOW (shell), remote, realm, callback, callback_data);
- gs_shell_modal_dialog_present (shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
@@ -2235,7 +2235,7 @@ gs_shell_show_installed_updates (GsShell *shell)
dialog = gs_update_dialog_new (shell->plugin_loader);
gs_update_dialog_show_installed_updates (GS_UPDATE_DIALOG (dialog));
- gs_shell_modal_dialog_present (shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (shell, GTK_WINDOW (dialog));
}
void
@@ -2248,7 +2248,7 @@ gs_shell_show_sources (GsShell *shell)
return;
dialog = gs_repos_dialog_new (GTK_WINDOW (shell), shell->plugin_loader);
- gs_shell_modal_dialog_present (shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
@@ -2261,7 +2261,7 @@ gs_shell_show_prefs (GsShell *shell)
GtkWidget *dialog;
dialog = gs_prefs_dialog_new (GTK_WINDOW (shell), shell->plugin_loader);
- gs_shell_modal_dialog_present (shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (shell, GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
diff --git a/src/gs-shell.h b/src/gs-shell.h
index cf3773f98..bb39fc928 100644
--- a/src/gs-shell.h
+++ b/src/gs-shell.h
@@ -53,7 +53,7 @@ void gs_shell_reset_state (GsShell *shell);
void gs_shell_set_mode (GsShell *shell,
GsShellMode mode);
void gs_shell_modal_dialog_present (GsShell *shell,
- GtkDialog *dialog);
+ GtkWindow *window);
GsShellMode gs_shell_get_mode (GsShell *shell);
const gchar *gs_shell_get_mode_string (GsShell *shell);
void gs_shell_install (GsShell *shell,
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index 606f8d7cb..82bcea90d 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -848,7 +848,7 @@ gs_updates_page_button_refresh_cb (GtkWidget *widget,
g_signal_connect (dialog, "response",
G_CALLBACK (gs_updates_page_refresh_confirm_cb),
self);
- gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
/* no network connection */
} else {
@@ -872,7 +872,7 @@ gs_updates_page_button_refresh_cb (GtkWidget *widget,
g_signal_connect (dialog, "response",
G_CALLBACK (gs_updates_page_refresh_confirm_cb),
self);
- gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
}
}
@@ -1105,7 +1105,7 @@ gs_updates_page_upgrade_install_cb (GsUpgradeBanner *upgrade_banner,
self);
gs_removal_dialog_show_upgrade_removals (GS_REMOVAL_DIALOG (dialog),
upgrade);
- gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
}
static void
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index 5ce435a84..73166121b 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -530,7 +530,7 @@ _app_row_activated_cb (GtkListBox *list_box, GtkListBoxRow *row, GsUpdatesSectio
dialog = gs_update_dialog_new (self->plugin_loader);
gs_update_dialog_show_update_details (GS_UPDATE_DIALOG (dialog), app);
- gs_shell_modal_dialog_present (gs_page_get_shell (self->page), GTK_DIALOG (dialog));
+ gs_shell_modal_dialog_present (gs_page_get_shell (self->page), GTK_WINDOW (dialog));
/* just destroy */
g_signal_connect_swapped (dialog, "response",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]