Exemplo n.º 1
0
Arquivo: on.cpp Projeto: luisivan/on
QStringList On::recentFiles() {

    QStringList recent;

    GtkRecentManager *manager = gtk_recent_manager_get_default();
    GList *list = gtk_recent_manager_get_items(manager);
    GtkRecentInfo *item;

    int i = 0;

    GFOREACH(item, list) {
        recent.append(QUrl::fromEncoded(gtk_recent_info_get_uri(item)).toString());
        recent.append(QUrl::fromEncoded(gtk_recent_info_get_display_name(item)).toString());
        recent.append(gdkPixbufToBase64(gtk_recent_info_get_icon(item, iconSize)));
        if (i == 50) {
            gtk_recent_info_unref(item);
            g_list_free(list);
            return recent;
        }
        i++;
    }
Exemplo n.º 2
0
static GdkPixbuf *
load_pixbuf_fallback(AsyncTextureLoadData *data)
{
  GdkPixbuf *pixbuf = NULL;

  if (data->thumbnail)
    {

      GtkIconTheme *theme = gtk_icon_theme_get_default ();

      if (data->recent_info)
          pixbuf = gtk_recent_info_get_icon (data->recent_info, data->width);
      else
        {
          GIcon *icon = icon_for_mimetype (data->mimetype);
          if (icon != NULL)
            {
              GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon (theme,
                                                                       icon,
                                                                       data->width,
                                                                       GTK_ICON_LOOKUP_USE_BUILTIN);
              g_object_unref (icon);
              if (icon_info != NULL)
                pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
            }
        }

      if (pixbuf == NULL)
        pixbuf = gtk_icon_theme_load_icon (theme,
                                           "gtk-file",
                                           data->width,
                                           GTK_ICON_LOOKUP_USE_BUILTIN,
                                           NULL);
    }
  /* Maybe we could need a fallback for outher image types? */

  return pixbuf;
}
Exemplo n.º 3
0
static VALUE
rg_get_icon(VALUE self, VALUE size)
{
    return GOBJ2RVAL(gtk_recent_info_get_icon(_SELF(self), NUM2INT(size)));
}