예제 #1
0
static IrisProgressWatch *
watch_process_internal (IrisProgressMonitor             *progress_monitor,
                        IrisProcess                     *process,
                        IrisProgressGroup               *group,
                        gboolean                         chain)
{
	IrisProgressMonitorInterface *iface;
	IrisProgressWatch *watch;

	g_return_val_if_fail (IRIS_IS_PROGRESS_MONITOR (progress_monitor), NULL);
	g_return_val_if_fail (IRIS_IS_PROCESS (process), NULL);

	iface = IRIS_PROGRESS_MONITOR_GET_INTERFACE(progress_monitor);

	if (iface->is_watching_task (progress_monitor, IRIS_TASK (process)))
		return NULL;

	/* Add watch to implementation */
	watch = iris_progress_monitor_add_watch_internal
	          (progress_monitor,
	           IRIS_TASK (process),
	           iris_process_get_title (process),
	           group);

	watch->chain_flag = chain;

	iris_process_add_watch (process, watch->port);

	return watch;
}
예제 #2
0
void
_iris_progress_monitor_cancel_group   (IrisProgressMonitor *progress_monitor,
                                       IrisProgressGroup   *group)
{
	GList             *node;
	IrisProgressWatch *watch;

	for (node=group->watch_list; node; node=node->next) {
		watch = node->data;

		/* Allowed, it's possible with a long watch_hide_delay .. */
		if (watch->cancelled || watch->complete)
			continue;

		/* Avoid cancelling every process in a chain; cancel the tails and the
		 * rest will follow (if they didn't already complete). If not running
		 * the connection info is not reliable of course so we ignore it.
		 */
		if (IRIS_IS_PROCESS (watch->task)) {
			if (iris_process_is_executing (IRIS_PROCESS (watch->task)) &&
			    iris_process_has_sink (IRIS_PROCESS (watch->task)))
				continue;
		}

		iris_task_cancel (IRIS_TASK (watch->task));
	}

	g_signal_emit (progress_monitor, signals[CANCEL], 0);
}
예제 #3
0
void
_iris_progress_monitor_cancel_watch   (IrisProgressMonitor *progress_monitor,
                                       IrisProgressWatch   *watch)
{
	g_return_if_fail (!watch->cancelled);

	iris_task_cancel (IRIS_TASK (watch->task));

	g_signal_emit (progress_monitor, signals[CANCEL], 0);
}
예제 #4
0
static void
find_password_cb (GnomeKeyringResult  res,
                  const gchar        *password,
                  gpointer            user_data)
{
  IrisTask *task = IRIS_TASK (user_data);
  
  if (res == GNOME_KEYRING_RESULT_OK)
    IRIS_TASK_RETURN_VALUE (task, G_TYPE_STRING, password);
  else
    IRIS_TASK_THROW_NEW (task, GOOGLE_READER_ERROR_QUARK, 0,
                         "No password found in keyring");

  iris_task_complete (task);
}
예제 #5
0
/* Add watches for connected processes, called once we know the connections
 * cannot change */
static void
watch_chain (IrisProgressMonitor             *progress_monitor,
             IrisProcess                     *added_process)
{
	IrisProgressMonitorInterface *iface;
	IrisProcess                  *head,
	                             *process;
	IrisProgressWatch            *watch;
	IrisProgressGroup            *group;

	g_return_if_fail (IRIS_IS_PROGRESS_MONITOR (progress_monitor));
	g_return_if_fail (IRIS_IS_PROCESS (added_process));

	iface = IRIS_PROGRESS_MONITOR_GET_INTERFACE (progress_monitor);

	watch = iface->get_watch (progress_monitor, IRIS_TASK (added_process));
	group = watch->group;

	head = added_process;
	while (iris_process_has_source (head))
		head = iris_process_get_source (head);

	process = head;
	do {
		if (process == added_process && process != head) {
			/* User has been awkward and added the chain using a process that
			 * wasn't its first one
			 */
			iface->reorder_watch_in_group (progress_monitor,
			                               watch,
			                               TRUE);
		} else
			watch_process_internal (progress_monitor, 
			                        process,
			                        group,
			                        FALSE);
	} while ((process = iris_process_get_sink (process)) != NULL);
}