示例#1
0
文件: gdk.c 项目: 3v1n0/gtk
/**
 * gdk_threads_add_timeout_seconds: (skip)
 * @interval: the time between calls to the function, in seconds
 * @function: function to call
 * @data:     data to pass to @function
 *
 * A wrapper for the common usage of gdk_threads_add_timeout_seconds_full() 
 * assigning the default priority, #G_PRIORITY_DEFAULT.
 *
 * For details, see gdk_threads_add_timeout_full().
 * 
 * Returns: the ID (greater than 0) of the event source.
 *
 * Since: 2.14
 */
guint
gdk_threads_add_timeout_seconds (guint       interval,
                                 GSourceFunc function,
                                 gpointer    data)
{
  return gdk_threads_add_timeout_seconds_full (G_PRIORITY_DEFAULT,
                                               interval, function, data, NULL);
}
示例#2
0
static void refresh_stories(gboolean immediate)
{
    static gint refresh_timer;

    if (refresh_timer) {
        if (immediate)
            g_source_remove(refresh_timer);
        else
            return;
    }

    refresh_timer = gdk_threads_add_timeout_seconds_full(G_PRIORITY_LOW,
            refresh_timeout, refresh_stories_cb, &refresh_timer, NULL);

    g_print("refreshing stories\n");

    const gchar *url = HN_API "topstories.json";
    if (gmulticurl_request(gmulticurl, url, topstories_on_data, NULL)) {
        g_warning("gmulticurl_request error");
    }
}