[gnome-control-center] printers: Drop cups_get_jobs_async



commit 1df4da54fc0d089edf9aedc492e9e9e58ce8c230
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Feb 28 16:20:07 2017 +0100

    printers: Drop cups_get_jobs_async
    
    pp_printer_get_jobs_async does the job with more modern GLib API
    (GTask).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779313

 panels/printers/pp-utils.c |  103 --------------------------------------------
 panels/printers/pp-utils.h |   10 ----
 2 files changed, 0 insertions(+), 113 deletions(-)
---
diff --git a/panels/printers/pp-utils.c b/panels/printers/pp-utils.c
index dc66061..c140e37 100644
--- a/panels/printers/pp-utils.c
+++ b/panels/printers/pp-utils.c
@@ -3624,109 +3624,6 @@ get_cups_devices_async (GCancellable *cancellable,
                           data);
 }
 
-typedef struct
-{
-  gchar        *printer_name;
-  gboolean      my_jobs;
-  gint          which_jobs;
-  cups_job_t   *jobs;
-  gint          num_of_jobs;
-  CGJCallback   callback;
-  gpointer      user_data;
-  GMainContext *context;
-} CGJData;
-
-static gboolean
-cups_get_jobs_idle_cb (gpointer user_data)
-{
-  CGJData *data = (CGJData *) user_data;
-
-  data->callback (data->jobs,
-                  data->num_of_jobs,
-                  data->user_data);
-
-  return FALSE;
-}
-
-static void
-cups_get_jobs_data_free (gpointer user_data)
-{
-  CGJData *data = (CGJData *) user_data;
-
-  if (data->context)
-    g_main_context_unref (data->context);
-  g_free (data->printer_name);
-  g_free (data);
-}
-
-static void
-cups_get_jobs_cb (gpointer user_data)
-{
-  CGJData *data = (CGJData *) user_data;
-  GSource *idle_source;
-
-  idle_source = g_idle_source_new ();
-  g_source_set_callback (idle_source,
-                         cups_get_jobs_idle_cb,
-                         data,
-                         cups_get_jobs_data_free);
-  g_source_attach (idle_source, data->context);
-  g_source_unref (idle_source);
-}
-
-static gpointer
-cups_get_jobs_func (gpointer user_data)
-{
-  CGJData *data = (CGJData *) user_data;
-
-  data->num_of_jobs = cupsGetJobs (&data->jobs,
-                                   data->printer_name,
-                                   data->my_jobs ? 1 : 0,
-                                   data->which_jobs);
-
-  cups_get_jobs_cb (data);
-
-  return NULL;
-}
-
-void
-cups_get_jobs_async (const gchar *printer_name,
-                     gboolean     my_jobs,
-                     gint         which_jobs,
-                     CGJCallback  callback,
-                     gpointer     user_data)
-{
-  CGJData *data;
-  GThread *thread;
-  GError  *error = NULL;
-
-  data = g_new0 (CGJData, 1);
-  data->printer_name = g_strdup (printer_name);
-  data->my_jobs = my_jobs;
-  data->which_jobs = which_jobs;
-  data->callback = callback;
-  data->user_data = user_data;
-  data->context = g_main_context_ref_thread_default ();
-
-  thread = g_thread_try_new ("cups-get-jobs",
-                             cups_get_jobs_func,
-                             data,
-                             &error);
-
-  if (!thread)
-    {
-      g_warning ("%s", error->message);
-      callback (NULL, 0, user_data);
-
-      g_error_free (error);
-      cups_get_jobs_data_free (data);
-    }
-  else
-    {
-      g_thread_unref (thread);
-    }
-}
-
 gchar *
 guess_device_hostname (PpPrintDevice *device)
 {
diff --git a/panels/printers/pp-utils.h b/panels/printers/pp-utils.h
index 17dbaf7..9723984 100644
--- a/panels/printers/pp-utils.h
+++ b/panels/printers/pp-utils.h
@@ -242,16 +242,6 @@ void        printer_add_option_async (const gchar   *printer_name,
                                       PAOCallback    callback,
                                       gpointer       user_data);
 
-typedef void (*CGJCallback) (cups_job_t *jobs,
-                             gint        num_of_jobs,
-                             gpointer    user_data);
-
-void        cups_get_jobs_async (const gchar *printer_name,
-                                 gboolean     my_jobs,
-                                 gint         which_jobs,
-                                 CGJCallback  callback,
-                                 gpointer     user_data);
-
 void         pp_devices_list_free (PpDevicesList *result);
 
 const gchar *get_page_size_from_locale (void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]