Beispiel #1
0
static Window *visible_windows(i3ipcCon *root)
{
    GList *nodes = g_list_copy((GList *) i3ipc_con_get_nodes(root));
    GList *floating = g_list_copy((GList *) i3ipc_con_get_floating_nodes(root));
    nodes = g_list_concat(nodes, floating);
    if (nodes == NULL)
    {
        return con_to_window(root);
    }

    gchar *layout = NULL;
    g_object_get(root, "layout", &layout, NULL);

    Window *res = NULL;
    const GList *elem;
    if ((strcmp(layout, "tabbed") == 0) ||
        (strcmp(layout, "stacked") == 0))
    {
        unsigned long focus_id = con_get_focused_id(root);
        for (elem = nodes; elem; elem = elem->next)
        {
            i3ipcCon *curr = elem->data;
            unsigned long id;
            g_object_get(curr, "id", &id, NULL);
            Window *win = NULL;
            if (id == focus_id)
            {
                win = visible_windows(curr);
                if (win->id != id)
                {
                    res = window_append(res, con_to_window(curr));
                }
            }
            else
            {
                win = con_to_window(curr);
            }

            res = window_append(res, win);
        }
    }
    else if ((strcmp(layout, "splith") == 0) ||
             (strcmp(layout, "splitv") == 0))
    {
        for (elem = nodes; elem; elem = elem->next)
        {
            i3ipcCon *curr = elem->data;
            res = window_append(res, visible_windows(curr));
        }
    }
    else
    {
        LOG("unknown layout of con: %s\n", layout);
    }

    g_free(layout);
    g_list_free(nodes);

    return res;
}
GList *
resources_os_list_ocf_agents(const char *provider)
{
    GList *gIter = NULL;
    GList *result = NULL;
    GList *providers = NULL;

    if (provider) {
        char buffer[500];

        snprintf(buffer, sizeof(buffer), "%s/resource.d/%s", OCF_ROOT_DIR, provider);
        return get_directory_list(buffer, TRUE, TRUE);
    }

    providers = resources_os_list_ocf_providers();
    for (gIter = providers; gIter != NULL; gIter = gIter->next) {
        GList *tmp1 = result;
        GList *tmp2 = resources_os_list_ocf_agents(gIter->data);

        if (tmp2) {
            result = g_list_concat(tmp1, tmp2);
        }
    }
    g_list_free_full(providers, free);
    return result;
}
Beispiel #3
0
static void
gimp_scale_combo_box_mru_add (GimpScaleComboBox *combo_box,
                              GtkTreeIter       *iter)
{
  GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
  GtkTreePath  *path  = gtk_tree_model_get_path (model, iter);
  GList        *list;
  gboolean      found;

  for (list = combo_box->mru, found = FALSE; list && !found; list = list->next)
    {
      GtkTreePath *this = gtk_tree_row_reference_get_path (list->data);

      if (gtk_tree_path_compare (this, path) == 0)
        {
          if (list->prev)
            {
              combo_box->mru = g_list_remove_link (combo_box->mru, list);
              combo_box->mru = g_list_concat (list, combo_box->mru);
            }

          found = TRUE;
        }

      gtk_tree_path_free (this);
    }

  if (! found)
    combo_box->mru = g_list_prepend (combo_box->mru,
                                     gtk_tree_row_reference_new (model, path));

  gtk_tree_path_free (path);
}
Beispiel #4
0
static GList *
xde_wmmenu(MenuContext *ctx)
{
	GList *text = NULL;
	GList *xsessions, *xsession;
	int gotone = FALSE;
	char *s;

	s = g_strdup_printf("\n%s\n", "Menu \"managers\" twm_MenuColor");
	text = g_list_append(text, s);
	s = strdup("{\n");
	text = g_list_append(text, s);

	xde_increase_indent(ctx);

	s = g_strdup_printf("    %-32s  %s\n", "\"Window Managers\"", "f.title");
	text = g_list_append(text, s);

	xsessions = xde_get_xsessions(ctx);
	for (xsession = xsessions; xsession; xsession = xsession->next) {
		XdeXsession *xsess = xsession->data;
		char *esc1, *esc2, *qname, *cmd;

		if (strncasecmp(xsess->key, ctx->name, strlen(ctx->name)) == 0)
			continue;
		if (options.launch)
			cmd = g_strdup_printf("xdg-launch --pointer -X %s", xsess->key);
		else
			cmd = xde_get_command(xsess->info, xsess->key, NULL);
		esc1 = xde_character_escape(xsess->name, '"');
		esc2 = xde_character_escape(cmd, '"');
		qname = g_strdup_printf("\"%s\"", esc1);
		if (!strcmp(ctx->name, "mwm") || !strcmp(ctx->name, "dtwm"))
			s = g_strdup_printf("    %-32s  %s \"%s\"\n", qname, "f.restart -", esc2);
		else if (!strcmp(ctx->name, "twm")||!strcmp(ctx->name, "vtwm"))
			s = g_strdup_printf("    %-32s  %s \"%s\"\n", qname, "f.startwm", esc2);
		else
			s = g_strdup_printf("    %-32s  %s \"exec %s &\"\n", qname, "f.exec", esc2);
		text = g_list_append(text, s);

		gotone = TRUE;
		free(esc1);
		free(esc2);
		free(qname);
		free(cmd);
	}
	if (gotone)
		text = g_list_concat(text, ctx->wmm.ops.separator(ctx, NULL));
	s = g_strdup_printf("    %-32s  %s\n", "\"Restart\"", "f.restart");
	text = g_list_append(text, s);
	if (!strcmp(ctx->name, "mwm") || !strcmp(ctx->name, "dtwm"))
		s = g_strdup_printf("    %-32s  %s\n", "\"Quit\"", "f.quit_mwm");
	else
		s = g_strdup_printf("    %-32s  %s\n", "\"Quit\"", "f.quit");
	text = g_list_append(text, s);
	s = strdup("}\n");
	text = g_list_append(text, s);

	return (text);
}
Beispiel #5
0
static GList *
xde_directory(MenuContext *ctx, GMenuTreeDirectory *dir)
{
	GList *text = NULL;
	const char *name, *path;
	char *esc1, *esc2;
	GIcon *gicon = NULL;
	char *icon = NULL;

	name = gmenu_tree_directory_get_name(dir);
	esc1 = xde_character_escape(name, ')');
	esc2 = xde_character_escape(name, '}');
	if (ctx->stack)
		gicon = gmenu_tree_directory_get_icon(ctx->stack->data);
	if ((path = gmenu_tree_directory_get_desktop_file_path(dir))) {
		GKeyFile *file = g_key_file_new();

		g_key_file_load_from_file(file, path, G_KEY_FILE_NONE, NULL);
		icon = xde_get_entry_icon(ctx, file, gicon, "folder", "unknown",
				GET_ENTRY_ICON_FLAG_XPM | GET_ENTRY_ICON_FLAG_PNG);
		g_key_file_unref(file);
	} else
		icon = xde_get_icon2(ctx, "folder", "unknown");
	icon = ctx->wmm.wrap(ctx, icon);
	text = g_list_append(text, g_strdup_printf("%s%s (%s) {%s Menu}%s\n", ctx->indent, "[submenu]", esc1, esc2, icon));
	text = g_list_concat(text, ctx->wmm.ops.menu(ctx, dir));
	text = g_list_append(text, g_strdup_printf("%s[end]\n", ctx->indent));
	free(icon);
	free(esc1);
	free(esc2);
	return (text);
}
static GList* _search_in_item (CDBookmarkItem *pFolderItem, const gchar *cText, int iFilter, int iNbMax, int *iNbEntries)
{
	GList *pEntries = NULL;
	int i = 0;
	CDBookmarkItem *pItem;
	CDEntry *pEntry;
	GList *it;
	for (it = pFolderItem->pSubItems; it != NULL && iNbMax > 0; it = it->next)
	{
		pItem = it->data;
		if (g_strstr_len (pItem->cLowerCaseName, -1, cText))
		{
			pEntry = _make_entry_from_item (pItem);
			pEntries = g_list_prepend (pEntries, pEntry);
			i ++;
			iNbMax --;
		}
		if (pItem->pSubItems != NULL)
		{
			int j = 0;
			GList *pSubList = _search_in_item (pItem, cText, iFilter, iNbMax, &j);
			i += j;
			iNbMax -= j;
			pEntries = g_list_concat (pEntries, pSubList);
		}
	}
	*iNbEntries = i;
	return pEntries;
}
Beispiel #7
0
static GList *
get_connected_drives (GVolumeMonitor *volume_monitor)
{
  GUnionVolumeMonitor *monitor;
  GVolumeMonitor *child_monitor;
  GList *res;
  GList *l;
  
  monitor = G_UNION_VOLUME_MONITOR (volume_monitor);

  res = NULL;
  
  g_static_rec_mutex_lock (&the_volume_monitor_mutex);

  for (l = monitor->monitors; l != NULL; l = l->next)
    {
      child_monitor = l->data;

      res = g_list_concat (res, g_volume_monitor_get_connected_drives (child_monitor));
    }
  
  g_static_rec_mutex_unlock (&the_volume_monitor_mutex);

  return res;
}
Beispiel #8
0
bool mgmt_unregister_index(struct mgmt *mgmt, uint16_t index)
{
	GList *list, *next;

	if (!mgmt)
		return false;

	for (list = g_list_first(mgmt->notify_list); list; list = next) {
		struct mgmt_notify *notify = list->data;

		next = g_list_next(list);

		if (notify->index != index)
			continue;

		mgmt->notify_list = g_list_remove_link(mgmt->notify_list, list);

		if (!mgmt->in_notify) {
			g_list_free_1(list);
			destroy_notify(notify, NULL);
			continue;
		}

		notify->destroyed = true;

		mgmt->notify_destroyed = g_list_concat(mgmt->notify_destroyed,
									list);
	}

	return true;
}
static GList *
get_extension_menus (NautilusWindow *window)
{
    NautilusFile *file;
    NautilusWindowSlot *slot;
    GList *providers;
    GList *items;
    GList *l;

    providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
    items = NULL;

    slot = nautilus_window_get_active_slot (window);
    file = nautilus_window_slot_get_file (slot);

    for (l = providers; l != NULL; l = l->next) {
        NautilusMenuProvider *provider;
        GList *file_items;

        provider = NAUTILUS_MENU_PROVIDER (l->data);
        file_items = nautilus_menu_provider_get_background_items (provider,
                     GTK_WIDGET (window),
                     file);
        items = g_list_concat (items, file_items);
    }

    nautilus_module_extension_list_free (providers);

    return items;
}
GList *get_pending_list(guint max) {
	const char *im=purple_prefs_get_string("/plugins/gtk/gtk-sarah-barnot/im");
	const char *chat=purple_prefs_get_string(
	                                     "/plugins/gtk/gtk-sarah-barnot/chat");
	GList *l_im = NULL;
	GList *l_chat = NULL;

	
	if (im != NULL && strcmp(im, "always") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             FALSE, max);
	} else if (im != NULL && strcmp(im, "hidden") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             TRUE, max);
	}

	if (chat != NULL && strcmp(chat, "always") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_TEXT,
		                                               FALSE, max);
	} else if (chat != NULL && strcmp(chat, "nick") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_NICK,
		                                               FALSE, max);
	}

	if (l_im != NULL && l_chat != NULL)
		return g_list_concat(l_im, l_chat);
	else if (l_im != NULL)
		return l_im;
	else
		return l_chat;
}
Beispiel #11
0
bool mgmt_unregister(struct mgmt *mgmt, unsigned int id)
{
	struct mgmt_notify *notify;
	GList *list;

	if (!mgmt || !id)
		return false;

	list = g_list_find_custom(mgmt->notify_list,
				GUINT_TO_POINTER(id), compare_notify_id);
	if (!list)
		return false;

	notify = list->data;

	mgmt->notify_list = g_list_remove_link(mgmt->notify_list, list);

	if (!mgmt->in_notify) {
		g_list_free_1(list);
		destroy_notify(notify, NULL);
		return true;
	}

	notify->destroyed = true;

	mgmt->notify_destroyed = g_list_concat(mgmt->notify_destroyed, list);

	return true;
}
Beispiel #12
0
static GList *
pop3_store_query_auth_types_sync (CamelService *service,
                                  GCancellable *cancellable,
                                  GError **error)
{
	CamelServiceClass *service_class;
	CamelPOP3Store *store = CAMEL_POP3_STORE (service);
	GList *types = NULL;
	GError *local_error = NULL;

	/* Chain up to parent's query_auth_types() method. */
	service_class = CAMEL_SERVICE_CLASS (camel_pop3_store_parent_class);
	types = service_class->query_auth_types_sync (
		service, cancellable, &local_error);

	if (local_error != NULL) {
		g_propagate_error (error, local_error);
		return NULL;
	}

	if (connect_to_server (service, cancellable, error)) {
		CamelPOP3Engine *pop3_engine;

		pop3_engine = camel_pop3_store_ref_engine (store);

		if (pop3_engine) {
			types = g_list_concat (types, g_list_copy (pop3_engine->auth));
			pop3_store_disconnect_sync (service, TRUE, cancellable, NULL);

			g_clear_object (&pop3_engine);
		}
	}

	return types;
}
Beispiel #13
0
static gboolean
thunar_folder_infos_ready (ThunarVfsJob *job,
                           GList        *infos,
                           ThunarFolder *folder)
{
  ThunarFile *file;
  GList      *lp;

  _thunar_return_val_if_fail (THUNAR_IS_FOLDER (folder), FALSE);
  _thunar_return_val_if_fail (THUNAR_VFS_IS_JOB (job), FALSE);
  _thunar_return_val_if_fail (folder->handle == NULL, FALSE);
  _thunar_return_val_if_fail (folder->job == job, FALSE);

  /* turn the info list into a file list */
  for (lp = infos; lp != NULL; lp = lp->next)
    {
      /* get the file corresponding to the info... */
      file = thunar_file_get_for_info (lp->data);

      /* ...release the info at the list position... */
      thunar_vfs_info_unref (lp->data);

      /* ...and replace it with the file */
      lp->data = file;
    }

  /* merge the list with the existing list of new files */
  folder->new_files = g_list_concat (folder->new_files, infos);

  /* TRUE to indicate that we took over ownership of the infos list */
  return TRUE;
}
Beispiel #14
0
void	ug_app_cmd_save (UgAppCmd* app)
{
	GList*	link;
	GList*	list;
	gchar*	file;

	// get all of UgDataset from all UgCategory
	list = NULL;
	for (link = app->category_list;  link;  link = link->next) {
		list = g_list_concat (list, ug_category_cmd_get_all ((UgCategory*) link->data));
	}

	// save all UgDataset
	file = g_build_filename (g_get_user_config_dir (),
	                         UG_APP_CMD_DIR, UG_APP_CMD_DOWNLOAD_FILE,
	                         NULL);
	ug_download_list_save (list, file);
	g_list_free (list);
	g_free (file);

	// save all UgCategory after calling ug_download_list_save()
	file = g_build_filename (g_get_user_config_dir (),
	                         UG_APP_CMD_DIR, UG_APP_CMD_CATEGORY_FILE,
	                         NULL);
	ug_category_list_save (app->category_list, file);
	g_free (file);
}
Beispiel #15
0
void
gimp_vectors_add_strokes (const GimpVectors *src_vectors,
                          GimpVectors       *dest_vectors)
{
  GList *current_lstroke;
  GList *strokes_copy;

  g_return_if_fail (GIMP_IS_VECTORS (src_vectors));
  g_return_if_fail (GIMP_IS_VECTORS (dest_vectors));

  gimp_vectors_freeze (dest_vectors);

  strokes_copy = g_list_copy (src_vectors->strokes);
  current_lstroke = strokes_copy;

  while (current_lstroke)
    {
      current_lstroke->data = gimp_stroke_duplicate (current_lstroke->data);
      dest_vectors->last_stroke_ID ++;
      gimp_stroke_set_ID (current_lstroke->data,
                          dest_vectors->last_stroke_ID);
      current_lstroke = g_list_next (current_lstroke);
    }

  dest_vectors->strokes = g_list_concat (dest_vectors->strokes, strokes_copy);

  gimp_vectors_thaw (dest_vectors);
}
static GList *
get_extension_menus (CajaWindow *window)
{
    CajaWindowSlot *slot;
    GList *providers;
    GList *items;
    GList *l;

    providers = caja_module_get_extensions_for_type (CAJA_TYPE_MENU_PROVIDER);
    items = NULL;

    slot = caja_window_get_active_slot (window);

    for (l = providers; l != NULL; l = l->next)
    {
        CajaMenuProvider *provider;
        GList *file_items;

        provider = CAJA_MENU_PROVIDER (l->data);
        file_items = caja_menu_provider_get_background_items (provider,
                     GTK_WIDGET (window),
                     slot->viewed_file);
        items = g_list_concat (items, file_items);
    }

    caja_module_extension_list_free (providers);

    return items;
}
Beispiel #17
0
/* Complete /MSG - if `server' is NULL, complete nicks from all servers */
static GList *completion_msg(IRC_SERVER_REC *win_server, IRC_SERVER_REC *find_server,
			     const char *nick, const char *prefix)
{
	GSList *tmp;
	GList *list, *tmplist;
	char *newprefix;

	g_return_val_if_fail(nick != NULL, NULL);
	if (servers == NULL) return NULL;

	if (find_server != NULL)
		return completion_msg_server(find_server, nick, prefix);

	list = NULL;
	for (tmp = servers; tmp != NULL; tmp = tmp->next) {
		IRC_SERVER_REC *rec = tmp->data;

		if (rec == win_server)
			newprefix = g_strdup(prefix);
		else {
			newprefix = prefix == NULL ?
				g_strdup_printf("-%s", rec->tag) :
				g_strdup_printf("%s -%s", prefix, rec->tag);
		}

		tmplist = completion_msg_server(rec, nick, newprefix);
		list = g_list_concat(list, tmplist);

		g_free_not_null(newprefix);
	}

	return list;
}
Beispiel #18
0
void fileops_empty_trash ()
{
    if (pool == NULL) {
        pool = g_thread_pool_new(_empty_trash_job, NULL, -1, FALSE, NULL);
        atexit(destroy_thread_pool);
    }
    GList* trash_list = NULL;

    GVolumeMonitor* vol_monitor = g_volume_monitor_get ();
    GList* mount_list = g_volume_monitor_get_mounts (vol_monitor);
    g_object_unref (vol_monitor);

    //iterate through all mounts
    GList* l;
    for (l = mount_list; l != NULL; l = l->next)
    {
        trash_list = g_list_concat (trash_list,
                                    _get_trash_dirs_for_mount (l->data));
    }
    g_list_free_full (mount_list, g_object_unref);
    //add 'trash:' prefix
    trash_list = g_list_prepend (trash_list,
                                 g_file_new_for_uri ("trash:"));

    g_thread_pool_push(pool, trash_list, NULL);
}
static inline GList *
get_all_targets (gchar * topdir, const gchar * categoryname)
{
  GList *res = NULL;

  if (categoryname) {
    gchar *subdir = g_build_filename (topdir, categoryname, NULL);
    /* Try to open the directory */
    res = sub_get_all_targets (subdir);
    g_free (subdir);
  } else {
    const gchar *subdirname;
    GDir *dir = g_dir_open (topdir, 0, NULL);

    if (G_UNLIKELY (dir == NULL))
      return NULL;

    while ((subdirname = g_dir_read_name (dir))) {
      gchar *ltmp = g_build_filename (topdir, subdirname, NULL);

      if (g_file_test (ltmp, G_FILE_TEST_IS_DIR)) {
        res = g_list_concat (res, sub_get_all_targets (ltmp));
      }
      g_free (ltmp);
    }
    g_dir_close (dir);
  }

  return res;
}
/**
 * @brief Randomizes the order of the hosts objects in the collection.
 * Not to be used while iterating over the single hosts as it resets the
 * iterator.
 *
 * @param[in] hosts The hosts collection to shuffle.
 */
void
openvas_hosts_shuffle (openvas_hosts_t *hosts)
{
  int count;
  GList *new_list;
  GRand *rand;

  if (hosts == NULL)
    return;

  count = openvas_hosts_count (hosts);
  new_list = NULL;

  rand = g_rand_new ();

  while (count)
    {
      GList *element;

      /* Get element from random position [0, count[. */
      element = g_list_nth (hosts->hosts, g_rand_int_range (rand, 0, count));
      /* Remove it. */
      hosts->hosts = g_list_remove_link (hosts->hosts, element);
      /* Insert it in new list */
      new_list = g_list_concat (element, new_list);
      count--;
    }
  hosts->hosts = new_list;
  hosts->current = hosts->hosts;

  g_rand_free (rand);
}
Beispiel #21
0
static GList *
xde_appmenu(MenuContext *ctx, GList *entries, const char *name)
{
	GMenuTreeDirectory *dir;
	GList *text = NULL;
	char *s, *esc, *qname;

	if (!(dir = gmenu_tree_get_root_directory(ctx->tree))) {
		EPRINTF("could not get root directory\n");
		return (text);
	}
	if (!name)
		name = gmenu_tree_directory_get_name(dir);
	esc = xde_character_escape(name, '"');
	s = g_strdup_printf("\nMenu \"%s\" twm_MenuColor\n", esc);
	text = g_list_append(text, s);
	s = strdup("{\n");
	text = g_list_append(text, s);
	qname = g_strdup_printf("\"%s\"", esc);
	s = g_strdup_printf("    %-32s  %s\n", qname, "f.title");
	text = g_list_append(text, s);
	text = g_list_concat(text, entries);
	s = strdup("}\n");
	text = g_list_append(text, s);
	g_free(qname);
	free(esc);
	return (text);
}
Beispiel #22
0
static gboolean
anjuta_profile_manager_load_profiles (AnjutaProfileManager *profile_manager, GError **error)
{
	AnjutaProfileManagerPriv *priv;
	gboolean loaded = FALSE;

	priv = profile_manager->priv;

	/* If there is no freeze load profile now */
	while ((priv->freeze_count <= 0) && (priv->profiles_queue != NULL))
	{
		AnjutaProfile *previous_profile = NULL;
		GList *node;

		/* We need to load each profile one by one because a "system" profile
		 * contains plugins which are never unloaded. */
		if (priv->profiles)
			previous_profile = priv->profiles->data;
		node = g_list_last (priv->profiles_queue);
		priv->profiles_queue = g_list_remove_link (priv->profiles_queue, node);
		priv->profiles = g_list_concat (node, priv->profiles);

		/* Load profile. Note that loading a profile can trigger the load of
		 * additional profile. Typically loading the default profile will
		 * trigger the load of the last project profile. */
		if (previous_profile != NULL) anjuta_profile_unload (previous_profile, NULL);
		loaded = anjuta_profile_load (ANJUTA_PROFILE (node->data), error);
	}

	return loaded;
}
Beispiel #23
0
GList *
ibus_observed_path_traverse (IBusObservedPath *path)
{
    g_assert (IBUS_IS_OBSERVED_PATH (path));

    GDir *dir;
    const gchar *name;
    GList *paths = NULL;

    dir = g_dir_open (path->path, 0, NULL);

    if (dir == NULL)
        return NULL;

    while ((name = g_dir_read_name (dir)) != NULL) {
        IBusObservedPath *sub;

        sub = g_object_new (IBUS_TYPE_OBSERVED_PATH, NULL);
        sub->path = g_build_filename (path->path, name, NULL);

        ibus_observed_path_fill_stat (sub);
        paths = g_list_append (paths, sub);

        if (sub->is_exist && sub->is_dir)
            paths = g_list_concat (paths, ibus_observed_path_traverse (sub));
    }
    g_dir_close (dir);

    return paths;
}
Beispiel #24
0
void
rut_asset_set_inferred_tags (RutAsset *asset,
                             const GList *inferred_tags)
{
  asset->inferred_tags = g_list_concat (asset->inferred_tags,
                                        copy_tags (inferred_tags));
}
Beispiel #25
0
static void path_list_recursive_append(GList **list, GList *dirs)
{
	GList *work;

	work = dirs;
	while (work)
		{
		const gchar *path = work->data;
		GList *f = NULL;
		GList *d = NULL;

		if (path_list(path, &f, &d))
			{
			f = path_list_filter(f, FALSE);
			f = path_list_sort(f);
			*list = g_list_concat(*list, f);

			d = path_list_filter(d, TRUE);
			d = path_list_sort(d);
			path_list_recursive_append(list, d);
			path_list_free(d);
			}

		work = work->next;
		}
}
static GList *
get_extension_toolbar_items (NautilusNavigationWindow *window)
{
	NautilusWindowSlot *slot;
	GList *items;
	GList *providers;
	GList *l;
	
	providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
	items = NULL;

	slot = NAUTILUS_WINDOW (window)->details->active_pane->active_slot;

	for (l = providers; l != NULL; l = l->next) {
		NautilusMenuProvider *provider;
		GList *file_items;
		
		provider = NAUTILUS_MENU_PROVIDER (l->data);
		file_items = nautilus_menu_provider_get_toolbar_items 
			(provider, 
			 GTK_WIDGET (window),
			 slot->viewed_file);
		items = g_list_concat (items, file_items);		
	}

	nautilus_module_extension_list_free (providers);

	return items;
}
Beispiel #27
0
static void
import_clicked_cb (GtkButton *button, RBImportDialog *dialog)
{
	GList *entries;
	RBSource *library_source;
	RBTrackTransferBatch *batch;

	entries = get_entries (dialog);

	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->copy_check)) == FALSE) {
		dialog->priv->add_entry_list = g_list_concat (dialog->priv->add_entry_list, entries);

		if (dialog->priv->add_entries_id == 0) {
			dialog->priv->add_entries_id = g_idle_add ((GSourceFunc) add_entries, dialog);
		}
	} else {
		g_object_get (dialog->priv->shell, "library-source", &library_source, NULL);

		batch = rb_source_paste (library_source, entries);
		g_list_free_full (entries, (GDestroyNotify) rhythmdb_entry_unref);
		g_object_unref (library_source);

		/* delete source entries as they finish being copied */
		g_signal_connect (batch, "track-done", G_CALLBACK (copy_track_done_cb), dialog);
		g_signal_connect (batch, "complete", G_CALLBACK (copy_complete_cb), dialog);
	}

}
Beispiel #28
0
static void complete_from_nicklist(GList **outlist, CHANNEL_REC *channel,
				   const char *nick, const char *suffix)
{
        MODULE_CHANNEL_REC *mchannel;
	GSList *tmp;
        GList *ownlist;
	char *str;
	int len;

	/* go through the last x nicks who have said something in the channel.
	   nicks of all the "own messages" are placed before others */
        ownlist = NULL;
	len = strlen(nick);
        mchannel = MODULE_DATA(channel);
	for (tmp = mchannel->lastmsgs; tmp != NULL; tmp = tmp->next) {
		LAST_MSG_REC *rec = tmp->data;

		if (g_strncasecmp(rec->nick, nick, len) == 0 &&
		    glist_find_icase_string(*outlist, rec->nick) == NULL) {
			str = g_strconcat(rec->nick, suffix, NULL);
			if (completion_lowercase) g_strdown(str);
			if (rec->own)
				ownlist = g_list_append(ownlist, str);
                        else
				*outlist = g_list_append(*outlist, str);
		}
	}

        *outlist = g_list_concat(ownlist, *outlist);
}
Beispiel #29
0
void
purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
                                   const gchar *participant,
                                   GList *remote_candidates)
{
#ifdef USE_VV
	PurpleMediaStream *stream;

	g_return_if_fail(PURPLE_IS_MEDIA(media));
	stream = purple_media_get_stream(media, sess_id, participant);

	if (stream == NULL) {
		purple_debug_error("media",
				"purple_media_add_remote_candidates: "
				"couldn't find stream %s %s.\n",
				sess_id ? sess_id : "(null)",
				participant ? participant : "(null)");
		return;
	}

	stream->remote_candidates = g_list_concat(stream->remote_candidates,
			purple_media_candidate_list_copy(remote_candidates));

	purple_media_backend_add_remote_candidates(media->priv->backend,
			sess_id, participant, remote_candidates);
#endif
}
Beispiel #30
0
void fileops_empty_trash ()
{
    GList* trash_list = NULL;

    GVolumeMonitor* vol_monitor = g_volume_monitor_get ();
    GList* mount_list = g_volume_monitor_get_mounts (vol_monitor);
    g_object_unref (vol_monitor);

    //iterate through all mounts
    GList* l;
    for (l = mount_list; l != NULL; l = l->next)
    {
	trash_list = g_list_concat (trash_list,
		                    _get_trash_dirs_for_mount (l->data));
    }
    g_list_free_full (mount_list, g_object_unref);
    //add 'trash:' prefix
    trash_list = g_list_prepend (trash_list,
				 g_file_new_for_uri ("trash:"));

    g_io_scheduler_push_job (_empty_trash_job,
			     trash_list,
			     NULL,
			     0,
			     NULL);
}