even more gio migration
2008-05-04 Jens Granseuer <jensgr@gmx.net> * appearance-desktop.c: (desktop_init): * gnome-wp-info.c: (gnome_wp_info_new), (gnome_wp_info_free): * gnome-wp-info.h: * gnome-wp-item.c: (gnome_wp_item_new), (gnome_wp_item_update_description): * gnome-wp-item.h: even more gio migration svn path=/trunk/; revision=8689
This commit is contained in:
parent
225e397072
commit
259efe4102
6 changed files with 61 additions and 54 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2008-05-04 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
|
* appearance-desktop.c: (desktop_init):
|
||||||
|
* gnome-wp-info.c: (gnome_wp_info_new), (gnome_wp_info_free):
|
||||||
|
* gnome-wp-info.h:
|
||||||
|
* gnome-wp-item.c: (gnome_wp_item_new),
|
||||||
|
(gnome_wp_item_update_description):
|
||||||
|
* gnome-wp-item.h: even more gio migration
|
||||||
|
|
||||||
2008-05-01 Jens Granseuer <jensgr@gmx.net>
|
2008-05-01 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
* appearance-themes.c: (theme_get_mtime),
|
* appearance-themes.c: (theme_get_mtime),
|
||||||
|
|
|
@ -931,8 +931,6 @@ desktop_init (AppearanceData *data,
|
||||||
|
|
||||||
data->wp_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
data->wp_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
gconf_client_add_dir (data->client, WP_KEYBOARD_PATH,
|
|
||||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
|
||||||
gconf_client_add_dir (data->client, WP_PATH_KEY,
|
gconf_client_add_dir (data->client, WP_PATH_KEY,
|
||||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
|
||||||
|
|
|
@ -19,52 +19,60 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnome.h>
|
#include <glib/gi18n.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
#include "gnome-wp-info.h"
|
#include "gnome-wp-info.h"
|
||||||
|
|
||||||
GnomeWPInfo * gnome_wp_info_new (const gchar * uri,
|
GnomeWPInfo * gnome_wp_info_new (const gchar * uri,
|
||||||
GnomeThumbnailFactory * thumbs) {
|
GnomeThumbnailFactory * thumbs) {
|
||||||
GnomeWPInfo * new;
|
GnomeWPInfo *wp;
|
||||||
GnomeVFSFileInfo * info;
|
GFile *file;
|
||||||
GnomeVFSResult result;
|
GFileInfo *info;
|
||||||
gchar * escaped_path;
|
|
||||||
|
|
||||||
info = gnome_vfs_file_info_new ();
|
file = g_file_new_for_commandline_arg (uri);
|
||||||
escaped_path = gnome_vfs_escape_path_string (uri);
|
|
||||||
|
|
||||||
result = gnome_vfs_get_file_info (escaped_path, info,
|
info = g_file_query_info (file,
|
||||||
GNOME_VFS_FILE_INFO_DEFAULT |
|
G_FILE_ATTRIBUTE_STANDARD_NAME ","
|
||||||
GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
|
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
|
||||||
GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
|
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
|
||||||
if (info == NULL || info->mime_type == NULL || result != GNOME_VFS_OK) {
|
G_FILE_ATTRIBUTE_TIME_MODIFIED,
|
||||||
|
G_FILE_QUERY_INFO_NONE,
|
||||||
|
NULL, NULL);
|
||||||
|
g_object_unref (file);
|
||||||
|
|
||||||
|
if (info == NULL || g_file_info_get_content_type (info) == NULL) {
|
||||||
if (!strcmp (uri, "(none)")) {
|
if (!strcmp (uri, "(none)")) {
|
||||||
new = g_new0 (GnomeWPInfo, 1);
|
wp = g_new0 (GnomeWPInfo, 1);
|
||||||
|
|
||||||
new->mime_type = g_strdup ("image/x-no-data");
|
wp->mime_type = g_strdup ("image/x-no-data");
|
||||||
new->uri = g_strdup (uri);
|
wp->uri = g_strdup (uri);
|
||||||
new->name = g_strdup (_("No Wallpaper"));
|
wp->name = g_strdup (_("No Wallpaper"));
|
||||||
new->size = 0;
|
wp->size = 0;
|
||||||
} else {
|
} else {
|
||||||
new = NULL;
|
wp = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
new = g_new0 (GnomeWPInfo, 1);
|
wp = g_new0 (GnomeWPInfo, 1);
|
||||||
|
|
||||||
new->uri = g_strdup (uri);
|
wp->uri = g_strdup (uri);
|
||||||
|
|
||||||
new->thumburi = gnome_thumbnail_factory_lookup (thumbs,
|
wp->name = g_strdup (g_file_info_get_name (info));
|
||||||
escaped_path,
|
if (g_file_info_get_content_type (info) != NULL)
|
||||||
info->mtime);
|
wp->mime_type = g_strdup (g_file_info_get_content_type (info));
|
||||||
new->name = g_strdup (info->name);
|
wp->size = g_file_info_get_size (info);
|
||||||
new->mime_type = g_strdup (info->mime_type);
|
wp->mtime = g_file_info_get_attribute_uint64 (info,
|
||||||
|
G_FILE_ATTRIBUTE_TIME_MODIFIED);
|
||||||
|
|
||||||
|
wp->thumburi = gnome_thumbnail_factory_lookup (thumbs,
|
||||||
|
uri,
|
||||||
|
wp->mtime);
|
||||||
|
|
||||||
new->size = info->size;
|
|
||||||
new->mtime = info->mtime;
|
|
||||||
}
|
}
|
||||||
g_free (escaped_path);
|
|
||||||
gnome_vfs_file_info_unref (info);
|
|
||||||
|
|
||||||
return new;
|
if (info != NULL)
|
||||||
|
g_object_unref (info);
|
||||||
|
|
||||||
|
return wp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnome_wp_info_free (GnomeWPInfo * info) {
|
void gnome_wp_info_free (GnomeWPInfo * info) {
|
||||||
|
@ -76,7 +84,4 @@ void gnome_wp_info_free (GnomeWPInfo * info) {
|
||||||
g_free (info->thumburi);
|
g_free (info->thumburi);
|
||||||
g_free (info->name);
|
g_free (info->name);
|
||||||
g_free (info->mime_type);
|
g_free (info->mime_type);
|
||||||
|
|
||||||
info = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#define _GNOME_WP_INFO_H_
|
#define _GNOME_WP_INFO_H_
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <libgnomevfs/gnome-vfs.h>
|
|
||||||
#include <libgnomeui/gnome-thumbnail.h>
|
#include <libgnomeui/gnome-thumbnail.h>
|
||||||
|
|
||||||
typedef struct _GnomeWPInfo GnomeWPInfo;
|
typedef struct _GnomeWPInfo GnomeWPInfo;
|
||||||
|
@ -33,7 +32,7 @@ struct _GnomeWPInfo {
|
||||||
gchar * name;
|
gchar * name;
|
||||||
gchar * mime_type;
|
gchar * mime_type;
|
||||||
|
|
||||||
GnomeVFSFileSize size;
|
goffset size;
|
||||||
|
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <gconf/gconf-client.h>
|
#include <gconf/gconf-client.h>
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
|
||||||
#include "gnome-wp-item.h"
|
#include "gnome-wp-item.h"
|
||||||
|
|
||||||
static GConfEnumStringPair options_lookup[] = {
|
static GConfEnumStringPair options_lookup[] = {
|
||||||
|
@ -129,20 +128,18 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||||
GnomeThumbnailFactory * thumbnails) {
|
GnomeThumbnailFactory * thumbnails) {
|
||||||
GnomeWPItem *item = g_new0 (GnomeWPItem, 1);
|
GnomeWPItem *item = g_new0 (GnomeWPItem, 1);
|
||||||
|
|
||||||
item->filename = gnome_vfs_unescape_string_for_display (filename);
|
item->filename = g_strdup (filename);
|
||||||
|
item->fileinfo = gnome_wp_info_new (filename, thumbnails);
|
||||||
|
|
||||||
item->fileinfo = gnome_wp_info_new (item->filename, thumbnails);
|
if (item->fileinfo != NULL && item->fileinfo->mime_type != NULL &&
|
||||||
|
|
||||||
if (item->fileinfo != NULL &&
|
|
||||||
(g_str_has_prefix (item->fileinfo->mime_type, "image/") ||
|
(g_str_has_prefix (item->fileinfo->mime_type, "image/") ||
|
||||||
strcmp (item->fileinfo->mime_type, "application/xml") == 0)) {
|
strcmp (item->fileinfo->mime_type, "application/xml") == 0)) {
|
||||||
if (item->name == NULL) {
|
|
||||||
if (g_utf8_validate (item->fileinfo->name, -1, NULL))
|
if (g_utf8_validate (item->fileinfo->name, -1, NULL))
|
||||||
item->name = g_strdup (item->fileinfo->name);
|
item->name = g_strdup (item->fileinfo->name);
|
||||||
else
|
else
|
||||||
item->name = g_filename_to_utf8 (item->fileinfo->name, -1, NULL,
|
item->name = g_filename_to_utf8 (item->fileinfo->name, -1, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
gnome_wp_item_update (item);
|
gnome_wp_item_update (item);
|
||||||
gnome_wp_item_update_description (item);
|
gnome_wp_item_update_description (item);
|
||||||
|
@ -211,7 +208,7 @@ void gnome_wp_item_update_description (GnomeWPItem * item) {
|
||||||
if (strcmp (item->fileinfo->mime_type, "application/xml") == 0)
|
if (strcmp (item->fileinfo->mime_type, "application/xml") == 0)
|
||||||
description = _("Slide Show");
|
description = _("Slide Show");
|
||||||
else
|
else
|
||||||
description = gnome_vfs_mime_get_description (item->fileinfo->mime_type);
|
description = g_content_type_get_description (item->fileinfo->mime_type);
|
||||||
|
|
||||||
/* translators: <b>wallpaper name</b>
|
/* translators: <b>wallpaper name</b>
|
||||||
* mime type, x pixel(s) by y pixel(s)
|
* mime type, x pixel(s) by y pixel(s)
|
||||||
|
|
|
@ -19,14 +19,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include <gtk/gtktreeview.h>
|
#include <gtk/gtktreeview.h>
|
||||||
#include <libgnomeui/gnome-thumbnail.h>
|
#include <libgnomeui/gnome-thumbnail.h>
|
||||||
#include <gnome-wp-info.h>
|
|
||||||
#include <libgnomevfs/gnome-vfs.h>
|
|
||||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||||
#include <libgnomeui/gnome-bg.h>
|
#include <libgnomeui/gnome-bg.h>
|
||||||
|
|
||||||
|
#include "gnome-wp-info.h"
|
||||||
|
|
||||||
#ifndef _GNOME_WP_ITEM_H_
|
#ifndef _GNOME_WP_ITEM_H_
|
||||||
#define _GNOME_WP_ITEM_H_
|
#define _GNOME_WP_ITEM_H_
|
||||||
|
|
||||||
|
@ -36,8 +37,6 @@
|
||||||
#define WP_SHADING_KEY WP_PATH_KEY "/color_shading_type"
|
#define WP_SHADING_KEY WP_PATH_KEY "/color_shading_type"
|
||||||
#define WP_PCOLOR_KEY WP_PATH_KEY "/primary_color"
|
#define WP_PCOLOR_KEY WP_PATH_KEY "/primary_color"
|
||||||
#define WP_SCOLOR_KEY WP_PATH_KEY "/secondary_color"
|
#define WP_SCOLOR_KEY WP_PATH_KEY "/secondary_color"
|
||||||
#define WP_KEYBOARD_PATH "/desktop/gnome/peripherals/keyboard"
|
|
||||||
#define WP_DELAY_KEY WP_KEYBOARD_PATH "/delay"
|
|
||||||
|
|
||||||
typedef struct _GnomeWPItem GnomeWPItem;
|
typedef struct _GnomeWPItem GnomeWPItem;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue