static void cancel (DialogData *data, DataFunc done_func) { if (data->cancelling) return; data->done_func = done_func; data->cancelling = TRUE; if (data->loading_list) g_cancellable_cancel (data->cancellable); else gth_file_list_cancel (GTH_FILE_LIST (data->file_list), cancel_done, data); }
static gboolean do_cancel_in_timeout (gpointer user_data) { g_autoptr(GCancellable) cancellable = user_data; IDE_ENTRY; g_assert (G_IS_CANCELLABLE (cancellable)); if (!g_cancellable_is_cancelled (cancellable)) g_cancellable_cancel (cancellable); IDE_RETURN (G_SOURCE_REMOVE); }
/** * pk_backend_cancel: */ void pk_backend_cancel (PkBackend *backend, PkBackendJob *job) { GCancellable *cancellable; g_return_if_fail (PK_IS_BACKEND (backend)); g_return_if_fail (PK_IS_BACKEND_JOB (job)); /* cancel */ cancellable = pk_backend_job_get_cancellable (job); g_cancellable_cancel (cancellable); /* call into the backend */ backend->priv->desc->cancel (backend, job); }
static void cc_date_time_panel_dispose (GObject *object) { CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (object)->priv; if (priv->clock_tracker != NULL) { g_object_unref (priv->clock_tracker); priv->clock_tracker = NULL; } if (priv->builder) { g_object_unref (priv->builder); priv->builder = NULL; } if (priv->settings) { g_object_unref (priv->settings); priv->settings = NULL; } if (priv->date) { g_date_time_unref (priv->date); priv->date = NULL; } if (priv->cancellable) { g_cancellable_cancel (priv->cancellable); g_object_unref (priv->cancellable); priv->cancellable = NULL; } if (priv->dtm) { g_object_unref (priv->dtm); priv->dtm = NULL; } if (priv->permission) { g_object_unref (priv->permission); priv->permission = NULL; } G_OBJECT_CLASS (cc_date_time_panel_parent_class)->dispose (object); }
void ofono_network_list_query_cancel(struct telephony_service *service, telephony_result_cb cb, void *data) { struct ofono_data *od = telephony_service_get_data(service); struct telephony_error error; if (od->network_scan_cancellable) { g_cancellable_cancel(od->network_scan_cancellable); cb(NULL, data); } else { error.code = TELEPHONY_ERROR_INVALID_ARGUMENT; cb(&error, data); } }
static void name_vanished_cb (GDBusConnection *connection, const gchar *name, TotemMediaPlayerKeysPlugin *pi) { if (pi->priv->proxy != NULL) { g_object_unref (pi->priv->proxy); pi->priv->proxy = NULL; } if (pi->priv->cancellable) { g_cancellable_cancel (pi->priv->cancellable); } }
static void impl_deactivate (PeasActivatable *plugin) { TotemMediaPlayerKeysPlugin *pi = TOTEM_MEDIA_PLAYER_KEYS_PLUGIN (plugin); GtkWindow *window; if (pi->priv->cancellable_init) { g_cancellable_cancel (pi->priv->cancellable_init); } if (pi->priv->cancellable) { g_cancellable_cancel (pi->priv->cancellable); } if (pi->priv->proxy != NULL) { g_object_unref (pi->priv->proxy); pi->priv->proxy = NULL; } if (pi->priv->handler_id != 0) { TotemObject *totem; totem = g_object_get_data (G_OBJECT (plugin), "object"); window = totem_get_main_window (totem); if (window == NULL) return; g_signal_handler_disconnect (G_OBJECT (window), pi->priv->handler_id); g_object_unref (window); pi->priv->handler_id = 0; } if (pi->priv->watch_id != 0) { g_bus_unwatch_name (pi->priv->watch_id); pi->priv->watch_id = 0; } }
static void shell_done (GitgShell *shell, GError *error) { if (shell->priv->error) { g_error_free (shell->priv->error); shell->priv->error = NULL; } if (error) { shell->priv->error = g_error_copy (error); gitg_io_set_exit_status (GITG_IO (shell), EXIT_FAILURE); } if (shell->priv->main_loop) { g_main_loop_quit (shell->priv->main_loop); g_main_loop_unref (shell->priv->main_loop); shell->priv->main_loop = NULL; } if (shell->priv->runners == NULL) { return; } if (shell->priv->cancellable) { g_cancellable_cancel (shell->priv->cancellable); g_object_unref (shell->priv->cancellable); shell->priv->cancellable = NULL; } /* Take over the exit code of the last runner */ if (!error) { gitg_io_set_exit_status (GITG_IO (shell), gitg_io_get_exit_status (GITG_IO (shell->priv->last_runner))); } close_runners (shell); gitg_io_close (GITG_IO (shell)); gitg_io_end (GITG_IO (shell), error); }
/** * pk_cnf_sigint_handler: **/ static void pk_cnf_sigint_handler (int sig) { g_debug ("Handling SIGINT"); /* restore default ASAP, as the cancel might hang */ signal (SIGINT, SIG_DFL); /* hopefully, cancel client */ g_cancellable_cancel (cancellable); /* kill ourselves */ g_debug ("Retrying SIGINT"); kill (getpid (), SIGINT); }
static void set_current_operation (TotemYouTubePlugin *self, guint tree_view, GCancellable *cancellable) { /* Cancel previous searches on this tree view */ if (self->cancellable[tree_view] != NULL) g_cancellable_cancel (self->cancellable[tree_view]); /* Make this the current cancellable action for the given tab */ g_object_weak_ref (G_OBJECT (cancellable), (GWeakNotify) cancellable_notify_cb, self); self->cancellable[tree_view] = cancellable; /* Enable the "Cancel" button if it applies to the current tree view */ if (self->current_tree_view == tree_view) gtk_widget_set_sensitive (self->cancel_button, TRUE); }
gboolean mm_port_probe_run_cancel (MMPortProbe *self) { g_return_val_if_fail (MM_IS_PORT_PROBE (self), FALSE); if (self->priv->task) { mm_dbg ("(%s/%s) requested to cancel the probing", g_udev_device_get_subsystem (self->priv->port), g_udev_device_get_name (self->priv->port)); g_cancellable_cancel (self->priv->task->cancellable); return TRUE; } return FALSE; }
static void gtk_search_engine_tracker_stop (GtkSearchEngine *engine) { GtkSearchEngineTracker *tracker; tracker = GTK_SEARCH_ENGINE_TRACKER (engine); g_debug ("Query stopping"); if (tracker->priv->query && tracker->priv->query_pending) { g_cancellable_cancel (tracker->priv->cancellable); tracker->priv->query_pending = FALSE; } }
static void decorator_cancel_active_tasks (TrackerDecorator *decorator) { TrackerDecoratorPrivate *priv = decorator->priv; GHashTableIter iter; GTask *task; g_hash_table_iter_init (&iter, priv->tasks); while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &task)) { g_cancellable_cancel (g_task_get_cancellable (task)); } g_hash_table_remove_all (priv->tasks); }
static void photos_application_stop_miners (PhotosApplication *self) { PhotosApplicationPrivate *priv = self->priv; GList *l; for (l = priv->miners_running; l != NULL; l = l->next) { GomMiner *miner = GOM_MINER (l->data); GCancellable *cancellable; cancellable = g_object_get_data (G_OBJECT (miner), "cancellable"); g_cancellable_cancel (cancellable); } }
static void receive_cancel (GtkButton *button, struct _send_info *info) { if (info->state == SEND_ACTIVE) { g_cancellable_cancel (info->cancellable); if (info->progress_bar != NULL) gtk_progress_bar_set_text ( GTK_PROGRESS_BAR (info->progress_bar), _("Canceling...")); info->state = SEND_CANCELLED; } if (info->cancel_button) gtk_widget_set_sensitive (info->cancel_button, FALSE); }
/** * pk_generate_pack_sigint_cb: **/ static void pk_generate_pack_sigint_cb (int sig) { g_debug ("Handling SIGINT"); /* restore default */ signal (SIGINT, SIG_DFL); /* cancel any tasks still running */ g_cancellable_cancel (cancellable); /* kill ourselves */ g_debug ("Retrying SIGINT"); kill (getpid (), SIGINT); }
/** * g_socket_service_stop: * @service: a #GSocketService * * Stops the service, i.e. stops accepting connections * from the added sockets when the mainloop runs. * * This call is thread-safe, so it may be called from a thread * handling an incoming client request. * * Since: 2.22 */ void g_socket_service_stop (GSocketService *service) { G_LOCK (active); if (service->priv->active) { service->priv->active = FALSE; if (service->priv->outstanding_accept) g_cancellable_cancel (service->priv->cancellable); } G_UNLOCK (active); }
static void _set_current_folder (FrFileSelectorDialog *self, GFile *folder, GList *files) { if (self->priv->current_operation != NULL) g_cancellable_cancel (self->priv->current_operation->cancellable); gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("files_liststore"))); _update_sensitivity (self); self->priv->current_operation = load_data_new (self, folder); self->priv->current_operation->files_to_select = _g_object_list_ref (files); _get_folder_list (self->priv->current_operation); }
void GThreadSafeMainLoopSource::cancel() { GMutexLocker<GRecMutex> locker(m_mutex); // The general cancellable object should only be present if we're currently dispatching this GMainLoopSource. ASSERT(!m_cancellable || m_status == Dispatching); // The source is perhaps being cancelled in the middle of a callback dispatch. // Cancelling this GCancellable object will convey this information to the // current execution context when the callback dispatch is finished. g_cancellable_cancel(m_cancellable.get()); m_cancellable = nullptr; GMainLoopSource::cancel(); }
static void channel_closed_cb (TpChannel *proxy, const GError *error, gpointer user_data, GObject *weak_object) { EmpathyTpFile *self = EMPATHY_TP_FILE (weak_object); gboolean cancel = GPOINTER_TO_INT (user_data); DEBUG ("Channel is closed, should cancel %s", cancel ? "True" : "False"); if (self->priv->cancellable != NULL && !g_cancellable_is_cancelled (self->priv->cancellable) && cancel) g_cancellable_cancel (self->priv->cancellable); }
static void cancel_load_basenames (GFilenameCompleter *completer) { LoadBasenamesData *loader; if (completer->basename_loader) { loader = completer->basename_loader; loader->completer = NULL; g_cancellable_cancel (loader->cancellable); completer->basename_loader = NULL; } }
static void nautilus_image_properties_page_finalize (GObject *object) { NautilusImagePropertiesPage *page; page = NAUTILUS_IMAGE_PROPERTIES_PAGE (object); if (page->details->cancellable) { g_cancellable_cancel (page->details->cancellable); g_object_unref (page->details->cancellable); page->details->cancellable = NULL; } G_OBJECT_CLASS (nautilus_image_properties_page_parent_class)->finalize (object); }
static void place_free (Place * p) { if (p->cancellable != NULL) { g_cancellable_cancel (p->cancellable); g_object_unref (p->cancellable); } g_clear_object (&p->icon); g_object_unref (p->location); g_free (p->display_name); g_slice_free (Place, p); }
static int on_window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { TrackedTask *task = NULL; /* Guard against going away before we display */ if (tracked_tasks) task = g_hash_table_lookup (tracked_tasks, user_data); if (task != NULL) g_cancellable_cancel (task->cancellable); return TRUE; /* allow window to close */ }
gboolean rejilla_async_task_manager_foreach_active_remove (RejillaAsyncTaskManager *self, RejillaAsyncFindTask func, gpointer user_data) { GSList *iter, *tasks = NULL; RejillaAsyncTaskCtx *ctx; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (func != NULL, FALSE); g_mutex_lock (self->priv->lock); for (iter = self->priv->active_tasks; iter; iter = iter->next) { ctx = iter->data; if (func (self, ctx->data, user_data)) { g_cancellable_cancel (ctx->cancel); tasks = g_slist_prepend (tasks, ctx); } } while (tasks && self->priv->active_tasks) { GSList *next; /* Now we wait for all these active tasks to be finished */ g_cond_wait (self->priv->task_finished, self->priv->lock); for (iter = tasks; iter; iter = next) { ctx = iter->data; next = iter->next; if (g_slist_find (self->priv->active_tasks, ctx)) continue; tasks = g_slist_remove (tasks, ctx); /* destroy it */ if (ctx->type->destroy) ctx->type->destroy (self, TRUE, ctx->data); g_free (ctx); } } g_mutex_unlock (self->priv->lock); return TRUE; }
void e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view) { EMailShellViewPrivate *priv = mail_shell_view->priv; gint ii; /* XXX It's a little awkward to have to dig up the * shell this late in the game. Should we just * keep a direct reference to it? Not sure. */ if (priv->prepare_for_quit_handler_id > 0) { EShellBackend *shell_backend; EShell *shell; shell_backend = E_SHELL_BACKEND (priv->mail_shell_backend); shell = e_shell_backend_get_shell (shell_backend); g_signal_handler_disconnect ( shell, priv->prepare_for_quit_handler_id); priv->prepare_for_quit_handler_id = 0; } g_clear_object (&priv->mail_shell_backend); g_clear_object (&priv->mail_shell_content); g_clear_object (&priv->mail_shell_sidebar); for (ii = 0; ii < MAIL_NUM_SEARCH_RULES; ii++) g_clear_object (&priv->search_rules[ii]); if (priv->opening_folder != NULL) { g_cancellable_cancel (priv->opening_folder); g_clear_object (&priv->opening_folder); } if (priv->search_account_all != NULL) { g_object_unref (priv->search_account_all); priv->search_account_all = NULL; } if (priv->search_account_current != NULL) { g_object_unref (priv->search_account_current); priv->search_account_current = NULL; } if (priv->search_account_cancel != NULL) { g_object_unref (priv->search_account_cancel); priv->search_account_cancel = NULL; } }
static void caja_image_properties_page_finalize (GObject *object) { CajaImagePropertiesPage *page; page = CAJA_IMAGE_PROPERTIES_PAGE (object); if (page->details->cancellable) { g_cancellable_cancel (page->details->cancellable); g_object_unref (page->details->cancellable); page->details->cancellable = NULL; } G_OBJECT_CLASS (caja_image_properties_page_parent_class)->finalize (object); }
static void streams_removed_cb (NiceAgent *agent, guint *stream_ids, gpointer user_data) { NiceOutputStream *self = NICE_OUTPUT_STREAM (user_data); guint i; for (i = 0; stream_ids[i] != 0; i++) { if (stream_ids[i] == self->priv->stream_id) { /* The socket has been closed. */ g_cancellable_cancel (self->priv->closed_cancellable); g_output_stream_close (G_OUTPUT_STREAM (self), NULL, NULL); break; } } }
static void bg_pictures_source_dispose (GObject *object) { BgPicturesSourcePrivate *priv = BG_PICTURES_SOURCE (object)->priv; if (priv->cancellable) { g_cancellable_cancel (priv->cancellable); g_clear_object (&priv->cancellable); } g_clear_object (&priv->grl_miner); g_clear_object (&priv->thumb_factory); G_OBJECT_CLASS (bg_pictures_source_parent_class)->dispose (object); }
void mm_manager_shutdown (MMManager *self) { g_return_if_fail (self != NULL); g_return_if_fail (MM_IS_MANAGER (self)); /* Cancel all ongoing auth requests */ g_cancellable_cancel (self->priv->authp_cancellable); g_hash_table_foreach (self->priv->devices, (GHFunc)foreach_disable, self); /* Disabling may take a few iterations of the mainloop, so the caller * has to iterate the mainloop until all devices have been disabled and * removed. */ }