open the files from an idle handler. Opening a file may take a while (in
2008-08-05 Sven Neumann <sven@gimp.org> * app/gui/gimpdbusservice.c: open the files from an idle handler. Opening a file may take a while (in particular if it involves asking the user for input) and we need to respond to the D-Bus call before it times out. svn path=/trunk/; revision=26370
This commit is contained in:
parent
93627c517b
commit
8cf6197552
@ -1,3 +1,10 @@
|
||||
2008-08-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gui/gimpdbusservice.c: open the files from an idle handler.
|
||||
Opening a file may take a while (in particular if it involves
|
||||
asking the user for input) and we need to respond to the D-Bus
|
||||
call before it times out.
|
||||
|
||||
2008-08-04 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/paint-funcs/scale-region.c: applied patch from Geert
|
||||
|
@ -71,6 +71,44 @@ gimp_dbus_service_new (Gimp *gimp)
|
||||
return G_OBJECT (service);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Gimp *gimp;
|
||||
gchar *uri;
|
||||
gboolean as_new;
|
||||
} IdleData;
|
||||
|
||||
static IdleData *
|
||||
gimp_dbus_service_open_idle_new (GimpDBusService *service,
|
||||
const gchar *uri,
|
||||
gboolean as_new)
|
||||
{
|
||||
IdleData *data = g_slice_new (IdleData);
|
||||
|
||||
data->gimp = g_object_ref (service->gimp);
|
||||
data->uri = g_strdup (uri);
|
||||
data->as_new = as_new;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dbus_service_open_idle_free (IdleData *data)
|
||||
{
|
||||
g_object_unref (data->gimp);
|
||||
g_free (data->uri);
|
||||
|
||||
g_slice_free (IdleData, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dbus_service_open_idle (IdleData *data)
|
||||
{
|
||||
file_open_from_command_line (data->gimp, data->uri, data->as_new);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_dbus_service_open (GimpDBusService *service,
|
||||
const gchar *uri,
|
||||
@ -81,7 +119,15 @@ gimp_dbus_service_open (GimpDBusService *service,
|
||||
g_return_val_if_fail (uri != NULL, FALSE);
|
||||
g_return_val_if_fail (success != NULL, FALSE);
|
||||
|
||||
*success = file_open_from_command_line (service->gimp, uri, FALSE);
|
||||
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
(GSourceFunc) gimp_dbus_service_open_idle,
|
||||
gimp_dbus_service_open_idle_new (service, uri, FALSE),
|
||||
(GDestroyNotify) gimp_dbus_service_open_idle_free);
|
||||
|
||||
/* The call always succeeds as it is handled in one way or another.
|
||||
* Even presenting an error message is considered success ;-)
|
||||
*/
|
||||
*success = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -96,7 +142,15 @@ gimp_dbus_service_open_as_new (GimpDBusService *service,
|
||||
g_return_val_if_fail (uri != NULL, FALSE);
|
||||
g_return_val_if_fail (success != NULL, FALSE);
|
||||
|
||||
*success = file_open_from_command_line (service->gimp, uri, TRUE);
|
||||
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
(GSourceFunc) gimp_dbus_service_open_idle,
|
||||
gimp_dbus_service_open_idle_new (service, uri, TRUE),
|
||||
(GDestroyNotify) gimp_dbus_service_open_idle_free);
|
||||
|
||||
/* The call always succeeds as it is handled in one way or another.
|
||||
* Even presenting an error message is considered success ;-)
|
||||
*/
|
||||
*success = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -116,4 +170,5 @@ gimp_dbus_service_activate (GimpDBusService *service,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_DBUS_GLIB */
|
||||
|
Loading…
Reference in New Issue
Block a user