gnome-software/gnome-software-fix-app-folders.patch

132 lines
4.1 KiB
Diff
Raw Normal View History

From 53e8e0842f28533c1df3a1504191182a67e9c963 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 7 Jun 2016 15:21:53 +0200
Subject: app folder dialog: Make the dialog work again
This commit makes the code match with the .ui file changes done in
commit 5fa5a35, fixing the add folder dialog to actually add things to
folders when clicking the 'Add' button.
https://bugzilla.gnome.org/show_bug.cgi?id=764437
---
src/gs-app-folder-dialog.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/gs-app-folder-dialog.c b/src/gs-app-folder-dialog.c
index f6b3d76..563f4b4 100644
--- a/src/gs-app-folder-dialog.c
+++ b/src/gs-app-folder-dialog.c
@@ -60,12 +60,6 @@ gs_app_folder_dialog_destroy (GtkWidget *widget)
}
static void
-cancel_cb (GsAppFolderDialog *dialog)
-{
- gtk_window_close (GTK_WINDOW (dialog));
-}
-
-static void
apply_changes (GsAppFolderDialog *dialog)
{
const gchar *folder;
@@ -88,10 +82,23 @@ apply_changes (GsAppFolderDialog *dialog)
}
static void
-done_cb (GsAppFolderDialog *dialog)
+response_cb (GtkDialog *dialog,
+ GtkResponseType response_type,
+ gpointer user_data)
{
- apply_changes (dialog);
- gtk_window_close (GTK_WINDOW (dialog));
+ switch (response_type) {
+ case GTK_RESPONSE_APPLY:
+ apply_changes (GS_APP_FOLDER_DIALOG (dialog));
+ gtk_window_close (GTK_WINDOW (dialog));
+ break;
+ case GTK_RESPONSE_CANCEL:
+ gtk_window_close (GTK_WINDOW (dialog));
+ break;
+ case GTK_RESPONSE_DELETE_EVENT:
+ break;
+ default:
+ g_assert_not_reached ();
+ }
}
static GtkWidget *create_row (GsAppFolderDialog *dialog, const gchar *folder);
@@ -129,10 +136,9 @@ gs_app_folder_dialog_init (GsAppFolderDialog *dialog)
dialog->folders = gs_folders_get ();
gtk_widget_init_template (GTK_WIDGET (dialog));
- g_signal_connect_swapped (dialog->cancel_button, "clicked",
- G_CALLBACK (cancel_cb), dialog);
- g_signal_connect_swapped (dialog->done_button, "clicked",
- G_CALLBACK (done_cb), dialog);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (response_cb),
+ NULL);
dialog->rows = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
gtk_list_box_set_header_func (GTK_LIST_BOX (dialog->app_folder_list),
--
cgit v0.12
From 81c67726cb9e3dd29c961cc857c6b5b43bf9bf45 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 7 Jun 2016 15:25:40 +0200
Subject: shell: Avoid destroying modal windows in the "response" signal
handler
Other code may legitimately connect to the "response" signal handler as
well and if we destroy it in the handler, their callbacks are never
invoked. Instead, do our window tracking in the "unmap" signal handler.
https://bugzilla.gnome.org/show_bug.cgi?id=764437
---
src/gs-shell.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 73319a8..d3afcdd 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -89,17 +89,12 @@ enum {
static guint signals [SIGNAL_LAST] = { 0 };
-/**
- * gs_shell_modal_dialog_present:
- **/
static void
-gs_shell_modal_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- GsShell *shell)
+modal_dialog_unmapped_cb (GtkWidget *dialog,
+ GsShell *shell)
{
GsShellPrivate *priv = gs_shell_get_instance_private (shell);
- g_debug ("handling modal dialog response %i for %p",
- response_id, dialog);
+ g_debug ("modal dialog %p unmapped", dialog);
g_ptr_array_remove (priv->modal_dialogs, dialog);
}
@@ -125,10 +120,10 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkDialog *dialog)
/* add to stack, transfer ownership to here */
g_ptr_array_add (priv->modal_dialogs, dialog);
+ g_signal_connect (GTK_WIDGET (dialog), "unmap",
+ G_CALLBACK (modal_dialog_unmapped_cb), shell);
/* present the new one */
- g_signal_connect (dialog, "response",
- G_CALLBACK (gs_shell_modal_dialog_response_cb), shell);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_present (GTK_WINDOW (dialog));
}
--
cgit v0.12