mate-desktop / mate-applets

Applets for use with the MATE panel
http://www.mate-desktop.org
GNU General Public License v2.0
79 stars 67 forks source link

trashapplet: Replace the deprecated function #648

Closed zhuyaliang closed 1 year ago

zhuyaliang commented 1 year ago

Use g_task replaces the deprecated g_io_scheduler, removing compilation warnings

trash-empty.c: In function 'trash_empty_job':
trash-empty.c:217:3: warning: 'g_io_scheduler_job_send_to_mainloop_async' is deprecated: Use 'g_main_context_invoke' instead [-Wdeprecated-declarations]
   g_io_scheduler_job_send_to_mainloop_async (job,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/gio/gio.h:89,
                 from trash-empty.c:22:
/usr/include/glib-2.0/gio/gioscheduler.h:47:10: note: declared here
 void     g_io_scheduler_job_send_to_mainloop_async (GIOSchedulerJob     *job,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trash-empty.c: In function 'trash_empty_start':
trash-empty.c:267:3: warning: 'g_io_scheduler_push_job' is deprecated: Use '"GThreadPool or g_task_run_in_thread"' instead [-Wdeprecated-declarations]
   g_io_scheduler_push_job (trash_empty_job, NULL, NULL, 0, cancellable);
zhuyaliang commented 1 year ago

@lukefromdc The unref been completed here

  task = g_task_new (parent, cancellable, trash_empty_done, NULL);
  g_task_run_in_thread (task, trash_empty_job);
  g_object_unref (task);