[libslab/gnome-3] initial gnome-3 port
- From: Michael Meeks <michael src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libslab/gnome-3] initial gnome-3 port
- Date: Tue, 13 Sep 2011 15:59:50 +0000 (UTC)
commit deb20c27c92649877fda3913b85628de7b34225d
Author: Michael Meeks <michael meeks novell com>
Date: Tue Sep 13 14:51:27 2011 +0200
initial gnome-3 port
Makefile.am | 2 +-
configure.ac | 11 ++---
libslab.pc.in => libslab-3.pc.in | 3 +-
libslab/Makefile.am | 2 +-
libslab/app-resizer.c | 12 +----
libslab/app-shell.c | 58 ++++++++++++++----------
libslab/app-shell.h | 5 +-
libslab/application-tile.c | 52 ++++++++++++---------
libslab/application-tile.h | 4 +-
libslab/bookmark-agent.c | 6 +-
libslab/document-tile.c | 7 +++-
libslab/gnome-utils.c | 16 ++++---
libslab/gnome-utils.h | 3 +-
libslab/libslab-utils.c | 91 +++++++++++++++++++++++--------------
libslab/libslab-utils.h | 15 ++++---
libslab/nameplate-tile.c | 5 +-
libslab/search-entry.c | 15 +++++--
libslab/shell-window.h | 1 -
libslab/slab-gnome-util.c | 50 +++++++++++++-------
libslab/slab-gnome-util.h | 13 +++---
libslab/system-tile.c | 15 +++---
libslab/system-tile.h | 2 -
libslab/tile.c | 20 ++++----
23 files changed, 232 insertions(+), 176 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 4ffa8e6..f153654 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
SUBDIRS = libslab po
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libslab.pc
+pkgconfig_DATA = libslab-3.pc
GIT_START = b515f410cb472ae416995c5578d98bab7f80b504
diff --git a/configure.ac b/configure.ac
index 33b76c2..2a36816 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([libslab], [2.30.1],
+AC_INIT([libslab], [3.0.0],
[http://bugzilla.gnome.org/enter_bug.cgi?product=FIXME])
AC_CONFIG_SRCDIR([libslab])
@@ -48,17 +48,16 @@ dnl Check that we meet the dependencies
dnl ==============================================
GLIB_REQUIRED=2.18.0
-GTK_REQUIRED=2.21.3
+GTK_REQUIRED=3.0.0
AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject)
MODULES="glib-2.0 >= $GLIB_REQUIRED \
gio-2.0 >= $GLIB_REQUIRED \
gobject-2.0 \
- gtk+-2.0 >= $GTK_REQUIRED \
- gdk-2.0 \
- gnome-desktop-2.0 \
+ gtk+-3.0 >= $GTK_REQUIRED \
librsvg-2.0 \
+ gnome-desktop-3.0 \
gconf-2.0 \
libgnome-menu"
@@ -108,7 +107,7 @@ AM_CONDITIONAL(LIBSLAB_FOR_INTERNAL_USE, test "yes" = "no")
AC_CONFIG_FILES([
Makefile
-libslab.pc
+libslab-3.pc
libslab/Makefile
po/Makefile.in
])
diff --git a/libslab.pc.in b/libslab-3.pc.in
similarity index 70%
rename from libslab.pc.in
rename to libslab-3.pc.in
index e920f07..72c213b 100644
--- a/libslab.pc.in
+++ b/libslab-3.pc.in
@@ -5,7 +5,8 @@ includedir= includedir@
Name: libslab
Description: Beautiful App Slab
-Requires: glib-2.0 gobject-2.0 gtk+-2.0 gnome-desktop-2.0 libgnome-menu gconf-2.0
+Requires: glib-2.0 gobject-2.0 gtk+-3.0 gnome-desktop-3.0 libgnome-menu gconf-2.0
Requires.private: gdk-2.0 librsvg-2.0
Version: @VERSION@
Libs: -L${libdir} -lslab
+Cflags: -I${includedir}/libslab-3
diff --git a/libslab/Makefile.am b/libslab/Makefile.am
index 1eca8b6..7a7c437 100644
--- a/libslab/Makefile.am
+++ b/libslab/Makefile.am
@@ -60,7 +60,7 @@ libslab_la_SOURCES = \
tile.c
if !LIBSLAB_FOR_INTERNAL_USE
-libslab_includedir = $(includedir)/libslab
+libslab_includedir = $(includedir)/libslab-3/libslab
libslab_include_HEADERS = $(HEADER_FILES)
libslab_la_LDFLAGS = -version-info $(LT_VERSION)
diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c
index 50d1587..199cc67 100644
--- a/libslab/app-resizer.c
+++ b/libslab/app-resizer.c
@@ -19,14 +19,12 @@
*/
#include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
#include "app-shell.h"
#include "app-resizer.h"
static void app_resizer_class_init (AppResizerClass *);
static void app_resizer_init (AppResizer *);
-static void app_resizer_destroy (GtkObject *);
static void app_resizer_size_allocate (GtkWidget * resizer, GtkAllocation * allocation);
static gboolean app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event,
@@ -40,8 +38,6 @@ app_resizer_class_init (AppResizerClass * klass)
{
GtkWidgetClass *widget_class;
- ((GtkObjectClass *) klass)->destroy = app_resizer_destroy;
-
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->size_allocate = app_resizer_size_allocate;
}
@@ -286,11 +282,6 @@ app_resizer_new (GtkVBox * child, gint initial_num_columns, gboolean homogeneous
return GTK_WIDGET (widget);
}
-static void
-app_resizer_destroy (GtkObject * obj)
-{
-}
-
void
app_resizer_set_vadjustment_value (GtkWidget * widget, gdouble value)
{
@@ -316,6 +307,8 @@ app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellDa
printf("Allocation:%d, %d, %d, %d\n\n", widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height);
*/
+ g_warning ("GTK3ME: No gdk to draw rectangles with");
+#ifdef DISABLED_FOR_NOW
gdk_draw_rectangle (gtk_layout_get_bin_window (GTK_LAYOUT (widget)),
gtk_widget_get_style (widget)->base_gc[GTK_STATE_NORMAL],
TRUE, event->area.x, event->area.y,
@@ -335,6 +328,7 @@ app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellDa
allocation.width, /* drawing with our coordinates here to draw all the way to the edge. */
selected_allocation.height);
}
+#endif
return FALSE;
}
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index e0fa67e..6cd2b27 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -22,8 +22,8 @@
#include <config.h>
#endif
-#include <libgnome/gnome-desktop-item.h>
#include <gio/gio.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@
#include "slab-section.h"
#include "slab-gnome-util.h"
#include "search-bar.h"
+#include "libslab-utils.h"
#include "application-tile.h"
#include "themed-icon.h"
@@ -60,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, GnomeDesktopItem * desktop_item,
+static void insert_launcher_into_category (CategoryData * cat_data, GKeyFile * desktop_item,
AppShellData * app_data);
static gboolean main_keypress_callback (GtkWidget * widget, GdkEventKey * event,
@@ -107,7 +108,7 @@ show_shell (AppShellData * app_data)
{
gtk_widget_show_all (app_data->main_app);
if (!app_data->static_actions)
- gtk_widget_hide_all (app_data->actions_section); /* don't show unless a launcher is selected */
+ gtk_widget_hide (app_data->actions_section); /* don't show unless a launcher is selected */
if (app_data->main_app_window_shown_once)
gtk_window_move (GTK_WINDOW (app_data->main_app),
@@ -192,7 +193,7 @@ launch_selected_app (AppShellData * app_data)
static gboolean
main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData * app_data)
{
- if (event->keyval == GDK_Return)
+ if (event->keyval == GDK_KEY_Return)
{
SlabSection *section = SLAB_SECTION (app_data->filter_section);
NldSearchBar *search_bar;
@@ -208,9 +209,9 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
}
/* quit on ESC or Ctl-W or Ctl-Q */
- if (event->keyval == GDK_Escape ||
- ((event->keyval == GDK_w || event->keyval == GDK_W) && (event->state & GDK_CONTROL_MASK)) ||
- ((event->keyval == GDK_q || event->keyval == GDK_Q) && (event->state & GDK_CONTROL_MASK)))
+ if (event->keyval == GDK_KEY_Escape ||
+ ((event->keyval == GDK_KEY_w || event->keyval == GDK_KEY_W) && (event->state & GDK_CONTROL_MASK)) ||
+ ((event->keyval == GDK_KEY_q || event->keyval == GDK_KEY_Q) && (event->state & GDK_CONTROL_MASK)))
{
if (app_data->exit_on_close)
gtk_main_quit ();
@@ -374,7 +375,7 @@ relayout_shell (AppShellData * app_data)
gtk_widget_show_all (shell);
if (!app_data->static_actions && !app_data->last_clicked_launcher)
- gtk_widget_hide_all (app_data->actions_section); /* don't show unless a launcher is selected */
+ gtk_widget_hide (app_data->actions_section); /* don't show unless a launcher is selected */
}
static GtkWidget *
@@ -560,7 +561,7 @@ handle_filter_changed_delayed (gpointer user_data)
gdk_cursor_new_for_display (gtk_widget_get_display (app_data->shell), GDK_WATCH);
gdk_window_set_cursor (gtk_widget_get_window (app_data->shell),
app_data->busy_cursor);
- gdk_cursor_unref (app_data->busy_cursor);
+ g_object_unref (app_data->busy_cursor);
set_state (app_data, NULL);
app_resizer_set_vadjustment_value (app_data->category_layout, 0);
@@ -957,7 +958,7 @@ generate_category (const char * category, GMenuTreeDirectory * root_dir, AppShel
}
static gboolean
-check_specific_apps_hack (GnomeDesktopItem * item)
+check_specific_apps_hack (GKeyFile * item)
{
static const gchar *COMMAND_LINE_LOCKDOWN_GCONF_KEY =
"/desktop/gnome/lockdown/disable_command_line";
@@ -965,8 +966,7 @@ check_specific_apps_hack (GnomeDesktopItem * item)
static gboolean got_lockdown_value = FALSE;
static gboolean command_line_lockdown;
- gchar *path;
- const char *exec;
+ gchar *path = NULL, *exec = NULL;
if (!got_lockdown_value)
{
@@ -975,13 +975,14 @@ check_specific_apps_hack (GnomeDesktopItem * item)
}
/* This seems like an ugly hack but it's the way it's currently done in the old control center */
- exec = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_EXEC);
+ exec = libslab_keyfile_get (item, G_KEY_FILE_DESKTOP_KEY_EXEC);
/* discard xscreensaver if gnome-screensaver is installed */
if ((exec && !strcmp (exec, "xscreensaver-demo"))
&& (path = g_find_program_in_path ("gnome-screensaver-preferences")))
{
g_free (path);
+ g_free (exec);
return TRUE;
}
@@ -990,6 +991,7 @@ check_specific_apps_hack (GnomeDesktopItem * item)
&& (path = g_find_program_in_path ("CASAManager.sh")))
{
g_free (path);
+ g_free (exec);
return TRUE;
}
@@ -997,21 +999,25 @@ check_specific_apps_hack (GnomeDesktopItem * item)
if (command_line_lockdown)
{
const gchar *categories =
- gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_CATEGORIES);
+ libslab_keyfile_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)); */
+ g_free (path);
+ g_free (exec);
return TRUE;
}
}
+ g_free (path);
+ g_free (exec);
return FALSE;
}
static void
generate_launchers (GMenuTreeDirectory * root_dir, AppShellData * app_data, CategoryData * cat_data, gboolean recursive)
{
- GnomeDesktopItem *desktop_item;
+ GKeyFile *desktop_item;
const gchar *desktop_file;
GSList *contents, *l;
@@ -1041,7 +1047,8 @@ generate_launchers (GMenuTreeDirectory * root_dir, AppShellData * app_data, Cate
g_hash_table_insert (app_data->hash, (gpointer) desktop_file,
(gpointer) desktop_file);
}
- desktop_item = gnome_desktop_item_new_from_file (desktop_file, 0, NULL);
+ desktop_item = g_key_file_new();
+ g_key_file_load_from_file (desktop_item, desktop_file, 0, NULL);
if (!desktop_item)
{
g_critical ("Failure - gnome_desktop_item_new_from_file(%s)",
@@ -1050,7 +1057,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);
- gnome_desktop_item_unref (desktop_item);
+ g_object_unref (desktop_item);
break;
default:
break;
@@ -1110,11 +1117,12 @@ generate_new_apps (AppShellData * app_data)
for (launchers = data->launcher_list; launchers; launchers = launchers->next)
{
Tile *tile = TILE (launchers->data);
- GnomeDesktopItem *item =
+ GKeyFile *item =
application_tile_get_desktop_item (APPLICATION_TILE (tile));
- const gchar *uri = gnome_desktop_item_get_location (item);
+ gchar *uri = libslab_keyfile_get_location (item);
g_string_append (gstr, uri);
g_string_append (gstr, separator);
+ g_free (uri);
}
}
@@ -1145,9 +1153,9 @@ generate_new_apps (AppShellData * app_data)
for (launchers = cat_data->launcher_list; launchers; launchers = launchers->next)
{
Tile *tile = TILE (launchers->data);
- GnomeDesktopItem *item =
+ GKeyFile *item =
application_tile_get_desktop_item (APPLICATION_TILE (tile));
- const gchar *uri = gnome_desktop_item_get_location (item);
+ gchar *uri = libslab_keyfile_get_location (item);
if (!g_hash_table_lookup (all_apps_cache, uri))
{
GFile *file;
@@ -1208,6 +1216,7 @@ generate_new_apps (AppShellData * app_data)
}
}
}
+ g_free (uri);
}
}
g_hash_table_destroy (new_apps_dups);
@@ -1240,7 +1249,7 @@ generate_new_apps (AppShellData * app_data)
}
static void
-insert_launcher_into_category (CategoryData * cat_data, GnomeDesktopItem * desktop_item,
+insert_launcher_into_category (CategoryData * cat_data, GKeyFile * desktop_item,
AppShellData * app_data)
{
GtkWidget *launcher;
@@ -1254,12 +1263,11 @@ insert_launcher_into_category (CategoryData * cat_data, GnomeDesktopItem * deskt
icon_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
launcher =
- application_tile_new_full (gnome_desktop_item_get_location (desktop_item),
+ application_tile_new_full (libslab_keyfile_get_location (desktop_item),
app_data->icon_size, app_data->show_tile_generic_name, app_data->gconf_prefix);
gtk_widget_set_size_request (launcher, SIZING_TILE_WIDTH, -1);
- filepath =
- g_strdup (gnome_desktop_item_get_string (desktop_item, GNOME_DESKTOP_ITEM_EXEC));
+ filepath = libslab_keyfile_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 7608206..4462b07 100644
--- a/libslab/app-shell.h
+++ b/libslab/app-shell.h
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#define GMENU_I_KNOW_THIS_IS_UNSTABLE
#include <gmenu-tree.h>
-#include <libgnome/gnome-desktop-item.h>
#include <libslab/slab-section.h>
#include <libslab/tile.h>
@@ -110,13 +109,13 @@ typedef struct
typedef struct
{
const gchar *name;
- GnomeDesktopItem *item;
+ GKeyFile *item;
} AppAction;
typedef struct
{
long time;
- GnomeDesktopItem *item;
+ GKeyFile *item;
} NewAppData;
void generate_categories (AppShellData * app_data);
diff --git a/libslab/application-tile.c b/libslab/application-tile.c
index 244c197..2d54e5b 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 (GnomeDesktopItem *);
+static StartupStatus get_desktop_item_startup_status (GKeyFile *);
static void update_startup_menu_item (ApplicationTile *);
typedef struct {
- GnomeDesktopItem *desktop_item;
+ GKeyFile *desktop_item;
gchar *image_id;
GtkIconSize image_size;
@@ -145,20 +145,25 @@ application_tile_new_full (const gchar *desktop_item_id,
const gchar *uri = NULL;
- GnomeDesktopItem *desktop_item;
-
+ GKeyFile *desktop_item;
desktop_item = load_desktop_item_from_unknown (desktop_item_id);
+ gchar *type = NULL;
if (
desktop_item &&
- gnome_desktop_item_get_entry_type (desktop_item) == GNOME_DESKTOP_ITEM_TYPE_APPLICATION
- )
- uri = gnome_desktop_item_get_location (desktop_item);
+ !g_ascii_strcasecmp ((type = libslab_keyfile_get (desktop_item,
+ G_KEY_FILE_DESKTOP_KEY_TYPE)),
+ G_KEY_FILE_DESKTOP_TYPE_APPLICATION))
+ {
+ uri = libslab_keyfile_get (desktop_item,
+ G_KEY_FILE_DESKTOP_KEY_URL);
+ }
+ g_free (type);
if (! uri) {
if (desktop_item)
- gnome_desktop_item_unref (desktop_item);
+ g_object_unref (desktop_item);
return NULL;
}
@@ -211,7 +216,7 @@ application_tile_finalize (GObject *g_object)
}
if (priv->desktop_item) {
- gnome_desktop_item_unref (priv->desktop_item);
+ g_object_unref (priv->desktop_item);
priv->desktop_item = NULL;
}
if (priv->image_id) {
@@ -316,12 +321,13 @@ application_tile_setup (ApplicationTile *this, const gchar *gconf_prefix)
return;
}
- priv->image_id = g_strdup (gnome_desktop_item_get_localestring (priv->desktop_item, "Icon"));
+ priv->image_id = libslab_keyfile_get_locale (priv->desktop_item,
+ G_KEY_FILE_DESKTOP_KEY_ICON);
image = themed_icon_new (priv->image_id, priv->image_size);
- name = gnome_desktop_item_get_localestring (priv->desktop_item, "Name");
- desc = gnome_desktop_item_get_localestring (priv->desktop_item, "GenericName");
- comment = gnome_desktop_item_get_localestring (priv->desktop_item, "Comment");
+ 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");
accessible = gtk_widget_get_accessible (GTK_WIDGET (this));
if (name)
@@ -388,7 +394,7 @@ application_tile_setup (ApplicationTile *this, const gchar *gconf_prefix)
/* make help action */
- if (gnome_desktop_item_get_string (priv->desktop_item, "DocPath")) {
+ if (libslab_keyfile_get (priv->desktop_item, "DocPath")) {
action = tile_action_new (
TILE (this), help_trigger, _("Help"),
TILE_ACTION_OPENS_NEW_WINDOW | TILE_ACTION_OPENS_HELP);
@@ -490,10 +496,12 @@ create_subheader (const gchar *desc)
subheader = gtk_label_new (desc);
gtk_label_set_ellipsize (GTK_LABEL (subheader), PANGO_ELLIPSIZE_END);
gtk_misc_set_alignment (GTK_MISC (subheader), 0.0, 0.5);
+#ifdef MORE_PORTING_REQUIRED
gtk_widget_modify_fg (
subheader,
GTK_STATE_NORMAL,
& gtk_widget_get_style (subheader)->fg [GTK_STATE_INSENSITIVE]);
+#endif
return subheader;
}
@@ -675,8 +683,8 @@ add_to_startup_list (ApplicationTile *this)
gchar *dst_uri;
desktop_item_filename =
- g_filename_from_uri (gnome_desktop_item_get_location (priv->desktop_item), NULL,
- NULL);
+ g_filename_from_uri (libslab_keyfile_get_location (priv->desktop_item), NULL,
+ NULL);
g_return_if_fail (desktop_item_filename != NULL);
@@ -689,7 +697,7 @@ add_to_startup_list (ApplicationTile *this)
dst_filename = g_build_filename (startup_dir, desktop_item_basename, NULL);
- src_uri = gnome_desktop_item_get_location (priv->desktop_item);
+ src_uri = libslab_keyfile_get_location (priv->desktop_item);
dst_uri = g_filename_to_uri (dst_filename, NULL, NULL);
copy_file (src_uri, dst_uri);
@@ -712,7 +720,7 @@ remove_from_startup_list (ApplicationTile *this)
gchar *src_filename;
ditem_filename =
- g_filename_from_uri (gnome_desktop_item_get_location (priv->desktop_item), NULL,
+ g_filename_from_uri (libslab_keyfile_get_location (priv->desktop_item), NULL,
NULL);
g_return_if_fail (ditem_filename != NULL);
@@ -734,7 +742,7 @@ remove_from_startup_list (ApplicationTile *this)
g_free (src_filename);
}
-GnomeDesktopItem *
+GKeyFile *
application_tile_get_desktop_item (ApplicationTile *tile)
{
return APPLICATION_TILE_GET_PRIVATE (tile)->desktop_item;
@@ -794,7 +802,7 @@ update_user_list_menu_item (ApplicationTile *this)
}
static StartupStatus
-get_desktop_item_startup_status (GnomeDesktopItem *desktop_item)
+get_desktop_item_startup_status (GKeyFile *desktop_item)
{
gchar *filename;
gchar *basename;
@@ -805,8 +813,8 @@ get_desktop_item_startup_status (GnomeDesktopItem *desktop_item)
StartupStatus retval;
gint x;
-
- filename = g_filename_from_uri (gnome_desktop_item_get_location (desktop_item), NULL, NULL);
+
+ filename = g_filename_from_uri (libslab_keyfile_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 6df049f..613132f 100644
--- a/libslab/application-tile.h
+++ b/libslab/application-tile.h
@@ -23,8 +23,6 @@
#include <libslab/nameplate-tile.h>
-#include <libgnome/gnome-desktop-item.h>
-
G_BEGIN_DECLS
#define APPLICATION_TILE_TYPE (application_tile_get_type ())
@@ -60,7 +58,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);
-GnomeDesktopItem *application_tile_get_desktop_item (ApplicationTile * tile);
+GKeyFile *application_tile_get_desktop_item (ApplicationTile * tile);
G_END_DECLS
#endif
diff --git a/libslab/bookmark-agent.c b/libslab/bookmark-agent.c
index 25f4a10..e6ca1ba 100644
--- a/libslab/bookmark-agent.c
+++ b/libslab/bookmark-agent.c
@@ -1067,14 +1067,14 @@ create_app_item (BookmarkAgent *this, const gchar *uri)
{
BookmarkAgentPrivate *priv = PRIVATE (this);
- GnomeDesktopItem *ditem;
+ GKeyFile *ditem;
gchar *uri_new = NULL;
ditem = libslab_gnome_desktop_item_new_from_unknown_id (uri);
if (ditem) {
- uri_new = g_strdup (gnome_desktop_item_get_location (ditem));
- gnome_desktop_item_unref (ditem);
+ uri_new = libslab_keyfile_get_location (ditem);
+ g_object_unref (ditem);
}
if (! uri_new)
diff --git a/libslab/document-tile.c b/libslab/document-tile.c
index e4ad7ad..5b2f13c 100644
--- a/libslab/document-tile.c
+++ b/libslab/document-tile.c
@@ -712,8 +712,10 @@ create_subheader (const gchar *desc)
subheader = gtk_label_new (desc);
gtk_label_set_ellipsize (GTK_LABEL (subheader), PANGO_ELLIPSIZE_END);
gtk_misc_set_alignment (GTK_MISC (subheader), 0.0, 0.5);
+#ifdef MORE_PORTING_REQUIRED
gtk_widget_modify_fg (subheader, GTK_STATE_NORMAL,
>k_widget_get_style (subheader)->fg[GTK_STATE_INSENSITIVE]);
+#endif
return subheader;
}
@@ -880,7 +882,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 ();
+ launch_context = g_object_new (GDK_TYPE_APP_LAUNCH_CONTEXT, NULL);
gdk_app_launch_context_set_screen (launch_context,
gtk_widget_get_screen (GTK_WIDGET (tile)));
gdk_app_launch_context_set_timestamp (launch_context,
@@ -1110,8 +1112,11 @@ send_to_trigger (Tile *tile, TileEvent *event, TileAction *action)
}
}
+ g_warning ("Spawn on screen !");
+#ifdef FIXME_MORE_PORTING
gdk_spawn_on_screen (gtk_widget_get_screen (GTK_WIDGET (tile)), NULL, argv, NULL,
G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
+#endif
if (error)
handle_g_error (&error, "error in %s", G_STRFUNC);
diff --git a/libslab/gnome-utils.c b/libslab/gnome-utils.c
index 893b5fb..9d24287 100644
--- a/libslab/gnome-utils.c
+++ b/libslab/gnome-utils.c
@@ -70,13 +70,15 @@ load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
return icon_exists;
}
-GnomeDesktopItem *
+GKeyFile *
load_desktop_item_by_unknown_id (const gchar * id)
{
- GnomeDesktopItem *item;
+ GKeyFile *item;
GError *error = NULL;
- item = gnome_desktop_item_new_from_uri (id, 0, &error);
+ item = g_key_file_new();
+#warning url or path ?
+ g_key_file_load_from_file (item, id, 0, &error);
if (!error)
return item;
@@ -85,8 +87,8 @@ load_desktop_item_by_unknown_id (const gchar * id)
g_error_free (error);
error = NULL;
}
-
- item = gnome_desktop_item_new_from_file (id, 0, &error);
+#ifdef FIXME_MORE_PORTING
+ item = gnme_desktop_item_new_from_file (id, 0, &error);
if (!error)
return item;
@@ -96,7 +98,7 @@ load_desktop_item_by_unknown_id (const gchar * id)
error = NULL;
}
- item = gnome_desktop_item_new_from_basename (id, 0, &error);
+ item = gnme_desktop_item_new_from_basename (id, 0, &error);
if (!error)
return item;
@@ -106,6 +108,8 @@ load_desktop_item_by_unknown_id (const gchar * id)
error = NULL;
}
+#endif
+ g_warning ("More porting required here");
return NULL;
}
diff --git a/libslab/gnome-utils.h b/libslab/gnome-utils.h
index a6b7723..e9f7e43 100644
--- a/libslab/gnome-utils.h
+++ b/libslab/gnome-utils.h
@@ -23,13 +23,12 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
-#include <libgnome/gnome-desktop-item.h>
G_BEGIN_DECLS
gboolean load_image_by_id (GtkImage * image, GtkIconSize size,
const gchar * image_id);
-GnomeDesktopItem *load_desktop_item_by_unknown_id (const gchar * 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);
diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c
index 3a2d50b..2c8e39d 100644
--- a/libslab/libslab-utils.c
+++ b/libslab/libslab-utils.c
@@ -88,19 +88,20 @@ libslab_gtk_image_set_by_id (GtkImage *image, const gchar *id)
return found;
}
-GnomeDesktopItem *
+GKeyFile *
libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
{
- GnomeDesktopItem *item;
+ GKeyFile *item;
gchar *basename;
GError *error = NULL;
-
+ g_warning ("Un-believable cut & paste here");
if (! id)
return NULL;
- item = gnome_desktop_item_new_from_uri (id, 0, & error);
+ item = g_key_file_new();
+ g_key_file_load_from_file (item, id, 0, &error);
if (! error)
return item;
@@ -109,7 +110,8 @@ libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
error = NULL;
}
- item = gnome_desktop_item_new_from_file (id, 0, & error);
+#ifdef FIXME_MORE_PORTING
+ item = gnme_desktop_item_new_from_file (id, 0, & error);
if (! error)
return item;
@@ -118,7 +120,7 @@ libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
error = NULL;
}
- item = gnome_desktop_item_new_from_basename (id, 0, & error);
+ item = gnme_desktop_item_new_from_basename (id, 0, & error);
if (! error)
return item;
@@ -132,7 +134,7 @@ libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
if (basename) {
basename++;
- item = gnome_desktop_item_new_from_basename (basename, 0, &error);
+ item = gnme_desktop_item_new_from_basename (basename, 0, &error);
if (! error)
return item;
@@ -141,23 +143,26 @@ libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
error = NULL;
}
}
+#endif
return NULL;
}
gboolean
-libslab_gnome_desktop_item_launch_default (GnomeDesktopItem *item)
+libslab_gnome_desktop_item_launch_default (GKeyFile *item)
{
GError *error = NULL;
if (! item)
return FALSE;
- gnome_desktop_item_launch (item, NULL, GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE, & error);
+ 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",
- gnome_desktop_item_get_location (item), error->message);
+ libslab_keyfile_get_location (item),
+ error->message);
g_error_free (error);
@@ -168,14 +173,13 @@ libslab_gnome_desktop_item_launch_default (GnomeDesktopItem *item)
}
gchar *
-libslab_gnome_desktop_item_get_docpath (GnomeDesktopItem *item)
+libslab_gnome_desktop_item_get_docpath (GKeyFile *item)
{
gchar *path;
- path = g_strdup (gnome_desktop_item_get_localestring (item, GNOME_DESKTOP_ITEM_DOC_PATH));
-
+ path = libslab_keyfile_get_locale (item, "DocPath");
if (! path)
- path = g_strdup (gnome_desktop_item_get_localestring (item, ALTERNATE_DOCPATH_KEY));
+ path = libslab_keyfile_get_locale (item, ALTERNATE_DOCPATH_KEY);
return path;
}
@@ -190,12 +194,9 @@ libslab_get_current_screen (void)
GdkScreen *screen = NULL;
event = gtk_get_current_event ();
- if (event) {
- if (event->any.window)
- screen = gdk_drawable_get_screen (GDK_DRAWABLE (event->any.window));
-
- gdk_event_free (event);
- }
+ if (event)
+ screen = gdk_event_get_screen (event);
+ gdk_event_free (event);
if (!screen)
screen = gdk_screen_get_default ();
@@ -204,7 +205,7 @@ libslab_get_current_screen (void)
}
gboolean
-libslab_gnome_desktop_item_open_help (GnomeDesktopItem *item)
+libslab_gnome_desktop_item_open_help (GKeyFile *item)
{
gchar *doc_path;
gchar *help_uri;
@@ -497,8 +498,8 @@ libslab_handle_g_error (GError **error, const gchar *msg_format, ...)
gboolean
libslab_desktop_item_is_a_terminal (const gchar *uri)
{
- GnomeDesktopItem *d_item;
- const gchar *categories;
+ GKeyFile *d_item;
+ gchar *categories;
gboolean is_terminal = FALSE;
@@ -508,11 +509,11 @@ libslab_desktop_item_is_a_terminal (const gchar *uri)
if (! d_item)
return FALSE;
- categories = gnome_desktop_item_get_string (d_item, GNOME_DESKTOP_ITEM_CATEGORIES);
-
+ 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);
- gnome_desktop_item_unref (d_item);
+ g_object_unref (d_item);
return is_terminal;
}
@@ -520,18 +521,20 @@ libslab_desktop_item_is_a_terminal (const gchar *uri)
gboolean
libslab_desktop_item_is_logout (const gchar *uri)
{
- GnomeDesktopItem *d_item;
+ 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;
- is_logout = strstr ("Logout", gnome_desktop_item_get_string (d_item, GNOME_DESKTOP_ITEM_NAME)) != NULL;
+ item_name = libslab_keyfile_get (d_item, G_KEY_FILE_DESKTOP_KEY_NAME);
+ is_logout = strstr ("Logout", item_name) != NULL;
+ g_free (item_name);
- gnome_desktop_item_unref (d_item);
+ g_object_unref (d_item);
return is_logout;
}
@@ -539,18 +542,20 @@ libslab_desktop_item_is_logout (const gchar *uri)
gboolean
libslab_desktop_item_is_lockscreen (const gchar *uri)
{
- GnomeDesktopItem *d_item;
+ 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;
- is_logout = strstr ("Lock Screen", gnome_desktop_item_get_string (d_item, GNOME_DESKTOP_ITEM_NAME)) != NULL;
+ 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);
- gnome_desktop_item_unref (d_item);
+ g_object_unref (d_item);
return is_logout;
}
@@ -561,7 +566,6 @@ libslab_string_replace_once (const gchar *string, const gchar *key, const gchar
GString *str_built;
gint pivot;
-
pivot = strstr (string, key) - string;
str_built = g_string_new_len (string, pivot);
@@ -714,3 +718,20 @@ 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);
+}
+
+char *libslab_keyfile_get_location (GKeyFile *keyfile)
+{
+ return libslab_keyfile_get (keyfile, G_KEY_FILE_DESKTOP_KEY_URL);
+}
diff --git a/libslab/libslab-utils.h b/libslab/libslab-utils.h
index 322a00a..afa37bd 100644
--- a/libslab/libslab-utils.h
+++ b/libslab/libslab-utils.h
@@ -4,17 +4,20 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
-#include <libgnome/gnome-desktop-item.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API 1
-#include <libgnomeui/gnome-desktop-thumbnail.h>
+#include <libgnome-desktop/gnome-desktop-thumbnail.h>
G_BEGIN_DECLS
+char *libslab_keyfile_get (GKeyFile *keyfile, const char *key);
+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);
-GnomeDesktopItem *libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id);
-gboolean libslab_gnome_desktop_item_launch_default (GnomeDesktopItem *item);
-gchar *libslab_gnome_desktop_item_get_docpath (GnomeDesktopItem *item);
-gboolean libslab_gnome_desktop_item_open_help (GnomeDesktopItem *item);
+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);
diff --git a/libslab/nameplate-tile.c b/libslab/nameplate-tile.c
index 769cb93..748c43e 100644
--- a/libslab/nameplate-tile.c
+++ b/libslab/nameplate-tile.c
@@ -279,13 +279,14 @@ nameplate_tile_drag_begin (GtkWidget * widget, GdkDragContext * context)
pixbuf = gtk_image_get_pixbuf (image);
if (pixbuf)
gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0);
-
break;
case GTK_IMAGE_ICON_NAME:
+ g_warning ("port me !");
+#ifdef PORTING_REQUIRED
if (image->data.name.pixbuf)
gtk_drag_set_icon_pixbuf (context, image->data.name.pixbuf, 0, 0);
-
+#endif
break;
default:
diff --git a/libslab/search-entry.c b/libslab/search-entry.c
index 41603c7..435eb7e 100644
--- a/libslab/search-entry.c
+++ b/libslab/search-entry.c
@@ -37,7 +37,7 @@ static void nld_search_entry_init (NldSearchEntry *);
static void nld_search_entry_finalize (GObject *);
static void nld_search_entry_realize (GtkWidget * widget);
-static gboolean nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event);
+static gboolean nld_search_entry_draw (GtkWidget * widget, cairo_t *cr);
G_DEFINE_TYPE (NldSearchEntry, nld_search_entry, GTK_TYPE_ENTRY)
@@ -49,7 +49,7 @@ static void nld_search_entry_class_init (NldSearchEntryClass * nld_search_entry_
g_type_class_add_private (nld_search_entry_class, sizeof (NldSearchEntryPrivate));
widget_class->realize = nld_search_entry_realize;
- widget_class->expose_event = nld_search_entry_expose_event;
+ widget_class->draw = nld_search_entry_draw;
g_obj_class->finalize = nld_search_entry_finalize;
}
@@ -90,6 +90,7 @@ nld_search_entry_realize (GtkWidget * widget)
GTK_WIDGET_CLASS (nld_search_entry_parent_class)->realize (widget);
+#ifdef MORE_PORTING_FUN
gdk_window_get_geometry (gtk_entry_get_text_window (GTK_ENTRY (widget)),
NULL, NULL, NULL, &height, NULL);
@@ -112,14 +113,19 @@ nld_search_entry_realize (GtkWidget * widget)
g_object_unref (priv->watermark);
priv->watermark = rsvg_handle_get_pixbuf (rsvg);
rsvg_handle_free (rsvg);
+#endif
+ g_warning ("missing svg entry fun");
}
static gboolean
-nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event)
+nld_search_entry_draw (GtkWidget *widget, cairo_t *cr)
{
NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget);
- GTK_WIDGET_CLASS (nld_search_entry_parent_class)->expose_event (widget, event);
+ GTK_WIDGET_CLASS (nld_search_entry_parent_class)->draw (widget, cr);
+
+ g_warning ("GTK3ME: No gdk to draw pixbufs with");
+#ifdef DISABLED_FOR_NOW
if (event->window == gtk_entry_get_text_window (GTK_ENTRY (widget)))
{
int width, height, x;
@@ -135,6 +141,7 @@ nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event)
priv->watermark, 0, 0, x, 1, priv->width, priv->height,
GDK_RGB_DITHER_NORMAL, 0, 0);
}
+#endif
return FALSE;
}
diff --git a/libslab/shell-window.h b/libslab/shell-window.h
index 54124c0..8318094 100644
--- a/libslab/shell-window.h
+++ b/libslab/shell-window.h
@@ -23,7 +23,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
#include <libslab/app-shell.h>
diff --git a/libslab/slab-gnome-util.c b/libslab/slab-gnome-util.c
index a22d514..0f81076 100644
--- a/libslab/slab-gnome-util.c
+++ b/libslab/slab-gnome-util.c
@@ -135,10 +135,10 @@ get_slab_gconf_slist (const gchar * key)
return value;
}
-GnomeDesktopItem *
+GKeyFile *
load_desktop_item_from_gconf_key (const gchar * key)
{
- GnomeDesktopItem *item;
+ GKeyFile *item;
gchar *id = get_slab_gconf_string (key);
if (!id)
@@ -149,14 +149,16 @@ load_desktop_item_from_gconf_key (const gchar * key)
return item;
}
-GnomeDesktopItem *
+GKeyFile *
load_desktop_item_from_unknown (const gchar *id)
{
- GnomeDesktopItem *item;
+ GKeyFile *item;
gchar *basename;
GError *error = NULL;
+ g_warning ("more cut and paste crap");
+#ifdef FIXME_MORE_PORTING
item = gnome_desktop_item_new_from_uri (id, 0, &error);
@@ -167,7 +169,7 @@ load_desktop_item_from_unknown (const gchar *id)
error = NULL;
}
- item = gnome_desktop_item_new_from_file (id, 0, &error);
+ item = gnme_desktop_item_new_from_file (id, 0, &error);
if (! error)
return item;
@@ -176,7 +178,7 @@ load_desktop_item_from_unknown (const gchar *id)
error = NULL;
}
- item = gnome_desktop_item_new_from_basename (id, 0, &error);
+ item = gnme_desktop_item_new_from_basename (id, 0, &error);
if (! error)
return item;
@@ -190,7 +192,7 @@ load_desktop_item_from_unknown (const gchar *id)
if (basename) {
basename++;
- item = gnome_desktop_item_new_from_basename (basename, 0, &error);
+ item = gnme_desktop_item_new_from_basename (basename, 0, &error);
if (! error)
return item;
@@ -199,12 +201,12 @@ load_desktop_item_from_unknown (const gchar *id)
error = NULL;
}
}
-
+#endif
return NULL;
}
gchar *
-get_package_name_from_desktop_item (GnomeDesktopItem * desktop_item)
+get_package_name_from_desktop_item (GKeyFile * desktop_item)
{
gchar *argv[6];
gchar *package_name;
@@ -215,7 +217,7 @@ get_package_name_from_desktop_item (GnomeDesktopItem * desktop_item)
argv[1] = "-qf";
argv[2] = "--qf";
argv[3] = "%{NAME}";
- argv[4] = g_filename_from_uri (gnome_desktop_item_get_location (desktop_item), NULL, NULL);
+ argv[4] = g_filename_from_uri (libslab_keyfile_get_location (desktop_item), NULL, NULL);
argv[5] = NULL;
error = NULL;
@@ -237,20 +239,23 @@ get_package_name_from_desktop_item (GnomeDesktopItem * desktop_item)
}
gboolean
-open_desktop_item_exec (GnomeDesktopItem * desktop_item)
+open_desktop_item_exec (GKeyFile * desktop_item)
{
GError *error = NULL;
if (!desktop_item)
return FALSE;
+ g_warning ("Item exec");
+#ifdef FIXME_MORE_PORTING
gnome_desktop_item_launch (desktop_item, NULL, GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE, &error);
+#endif
if (error)
{
g_warning ("error launching %s [%s]\n",
- gnome_desktop_item_get_location (desktop_item), error->message);
-
+ libslab_keyfile_get_location (desktop_item),
+ error->message);
g_error_free (error);
return FALSE;
}
@@ -259,9 +264,9 @@ open_desktop_item_exec (GnomeDesktopItem * desktop_item)
}
gboolean
-open_desktop_item_help (GnomeDesktopItem * desktop_item)
+open_desktop_item_help (GKeyFile * desktop_item)
{
- const gchar *doc_path;
+ gchar *doc_path;
gchar *help_uri;
GError *error;
@@ -269,7 +274,7 @@ open_desktop_item_help (GnomeDesktopItem * desktop_item)
if (!desktop_item)
return FALSE;
- doc_path = gnome_desktop_item_get_string (desktop_item, "DocPath");
+ doc_path = libslab_keyfile_get (desktop_item, "DocPath");
if (doc_path)
{
@@ -281,22 +286,31 @@ open_desktop_item_help (GnomeDesktopItem * desktop_item)
g_warning ("error opening %s [%s]\n", help_uri, error->message);
g_free (help_uri);
+ g_free (doc_path);
g_error_free (error);
return FALSE;
}
+ g_free (doc_path);
g_free (help_uri);
}
else
+ {
+ g_free (doc_path);
return FALSE;
+ }
+ g_free (doc_path);
return TRUE;
}
gboolean
-desktop_item_is_in_main_menu (GnomeDesktopItem * desktop_item)
+desktop_item_is_in_main_menu (GKeyFile * desktop_item)
{
- return desktop_uri_is_in_main_menu (gnome_desktop_item_get_location (desktop_item));
+ char *url = libslab_keyfile_get_location (desktop_item);
+ gboolean ret = desktop_uri_is_in_main_menu (url);
+ g_free (url);
+ return ret;
}
gboolean
diff --git a/libslab/slab-gnome-util.h b/libslab/slab-gnome-util.h
index 982f81e..bb5878e 100644
--- a/libslab/slab-gnome-util.h
+++ b/libslab/slab-gnome-util.h
@@ -23,7 +23,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
G_BEGIN_DECLS
@@ -52,15 +51,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);
-GnomeDesktopItem *load_desktop_item_from_gconf_key (const gchar * key);
-GnomeDesktopItem *load_desktop_item_from_unknown (const gchar * id);
+GKeyFile *load_desktop_item_from_gconf_key (const gchar * key);
+GKeyFile *load_desktop_item_from_unknown (const gchar * id);
-gchar *get_package_name_from_desktop_item (GnomeDesktopItem * desktop_item);
+gchar *get_package_name_from_desktop_item (GKeyFile * desktop_item);
-gboolean open_desktop_item_exec (GnomeDesktopItem * desktop_item);
-gboolean open_desktop_item_help (GnomeDesktopItem * desktop_item);
+gboolean open_desktop_item_exec (GKeyFile * desktop_item);
+gboolean open_desktop_item_help (GKeyFile * desktop_item);
-gboolean desktop_item_is_in_main_menu (GnomeDesktopItem * desktop_item);
+gboolean desktop_item_is_in_main_menu (GKeyFile * 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/system-tile.c b/libslab/system-tile.c
index 55c7a8d..ae99404 100644
--- a/libslab/system-tile.c
+++ b/libslab/system-tile.c
@@ -44,12 +44,12 @@ static void update_user_list_menu_item (SystemTile *);
static void agent_notify_cb (GObject *, GParamSpec *, gpointer);
typedef struct {
- GnomeDesktopItem *desktop_item;
+ GKeyFile *desktop_item;
BookmarkAgent *agent;
BookmarkStoreStatus agent_status;
gulong notify_signal_id;
-
+
gchar *image_id;
} SystemTilePrivate;
@@ -71,7 +71,7 @@ system_tile_new (const gchar *desktop_item_id, const gchar *title)
GtkWidget *menu_item;
GtkContainer *menu_ctnr;
- GnomeDesktopItem *desktop_item = NULL;
+ GKeyFile *desktop_item = NULL;
gchar *image_id = NULL;
gchar *header_txt = NULL;
@@ -83,14 +83,13 @@ system_tile_new (const gchar *desktop_item_id, const gchar *title)
desktop_item = libslab_gnome_desktop_item_new_from_unknown_id (desktop_item_id);
if (desktop_item) {
- image_id = g_strdup (gnome_desktop_item_get_localestring (desktop_item, "Icon"));
- uri = g_strdup (gnome_desktop_item_get_location (desktop_item));
+ image_id = libslab_keyfile_get_locale (desktop_item, "Icon");
+ uri = libslab_keyfile_get (desktop_item, G_KEY_FILE_DESKTOP_KEY_URL);
if (title)
header_txt = g_strdup (title);
else
- header_txt = g_strdup (
- gnome_desktop_item_get_localestring (desktop_item, "Name"));
+ header_txt = libslab_keyfile_get_locale (desktop_item, "Name");
}
if (! uri)
@@ -201,7 +200,7 @@ system_tile_finalize (GObject *g_obj)
SystemTilePrivate *priv = PRIVATE (g_obj);
g_free (priv->image_id);
- gnome_desktop_item_unref (priv->desktop_item);
+ g_object_unref (priv->desktop_item);
if (priv->notify_signal_id)
g_signal_handler_disconnect (priv->agent, priv->notify_signal_id);
diff --git a/libslab/system-tile.h b/libslab/system-tile.h
index 40ee87e..743eeef 100644
--- a/libslab/system-tile.h
+++ b/libslab/system-tile.h
@@ -23,8 +23,6 @@
#include <libslab/nameplate-tile.h>
-#include <libgnome/gnome-desktop-item.h>
-
G_BEGIN_DECLS
#define SYSTEM_TILE_TYPE (system_tile_get_type ())
diff --git a/libslab/tile.c b/libslab/tile.c
index 602288d..c1201b0 100644
--- a/libslab/tile.c
+++ b/libslab/tile.c
@@ -47,7 +47,7 @@ static void tile_clicked (GtkButton *widget);
static gboolean tile_focus_in (GtkWidget *, GdkEventFocus *);
static gboolean tile_focus_out (GtkWidget *, GdkEventFocus *);
-static gboolean tile_expose (GtkWidget *, GdkEventExpose *);
+static gboolean tile_draw (GtkWidget *, cairo_t *);
static gboolean tile_button_release (GtkWidget *, GdkEventButton *);
static gboolean tile_key_release (GtkWidget *, GdkEventKey *);
static gboolean tile_popup_menu (GtkWidget *);
@@ -101,7 +101,7 @@ tile_class_init (TileClass * this_class)
widget_class->focus_in_event = tile_focus_in;
widget_class->focus_out_event = tile_focus_out;
- widget_class->expose_event = tile_expose;
+ widget_class->draw = tile_draw;
widget_class->button_release_event = tile_button_release;
widget_class->key_release_event = tile_key_release;
widget_class->drag_begin = tile_drag_begin;
@@ -318,10 +318,10 @@ tile_clicked (GtkButton * widget)
tile_event->time = gtk_get_current_event_time ();
g_signal_emit (widget, tile_signals[TILE_ACTIVATED_SIGNAL], 0, tile_event);
-
- gtk_button_released (widget);
g_free (tile_event);
- gtk_button_leave (widget);
+
+ g_signal_emit_by_name (widget, "released", 0, 0); // urgh ! what ?
+ g_signal_emit_by_name (widget, "leave", 0, 0); // urgh ! what ?
}
static gboolean
@@ -344,7 +344,7 @@ tile_focus_out (GtkWidget * widget, GdkEventFocus * event)
}
static gboolean
-tile_expose (GtkWidget * widget, GdkEventExpose * event)
+tile_draw (GtkWidget * widget, cairo_t * cr)
{
/* FIXME: there ought to be a better way to prevent the focus from being rendered. */
@@ -358,7 +358,7 @@ tile_expose (GtkWidget * widget, GdkEventExpose * event)
if (TILE (widget)->entered == FALSE)
gtk_widget_set_state (widget, GTK_STATE_NORMAL);
- retval = (*GTK_WIDGET_CLASS (tile_parent_class)->expose_event) (widget, event);
+ retval = (*GTK_WIDGET_CLASS (tile_parent_class)->draw) (widget, cr);
if (has_focus)
gtk_widget_set_can_focus (widget, TRUE);
@@ -395,7 +395,7 @@ tile_button_release (GtkWidget * widget, GdkEventButton * event)
g_signal_emit (tile, tile_signals[TILE_ACTIVATED_SIGNAL], 0, tile_event);
- gtk_button_released (GTK_BUTTON (widget));
+ g_signal_emit_by_name (widget, "released", 0, 0); // urgh ! what ?
g_free (tile_event);
break;
@@ -419,7 +419,7 @@ tile_key_release (GtkWidget * widget, GdkEventKey * event)
{
TileEvent *tile_event;
- if (event->keyval == GDK_Return)
+ if (event->keyval == GDK_KEY_Return)
{
tile_event = g_new0 (TileEvent, 1);
tile_event->type = TILE_EVENT_ACTIVATED_KEYBOARD;
@@ -445,7 +445,7 @@ tile_popup_menu_position (GtkMenu * menu, gint * x, gint * y, gboolean * push_in
if (!gtk_widget_get_realized (GTK_WIDGET (tile)))
return;
- gtk_widget_size_request (GTK_WIDGET (menu), &req);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
top = gtk_widget_get_toplevel (GTK_WIDGET (tile));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]