summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Granseuer <jensgr@gmx.net>2008-05-04 13:39:46 +0000
committerJens Granseuer <jensg@src.gnome.org>2008-05-04 13:39:46 +0000
commit259efe410262cdc6697823ddc5e81f7975c5e04c (patch)
treed2a7e87c9eedf14787efd39a549e03597ddc3f4f
parent225e3970720f10eaca5c780a110fa47c638f45d5 (diff)
downloadgnome-control-center-259efe410262cdc6697823ddc5e81f7975c5e04c.tar.gz
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
-rw-r--r--capplets/appearance/ChangeLog9
-rw-r--r--capplets/appearance/appearance-desktop.c2
-rw-r--r--capplets/appearance/gnome-wp-info.c71
-rw-r--r--capplets/appearance/gnome-wp-info.h3
-rw-r--r--capplets/appearance/gnome-wp-item.c23
-rw-r--r--capplets/appearance/gnome-wp-item.h7
6 files changed, 61 insertions, 54 deletions
diff --git a/capplets/appearance/ChangeLog b/capplets/appearance/ChangeLog
index a6e58198d..ae5ba8c8a 100644
--- a/capplets/appearance/ChangeLog
+++ b/capplets/appearance/ChangeLog
@@ -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>
* appearance-themes.c: (theme_get_mtime),
diff --git a/capplets/appearance/appearance-desktop.c b/capplets/appearance/appearance-desktop.c
index 2b54e9230..e96d7daf1 100644
--- a/capplets/appearance/appearance-desktop.c
+++ b/capplets/appearance/appearance-desktop.c
@@ -931,8 +931,6 @@ desktop_init (AppearanceData *data,
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_PRELOAD_ONELEVEL, NULL);
diff --git a/capplets/appearance/gnome-wp-info.c b/capplets/appearance/gnome-wp-info.c
index c49d0decd..2642a53e2 100644
--- a/capplets/appearance/gnome-wp-info.c
+++ b/capplets/appearance/gnome-wp-info.c
@@ -19,52 +19,60 @@
*/
#include <config.h>
-#include <gnome.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
#include "gnome-wp-info.h"
GnomeWPInfo * gnome_wp_info_new (const gchar * uri,
GnomeThumbnailFactory * thumbs) {
- GnomeWPInfo * new;
- GnomeVFSFileInfo * info;
- GnomeVFSResult result;
- gchar * escaped_path;
+ GnomeWPInfo *wp;
+ GFile *file;
+ GFileInfo *info;
- info = gnome_vfs_file_info_new ();
- escaped_path = gnome_vfs_escape_path_string (uri);
+ file = g_file_new_for_commandline_arg (uri);
- result = gnome_vfs_get_file_info (escaped_path, info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (info == NULL || info->mime_type == NULL || result != GNOME_VFS_OK) {
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE ","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ 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)")) {
- new = g_new0 (GnomeWPInfo, 1);
+ wp = g_new0 (GnomeWPInfo, 1);
- new->mime_type = g_strdup ("image/x-no-data");
- new->uri = g_strdup (uri);
- new->name = g_strdup (_("No Wallpaper"));
- new->size = 0;
+ wp->mime_type = g_strdup ("image/x-no-data");
+ wp->uri = g_strdup (uri);
+ wp->name = g_strdup (_("No Wallpaper"));
+ wp->size = 0;
} else {
- new = NULL;
+ wp = NULL;
}
} else {
- new = g_new0 (GnomeWPInfo, 1);
+ wp = g_new0 (GnomeWPInfo, 1);
+
+ wp->uri = g_strdup (uri);
- new->uri = g_strdup (uri);
+ wp->name = g_strdup (g_file_info_get_name (info));
+ if (g_file_info_get_content_type (info) != NULL)
+ wp->mime_type = g_strdup (g_file_info_get_content_type (info));
+ wp->size = g_file_info_get_size (info);
+ wp->mtime = g_file_info_get_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED);
- new->thumburi = gnome_thumbnail_factory_lookup (thumbs,
- escaped_path,
- info->mtime);
- new->name = g_strdup (info->name);
- new->mime_type = g_strdup (info->mime_type);
+ 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) {
@@ -76,7 +84,4 @@ void gnome_wp_info_free (GnomeWPInfo * info) {
g_free (info->thumburi);
g_free (info->name);
g_free (info->mime_type);
-
- info = NULL;
}
-
diff --git a/capplets/appearance/gnome-wp-info.h b/capplets/appearance/gnome-wp-info.h
index f8cf69074..8ca76e613 100644
--- a/capplets/appearance/gnome-wp-info.h
+++ b/capplets/appearance/gnome-wp-info.h
@@ -22,7 +22,6 @@
#define _GNOME_WP_INFO_H_
#include <glib.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libgnomeui/gnome-thumbnail.h>
typedef struct _GnomeWPInfo GnomeWPInfo;
@@ -33,7 +32,7 @@ struct _GnomeWPInfo {
gchar * name;
gchar * mime_type;
- GnomeVFSFileSize size;
+ goffset size;
time_t mtime;
};
diff --git a/capplets/appearance/gnome-wp-item.c b/capplets/appearance/gnome-wp-item.c
index de3d17ebb..41d6cd7f6 100644
--- a/capplets/appearance/gnome-wp-item.c
+++ b/capplets/appearance/gnome-wp-item.c
@@ -24,7 +24,6 @@
#include <gconf/gconf-client.h>
#include <gnome.h>
#include <string.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include "gnome-wp-item.h"
static GConfEnumStringPair options_lookup[] = {
@@ -129,20 +128,18 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
GnomeThumbnailFactory * thumbnails) {
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 &&
+ if (item->fileinfo != NULL && item->fileinfo->mime_type != NULL &&
(g_str_has_prefix (item->fileinfo->mime_type, "image/") ||
strcmp (item->fileinfo->mime_type, "application/xml") == 0)) {
- if (item->name == NULL) {
- if (g_utf8_validate (item->fileinfo->name, -1, NULL))
- item->name = g_strdup (item->fileinfo->name);
- else
- item->name = g_filename_to_utf8 (item->fileinfo->name, -1, NULL,
- NULL, NULL);
- }
+
+ if (g_utf8_validate (item->fileinfo->name, -1, NULL))
+ item->name = g_strdup (item->fileinfo->name);
+ else
+ item->name = g_filename_to_utf8 (item->fileinfo->name, -1, NULL,
+ NULL, NULL);
gnome_wp_item_update (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)
description = _("Slide Show");
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>
* mime type, x pixel(s) by y pixel(s)
diff --git a/capplets/appearance/gnome-wp-item.h b/capplets/appearance/gnome-wp-item.h
index 897b962b5..c6dd8ec80 100644
--- a/capplets/appearance/gnome-wp-item.h
+++ b/capplets/appearance/gnome-wp-item.h
@@ -19,14 +19,15 @@
*/
#include <glib.h>
+#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtktreeview.h>
#include <libgnomeui/gnome-thumbnail.h>
-#include <gnome-wp-info.h>
-#include <libgnomevfs/gnome-vfs.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnomeui/gnome-bg.h>
+#include "gnome-wp-info.h"
+
#ifndef _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_PCOLOR_KEY WP_PATH_KEY "/primary_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;