gnome-control-center r8689 - trunk/capplets/appearance



Author: jensg
Date: Sun May  4 13:39:46 2008
New Revision: 8689
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8689&view=rev

Log:
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


Modified:
   trunk/capplets/appearance/ChangeLog
   trunk/capplets/appearance/appearance-desktop.c
   trunk/capplets/appearance/gnome-wp-info.c
   trunk/capplets/appearance/gnome-wp-info.h
   trunk/capplets/appearance/gnome-wp-item.c
   trunk/capplets/appearance/gnome-wp-item.h

Modified: trunk/capplets/appearance/appearance-desktop.c
==============================================================================
--- trunk/capplets/appearance/appearance-desktop.c	(original)
+++ trunk/capplets/appearance/appearance-desktop.c	Sun May  4 13:39:46 2008
@@ -931,8 +931,6 @@
 
   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);
 

Modified: trunk/capplets/appearance/gnome-wp-info.c
==============================================================================
--- trunk/capplets/appearance/gnome-wp-info.c	(original)
+++ trunk/capplets/appearance/gnome-wp-info.c	Sun May  4 13:39:46 2008
@@ -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;
-
-  info = gnome_vfs_file_info_new ();
-  escaped_path = gnome_vfs_escape_path_string (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) {
+  GnomeWPInfo *wp;
+  GFile *file;
+  GFileInfo *info;
+
+  file = g_file_new_for_commandline_arg (uri);
+
+  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);
 
-    new->uri = g_strdup (uri);
+    wp->uri = g_strdup (uri);
 
-    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->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);
+
+    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 @@
   g_free (info->thumburi);
   g_free (info->name);
   g_free (info->mime_type);
-
-  info = NULL;
 }
-

Modified: trunk/capplets/appearance/gnome-wp-info.h
==============================================================================
--- trunk/capplets/appearance/gnome-wp-info.h	(original)
+++ trunk/capplets/appearance/gnome-wp-info.h	Sun May  4 13:39:46 2008
@@ -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 @@
   gchar * name;
   gchar * mime_type;
 
-  GnomeVFSFileSize size;
+  goffset size;
 
   time_t mtime;
 };

Modified: trunk/capplets/appearance/gnome-wp-item.c
==============================================================================
--- trunk/capplets/appearance/gnome-wp-item.c	(original)
+++ trunk/capplets/appearance/gnome-wp-item.c	Sun May  4 13:39:46 2008
@@ -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 @@
 				 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 @@
     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)

Modified: trunk/capplets/appearance/gnome-wp-item.h
==============================================================================
--- trunk/capplets/appearance/gnome-wp-item.h	(original)
+++ trunk/capplets/appearance/gnome-wp-item.h	Sun May  4 13:39:46 2008
@@ -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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]