Пример #1
0
/**
 * mega_filesystem_get_root_nodes:
 * @filesystem: a #MegaFilesystem
 *
 * Get filesystem root nodes.
 *
 * Returns: (transfer full) (element-type MegaNode): List of nodes.
 */
GSList* mega_filesystem_get_root_nodes(MegaFilesystem* filesystem)
{
  MegaFilesystemPrivate* priv;

  g_return_val_if_fail(MEGA_IS_FILESYSTEM(filesystem), NULL);

  priv = filesystem->priv;

  return g_slist_copy_deep(priv->root_nodes, (GCopyFunc)g_object_ref, NULL);
}
Пример #2
0
static GSList *
gtk_file_chooser_native_get_files (GtkFileChooser *chooser)
{
  GtkFileChooserNative *self = GTK_FILE_CHOOSER_NATIVE (chooser);

  switch (self->mode)
    {
    case MODE_WIN32:
      return g_slist_copy_deep (self->custom_files, (GCopyFunc)g_object_ref, NULL);

    case MODE_FALLBACK:
    default:
      return gtk_file_chooser_get_files (GTK_FILE_CHOOSER (self->dialog));
    }
}
Пример #3
0
static void
update_emoji_dict (EmojiData *data)
{
    GSList *annotations = data->annotations;
    while (annotations) {
        const gchar *annotation = (const gchar *) annotations->data;
        GSList *emojis = g_hash_table_lookup (data->dict, annotation);
        if (emojis) {
            GSList *duplicated = g_slist_find_custom (emojis,
                                                      data->emoji,
                                                      (GCompareFunc) g_strcmp0);
            if (duplicated != NULL)
                 continue;
            emojis = g_slist_copy_deep (emojis, (GCopyFunc) g_strdup, NULL);
        }
        emojis = g_slist_append (emojis, g_strdup (data->emoji));
        g_hash_table_replace (data->dict,
                              g_strdup (annotation),
                              emojis);
        annotations = annotations->next;
    }
}
Пример #4
0
/**
 * g_slist_copy:
 * @list: a #GSList
 *
 * Copies a #GSList.
 *
 * <note><para>
 * Note that this is a "shallow" copy. If the list elements
 * consist of pointers to data, the pointers are copied but
 * the actual data isn't. See g_slist_copy_deep() if you need
 * to copy the data as well.
 * </para></note>
 *
 * Returns: a copy of @list
 */
GSList*
g_slist_copy (GSList *list)
{
  return g_slist_copy_deep (list, NULL, NULL);
}
Пример #5
0
void
servlist_connect (session *sess, ircnet *net, gboolean join)
{
    ircserver *ircserv;
    GSList *list;
    char *port;
    server *serv;

    if (!sess)
        sess = new_ircwindow (NULL, NULL, SESS_SERVER, TRUE);

    serv = sess->server;

    /* connect to the currently selected Server-row */
    list = g_slist_nth (net->servlist, net->selected);
    if (!list)
        list = net->servlist;
    if (!list)
        return;
    ircserv = list->data;

    /* in case a protocol switch is added to the servlist gui */
    server_fill_her_up (sess->server);

    if (join)
    {
        sess->willjoinchannel[0] = 0;

        if (net->favchanlist)
        {
            if (serv->favlist)
            {
                g_slist_free_full (serv->favlist, (GDestroyNotify) servlist_favchan_free);
            }
            serv->favlist = g_slist_copy_deep (net->favchanlist, (GCopyFunc) servlist_favchan_copy, NULL);
        }
    }

    if (net->logintype)
    {
        serv->loginmethod = net->logintype;
    }
    else
    {
        serv->loginmethod = LOGIN_DEFAULT_REAL;
    }

    serv->password[0] = 0;

    if (net->pass)
    {
        safe_strcpy (serv->password, net->pass, sizeof (serv->password));
    }

    if (net->flags & FLAG_USE_GLOBAL)
    {
        strcpy (serv->nick, prefs.hex_irc_nick1);
    }
    else
    {
        if (net->nick)
            strcpy (serv->nick, net->nick);
    }

    serv->dont_use_proxy = (net->flags & FLAG_USE_PROXY) ? FALSE : TRUE;

#ifdef USE_OPENSSL
    serv->use_ssl = (net->flags & FLAG_USE_SSL) ? TRUE : FALSE;
    serv->accept_invalid_cert =
        (net->flags & FLAG_ALLOW_INVALID) ? TRUE : FALSE;
#endif

    serv->network = net;

    port = strrchr (ircserv->hostname, '/');
    if (port)
    {
        *port = 0;

        /* support "+port" to indicate SSL (like mIRC does) */
        if (port[1] == '+')
        {
#ifdef USE_OPENSSL
            serv->use_ssl = TRUE;
#endif
            serv->connect (serv, ircserv->hostname, atoi (port + 2), FALSE);
        } else
        {
            serv->connect (serv, ircserv->hostname, atoi (port + 1), FALSE);
        }

        *port = '/';
    } else
        serv->connect (serv, ircserv->hostname, -1, FALSE);

    server_set_encoding (serv, net->encoding);
}