printers: redesign the Printer Jobs Dialog
Update the Printer Jobs Dialog to match the current designs at https://wiki.gnome.org/Design/SystemSettings/Printers https://bugzilla.gnome.org/show_bug.cgi?id=755626
This commit is contained in:
parent
8ec6506a04
commit
8baaa81a39
7 changed files with 513 additions and 583 deletions
|
@ -3824,168 +3824,6 @@ cups_get_jobs_async (const gchar *printer_name,
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GCancellable *cancellable;
|
||||
JCPCallback callback;
|
||||
gpointer user_data;
|
||||
} JCPData;
|
||||
|
||||
static void
|
||||
job_cancel_purge_async_dbus_cb (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *output;
|
||||
JCPData *data = (JCPData *) user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
output = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
|
||||
res,
|
||||
&error);
|
||||
g_object_unref (source_object);
|
||||
|
||||
if (output)
|
||||
{
|
||||
g_variant_unref (output);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_cancellable_is_cancelled (data->cancellable))
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
data->callback (data->user_data);
|
||||
|
||||
if (data->cancellable)
|
||||
g_object_unref (data->cancellable);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
void
|
||||
job_cancel_purge_async (gint job_id,
|
||||
gboolean job_purge,
|
||||
GCancellable *cancellable,
|
||||
JCPCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusConnection *bus;
|
||||
JCPData *data;
|
||||
GError *error = NULL;
|
||||
|
||||
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (!bus)
|
||||
{
|
||||
g_warning ("Failed to get session bus: %s", error->message);
|
||||
g_error_free (error);
|
||||
callback (user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
data = g_new0 (JCPData, 1);
|
||||
if (cancellable)
|
||||
data->cancellable = g_object_ref (cancellable);
|
||||
data->callback = callback;
|
||||
data->user_data = user_data;
|
||||
|
||||
g_dbus_connection_call (bus,
|
||||
MECHANISM_BUS,
|
||||
"/",
|
||||
MECHANISM_BUS,
|
||||
"JobCancelPurge",
|
||||
g_variant_new ("(ib)",
|
||||
job_id,
|
||||
job_purge),
|
||||
G_VARIANT_TYPE ("(s)"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
job_cancel_purge_async_dbus_cb,
|
||||
data);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GCancellable *cancellable;
|
||||
JSHUCallback callback;
|
||||
gpointer user_data;
|
||||
} JSHUData;
|
||||
|
||||
static void
|
||||
job_set_hold_until_async_dbus_cb (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *output;
|
||||
JSHUData *data = (JSHUData *) user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
output = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
|
||||
res,
|
||||
&error);
|
||||
g_object_unref (source_object);
|
||||
|
||||
if (output)
|
||||
{
|
||||
g_variant_unref (output);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_cancellable_is_cancelled (data->cancellable))
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
data->callback (data->user_data);
|
||||
|
||||
if (data->cancellable)
|
||||
g_object_unref (data->cancellable);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
void
|
||||
job_set_hold_until_async (gint job_id,
|
||||
const gchar *job_hold_until,
|
||||
GCancellable *cancellable,
|
||||
JSHUCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusConnection *bus;
|
||||
JSHUData *data;
|
||||
GError *error = NULL;
|
||||
|
||||
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (!bus)
|
||||
{
|
||||
g_warning ("Failed to get session bus: %s", error->message);
|
||||
g_error_free (error);
|
||||
callback (user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
data = g_new0 (JSHUData, 1);
|
||||
if (cancellable)
|
||||
data->cancellable = g_object_ref (cancellable);
|
||||
data->callback = callback;
|
||||
data->user_data = user_data;
|
||||
|
||||
g_dbus_connection_call (bus,
|
||||
MECHANISM_BUS,
|
||||
"/",
|
||||
MECHANISM_BUS,
|
||||
"JobSetHoldUntil",
|
||||
g_variant_new ("(is)",
|
||||
job_id,
|
||||
job_hold_until),
|
||||
G_VARIANT_TYPE ("(s)"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
job_set_hold_until_async_dbus_cb,
|
||||
data);
|
||||
}
|
||||
|
||||
gchar *
|
||||
guess_device_hostname (PpPrintDevice *device)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue