[libslab/gnome-3] seems we need our own GKeyFile-alike (sadly) so add that back



commit 587cf6788961136ed576876629eb5ba596a44b45
Author: Michael Meeks <michael meeks suse com>
Date:   Mon Sep 26 15:12:33 2011 +0100

    seems we need our own GKeyFile-alike (sadly) so add that back
    
    handles ref-counting (GKeyFile is not a GObject), and storing the
    filename of the source .desktop

 libslab/Makefile.am        |    2 +
 libslab/app-resizer.c      |    4 +-
 libslab/app-shell.c        |   32 +++---
 libslab/app-shell.h        |    5 +-
 libslab/application-tile.c |   40 +++---
 libslab/application-tile.h |    3 +-
 libslab/bookmark-agent.c   |    9 +-
 libslab/directory-tile.c   |    8 +-
 libslab/document-tile.c    |    8 +-
 libslab/gnome-utils.c      |  266 ++---------------------------------------
 libslab/gnome-utils.h      |   11 +--
 libslab/libslab-utils.c    |  221 ---------------------------------
 libslab/libslab-utils.h    |   11 --
 libslab/slab-gnome-util.c  |   22 ++--
 libslab/slab-gnome-util.h  |   13 +-
 libslab/slab-key-file.c    |  291 ++++++++++++++++++++++++++++++++++++++++++++
 libslab/slab-key-file.h    |   59 +++++++++
 libslab/system-tile.c      |   14 +-
 18 files changed, 444 insertions(+), 575 deletions(-)
---
diff --git a/libslab/Makefile.am b/libslab/Makefile.am
index 7a7c437..e67a965 100644
--- a/libslab/Makefile.am
+++ b/libslab/Makefile.am
@@ -22,6 +22,7 @@ HEADER_FILES=					\
 	search-context-picker.h			\
 	search-entry.h				\
 	shell-window.h				\
+	slab-key-file.h				\
 	slab-gnome-util.h			\
 	slab-section.h				\
 	slab.h					\
@@ -51,6 +52,7 @@ libslab_la_SOURCES =				\
 	search-entry-watermark.h		\
 	search-entry.c				\
 	shell-window.c				\
+	slab-key-file.c				\
 	slab-gnome-util.c			\
 	slab-section.c				\
 	system-tile.c				\
diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c
index 6c9fc20..9925d32 100644
--- a/libslab/app-resizer.c
+++ b/libslab/app-resizer.c
@@ -243,7 +243,7 @@ app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
 		GtkRequisition req;
 
 		/* Have to do this so that it requests, and thus gets allocated, new amount */
-		gtk_widget_size_request (child, &req);
+		gtk_widget_get_preferred_size (child, &req, NULL);
 
 		resizer->cur_num_cols = new_num_cols;
 	}
