|
|
f09075 |
From 76f5e0e98a86e5a91f636ae2fb74c5b6663208ab Mon Sep 17 00:00:00 2001
|
|
|
f09075 |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
f09075 |
Date: Wed, 8 Jan 2014 19:25:03 -0500
|
|
|
f09075 |
Subject: [PATCH 2/2] Make dialog work with --xid again
|
|
|
f09075 |
|
|
|
f09075 |
When triggering an async operation from a GApplicationCommandline,
|
|
|
f09075 |
we must use g_application_hold/release to ensure the application
|
|
|
f09075 |
instance stays around until the operation is done.
|
|
|
f09075 |
|
|
|
f09075 |
https://bugzilla.gnome.org/show_bug.cgi?id=721278
|
|
|
f09075 |
---
|
|
|
f09075 |
src/disks/gduapplication.c | 4 +++-
|
|
|
f09075 |
src/disks/gduformatvolumedialog.c | 19 +++++++++++++++----
|
|
|
f09075 |
src/disks/gduformatvolumedialog.h | 4 +++-
|
|
|
f09075 |
3 files changed, 21 insertions(+), 6 deletions(-)
|
|
|
f09075 |
|
|
|
f09075 |
diff --git a/src/disks/gduapplication.c b/src/disks/gduapplication.c
|
|
|
f09075 |
index 1334d28..78d6272 100644
|
|
|
f09075 |
--- a/src/disks/gduapplication.c
|
|
|
f09075 |
+++ b/src/disks/gduapplication.c
|
|
|
f09075 |
@@ -251,7 +251,9 @@ gdu_application_command_line (GApplication *_app,
|
|
|
f09075 |
}
|
|
|
f09075 |
else if (opt_format)
|
|
|
f09075 |
{
|
|
|
f09075 |
- gdu_format_volume_dialog_show_for_xid (app->client, opt_xid, object_to_select);
|
|
|
f09075 |
+ g_application_hold (_app);
|
|
|
f09075 |
+ gdu_format_volume_dialog_show_for_xid (app->client, opt_xid, object_to_select,
|
|
|
f09075 |
+ (GCallback)g_application_release, _app);
|
|
|
f09075 |
}
|
|
|
f09075 |
|
|
|
f09075 |
|
|
|
f09075 |
diff --git a/src/disks/gduformatvolumedialog.c b/src/disks/gduformatvolumedialog.c
|
|
|
f09075 |
index f741ade..2e0ca79 100644
|
|
|
f09075 |
--- a/src/disks/gduformatvolumedialog.c
|
|
|
f09075 |
+++ b/src/disks/gduformatvolumedialog.c
|
|
|
f09075 |
@@ -33,11 +33,16 @@ typedef struct
|
|
|
f09075 |
|
|
|
f09075 |
GtkWidget *contents_box;
|
|
|
f09075 |
GtkWidget *create_filesystem_widget;
|
|
|
f09075 |
+
|
|
|
f09075 |
+ GCallback finished_cb;
|
|
|
f09075 |
+ gpointer cb_data;
|
|
|
f09075 |
} FormatVolumeData;
|
|
|
f09075 |
|
|
|
f09075 |
static void
|
|
|
f09075 |
format_volume_data_free (FormatVolumeData *data)
|
|
|
f09075 |
{
|
|
|
f09075 |
+ if (data->finished_cb)
|
|
|
f09075 |
+ ((GDestroyNotify) data->finished_cb) (data->cb_data);
|
|
|
f09075 |
g_clear_object (&data->parent_window);
|
|
|
f09075 |
g_object_unref (data->object);
|
|
|
f09075 |
g_object_unref (data->block);
|
|
|
f09075 |
@@ -144,13 +149,17 @@ static void
|
|
|
f09075 |
gdu_format_volume_dialog_show_internal (UDisksClient *client,
|
|
|
f09075 |
GtkWindow *parent_window,
|
|
|
f09075 |
gint parent_xid,
|
|
|
f09075 |
- UDisksObject *object)
|
|
|
f09075 |
+ UDisksObject *object,
|
|
|
f09075 |
+ GCallback finished_cb,
|
|
|
f09075 |
+ gpointer cb_data)
|
|
|
f09075 |
{
|
|
|
f09075 |
GduApplication *app = GDU_APPLICATION (g_application_get_default ());
|
|
|
f09075 |
FormatVolumeData *data;
|
|
|
f09075 |
gint response;
|
|
|
f09075 |
|
|
|
f09075 |
data = g_new0 (FormatVolumeData, 1);
|
|
|
f09075 |
+ data->finished_cb = finished_cb;
|
|
|
f09075 |
+ data->cb_data = cb_data;
|
|
|
f09075 |
data->parent_window = (parent_window != NULL) ? g_object_ref (parent_window) : NULL;
|
|
|
f09075 |
data->object = g_object_ref (object);
|
|
|
f09075 |
data->block = udisks_object_get_block (object);
|
|
|
f09075 |
@@ -250,9 +259,11 @@ gdu_format_volume_dialog_show_internal (UDisksClient *client,
|
|
|
f09075 |
void
|
|
|
f09075 |
gdu_format_volume_dialog_show_for_xid (UDisksClient *client,
|
|
|
f09075 |
gint xid,
|
|
|
f09075 |
- UDisksObject *object)
|
|
|
f09075 |
+ UDisksObject *object,
|
|
|
f09075 |
+ GCallback finished_cb,
|
|
|
f09075 |
+ gpointer cb_data)
|
|
|
f09075 |
{
|
|
|
f09075 |
- gdu_format_volume_dialog_show_internal (client, NULL, xid, object);
|
|
|
f09075 |
+ gdu_format_volume_dialog_show_internal (client, NULL, xid, object, finished_cb, cb_data);
|
|
|
f09075 |
}
|
|
|
f09075 |
|
|
|
f09075 |
void
|
|
|
f09075 |
@@ -260,5 +271,5 @@ gdu_format_volume_dialog_show (GduWindow *window,
|
|
|
f09075 |
UDisksObject *object)
|
|
|
f09075 |
{
|
|
|
f09075 |
gdu_format_volume_dialog_show_internal (gdu_window_get_client (window), GTK_WINDOW (window),
|
|
|
f09075 |
- -1, object);
|
|
|
f09075 |
+ -1, object, NULL, NULL);
|
|
|
f09075 |
}
|
|
|
f09075 |
diff --git a/src/disks/gduformatvolumedialog.h b/src/disks/gduformatvolumedialog.h
|
|
|
f09075 |
index 62a43ef..3721fbb 100644
|
|
|
f09075 |
--- a/src/disks/gduformatvolumedialog.h
|
|
|
f09075 |
+++ b/src/disks/gduformatvolumedialog.h
|
|
|
f09075 |
@@ -19,7 +19,9 @@ void gdu_format_volume_dialog_show (GduWindow *window,
|
|
|
f09075 |
UDisksObject *object);
|
|
|
f09075 |
void gdu_format_volume_dialog_show_for_xid (UDisksClient *client,
|
|
|
f09075 |
gint xid,
|
|
|
f09075 |
- UDisksObject *object);
|
|
|
f09075 |
+ UDisksObject *object,
|
|
|
f09075 |
+ GCallback finished_cb,
|
|
|
f09075 |
+ gpointer cb_data);
|
|
|
f09075 |
|
|
|
f09075 |
G_END_DECLS
|
|
|
f09075 |
|
|
|
f09075 |
--
|
|
|
f09075 |
1.8.4.2
|
|
|
f09075 |
|