@@ -285,7 +285,7 @@ app_resizer_new (GtkBox * child, gint initial_num_columns,
 void
 app_resizer_set_vadjustment_value (GtkWidget * widget, gdouble value)
 {
-	GtkAdjustment *adjust = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
+	GtkAdjustment *adjust = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget));
 	gdouble upper, page_size;
 
 	upper = gtk_adjustment_get_upper (adjust);
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 739eca6..ed78520 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -61,7 +61,7 @@ static void generate_category (const char * category, GMenuTreeDirectory * root_
 static void generate_launchers (GMenuTreeDirectory * root_dir, AppShellData * app_data,
 	CategoryData * cat_data, gboolean recursive);
 static void generate_new_apps (AppShellData * app_data);
-static void insert_launcher_into_category (CategoryData * cat_data, GKeyFile * desktop_item,
+static void insert_launcher_into_category (CategoryData * cat_data, SlabKeyFile * desktop_item,
 	AppShellData * app_data);
 
 static gboolean main_keypress_callback (GtkWidget * widget, GdkEventKey * event,
@@ -976,7 +976,7 @@ generate_category (const char * category, GMenuTreeDirectory * root_dir, AppShel
 }
 
 static gboolean
-check_specific_apps_hack (GKeyFile * item)
+check_specific_apps_hack (SlabKeyFile * item)
 {
 	static const gchar *COMMAND_LINE_LOCKDOWN_GCONF_KEY =
 		"/desktop/gnome/lockdown/disable_command_line";
@@ -993,7 +993,7 @@ check_specific_apps_hack (GKeyFile * item)
 	}
 
 	/* This seems like an ugly hack but it's the way it's currently done in the old control center */
-	exec = libslab_keyfile_get (item, G_KEY_FILE_DESKTOP_KEY_EXEC);
+	exec = slab_key_file_get (item, G_KEY_FILE_DESKTOP_KEY_EXEC);
 
 	/* discard xscreensaver if gnome-screensaver is installed */
 	if ((exec && !strcmp (exec, "xscreensaver-demo"))
@@ -1017,7 +1017,7 @@ check_specific_apps_hack (GKeyFile * item)
 	if (command_line_lockdown)
 	{
 		const gchar *categories =
-		  libslab_keyfile_get (item, G_KEY_FILE_DESKTOP_KEY_CATEGORIES);
+		  slab_key_file_get (item, G_KEY_FILE_DESKTOP_KEY_CATEGORIES);
 		if (g_strrstr (categories, COMMAND_LINE_LOCKDOWN_DESKTOP_CATEGORY))
 		{
 			/* printf ("eliminating %s\n", gnome_desktop_item_get_location (item)); */
@@ -1035,7 +1035,7 @@ check_specific_apps_hack (GKeyFile * item)
 static void
 generate_launchers (GMenuTreeDirectory * root_dir, AppShellData * app_data, CategoryData * cat_data, gboolean recursive)
 {
-	GKeyFile *desktop_item;
+	SlabKeyFile *desktop_item;
 	const gchar *desktop_file;
 	GSList *contents, *l;
 
@@ -1065,8 +1065,7 @@ generate_launchers (GMenuTreeDirectory * root_dir, AppShellData * app_data, Cate
 				g_hash_table_insert (app_data->hash, (gpointer) desktop_file,
 					(gpointer) desktop_file);
 			}
-			desktop_item = g_key_file_new();
-			g_key_file_load_from_file (desktop_item, desktop_file, 0, NULL);
+			desktop_item = slab_key_file_new_from_path (desktop_file);
 			if (!desktop_item)
 			{
 				g_critical ("Failure - gnome_desktop_item_new_from_file(%s)",
@@ -1075,7 +1074,7 @@ generate_launchers (GMenuTreeDirectory * root_dir, AppShellData * app_data, Cate
 			}
 			if (!check_specific_apps_hack (desktop_item))
 				insert_launcher_into_category (cat_data, desktop_item, app_data);
-			g_object_unref (desktop_item);
+			slab_key_file_unref (desktop_item);
 			break;
 		default:
 			break;
@@ -1135,9 +1134,9 @@ generate_new_apps (AppShellData * app_data)
 			for (launchers = data->launcher_list; launchers; launchers = launchers->next)
 			{
 				Tile *tile = TILE (launchers->data);
-				GKeyFile *item =
+				SlabKeyFile *item =
 					application_tile_get_desktop_item (APPLICATION_TILE (tile));
-				gchar *uri = libslab_keyfile_get_location (item);
+				gchar *uri = slab_key_file_get_location (item);
 				g_string_append (gstr, uri);
 				g_string_append (gstr, separator);
 				g_free (uri);
@@ -1171,9 +1170,9 @@ generate_new_apps (AppShellData * app_data)
 		for (launchers = cat_data->launcher_list; launchers; launchers = launchers->next)
 		{
 			Tile *tile = TILE (launchers->data);
-			GKeyFile *item =
+			SlabKeyFile *item =
 				application_tile_get_desktop_item (APPLICATION_TILE (tile));
-			gchar *uri = libslab_keyfile_get_location (item);
+			gchar *uri = slab_key_file_get_location (item);
 			if (!g_hash_table_lookup (all_apps_cache, uri))
 			{
 				GFile *file;
@@ -1267,8 +1266,9 @@ generate_new_apps (AppShellData * app_data)
 }
 
 static void
-insert_launcher_into_category (CategoryData * cat_data, GKeyFile * desktop_item,
-	AppShellData * app_data)
+insert_launcher_into_category (CategoryData * cat_data,
+			       SlabKeyFile * desktop_item,
+			       AppShellData * app_data)
 {
 	GtkWidget *launcher;
 	static GtkSizeGroup *icon_group = NULL;
@@ -1281,13 +1281,13 @@ insert_launcher_into_category (CategoryData * cat_data, GKeyFile * desktop_item,
 		icon_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
 	launcher =
-	  application_tile_new_full (libslab_keyfile_get_location (desktop_item),
+	  application_tile_new_full (slab_key_file_get_location (desktop_item),
 		app_data->icon_size, app_data->show_tile_generic_name, app_data->gconf_prefix);
 	g_return_if_fail (launcher != NULL);
 
 	gtk_widget_set_size_request (launcher, SIZING_TILE_WIDTH, -1);
 
-	filepath = libslab_keyfile_get (desktop_item, G_KEY_FILE_DESKTOP_KEY_EXEC);
+	filepath = slab_key_file_get (desktop_item, G_KEY_FILE_DESKTOP_KEY_EXEC);
 	g_strdelimit (filepath, " ", '\0');	/* just want the file name - no args or replacements */
 	filename = g_strrstr (filepath, "/");
 	if (filename)
diff --git a/libslab/app-shell.h b/libslab/app-shell.h
index 4462b07..2ef45de 100644
--- a/libslab/app-shell.h
+++ b/libslab/app-shell.h
@@ -26,6 +26,7 @@
 #define GMENU_I_KNOW_THIS_IS_UNSTABLE
 #include <gmenu-tree.h>
 
+#include <libslab/slab-key-file.h>
 #include <libslab/slab-section.h>
 #include <libslab/tile.h>
 
@@ -109,13 +110,13 @@ typedef struct
 typedef struct
 {
 	const gchar *name;
-	GKeyFile *item;
+	SlabKeyFile *item;
 } AppAction;
 
 typedef struct
 {
 	long time;
-	GKeyFile *item;
+	SlabKeyFile *item;
 } NewAppData;
 
 void generate_categories (AppShellData * app_data);
diff --git a/libslab/application-tile.c b/libslab/application-tile.c
index e20eb93..55f3de1 100644
--- a/libslab/application-tile.c
+++ b/libslab/application-tile.c
@@ -70,11 +70,11 @@ static void run_package_management_command (ApplicationTile *, gchar *);
 static void update_user_list_menu_item (ApplicationTile *);
 static void agent_notify_cb (GObject *, GParamSpec *, gpointer);
 
-static StartupStatus get_desktop_item_startup_status (GKeyFile *);
+static StartupStatus get_desktop_item_startup_status (SlabKeyFile *);
 static void          update_startup_menu_item (ApplicationTile *);
 
 typedef struct {
-	GKeyFile *desktop_item;
+	SlabKeyFile *desktop_item;
 
 	gchar       *image_id;
 	GtkIconSize  image_size;
@@ -145,24 +145,24 @@ application_tile_new_full (const gchar *desktop_item_id,
 
 	const gchar *uri = NULL;
 
-	GKeyFile *desktop_item;
+	SlabKeyFile *desktop_item;
 
-	desktop_item = libslab_gnome_desktop_item_new_from_unknown_id (desktop_item_id);
+	desktop_item = slab_key_file_new_from_unknown_id (desktop_item_id);
 
 	gchar *type = NULL;
 	if (
 		desktop_item &&
-		!g_ascii_strcasecmp ((type = libslab_keyfile_get (desktop_item,
+		!g_ascii_strcasecmp ((type = slab_key_file_get (desktop_item,
 								  G_KEY_FILE_DESKTOP_KEY_TYPE)),
 				     G_KEY_FILE_DESKTOP_TYPE_APPLICATION))
 	{
-	  uri = libslab_keyfile_get_location (desktop_item);
+	  uri = slab_key_file_get_location (desktop_item);
         }
 	g_free (type);
 
 	if (! uri) {
 		if (desktop_item)
-			g_object_unref (desktop_item);
+			slab_key_file_unref (desktop_item);
 
 		return NULL;
 	}
@@ -215,7 +215,7 @@ application_tile_finalize (GObject *g_object)
 	}
 
 	if (priv->desktop_item) {
-		g_object_unref (priv->desktop_item);
+		slab_key_file_unref (priv->desktop_item);
 		priv->desktop_item = NULL;
 	}
 	if (priv->image_id) {
@@ -314,18 +314,18 @@ application_tile_setup (ApplicationTile *this, const gchar *gconf_prefix)
 
 
 	if (! priv->desktop_item) {
-		priv->desktop_item = libslab_gnome_desktop_item_new_from_unknown_id (TILE (this)->uri);
+		priv->desktop_item = slab_key_file_new_from_unknown_id (TILE (this)->uri);
 		if (! priv->desktop_item)
 			return;
 	}
 
-	priv->image_id = libslab_keyfile_get_locale (priv->desktop_item,
+	priv->image_id = slab_key_file_get_locale (priv->desktop_item,
 						     G_KEY_FILE_DESKTOP_KEY_ICON);
 	image = themed_icon_new (priv->image_id, priv->image_size);
 
-	name = libslab_keyfile_get_locale (priv->desktop_item, "Name");
-	desc = libslab_keyfile_get_locale (priv->desktop_item, "GenericName");
-	comment = libslab_keyfile_get_locale (priv->desktop_item, "Comment");	
+	name = slab_key_file_get_locale (priv->desktop_item, "Name");
+	desc = slab_key_file_get_locale (priv->desktop_item, "GenericName");
+	comment = slab_key_file_get_locale (priv->desktop_item, "Comment");	
 
 	accessible = gtk_widget_get_accessible (GTK_WIDGET (this));
 	if (name)
@@ -392,7 +392,7 @@ application_tile_setup (ApplicationTile *this, const gchar *gconf_prefix)
 
 /* make help action */
 
-	if (libslab_keyfile_get (priv->desktop_item, "DocPath")) {
+	if (slab_key_file_get (priv->desktop_item, "DocPath")) {
 		action = tile_action_new (
 			TILE (this), help_trigger, _("Help"),
 			TILE_ACTION_OPENS_NEW_WINDOW | TILE_ACTION_OPENS_HELP);
@@ -681,7 +681,7 @@ add_to_startup_list (ApplicationTile *this)
 	gchar *dst_uri;
 
 	desktop_item_filename =
-	  g_filename_from_uri (libslab_keyfile_get_location (priv->desktop_item), NULL,
+	  g_filename_from_uri (slab_key_file_get_location (priv->desktop_item), NULL,
 			       NULL);
 
 	g_return_if_fail (desktop_item_filename != NULL);
@@ -695,7 +695,7 @@ add_to_startup_list (ApplicationTile *this)
 
 	dst_filename = g_build_filename (startup_dir, desktop_item_basename, NULL);
 
-	src_uri = libslab_keyfile_get_location (priv->desktop_item);
+	src_uri = slab_key_file_get_location (priv->desktop_item);
 	dst_uri = g_filename_to_uri (dst_filename, NULL, NULL);
 
 	copy_file (src_uri, dst_uri);
@@ -718,7 +718,7 @@ remove_from_startup_list (ApplicationTile *this)
 	gchar *src_filename;
 
 	ditem_filename =
-		g_filename_from_uri (libslab_keyfile_get_location (priv->desktop_item), NULL,
+		g_filename_from_uri (slab_key_file_get_location (priv->desktop_item), NULL,
 		NULL);
 
 	g_return_if_fail (ditem_filename != NULL);
@@ -740,7 +740,7 @@ remove_from_startup_list (ApplicationTile *this)
 	g_free (src_filename);
 }
 
-GKeyFile *
+SlabKeyFile *
 application_tile_get_desktop_item (ApplicationTile *tile)
 {
 	return APPLICATION_TILE_GET_PRIVATE (tile)->desktop_item;
@@ -800,7 +800,7 @@ update_user_list_menu_item (ApplicationTile *this)
 }
 
 static StartupStatus
-get_desktop_item_startup_status (GKeyFile *desktop_item)
+get_desktop_item_startup_status (SlabKeyFile *desktop_item)
 {
 	gchar *filename;
 	gchar *basename;
@@ -812,7 +812,7 @@ get_desktop_item_startup_status (GKeyFile *desktop_item)
 	StartupStatus retval;
 	gint x;
 
-	filename = g_filename_from_uri (libslab_keyfile_get_location (desktop_item), NULL, NULL);
+	filename = g_filename_from_uri (slab_key_file_get_location (desktop_item), NULL, NULL);
 	if (!filename)
 		return APP_NOT_ELIGIBLE;
 	basename = g_path_get_basename (filename);
diff --git a/libslab/application-tile.h b/libslab/application-tile.h
index 613132f..faae978 100644
--- a/libslab/application-tile.h
+++ b/libslab/application-tile.h
@@ -22,6 +22,7 @@
 #define __APPLICATION_TILE_H__
 
 #include <libslab/nameplate-tile.h>
+#include <libslab/slab-key-file.h>
 
 G_BEGIN_DECLS
 
@@ -58,7 +59,7 @@ GtkWidget *application_tile_new (const gchar * desktop_item_id);
 GtkWidget *application_tile_new_full (const gchar * desktop_item_id,
 	GtkIconSize icon_size, gboolean show_generic_name, const gchar *gconf_prefix);
 
-GKeyFile *application_tile_get_desktop_item (ApplicationTile * tile);
+SlabKeyFile *application_tile_get_desktop_item (ApplicationTile * tile);
 
 G_END_DECLS
 #endif
diff --git a/libslab/bookmark-agent.c b/libslab/bookmark-agent.c
index 87f03cb..f788d4e 100644
--- a/libslab/bookmark-agent.c
+++ b/libslab/bookmark-agent.c
@@ -35,6 +35,7 @@
 #include <gio/gio.h>
 
 #include "libslab-utils.h"
+#include <libslab/slab-key-file.h>
 
 #define MODIFIABLE_APPS_GCONF_KEY "/desktop/gnome/applications/main-menu/lock-down/user_modifiable_apps"
 #define MODIFIABLE_DOCS_GCONF_KEY "/desktop/gnome/applications/main-menu/lock-down/user_modifiable_docs"
@@ -1067,14 +1068,14 @@ create_app_item (BookmarkAgent *this, const gchar *uri)
 {
 	BookmarkAgentPrivate *priv = PRIVATE (this);
 
-	GKeyFile *ditem;
+	SlabKeyFile *ditem;
 	gchar *uri_new = NULL;
 
-	ditem = libslab_gnome_desktop_item_new_from_unknown_id (uri);
+	ditem = slab_key_file_new_from_unknown_id (uri);
 
 	if (ditem) {
-		uri_new = g_strdup (libslab_keyfile_get_location (ditem));
-		g_object_unref (ditem);
+		uri_new = g_strdup (slab_key_file_get_location (ditem));
+		slab_key_file_unref (ditem);
 	}
 
 	if (! uri_new)
diff --git a/libslab/directory-tile.c b/libslab/directory-tile.c
index f5a7ef1..a994236 100644
--- a/libslab/directory-tile.c
+++ b/libslab/directory-tile.c
@@ -265,13 +265,13 @@ directory_tile_private_setup (DirectoryTile *tile)
 		priv->default_app = NULL;
 
 	priv->delete_enabled =
-		(gboolean) GPOINTER_TO_INT (get_gconf_value (GCONF_ENABLE_DELETE_KEY));
+		(gboolean) GPOINTER_TO_INT (libslab_get_gconf_value (GCONF_ENABLE_DELETE_KEY));
 
 	client = gconf_client_get_default ();
 
 	gconf_client_add_dir (client, GCONF_ENABLE_DELETE_KEY_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
 	priv->gconf_conn_id =
-		connect_gconf_notify (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, tile);
+		libslab_gconf_notify_add (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, tile);
 
 	g_object_unref (client);
 }
@@ -571,7 +571,7 @@ send_to_trigger (Tile *tile, TileEvent *event, TileAction *action)
 	gint i;
 
 
-	cmd = (gchar *) get_gconf_value (GCONF_SEND_TO_CMD_KEY);
+	cmd = (gchar *) libslab_get_gconf_value (GCONF_SEND_TO_CMD_KEY);
 
 	if (! g_shell_parse_argv (cmd, & argc, & argv_parsed, NULL))
 		goto exit;
@@ -635,7 +635,7 @@ open_with_default_trigger (Tile *tile, TileEvent *event, TileAction *action)
 	if (priv->default_app)
 	{
 		uris = g_list_append (uris, TILE (tile)->uri);
-		
+
 		launch_context = gdk_app_launch_context_new ();
 		gdk_app_launch_context_set_screen (launch_context,
 						   gtk_widget_get_screen (GTK_WIDGET (tile)));
diff --git a/libslab/document-tile.c b/libslab/document-tile.c
index 5b2f13c..9bb75fe 100644
--- a/libslab/document-tile.c
+++ b/libslab/document-tile.c
@@ -351,13 +351,13 @@ document_tile_private_setup (DocumentTile *this)
 	g_object_unref (file);
 
 	priv->delete_enabled =
-		(gboolean) GPOINTER_TO_INT (get_gconf_value (GCONF_ENABLE_DELETE_KEY));
+		(gboolean) GPOINTER_TO_INT (libslab_get_gconf_value (GCONF_ENABLE_DELETE_KEY));
 
 	client = gconf_client_get_default ();
 
 	gconf_client_add_dir (client, GCONF_ENABLE_DELETE_KEY_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
 	priv->gconf_conn_id =
-		connect_gconf_notify (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, this);
+		libslab_gconf_notify_add (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, this);
 
 	g_object_unref (client);
 
@@ -1088,7 +1088,7 @@ send_to_trigger (Tile *tile, TileEvent *event, TileAction *action)
 	gchar *tmp;
 	gint i;
 
-	cmd = (gchar *) get_gconf_value (GCONF_SEND_TO_CMD_KEY);
+	cmd = (gchar *) libslab_get_gconf_value (GCONF_SEND_TO_CMD_KEY);
 	argv = g_strsplit (cmd, " ", 0);
 
 	filename = g_filename_from_uri (TILE (tile)->uri, NULL, NULL);
@@ -1119,7 +1119,7 @@ send_to_trigger (Tile *tile, TileEvent *event, TileAction *action)
 #endif
 
 	if (error)
-		handle_g_error (&error, "error in %s", G_STRFUNC);
+		libslab_handle_g_error (&error, "error in %s", G_STRFUNC);
 
 	g_free (cmd);
 	g_free (filename);
diff --git a/libslab/gnome-utils.c b/libslab/gnome-utils.c
index 9d24287..9447ec5 100644
--- a/libslab/gnome-utils.c
+++ b/libslab/gnome-utils.c
@@ -1,9 +1,7 @@
 #include "gnome-utils.h"
-
+#include <libslab/slab-key-file.h>
 #include <string.h>
 
-static void section_header_style_set (GtkWidget *, GtkStyle *, gpointer);
-
 gboolean
 load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
 {
@@ -70,252 +68,16 @@ load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
 	return icon_exists;
 }
 
-GKeyFile *
-load_desktop_item_by_unknown_id (const gchar * id)
-{
-	GKeyFile *item;
-	GError *error = NULL;
-
-	item = g_key_file_new();
-#warning url or path ?
-	g_key_file_load_from_file (item, id, 0, &error);
-
-	if (!error)
-		return item;
-	else
-	{
-		g_error_free (error);
-		error = NULL;
-	}
-#ifdef FIXME_MORE_PORTING
-	item = gnme_desktop_item_new_from_file (id, 0, &error);
-
-	if (!error)
-		return item;
-	else
-	{
-		g_error_free (error);
-		error = NULL;
-	}
-
-	item = gnme_desktop_item_new_from_basename (id, 0, &error);
-
-	if (!error)
-		return item;
-	else
-	{
-		g_error_free (error);
-		error = NULL;
-	}
-
-#endif
-	g_warning ("More porting required here");
-	return NULL;
-}
-
-gpointer
-get_gconf_value (const gchar * key)
-{
-	GConfClient *client;
-	GConfValue *value;
-	GError *error = NULL;
-
-	gpointer retval = NULL;
-
-	GList *list;
-	GSList *slist;
-
-	GConfValue *value_i;
-	GSList *node;
-
-	client = gconf_client_get_default ();
-	value = gconf_client_get (client, key, &error);
-
-	if (error || ! value)
-	{
-		handle_g_error (&error, "%s: error getting %s", G_STRFUNC, key);
-
-		goto exit;
-	}
-
-	switch (value->type)
-	{
-	case GCONF_VALUE_STRING:
-		retval = (gpointer) g_strdup (gconf_value_get_string (value));
-		break;
-
-	case GCONF_VALUE_INT:
-		retval = GINT_TO_POINTER (gconf_value_get_int (value));
-		break;
-
-	case GCONF_VALUE_BOOL:
-		retval = GINT_TO_POINTER (gconf_value_get_bool (value));
-		break;
-
-	case GCONF_VALUE_LIST:
-		list = NULL;
-		slist = gconf_value_get_list (value);
-
-		for (node = slist; node; node = node->next)
-		{
-			value_i = (GConfValue *) node->data;
-
-			if (value_i->type == GCONF_VALUE_STRING)
-				list = g_list_append (list,
-					g_strdup (gconf_value_get_string (value_i)));
-			else if (value_i->type == GCONF_VALUE_INT)
-				list = g_list_append (list,
-					GINT_TO_POINTER (gconf_value_get_int (value_i)));
-			else
-				g_assert_not_reached ();
-		}
-
-		retval = (gpointer) list;
-
-		break;
-
-	default:
-		g_assert_not_reached ();
-		break;
-	}
-
-	exit:
-
-	g_object_unref (client);
-	if(value)
-		gconf_value_free (value);
-
-	return retval;
-}
-
-void
-set_gconf_value (const gchar * key, gconstpointer data)
-{
-	GConfClient *client;
-	GConfValue *value;
-
-	GConfValueType type;
-	GConfValueType list_type;
-
-	GSList *slist = NULL;
-
-	GError *error = NULL;
-
-	GConfValue *value_i;
-	GList *node;
-
-	client = gconf_client_get_default ();
-	value = gconf_client_get (client, key, &error);
-
-	if (error)
-	{
-		handle_g_error (&error, "%s: error getting %s", G_STRFUNC, key);
-
-		goto exit;
-	}
-
-	type = value->type;
-	list_type =
-		(type ==
-		GCONF_VALUE_LIST ? gconf_value_get_list_type (value) : GCONF_VALUE_INVALID);
-
-	gconf_value_free (value);
-	value = gconf_value_new (type);
-
-	if (type == GCONF_VALUE_LIST)
-		gconf_value_set_list_type (value, list_type);
-
-	switch (type)
-	{
-	case GCONF_VALUE_STRING:
-		gconf_value_set_string (value, g_strdup ((gchar *) data));
-		break;
-
-	case GCONF_VALUE_INT:
-		gconf_value_set_int (value, GPOINTER_TO_INT (data));
-		break;
-
-	case GCONF_VALUE_BOOL:
-		gconf_value_set_bool (value, GPOINTER_TO_INT (data));
-		break;
-
-	case GCONF_VALUE_LIST:
-		for (node = (GList *) data; node; node = node->next)
-		{
-			value_i = gconf_value_new (list_type);
-
-			if (list_type == GCONF_VALUE_STRING)
-				gconf_value_set_string (value_i, (const gchar *) node->data);
-			else if (list_type == GCONF_VALUE_INT)
-				gconf_value_set_int (value_i, GPOINTER_TO_INT (node->data));
-			else
-				g_assert_not_reached ();
-
-			slist = g_slist_append (slist, value_i);
-		}
-
-		gconf_value_set_list_nocopy (value, slist);
-
-		break;
-
-	default:
-		g_assert_not_reached ();
-		break;
-	}
-
-	gconf_client_set (client, key, value, &error);
-
-	if (error)
-		handle_g_error (&error, "%s: error setting %s", G_STRFUNC, key);
-
-      exit:
-
-	gconf_value_free (value);
-	g_object_unref (client);
-}
-
-guint
-connect_gconf_notify (const gchar * key, GConfClientNotifyFunc cb, gpointer user_data)
-{
-	GConfClient *client;
-	guint conn_id;
-
-	GError *error = NULL;
-
-	client = gconf_client_get_default ();
-	conn_id = gconf_client_notify_add (client, key, cb, user_data, NULL, &error);
-
-	if (error)
-		handle_g_error (&error, "%s: error adding notify for (%s)", G_STRFUNC, key);
-
-	g_object_unref (client);
-
-	return conn_id;
-}
-
-void
-handle_g_error (GError ** error, const gchar * msg_format, ...)
+static void
+section_header_style_set (GtkWidget * widget, GtkStyle * prev_style, gpointer user_data)
 {
-	gchar *msg;
-	va_list args;
-
-	va_start (args, msg_format);
-	msg = g_strdup_vprintf (msg_format, args);
-	va_end (args);
-
-	if (*error)
-	{
-		g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
-			"\nGError raised: [%s]\nuser_message: [%s]\n", (*error)->message, msg);
-
-		g_error_free (*error);
+	GtkStyle *style = gtk_widget_get_style (widget);
 
-		*error = NULL;
-	}
-	else
-		g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "\nerror raised: [%s]\n", msg);
+	if (prev_style &&
+	    style->fg[GTK_STATE_SELECTED].green == prev_style->fg[GTK_STATE_SELECTED].green)
+		return;
 
-	g_free (msg);
+	gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
 }
 
 GtkWidget *
@@ -337,15 +99,3 @@ get_main_menu_section_header (const gchar * markup)
 
 	return label;
 }
-
-static void
-section_header_style_set (GtkWidget * widget, GtkStyle * prev_style, gpointer user_data)
-{
-	GtkStyle *style = gtk_widget_get_style (widget);
-
-	if (prev_style &&
-	    style->fg[GTK_STATE_SELECTED].green == prev_style->fg[GTK_STATE_SELECTED].green)
-		return;
-
-	gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
-}
diff --git a/libslab/gnome-utils.h b/libslab/gnome-utils.h
index e9f7e43..631cd06 100644
--- a/libslab/gnome-utils.h
+++ b/libslab/gnome-utils.h
@@ -26,14 +26,9 @@
 
 G_BEGIN_DECLS
 
-gboolean load_image_by_id (GtkImage * image, GtkIconSize size,
-	const gchar * image_id);
-GKeyFile *load_desktop_item_by_unknown_id (const gchar * id);
-gpointer get_gconf_value (const gchar * key);
-void set_gconf_value (const gchar * key, gconstpointer data);
-guint connect_gconf_notify (const gchar * key, GConfClientNotifyFunc cb, gpointer user_data);
-void handle_g_error (GError ** error, const gchar * user_format, ...);
-GtkWidget *get_main_menu_section_header (const gchar * markup);
+gboolean     load_image_by_id (GtkImage * image, GtkIconSize size,
+			       const gchar * image_id);
+GtkWidget   *get_main_menu_section_header (const gchar * markup);
 
 G_END_DECLS
 #endif /* __GNOME_UTILS_H__ */
diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c
index c0024b2..713edd0 100644
--- a/libslab/libslab-utils.c
+++ b/libslab/libslab-utils.c
@@ -14,9 +14,6 @@
 #include <gconf/gconf-value.h>
 #include <gtk/gtk.h>
 
-#define DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG "TerminalEmulator"
-#define ALTERNATE_DOCPATH_KEY               "DocPath"
-
 static FILE *checkpoint_file;
 
 gboolean
@@ -52,7 +49,6 @@ libslab_gtk_image_set_by_id (GtkImage *image, const gchar *id)
 
 		if (found) {
 			gtk_image_set_from_pixbuf (image, pixbuf);
-
 			g_object_unref (pixbuf);
 		}
 		else
@@ -88,105 +84,6 @@ libslab_gtk_image_set_by_id (GtkImage *image, const gchar *id)
 	return found;
 }
 
-GKeyFile *
-libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
-{
-	GKeyFile *item;
-	gchar            *basename;
-
-	GError *error = NULL;
-
-	g_warning ("Un-believable cut & paste here");
-	if (! id)
-		return NULL;
-
-	item = g_key_file_new();
-	g_object_set_data_full (G_OBJECT (item), "file", g_strdup (id), g_free);
-
-	g_key_file_load_from_file (item, id, 0, &error);
-
-	if (! error)
-		return item;
-	else {
-		g_error_free (error);
-		error = NULL;
-	}
-
-	basename = g_strrstr (id, "/");
-
-	if (basename) {
-		basename++;
-
-		g_key_file_load_from_file (item, basename, 0, &error);
-
-		if (! error)
-			return item;
-		else {
-			g_error_free (error);
-			error = NULL;
-		}
-	}
-	g_object_unref (item);
-
-#ifdef FIXME_MORE_PORTING
-	item = gnme_desktop_item_new_from_file (id, 0, & error);
-
-	if (! error)
-		return item;
-	else {
-		g_error_free (error);
-		error = NULL;
-	}
-
-	item = gnme_desktop_item_new_from_basename (id, 0, & error);
-
-	if (! error)
-		return item;
-	else {
-		g_error_free (error);
-		error = NULL;
-	}
-
-#endif
-
-	return NULL;
-}
-
-gboolean
-libslab_gnome_desktop_item_launch_default (GKeyFile *item)
-{
-	GError *error = NULL;
-
-	if (! item)
-		return FALSE;
-
-	g_warning ("desktop item launch !"); /* FIXME more porting required */
-	/*	gnme_desktop_item_launch (item, NULL, GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE, & error); */
-
-	if (error) {
-		g_warning ("error launching %s [%s]\n",
-			   libslab_keyfile_get_location (item),
-			   error->message);
-
-		g_error_free (error);
-
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-gchar *
-libslab_gnome_desktop_item_get_docpath (GKeyFile *item)
-{
-	gchar *path;
-
-	path = libslab_keyfile_get_locale (item, "DocPath");
-	if (! path)
-		path = libslab_keyfile_get_locale (item, ALTERNATE_DOCPATH_KEY);
-
-	return path;
-}
 
 /* Ugh, here we don't have knowledge of the screen that is being used.  So, do
  * what we can to find it.
@@ -208,42 +105,6 @@ libslab_get_current_screen (void)
 	return screen;
 }
 
-gboolean
-libslab_gnome_desktop_item_open_help (GKeyFile *item)
-{
-	gchar *doc_path;
-	gchar *help_uri;
-
-	GError *error = NULL;
-
-	gboolean retval = FALSE;
-
-
-	if (! item)
-		return retval;
-
-	doc_path = libslab_gnome_desktop_item_get_docpath (item);
-
-	if (doc_path) {
-		help_uri = g_strdup_printf ("ghelp:%s", doc_path);
-
-		if (!gtk_show_uri (libslab_get_current_screen (), help_uri, gtk_get_current_event_time (), &error)) {
-			g_warning ("error opening %s [%s]\n", help_uri, error->message);
-
-			g_error_free (error);
-
-			retval = FALSE;
-		}
-		else
-			retval = TRUE;
-
-		g_free (help_uri);
-		g_free (doc_path);
-	}
-
-	return retval;
-}
-
 guint32
 libslab_get_current_time_millis ()
 {
@@ -499,71 +360,6 @@ libslab_handle_g_error (GError **error, const gchar *msg_format, ...)
 	g_free (msg);
 }
 
-gboolean
-libslab_desktop_item_is_a_terminal (const gchar *uri)
-{
-	GKeyFile *d_item;
-	gchar *categories;
-
-	gboolean is_terminal = FALSE;
-
-
-	d_item = libslab_gnome_desktop_item_new_from_unknown_id (uri);
-
-	if (! d_item)
-		return FALSE;
-
-	categories = libslab_keyfile_get (d_item, G_KEY_FILE_DESKTOP_KEY_CATEGORIES);
-	is_terminal = (categories && strstr (categories, DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG));
-	g_free (categories);
-
-	g_object_unref (d_item);
-
-	return is_terminal;
-}
-
-gboolean
-libslab_desktop_item_is_logout (const gchar *uri)
-{
-	GKeyFile *d_item;
-	gboolean is_logout = FALSE;
-	gchar *item_name;
-
-	d_item = libslab_gnome_desktop_item_new_from_unknown_id (uri);
-
-	if (! d_item)
-		return FALSE;
-
-	item_name = libslab_keyfile_get (d_item, G_KEY_FILE_DESKTOP_KEY_NAME);
-	is_logout = strstr ("Logout", item_name) != NULL;
-	g_free (item_name);
-
-	g_object_unref (d_item);
-
-	return is_logout;
-}
-
-gboolean
-libslab_desktop_item_is_lockscreen (const gchar *uri)
-{
-	GKeyFile *d_item;
-	gboolean is_logout = FALSE;
-	gchar *item_name;
-
-	d_item = libslab_gnome_desktop_item_new_from_unknown_id (uri);
-
-	if (! d_item)
-		return FALSE;
-
-	item_name = libslab_keyfile_get (d_item, G_KEY_FILE_DESKTOP_KEY_NAME);
-	is_logout = strstr ("Lock Screen", item_name) != NULL;
-	g_free (item_name);
-
-	g_object_unref (d_item);
-
-	return is_logout;
-}
-
 gchar *
 libslab_string_replace_once (const gchar *string, const gchar *key, const gchar *value)
 {
@@ -722,20 +518,3 @@ libslab_checkpoint (const char *format, ...)
 	fputs ("\n", checkpoint_file);
 	fflush (checkpoint_file);
 }
-
-char *
-libslab_keyfile_get (GKeyFile *keyfile, const char *key)
-{
-  return g_key_file_get_value (keyfile, G_KEY_FILE_DESKTOP_GROUP, key, NULL);
-}
-
-char *
-libslab_keyfile_get_locale (GKeyFile *keyfile, const char *key)
-{
-  return g_key_file_get_locale_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, key, NULL, NULL);
-}
-
-const char *libslab_keyfile_get_location (GKeyFile *keyfile)
-{
-  return g_object_get_data (keyfile, "file");
-}
diff --git a/libslab/libslab-utils.h b/libslab/libslab-utils.h
index 70a6b34..f7a9009 100644
--- a/libslab/libslab-utils.h
+++ b/libslab/libslab-utils.h
@@ -9,15 +9,7 @@
 
 G_BEGIN_DECLS
 
-char             *libslab_keyfile_get (GKeyFile *keyfile, const char *key);
-const char       *libslab_keyfile_get_location (GKeyFile *keyfile);
-char             *libslab_keyfile_get_locale (GKeyFile *keyfile, const char *key);
-
 gboolean          libslab_gtk_image_set_by_id (GtkImage *image, const gchar *id);
-GKeyFile *libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id);
-gboolean          libslab_gnome_desktop_item_launch_default (GKeyFile *item);
-gchar            *libslab_gnome_desktop_item_get_docpath (GKeyFile *item);
-gboolean          libslab_gnome_desktop_item_open_help (GKeyFile *item);
 guint32           libslab_get_current_time_millis (void);
 gint              libslab_strcmp (const gchar *a, const gchar *b);
 gint              libslab_strlen (const gchar *a);
@@ -26,9 +18,6 @@ void              libslab_set_gconf_value (const gchar *key, gconstpointer data)
 guint             libslab_gconf_notify_add (const gchar *key, GConfClientNotifyFunc callback, gpointer user_data);
 void              libslab_gconf_notify_remove (guint conn_id);
 void              libslab_handle_g_error (GError **error, const gchar *msg_format, ...);
-gboolean          libslab_desktop_item_is_a_terminal (const gchar *uri);
-gboolean          libslab_desktop_item_is_logout (const gchar *uri);
-gboolean          libslab_desktop_item_is_lockscreen (const gchar *uri);
 gchar            *libslab_string_replace_once (const gchar *string, const gchar *key, const gchar *value);
 void              libslab_spawn_command (const gchar *cmd);
 
diff --git a/libslab/slab-gnome-util.c b/libslab/slab-gnome-util.c
index 7e07e27..7a82ca5 100644
--- a/libslab/slab-gnome-util.c
+++ b/libslab/slab-gnome-util.c
@@ -135,22 +135,22 @@ get_slab_gconf_slist (const gchar * key)
 	return value;
 }
 
-GKeyFile *
+SlabKeyFile *
 load_desktop_item_from_gconf_key (const gchar * key)
 {
-	GKeyFile *item;
+	SlabKeyFile *item;
 	gchar *id = get_slab_gconf_string (key);
 
 	if (!id)
 		return NULL;
 
-	item = libslab_gnome_desktop_item_new_from_unknown_id (id);
+	item = slab_key_file_new_from_unknown_id (id);
 	g_free (id);
 	return item;
 }
 
 gchar *
-get_package_name_from_desktop_item (GKeyFile * desktop_item)
+get_package_name_from_desktop_item (SlabKeyFile * desktop_item)
 {
 	gchar *argv[6];
 	gchar *package_name;
@@ -161,7 +161,7 @@ get_package_name_from_desktop_item (GKeyFile * desktop_item)
 	argv[1] = "-qf";
 	argv[2] = "--qf";
 	argv[3] = "%{NAME}";
-	argv[4] = g_filename_from_uri (libslab_keyfile_get_location (desktop_item), NULL, NULL);
+	argv[4] = g_filename_from_uri (slab_key_file_get_location (desktop_item), NULL, NULL);
 	argv[5] = NULL;
 
 	error = NULL;
@@ -183,7 +183,7 @@ get_package_name_from_desktop_item (GKeyFile * desktop_item)
 }
 
 gboolean
-open_desktop_item_exec (GKeyFile * desktop_item)
+open_desktop_item_exec (SlabKeyFile * desktop_item)
 {
 	GError *error = NULL;
 
@@ -198,7 +198,7 @@ open_desktop_item_exec (GKeyFile * desktop_item)
 	if (error)
 	{
 		g_warning ("error launching %s [%s]\n",
-			   libslab_keyfile_get_location (desktop_item),
+			   slab_key_file_get_location (desktop_item),
 			   error->message);
 		g_error_free (error);
 		return FALSE;
@@ -208,7 +208,7 @@ open_desktop_item_exec (GKeyFile * desktop_item)
 }
 
 gboolean
-open_desktop_item_help (GKeyFile * desktop_item)
+open_desktop_item_help (SlabKeyFile * desktop_item)
 {
 	gchar *doc_path;
 	gchar *help_uri;
@@ -218,7 +218,7 @@ open_desktop_item_help (GKeyFile * desktop_item)
 	if (!desktop_item)
 		return FALSE;
 
-	doc_path = libslab_keyfile_get (desktop_item, "DocPath");
+	doc_path = slab_key_file_get (desktop_item, "DocPath");
 
 	if (doc_path)
 	{
@@ -249,9 +249,9 @@ open_desktop_item_help (GKeyFile * desktop_item)
 }
 
 gboolean
-desktop_item_is_in_main_menu (GKeyFile * desktop_item)
+desktop_item_is_in_main_menu (SlabKeyFile * desktop_item)
 {
-	return desktop_uri_is_in_main_menu (libslab_keyfile_get_location (desktop_item));
+	return desktop_uri_is_in_main_menu (slab_key_file_get_location (desktop_item));
 }
 
 gboolean
diff --git a/libslab/slab-gnome-util.h b/libslab/slab-gnome-util.h
index bb5878e..3c29c88 100644
--- a/libslab/slab-gnome-util.h
+++ b/libslab/slab-gnome-util.h
@@ -23,6 +23,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <libslab/slab-key-file.h>
 
 G_BEGIN_DECLS
 
@@ -51,15 +52,15 @@ void free_slab_gconf_slist_of_strings (GSList * list);
 void free_list_of_strings (GList * list);
 gchar *get_slab_gconf_string (const gchar * key);
 
-GKeyFile *load_desktop_item_from_gconf_key (const gchar * key);
-GKeyFile *load_desktop_item_from_unknown (const gchar * id);
+SlabKeyFile *load_desktop_item_from_gconf_key (const gchar * key);
+SlabKeyFile *load_desktop_item_from_unknown (const gchar * id);
 
-gchar *get_package_name_from_desktop_item (GKeyFile * desktop_item);
+gchar *get_package_name_from_desktop_item (SlabKeyFile * desktop_item);
 
-gboolean open_desktop_item_exec (GKeyFile * desktop_item);
-gboolean open_desktop_item_help (GKeyFile * desktop_item);
+gboolean open_desktop_item_exec (SlabKeyFile * desktop_item);
+gboolean open_desktop_item_help (SlabKeyFile * desktop_item);
 
-gboolean desktop_item_is_in_main_menu (GKeyFile * desktop_item);
+gboolean desktop_item_is_in_main_menu (SlabKeyFile * desktop_item);
 gboolean desktop_uri_is_in_main_menu (const gchar * uri);
 
 gint desktop_item_location_compare (gconstpointer a, gconstpointer b);
diff --git a/libslab/slab-key-file.c b/libslab/slab-key-file.c
new file mode 100644
index 0000000..f6705da
--- /dev/null
+++ b/libslab/slab-key-file.c
@@ -0,0 +1,291 @@
+#include <config.h>
+#include <string.h>
+#include <libslab/slab-key-file.h>
+
+#define DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG "TerminalEmulator"
+#define ALTERNATE_DOCPATH_KEY               "DocPath"
+
+/*
+ * This guy has to track the file path we loaded from
+ * which is required by lots of the later slab code.
+ */
+struct _SlabKeyFile {
+  int ref;
+  GKeyFile *kf;
+  char *filename;
+};
+
+#define EVIL_KEY_GROUP "evilgroup"
+#define EVIL_KEY_VALUE "evilfilename"
+
+char *
+slab_key_file_get_location (SlabKeyFile *keyfile)
+{
+	return g_strdup (keyfile->filename);
+}
+
+static SlabKeyFile *
+slab_key_file_new_with (GKeyFile *kf, const char *path)
+{
+	SlabKeyFile *item = g_new0 (SlabKeyFile, 1);
+
+	item->ref = 1;
+	item->kf = kf;
+	item->filename = g_strdup (path);
+
+	return item;
+}
+
+SlabKeyFile *
+slab_key_file_ref (SlabKeyFile *item)
+{
+	g_return_val_if_fail (item != NULL, NULL);
+	item->ref++;
+	return item;
+}
+
+void
+slab_key_file_unref (SlabKeyFile *item)
+{
+  g_return_if_fail (item != NULL);
+  if (--item->ref == 0) {
+	g_key_file_free (item->kf);
+	g_free (item->filename);
+	item->kf = NULL;
+	item->filename = NULL;
+  }
+}
+
+SlabKeyFile *
+slab_key_file_new (void)
+{
+	return slab_key_file_new_with (g_key_file_new(), NULL);
+}
+
+SlabKeyFile *
+slab_key_file_new_from_path (const gchar *file_path)
+{
+	GKeyFile *kf;
+	GError *error = NULL;
+
+	if (! file_path)
+		return NULL;
+
+	kf = g_key_file_new();
+	g_key_file_load_from_file (kf, file_path, 0, &error);
+
+	if (! error)
+		return slab_key_file_new_with (kf, file_path);
+	else {
+		g_error_free (error);
+		error = NULL;
+	}
+	return NULL;
+}
+
+SlabKeyFile *
+slab_key_file_new_from_unknown_id (const gchar *id)
+{
+	SlabKeyFile *item;
+	gchar *basename;
+
+	item = slab_key_file_new_from_path (id);
+	if (item)
+		return item;
+
+	basename = g_strrstr (id, "/");
+	if (basename) {
+		basename++;
+
+		item = slab_key_file_new_from_path (id);
+		if (item)
+			return item;
+	}
+
+#ifdef FIXME_MORE_PORTING
+	item = gnme_desktop_item_new_from_file (id, 0, & error);
+
+	if (! error)
+		return item;
+	else {
+		g_error_free (error);
+		error = NULL;
+	}
+
+	item = gnme_desktop_item_new_from_basename (id, 0, & error);
+
+	if (! error)
+		return item;
+	else {
+		g_error_free (error);
+		error = NULL;
+	}
+#endif
+
+	return NULL;
+}
+
+void
+slab_key_file_save (SlabKeyFile *item, const gchar *path)
+{
+	gsize  length;
+	gchar *flat_text = g_key_file_to_data (item->kf, &length, NULL);
+	g_file_set_contents (path, flat_text, length, NULL);
+	g_free (flat_text);
+}
+
+gboolean
+slab_key_file_launch_default (SlabKeyFile *item)
+{
+	GError *error = NULL;
+
+	if (! item)
+		return FALSE;
+
+	g_warning ("desktop item launch !"); /* FIXME more porting required */
+	/*	gnme_desktop_item_launch (item, NULL, GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE, & error); */
+
+	if (error) {
+		g_warning ("error launching %s [%s]\n",
+			   slab_key_file_get_location (item),
+			   error->message);
+
+		g_error_free (error);
+
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gchar *
+slab_key_file_get_docpath (SlabKeyFile *item)
+{
+	gchar *path;
+
+	path = slab_key_file_get_locale (item, "DocPath");
+	if (! path)
+		path = slab_key_file_get_locale (item, ALTERNATE_DOCPATH_KEY);
+
+	return path;
+}
+
+gboolean
+slab_key_file_open_help (SlabKeyFile *item)
+{
+	gchar *doc_path;
+	gchar *help_uri;
+
+	GError *error = NULL;
+
+	gboolean retval = FALSE;
+
+
+	if (! item)
+		return retval;
+
+	doc_path = slab_key_file_get_docpath (item);
+
+	if (doc_path) {
+		help_uri = g_strdup_printf ("ghelp:%s", doc_path);
+
+		if (!gtk_show_uri (libslab_get_current_screen (), help_uri, gtk_get_current_event_time (), &error)) {
+			g_warning ("error opening %s [%s]\n", help_uri, error->message);
+
+			g_error_free (error);
+
+			retval = FALSE;
+		}
+		else
+			retval = TRUE;
+
+		g_free (help_uri);
+		g_free (doc_path);
+	}
+
+	return retval;
+}
+
+gboolean
+slab_key_file_is_a_terminal (const gchar *uri)
+{
+	SlabKeyFile *d_item;
+	gchar *categories;
+
+	gboolean is_terminal = FALSE;
+
+	d_item = slab_key_file_new_from_unknown_id (uri);
+
+	if (! d_item)
+		return FALSE;
+
+	categories = slab_key_file_get (d_item, G_KEY_FILE_DESKTOP_KEY_CATEGORIES);
+	is_terminal = (categories && strstr (categories, DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG));
+	g_free (categories);
+
+	slab_key_file_unref (d_item);
+
+	return is_terminal;
+}
+
+gboolean
+slab_key_file_is_logout (const gchar *uri)
+{
+	SlabKeyFile *d_item;
+	gboolean is_logout = FALSE;
+	gchar *item_name;
+
+	d_item = slab_key_file_new_from_unknown_id (uri);
+
+	if (! d_item)
+		return FALSE;
+
+	item_name = slab_key_file_get (d_item, G_KEY_FILE_DESKTOP_KEY_NAME);
+	is_logout = strstr ("Logout", item_name) != NULL;
+	g_free (item_name);
+
+	slab_key_file_unref (d_item);
+
+	return is_logout;
+}
+
+gboolean
+slab_key_file_is_lockscreen (const gchar *uri)
+{
+	SlabKeyFile *d_item;
+	gboolean is_logout = FALSE;
+	gchar *item_name;
+
+	d_item = slab_key_file_new_from_unknown_id (uri);
+
+	if (! d_item)
+		return FALSE;
+
+	item_name = slab_key_file_get (d_item, G_KEY_FILE_DESKTOP_KEY_NAME);
+	is_logout = strstr ("Lock Screen", item_name) != NULL;
+	g_free (item_name);
+
+	slab_key_file_unref (d_item);
+
+	return is_logout;
+}
+
+char *
+slab_key_file_get (SlabKeyFile *keyfile, const char *key)
+{
+	return g_key_file_get_value (keyfile->kf, G_KEY_FILE_DESKTOP_GROUP, key, NULL);
+}
+
+char *
+slab_key_file_get_locale (SlabKeyFile *keyfile, const char *key)
+{
+	return g_key_file_get_locale_string (keyfile->kf, G_KEY_FILE_DESKTOP_GROUP,
+					     key, NULL, NULL);
+}
+
+void
+slab_key_file_set_string (SlabKeyFile *keyfile, const char *group,
+			  const char *key, const char *value)
+{
+	g_key_file_set_string (keyfile->kf, group, key, value);
+}
diff --git a/libslab/slab-key-file.h b/libslab/slab-key-file.h
new file mode 100644
index 0000000..6fcbd4e
--- /dev/null
+++ b/libslab/slab-key-file.h
@@ -0,0 +1,59 @@
+/*
+ * This file is part of libslab.
+ *
+ * Copyright (c) 2011 Novell, Inc.
+ *
+ * Libslab is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * Libslab is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libslab; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __SLAB_KEY_FILE_H__
+#define __SLAB_KEY_FILE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _SlabKeyFile SlabKeyFile;
+
+SlabKeyFile      *slab_key_file_new                 (void);
+SlabKeyFile      *slab_key_file_new_from_path       (const gchar *file_path);
+SlabKeyFile      *slab_key_file_new_from_unknown_id (const gchar *id);
+
+void              slab_key_file_save                (SlabKeyFile *item,
+						     const gchar *path);
+
+SlabKeyFile      *slab_key_file_ref   (SlabKeyFile *item);
+void              slab_key_file_unref (SlabKeyFile *item);
+
+char             *slab_key_file_get (SlabKeyFile *keyfile, const char *key);
+char             *slab_key_file_get_location (SlabKeyFile *keyfile);
+char             *slab_key_file_get_locale (SlabKeyFile *keyfile, const char *key);
+
+void              slab_key_file_set_string (SlabKeyFile *keyfile, const char *group,
+					    const char *key, const char *value);
+
+gboolean          slab_key_file_launch_default (SlabKeyFile *item);
+gchar            *slab_key_file_get_docpath (SlabKeyFile *item);
+gboolean          slab_key_file_open_help (SlabKeyFile *item);
+
+gboolean          slab_key_file_is_a_terminal (const gchar *uri);
+gboolean          slab_key_file_is_logout (const gchar *uri);
+gboolean          slab_key_file_is_lockscreen (const gchar *uri);
+
+
+
+G_END_DECLS
+
+#endif /* __SLAB_KEY_FILE_H__ */
diff --git a/libslab/system-tile.c b/libslab/system-tile.c
index 34f5b92..16640dc 100644
--- a/libslab/system-tile.c
+++ b/libslab/system-tile.c
@@ -44,7 +44,7 @@ static void update_user_list_menu_item (SystemTile *);
 static void agent_notify_cb (GObject *, GParamSpec *, gpointer);
 
 typedef struct {
-	GKeyFile *desktop_item;
+	SlabKeyFile *desktop_item;
 
 	BookmarkAgent       *agent;
 	BookmarkStoreStatus  agent_status;
@@ -71,7 +71,7 @@ system_tile_new (const gchar *desktop_item_id, const gchar *title)
 	GtkWidget    *menu_item;
 	GtkContainer *menu_ctnr;
 
-	GKeyFile *desktop_item = NULL;
+	SlabKeyFile *desktop_item = NULL;
 	gchar            *image_id     = NULL;
 	gchar            *header_txt   = NULL;
 
@@ -80,16 +80,16 @@ system_tile_new (const gchar *desktop_item_id, const gchar *title)
 	AtkObject *accessible = NULL;
 
 
-	desktop_item = libslab_gnome_desktop_item_new_from_unknown_id (desktop_item_id);
+	desktop_item = slab_key_file_new_from_unknown_id (desktop_item_id);
 
 	if (desktop_item) {
-		image_id = libslab_keyfile_get_locale (desktop_item, "Icon");
-		uri      = g_strdup (libslab_keyfile_get_location (desktop_item));
+		image_id = slab_key_file_get_locale (desktop_item, "Icon");
+		uri      = g_strdup (slab_key_file_get_location (desktop_item));
 
 		if (title)
 			header_txt = g_strdup (title);
 		else
-			header_txt = libslab_keyfile_get_locale (desktop_item, "Name");
+			header_txt = slab_key_file_get_locale (desktop_item, "Name");
 	}
 
 	if (! uri)
@@ -200,7 +200,7 @@ system_tile_finalize (GObject *g_obj)
         SystemTilePrivate *priv = PRIVATE (g_obj);
 
 	g_free (priv->image_id);
-	g_object_unref (priv->desktop_item);
+	slab_key_file_unref (priv->desktop_item);
 
 	if (priv->notify_signal_id)
 		g_signal_handler_disconnect (priv->agent, priv->notify_signal_id);



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