[Xfce4-commits] <xfdesktop:libxfce4ui> remove dependency on libxfcegui4 and use libxfce4ui instead
Brian J. Tarricone
noreply at xfce.org
Mon Oct 5 05:52:01 CEST 2009
Updating branch refs/heads/libxfce4ui
to 44e0e0ac46744fe7a5c39726913a787964ab1f44 (commit)
from 2ce186835f70701b90d02592106a7d489f67f157 (commit)
commit 44e0e0ac46744fe7a5c39726913a787964ab1f44
Author: Brian J. Tarricone <brian at tarricone.org>
Date: Sun Oct 4 18:04:27 2009 -0700
remove dependency on libxfcegui4 and use libxfce4ui instead
also copy XfceAppMenuItem from libgui and rename to
XfdesktopAppMenuItem. xfdesktop is the only one that uses it anyway
common/Makefile.am | 4 +-
common/xfdesktop-common.c | 3 +-
common/xfdesktop-common.h | 3 +
configure.ac.in | 17 +-
modules/menu/Makefile.am | 9 +-
modules/menu/desktop-menu.c | 17 +-
modules/menu/xfdesktop-app-menu-item.c | 903 ++++++++++++++++++++++++++++++++
modules/menu/xfdesktop-app-menu-item.h | 88 +++
panel-plugin/Makefile.am | 4 +-
panel-plugin/desktop-menu-plugin.c | 44 ++-
settings/Makefile.am | 4 +-
settings/main.c | 8 +-
src/Makefile.am | 8 +-
src/main.c | 111 ++--
src/windowlist.c | 2 +-
src/xfce-desktop.c | 2 +-
src/xfdesktop-file-icon-manager.c | 56 ++-
src/xfdesktop-file-icon.c | 2 +-
src/xfdesktop-file-properties-dialog.c | 10 +-
src/xfdesktop-file-utils.c | 29 +-
src/xfdesktop-icon-view.c | 2 +-
src/xfdesktop-regular-file-icon.c | 8 +-
src/xfdesktop-special-file-icon.c | 2 +-
src/xfdesktop-volume-icon.c | 2 +-
src/xfdesktop-window-icon-manager.c | 3 +-
src/xfdesktop-window-icon.c | 2 +-
src/xfdesktop-window-icon.h | 2 +-
27 files changed, 1204 insertions(+), 141 deletions(-)
diff --git a/common/Makefile.am b/common/Makefile.am
index 8d8d108..9e7dfbf 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -6,7 +6,7 @@ libxfdesktop_la_SOURCES = \
libxfdesktop_la_CFLAGS = \
-I$(top_srcdir)/src \
- $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
$(GTK_CFLAGS)
if BUILD_DESKTOP_MENU
@@ -34,5 +34,5 @@ libxfdesktop_menu_utils_la_CFLAGS = \
endif
if HAVE_CYGWIN
- libxfdesktop_menu_la_LDLAGS = -no-undefined
+ libxfdesktop_menu_la_LDFLAGS = -no-undefined
endif
diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index d938aea..1cba4ec 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -46,8 +46,9 @@
#include <glib.h>
#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+
#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/dialogs.h>
#include "xfdesktop-common.h"
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index c487d17..36f73bf 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -35,6 +35,9 @@
#define DEFAULT_BACKDROP_LIST "xfce4/desktop/backdrop.list"
#define DEFAULT_ICON_FONT_SIZE 12
#define DEFAULT_ICON_SIZE 32
+#define ITHEME_FLAGS (GTK_ICON_LOOKUP_USE_BUILTIN \
+ | GTK_ICON_LOOKUP_GENERIC_FALLBACK \
+ | GTK_ICON_LOOKUP_FORCE_SIZE)
#define LIST_TEXT "# xfce backdrop list"
#define XFDESKTOP_SELECTION_FMT "XFDESKTOP_SELECTION_%d"
diff --git a/configure.ac.in b/configure.ac.in
index ac78934..9a9c85f 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -13,9 +13,10 @@ m4_define([xfdesktop_version_tag],[git])
m4_define([xfdesktop_version], [xfdesktop_version_major().xfdesktop_version_minor().xfdesktop_version_micro()ifelse(xfdesktop_version_nano(), [], [], [.xfdesktop_version_nano()])ifelse(xfdesktop_version_tag(), [git], [xfdesktop_version_tag()-xfdesktop_version_build()], [xfdesktop_version_tag()])])
dnl minimum required versions
-m4_define([gtk_minimum_version], [2.10.0])
+m4_define([glib_minimum_version], [2.18.0])
+m4_define([gtk_minimum_version], [2.14.0])
m4_define([libxfce4util_minimum_version], [4.6.0])
-m4_define([libxfcegui4_minimum_version], [4.6.0])
+m4_define([libxfce4ui_minimum_version], [4.7.0])
m4_define([xfce_minimum_version], [4.6.0])
m4_define([xfce4menu_minimum_version], [4.6.0])
m4_define([exo_minimum_version], [0.3.100])
@@ -63,14 +64,16 @@ XDT_CHECK_LIBX11_REQUIRE
XDT_CHECK_LIBSM
dnl required
-XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [gtk_minimum_version])
-XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [gtk_minimum_version])
-XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [gtk_minimum_version])
+XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [glib_minimum_version])
+XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [glib_minimum_version])
+XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [glib_minimum_version])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [gtk_minimum_version])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0],
[libxfce4util_minimum_version])
-XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0],
- [libxfcegui4_minimum_version])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1],
+ [libxfce4ui_minimum_version])
+XDT_CHECK_PACKAGE([LIBXFCE4SMCLIENT_PRIVATE], [libxfce4smclient-private-1],
+ [libxfce4ui_minimum_version])
XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [wnck_minimum_version])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [xfconf_minimum_version])
XDT_CHECK_PACKAGE([LIBGLADE], [libglade-2.0], [2.0.0])
diff --git a/modules/menu/Makefile.am b/modules/menu/Makefile.am
index 11546c0..b8db5d5 100644
--- a/modules/menu/Makefile.am
+++ b/modules/menu/Makefile.am
@@ -6,7 +6,10 @@ plugindir = $(libdir)/xfce4/modules
plugin_LTLIBRARIES = xfce4_desktop_menu.la
-xfce4_desktop_menu_la_SOURCES = desktop-menu.c
+xfce4_desktop_menu_la_SOURCES = \
+ desktop-menu.c \
+ xfdesktop-app-menu-item.c \
+ xfdesktop-app-menu-item.h
xfce4_desktop_menu_la_CFLAGS = \
-I$(top_srcdir)/common \
@@ -14,7 +17,7 @@ xfce4_desktop_menu_la_CFLAGS = \
$(GTHREAD_CFLAGS) \
$(LIBXFCE4MENU_CFLAGS) \
$(LIBX11_CFLAGS) \
- $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
$(THUNAR_VFS_CFLAGS) \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DDATADIR=\"$(datadir)\" \
@@ -40,5 +43,5 @@ xfce4_desktop_menu_la_LIBADD = \
$(LIBXFCE4MENU_LIBS) \
$(LIBX11_LDFLAGS) \
$(LIBX11_LIBS) \
- $(LIBXFCEGUI4_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
$(THUNAR_VFS_LIBS)
diff --git a/modules/menu/desktop-menu.c b/modules/menu/desktop-menu.c
index 2cfb52f..6e75648 100644
--- a/modules/menu/desktop-menu.c
+++ b/modules/menu/desktop-menu.c
@@ -60,7 +60,7 @@
#include <glib.h>
#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4menu/libxfce4menu.h>
#ifdef HAVE_THUNAR_VFS
@@ -68,6 +68,7 @@
#endif
#include "desktop-menu-utils.h"
+#include "xfdesktop-app-menu-item.h"
typedef struct
{
@@ -333,13 +334,13 @@ desktop_menu_add_items(XfceDesktopMenu *desktop_menu,
continue;
}
- mi = xfce_app_menu_item_new_full(xfce_menu_element_get_name(XFCE_MENU_ELEMENT(xfce_item)),
- xfce_menu_item_get_command(xfce_item),
- desktop_menu->use_menu_icons
- ? xfce_menu_item_get_icon_name(xfce_item)
- : NULL,
- xfce_menu_item_requires_terminal(xfce_item),
- xfce_menu_item_supports_startup_notification(xfce_item));
+ mi = xfdesktop_app_menu_item_new_full(xfce_menu_element_get_name(XFCE_MENU_ELEMENT(xfce_item)),
+ xfce_menu_item_get_command(xfce_item),
+ desktop_menu->use_menu_icons
+ ? xfce_menu_item_get_icon_name(xfce_item)
+ : NULL,
+ xfce_menu_item_requires_terminal(xfce_item),
+ xfce_menu_item_supports_startup_notification(xfce_item));
gtk_widget_show(mi);
if(menu)
diff --git a/modules/menu/xfdesktop-app-menu-item.c b/modules/menu/xfdesktop-app-menu-item.c
new file mode 100644
index 0000000..b400007
--- /dev/null
+++ b/modules/menu/xfdesktop-app-menu-item.c
@@ -0,0 +1,903 @@
+/*
+ * A GtkImageMenuItem subclass that handles menu items that are
+ * intended to represent launchable applications.
+ *
+ * Copyright (c) 2004-2007,2009 Brian Tarricone <bjt23 at cornell.edu>
+ *
+ * This library 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.
+ *
+ * This library 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 this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4ui/libxfce4ui.h>
+
+#include "xfdesktop-app-menu-item.h"
+
+struct _XfdesktopAppMenuItem
+{
+ GtkImageMenuItem parent;
+
+ gchar *name;
+ gchar *command;
+ gboolean needs_term;
+ gboolean snotify;
+ gchar *icon_name;
+ gchar *icon_path;
+ gboolean icon_set;
+
+ gchar *command_expanded;
+ gchar *dot_desktop_filename;
+
+ GtkWidget *accel_label;
+};
+
+typedef struct _XfdesktopAppMenuItemClass
+{
+ GtkImageMenuItemClass parent;
+} XfdesktopAppMenuItemClass;
+
+enum
+{
+ PROP_ZERO = 0,
+ PROP_TERM,
+ PROP_CMD,
+ PROP_ICON,
+ PROP_LABEL,
+ PROP_SNOTIFY,
+ PROP_USE_UNDERLINE,
+};
+
+static void xfdesktop_app_menu_item_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void xfdesktop_app_menu_item_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void xfdesktop_app_menu_item_finalize(GObject *object);
+
+static void xfdesktop_app_menu_item_realize(GtkWidget *widget);
+
+static void xfdesktop_app_menu_item_update_icon(XfdesktopAppMenuItem *app_menu_item);
+
+static void _command_activate_cb(GtkMenuItem *menu_item,
+ gpointer user_data);
+
+
+G_DEFINE_TYPE(XfdesktopAppMenuItem, xfdesktop_app_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
+
+
+static void
+_style_set_cb(GtkWidget *w, GtkStyle *prev_style, gpointer user_data)
+{
+ GtkStyle *style;
+ GList *children, *l;
+
+ style = gtk_rc_get_style_by_paths(gtk_settings_get_default(),
+ "GtkMenuItem", "GtkMenuItem",
+ GTK_TYPE_IMAGE_MENU_ITEM);
+ children = gtk_container_get_children(GTK_CONTAINER(w));
+ for(l = children; l; l = l->next) {
+ if(GTK_IS_WIDGET(l->data))
+ gtk_widget_set_style(GTK_WIDGET(l->data), style);
+ }
+ g_list_free(children);
+}
+
+static void
+_expand_percent_vars(XfdesktopAppMenuItem *app_menu_item)
+{
+ GString *newstr;
+ gchar *p;
+
+ g_return_if_fail(app_menu_item->command);
+
+ newstr = g_string_sized_new(strlen(app_menu_item->command) + 1);
+
+ for(p = app_menu_item->command; *p; ++p) {
+ if('%' == *p) {
+ ++p;
+ switch(*p) {
+ /* we don't care about these since we aren't passing filenames */
+ case 'f':
+ case 'F':
+ case 'u':
+ case 'U':
+ /* these are all deprecated */
+ case 'd':
+ case 'D':
+ case 'n':
+ case 'N':
+ case 'v':
+ case 'm':
+ break;
+
+ case 'i':
+ if(G_LIKELY(app_menu_item->icon_name)) {
+ gchar *str = g_shell_quote(app_menu_item->icon_name);
+ g_string_append(newstr, "--icon ");
+ g_string_append(newstr, str);
+ g_free(str);
+ }
+ break;
+
+ case 'c':
+ if(G_LIKELY(app_menu_item->name)) {
+ gchar *name_locale, *str;
+ gsize bread = 0;
+ GError *error = NULL;
+
+ name_locale = g_locale_from_utf8(app_menu_item->name,
+ -1, &bread, NULL,
+ &error);
+ if(name_locale) {
+ str = g_shell_quote(name_locale);
+ g_string_append(newstr, str);
+ g_free(str);
+ g_free(name_locale);
+ } else {
+ g_warning("Invalid UTF-8 in Name at byte %u: %s",
+ (guint)bread, error->message);
+ }
+ }
+ break;
+
+ case 'k':
+ if(app_menu_item->dot_desktop_filename) {
+ gchar *str = g_shell_quote(app_menu_item->dot_desktop_filename);
+ g_string_append(newstr, str);
+ g_free(str);
+ }
+ break;
+
+ case '%':
+ g_string_append_c(newstr, '%');
+ break;
+
+ default:
+ g_warning("Invalid field code in Exec line: %%%c", *p);
+ break;
+ }
+ } else
+ g_string_append_c(newstr, *p);
+ }
+
+ app_menu_item->command_expanded = newstr->str;
+ g_string_free(newstr, FALSE);
+}
+
+static void
+_command_activate_cb(GtkMenuItem *menu_item,
+ gpointer user_data)
+{
+ XfdesktopAppMenuItem *app_menu_item = XFDESKTOP_APP_MENU_ITEM(menu_item);
+
+ g_return_if_fail(app_menu_item && app_menu_item->command);
+
+ /* we do this here instead of in _new*() for 2 reasons:
+ * 1. menu items that never get activated won't slow us down for no
+ * reason.
+ * 2. we can't guarantee that the icon name or whatever (which can
+ * influence the result of _expand_percent_vars()) has been set
+ * when the command is first set.
+ */
+ if(!app_menu_item->command_expanded)
+ _expand_percent_vars(app_menu_item);
+
+ if(!xfce_spawn_command_line_on_screen(gtk_widget_get_screen(GTK_WIDGET(menu_item)),
+ app_menu_item->command_expanded,
+ app_menu_item->needs_term,
+ app_menu_item->snotify, NULL))
+ {
+ g_warning("XfdesktopAppMenuItem: unable to spawn %s\n",
+ app_menu_item->command_expanded);
+ }
+}
+
+static void
+xfdesktop_app_menu_item_class_init(XfdesktopAppMenuItemClass *klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *)klass;
+ GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
+
+ widget_class->realize = xfdesktop_app_menu_item_realize;
+
+ gobject_class->finalize = xfdesktop_app_menu_item_finalize;
+ gobject_class->set_property = xfdesktop_app_menu_item_set_property;
+ gobject_class->get_property = xfdesktop_app_menu_item_get_property;
+
+ g_object_class_install_property(gobject_class, PROP_TERM,
+ g_param_spec_boolean("needs-term",
+ _("Needs terminal"),
+ _("Whether or not the command needs a terminal to execute"),
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_CMD,
+ g_param_spec_string("command",
+ _("Command"),
+ _("The command to run when the item is clicked"),
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_ICON,
+ g_param_spec_string("icon-name",
+ _("Icon name"),
+ _("The name of the themed icon to display next to the item"),
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_LABEL,
+ g_param_spec_string("label",
+ _("Label"),
+ _("The label displayed in the item"),
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_SNOTIFY,
+ g_param_spec_boolean("snotify",
+ _("Startup notification"),
+ _("Whether or not the app supports startup notification"),
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_USE_UNDERLINE,
+ g_param_spec_boolean("use-underline",
+ _("Use underline"),
+ _("Whether or not to use an underscore in the label as a keyboard mnemonic"),
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+xfdesktop_app_menu_item_init(XfdesktopAppMenuItem *app_menu_item)
+{
+ GtkWidget *accel_label;
+
+ gtk_widget_add_events(GTK_WIDGET(app_menu_item),
+ GDK_STRUCTURE_MASK | GDK_SUBSTRUCTURE_MASK
+ | GDK_VISIBILITY_NOTIFY_MASK);
+
+ g_signal_connect(G_OBJECT(app_menu_item), "activate",
+ G_CALLBACK(_command_activate_cb), NULL);
+ g_signal_connect(G_OBJECT(app_menu_item), "style-set",
+ G_CALLBACK(_style_set_cb), NULL);
+
+ app_menu_item->accel_label = accel_label = gtk_accel_label_new("");
+ gtk_misc_set_alignment(GTK_MISC(accel_label), 0.0, 0.5);
+
+ gtk_container_add(GTK_CONTAINER(app_menu_item), accel_label);
+ gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(accel_label),
+ GTK_WIDGET(app_menu_item));
+ gtk_widget_show(accel_label);
+}
+
+static void
+xfdesktop_app_menu_item_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ XfdesktopAppMenuItem *app_menu_item = XFDESKTOP_APP_MENU_ITEM(object);
+
+ switch(prop_id) {
+ case PROP_TERM:
+ xfdesktop_app_menu_item_set_needs_term(app_menu_item,
+ g_value_get_boolean(value));
+ break;
+ case PROP_CMD:
+ xfdesktop_app_menu_item_set_command(app_menu_item,
+ g_value_get_string(value));
+ break;
+ case PROP_ICON:
+ xfdesktop_app_menu_item_set_icon_name(app_menu_item,
+ g_value_get_string(value));
+ break;
+ case PROP_LABEL:
+ xfdesktop_app_menu_item_set_name(app_menu_item,
+ g_value_get_string(value));
+ break;
+ case PROP_SNOTIFY:
+ xfdesktop_app_menu_item_set_startup_notification(app_menu_item,
+ g_value_get_boolean(value));
+ break;
+ case PROP_USE_UNDERLINE:
+ gtk_label_set_use_underline(GTK_LABEL(app_menu_item->accel_label),
+ g_value_get_boolean(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+xfdesktop_app_menu_item_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ XfdesktopAppMenuItem *app_menu_item = XFDESKTOP_APP_MENU_ITEM(object);
+
+ switch(prop_id) {
+ case PROP_TERM:
+ g_value_set_boolean(value, app_menu_item->needs_term);
+ break;
+ case PROP_CMD:
+ g_value_set_string(value, app_menu_item->command);
+ break;
+ case PROP_ICON:
+ g_value_set_string(value, app_menu_item->icon_name);
+ break;
+ case PROP_LABEL:
+ g_value_set_string(value, app_menu_item->name);
+ break;
+ case PROP_SNOTIFY:
+ g_value_set_boolean(value, app_menu_item->snotify);
+ break;
+ case PROP_USE_UNDERLINE:
+ g_value_set_boolean(value,
+ gtk_label_get_use_underline(GTK_LABEL(app_menu_item->accel_label)));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+xfdesktop_app_menu_item_finalize(GObject *object)
+{
+ XfdesktopAppMenuItem *app_menu_item = XFDESKTOP_APP_MENU_ITEM(object);
+
+ g_return_if_fail(app_menu_item != NULL);
+
+ g_free(app_menu_item->name);
+ g_free(app_menu_item->command);
+ g_free(app_menu_item->icon_name);
+ g_free(app_menu_item->icon_path);
+ g_free(app_menu_item->command_expanded);
+ g_free(app_menu_item->dot_desktop_filename);
+
+ G_OBJECT_CLASS(xfdesktop_app_menu_item_parent_class)->finalize(object);
+}
+
+static void
+xfdesktop_app_menu_item_realize(GtkWidget *widget)
+{
+ XfdesktopAppMenuItem *app_menu_item = XFDESKTOP_APP_MENU_ITEM(widget);
+
+ GTK_WIDGET_CLASS(xfdesktop_app_menu_item_parent_class)->realize(widget);
+
+ xfdesktop_app_menu_item_update_icon(app_menu_item);
+}
+
+static void
+xfdesktop_app_menu_item_update_icon(XfdesktopAppMenuItem *app_menu_item)
+{
+ GtkWidget *img;
+
+ if(!GTK_WIDGET_REALIZED(app_menu_item))
+ return;
+
+ img = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(app_menu_item));
+ if(!img) {
+ img = gtk_image_new();
+ gtk_widget_show(img);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(app_menu_item), img);
+ } else
+ gtk_image_clear(GTK_IMAGE(img));
+
+ if(app_menu_item->icon_name) {
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
+
+ if(gtk_icon_theme_has_icon(itheme, app_menu_item->icon_name)) {
+ gtk_image_set_from_icon_name(GTK_IMAGE(img), app_menu_item->icon_name,
+ GTK_ICON_SIZE_MENU);
+ }
+ } else if(app_menu_item->icon_path) {
+ GdkPixbuf *pix;
+ gint w, h;
+
+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &w, &h);
+
+ pix = gdk_pixbuf_new_from_file_at_scale(app_menu_item->icon_path,
+ w, h, TRUE, NULL);
+ if(pix) {
+ gtk_image_set_from_pixbuf(GTK_IMAGE(img), pix);
+ g_object_unref(G_OBJECT(pix));
+ }
+ }
+}
+
+/**
+ * xfdesktop_app_menu_item_new:
+ * @returns: A new #XfdesktopAppMenuItem.
+ *
+ * Creates a new #XfdesktopAppMenuItem with an empty label.
+ *
+ * Since 4.1
+ **/
+GtkWidget *
+xfdesktop_app_menu_item_new(void)
+{
+ return g_object_new(XFDESKTOP_TYPE_APP_MENU_ITEM, NULL);
+}
+
+/**
+ * xfdesktop_app_menu_item_new_with_label:
+ * @label: The text of the menu item.
+ * @returns: A new #XfdesktopAppMenuItem.
+ *
+ * Creates a new #XfdesktopAppMenuItem containing a label.
+ *
+ * Since 4.1
+ **/
+GtkWidget *
+xfdesktop_app_menu_item_new_with_label(const gchar *label)
+{
+ return g_object_new(XFDESKTOP_TYPE_APP_MENU_ITEM,
+ "label", label,
+ NULL);
+}
+
+/**
+ * xfdesktop_app_menu_item_new_with_mnemonic:
+ * @label: The text of the menu item, with an underscore in front of the
+ * mnemonic character.
+ * @returns: A new #XfdesktopAppMenuItem.
+ *
+ * Creates a new #XfdesktopAppMenuItem containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the menu item.
+ *
+ * Since 4.1
+ **/
+GtkWidget *
+xfdesktop_app_menu_item_new_with_mnemonic(const gchar *label)
+{
+ return g_object_new(XFDESKTOP_TYPE_APP_MENU_ITEM,
+ "label", label,
+ "use-underline", TRUE,
+ NULL);
+}
+
+/**
+ * xfdesktop_app_menu_item_new_with_command:
+ * @label: The text of the menu item.
+ * @command: The command associated with the menu item.
+ * @returns: A new #XfdesktopAppMenuItem.
+ *
+ * Creates a new #XfdesktopAppMenuItem containing a label. The item's @activate
+ * signal will be connected such that @command will run when it is clicked.
+ *
+ * Since 4.1
+ **/
+GtkWidget *
+xfdesktop_app_menu_item_new_with_command(const gchar *label,
+ const gchar *command)
+{
+ return g_object_new(XFDESKTOP_TYPE_APP_MENU_ITEM,
+ "label", label,
+ "command", command,
+ NULL);
+}
+
+/**
+ * xfdesktop_app_menu_item_new_full:
+ * @label: The text of the menu item.
+ * @command: The command associated with the menu item.
+ * @icon_filename: The filename of the icon.
+ * @needs_term: TRUE if the application needs a terminal, FALSE if not.
+ * @snotify: TRUE if the application supports startup notification, FALSE if
+ * not.
+ * @returns: A new #XfdesktopAppMenuItem.
+ *
+ * Single-function interface to create an #XfdesktopAppMenuItem. Has the effect of
+ * calling xfdesktop_app_menu_item_new_with_label() followed by all the
+ * xfdesktop_app_menu_item_set_*() functions.
+ *
+ * Since 4.1
+ **/
+GtkWidget *
+xfdesktop_app_menu_item_new_full(const gchar *label,
+ const gchar *command,
+ const gchar *icon_filename,
+ gboolean needs_term,
+ gboolean snotify)
+{
+ return g_object_new(XFDESKTOP_TYPE_APP_MENU_ITEM,
+ "label", label,
+ "command", command,
+ "icon-name", icon_filename,
+ "needs-term", needs_term,
+ "snotify", snotify,
+ NULL);
+}
+
+/**
+ * xfdesktop_app_menu_item_new_from_desktop_entry:
+ * @entry: An #XfceDesktopEntry describing the menu item to create.
+ * @show_icon: Sets whether or not to show an icon in the menu item.
+ * @returns: A new #XfdesktopAppMenuItem, or %NULL on error.
+ *
+ * Creates a new #XfdesktopAppMenuItem using parameters from the application
+ * specified in a #XfceDesktopEntry object. This has the effect of calling
+ * xfdesktop_app_menu_item_new_with_command(), xfdesktop_app_menu_item_set_needs_term(),
+ * xfdesktop_app_menu_item_set_icon_name(), and
+ * xfdesktop_app_menu_item_set_startup_notification().
+ *
+ * Since 4.1
+ **/
+GtkWidget *
+xfdesktop_app_menu_item_new_from_desktop_entry(XfceDesktopEntry *entry,
+ gboolean show_icon)
+{
+ XfdesktopAppMenuItem *app_menu_item;
+ gchar *name = NULL, *cmd = NULL, *icon = NULL, *snotify = NULL;
+ gchar *onlyshowin = NULL, *categories = NULL, *term = NULL;
+ const gchar *dfile;
+
+ g_return_val_if_fail(XFCE_IS_DESKTOP_ENTRY(entry), NULL);
+
+ if(xfce_desktop_entry_get_string(entry, "OnlyShowIn", FALSE, &onlyshowin)
+ || xfce_desktop_entry_get_string(entry, "Categories", FALSE,
+ &categories))
+ {
+ if((onlyshowin && strstr(onlyshowin, "XFCE;"))
+ || (categories && strstr(categories, "X-XFCE;")))
+ {
+ if(xfce_desktop_entry_has_translated_entry(entry, "GenericName")) {
+ xfce_desktop_entry_get_string(entry, "GenericName", TRUE,
+ &name);
+ } else if(xfce_desktop_entry_has_translated_entry(entry, "Name")) {
+ xfce_desktop_entry_get_string(entry, "Name", TRUE, &name);
+ } else {
+ xfce_desktop_entry_get_string(entry, "GenericName", FALSE,
+ &name);
+ }
+ } else if(onlyshowin) {
+ g_free(onlyshowin);
+ g_free(categories);
+ return NULL;
+ }
+
+ g_free(onlyshowin);
+ g_free(categories);
+ }
+
+ app_menu_item = XFDESKTOP_APP_MENU_ITEM(xfdesktop_app_menu_item_new());
+
+ if(!name && !xfce_desktop_entry_get_string(entry, "Name", TRUE, &name)) {
+ gchar *tmp, *tmp1;
+
+ tmp = g_filename_to_utf8(xfce_desktop_entry_get_file(entry), -1,
+ NULL, NULL, NULL);
+ if(!tmp)
+ tmp = g_strdup(xfce_desktop_entry_get_file(entry));
+
+ if((tmp1 = g_strrstr(tmp, ".desktop")))
+ *tmp1 = 0;
+ if((tmp1 = g_strrstr(tmp, "/")))
+ tmp1++;
+ else
+ tmp1 = name;
+ name = g_strdup(tmp1);
+ g_free(tmp);
+ }
+
+ app_menu_item->name = name;
+
+ if(!g_utf8_validate(name, -1, NULL)) {
+ g_warning("XfdesktopAppMenuItem: 'name' failed utf8 validation for .desktop file '%s'",
+ xfce_desktop_entry_get_file(entry));
+ gtk_widget_destroy(GTK_WIDGET(app_menu_item));
+ return NULL;
+ }
+
+ gtk_label_set_text(GTK_LABEL(app_menu_item->accel_label),
+ app_menu_item->name);
+
+ if(xfce_desktop_entry_get_string(entry, "Terminal", TRUE, &term)) {
+ app_menu_item->needs_term = (*term == '1'
+ || !g_ascii_strcasecmp(term, "true"));
+ g_free(term);
+ }
+
+ if(xfce_desktop_entry_get_string(entry, "StartupNotify", TRUE, &snotify)) {
+ app_menu_item->snotify = (*snotify == '1'
+ || !g_ascii_strcasecmp(snotify, "true"));
+ g_free(snotify);
+ }
+
+ if(!xfce_desktop_entry_get_string(entry, "Exec", TRUE, &cmd)) {
+ gtk_widget_destroy(GTK_WIDGET(app_menu_item));
+ return NULL;
+ }
+
+ /* remove quotes around the command (yes, people do that!) */
+ if(cmd[0] == '"') {
+ gint i;
+
+ for(i = 1; cmd[i - 1] != '\0'; ++i) {
+ if (cmd[i] != '"')
+ cmd[i-1] = cmd[i];
+ else {
+ cmd[i-1] = cmd[i] = ' ';
+ break;
+ }
+ }
+ }
+
+ app_menu_item->command = xfce_expand_variables(cmd, NULL);
+ g_free(cmd);
+
+ if(show_icon) {
+ xfce_desktop_entry_get_string(entry, "Icon", TRUE, &icon);
+ if(icon) {
+ xfdesktop_app_menu_item_set_icon_name(app_menu_item, icon);
+ g_free(icon);
+ }
+ }
+
+ dfile = xfce_desktop_entry_get_file(entry);
+ if(dfile)
+ app_menu_item->dot_desktop_filename = g_strdup(dfile);
+
+ return GTK_WIDGET(app_menu_item);
+}
+
+/**
+ * xfdesktop_app_menu_item_set_name:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @name: The name of the menu item the menu item.
+ *
+ * Sets @name as the displayed name of the #XfdesktopAppMenuItem.
+ *
+ * Since 4.1
+ **/
+void
+xfdesktop_app_menu_item_set_name(XfdesktopAppMenuItem *app_menu_item,
+ const gchar *name)
+{
+ g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
+
+ if(app_menu_item->name)
+ g_free(app_menu_item->name);
+
+ app_menu_item->name = g_strdup(name);
+ gtk_label_set_text(GTK_LABEL(app_menu_item->accel_label), name);
+}
+
+/**
+ * xfdesktop_app_menu_item_set_icon_name:
+ * @app_menu_item: an #XfdesktopAppMenuItem.
+ * @filename: The filename of the icon.
+ *
+ * Sets the icon of the #XfdesktopAppMenuItem using the specified filename. If
+ * the filename doesn't have a full pathname, standard icon search paths
+ * will be used. If the filename doesn't have an extension, the best image
+ * format found (if any) will be used. If there is already an icon set, the
+ * current one is freed, regardless if the icon is found or not.
+ *
+ * Since 4.1
+ **/
+void
+xfdesktop_app_menu_item_set_icon_name(XfdesktopAppMenuItem *app_menu_item,
+ const gchar *filename)
+{
+ g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
+
+ g_free(app_menu_item->icon_name);
+ app_menu_item->icon_name = NULL;
+ g_free(app_menu_item->icon_path);
+ app_menu_item->icon_path = NULL;
+
+ if(filename) {
+ if(g_path_is_absolute(filename))
+ app_menu_item->icon_path = g_strdup(filename);
+ else {
+ gchar *p, *q;
+ gsize len;
+
+ /* yes, there are really broken .desktop files out there
+ * messed up like this */
+
+ /* first make sure we aren't a weird relative path */
+ p = g_strrstr(filename, G_DIR_SEPARATOR_S);
+ if(p)
+ p++;
+ else
+ p = (gchar *)filename;
+
+ len = strlen(p);
+
+ /* now make sure we don't have an extension */
+ q = g_strrstr(p, ".");
+ if(q && (!strcmp(q, ".png") || !strcmp(q, ".svg")
+ || !strcmp(q, ".jpg") || !strcmp(q, ".gif")
+ || !strcmp(q, ".bmp")))
+ {
+ len -= strlen(q);
+ }
+
+ /* whatever's left... */
+ if(p[0] && len)
+ app_menu_item->icon_name = g_strndup(p, len);
+ }
+ }
+
+ xfdesktop_app_menu_item_update_icon(app_menu_item);
+}
+
+/**
+ * xfdesktop_app_menu_item_set_command:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @command: The command to associate with the menu item.
+ *
+ * Sets @command as the command run when the #XfdesktopAppMenuItem is clicked.
+ *
+ * Since 4.1
+ **/
+void
+xfdesktop_app_menu_item_set_command(XfdesktopAppMenuItem *app_menu_item,
+ const gchar *command)
+{
+ g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
+
+ if(app_menu_item->command)
+ g_free(app_menu_item->command);
+
+ app_menu_item->command = xfce_expand_variables(command, NULL);
+}
+
+/**
+ * xfdesktop_app_menu_item_set_needs_term:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @needs_term: TRUE if the application needs a terminal, FALSE if not.
+ *
+ * Sets whether or not the command executed by this #XfdesktopAppMenuItem requires
+ * a terminal window to run.
+ *
+ * Since 4.1
+ **/
+void
+xfdesktop_app_menu_item_set_needs_term(XfdesktopAppMenuItem *app_menu_item,
+ gboolean needs_term)
+{
+ g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
+
+ app_menu_item->needs_term = needs_term;
+}
+
+/**
+ * xfdesktop_app_menu_item_set_startup_notification:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @snotify: TRUE if the application supports startup notification, FALSE if
+ * not.
+ *
+ * Sets whether or not the application supports startup notification.
+ *
+ * Since 4.1
+ **/
+void
+xfdesktop_app_menu_item_set_startup_notification(XfdesktopAppMenuItem *app_menu_item,
+ gboolean snotify)
+{
+ g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
+
+ app_menu_item->snotify = snotify;
+}
+
+/**
+ * xfdesktop_app_menu_item_get_name:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @returns: A name/label string.
+ *
+ * Returns the current name/label set for the #XfdesktopAppMenuItem, or NULL.
+ *
+ * Since 4.1
+ **/
+G_CONST_RETURN gchar *
+xfdesktop_app_menu_item_get_name(XfdesktopAppMenuItem *app_menu_item)
+{
+ g_return_val_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item), NULL);
+
+ return app_menu_item->name;
+}
+
+/**
+ * xfdesktop_app_menu_item_get_icon_name:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @returns: An icon name string.
+ *
+ * Returns the current icon name set for the #XfdesktopAppMenuItem, or NULL.
+ *
+ * Since 4.1
+ **/
+G_CONST_RETURN gchar *
+xfdesktop_app_menu_item_get_icon_name(XfdesktopAppMenuItem *app_menu_item)
+{
+ g_return_val_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item), NULL);
+
+ if(app_menu_item->icon_name)
+ return app_menu_item->icon_name;
+ else
+ return app_menu_item->icon_path;
+}
+
+/**
+ * xfdesktop_app_menu_item_get_command:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @returns: A command string.
+ *
+ * Returns the current command set for the #XfdesktopAppMenuItem, or NULL.
+ *
+ * Since 4.1
+ **/
+G_CONST_RETURN gchar *
+xfdesktop_app_menu_item_get_command(XfdesktopAppMenuItem *app_menu_item)
+{
+ g_return_val_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item), NULL);
+
+ return app_menu_item->command;
+}
+
+/**
+ * xfdesktop_app_menu_item_get_needs_term:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @returns: TRUE if the item will spawn a terminal, FALSE if not.
+ *
+ * Checks whether or not the command executed by this #XfdesktopAppMenuItem requires
+ * a terminal window to run.
+ *
+ * Since 4.1
+ **/
+gboolean
+xfdesktop_app_menu_item_get_needs_term(XfdesktopAppMenuItem *app_menu_item)
+{
+ g_return_val_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item), FALSE);
+
+ return app_menu_item->needs_term;
+}
+
+/**
+ * xfdesktop_app_menu_item_get_startup_notification:
+ * @app_menu_item: An #XfdesktopAppMenuItem.
+ * @returns: TRUE if the item supports startup notification, FALSE if not.
+ *
+ * Checks whether or not the command executed by this #XfdesktopAppMenuItem supports
+ * startup notification.
+ *
+ * Since 4.1
+ **/
+gboolean
+xfdesktop_app_menu_item_get_startup_notification(XfdesktopAppMenuItem *app_menu_item)
+{
+ g_return_val_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item), FALSE);
+
+ return app_menu_item->snotify;
+}
diff --git a/modules/menu/xfdesktop-app-menu-item.h b/modules/menu/xfdesktop-app-menu-item.h
new file mode 100644
index 0000000..e7ae1f9
--- /dev/null
+++ b/modules/menu/xfdesktop-app-menu-item.h
@@ -0,0 +1,88 @@
+/*
+ * A GtkImageMenuItem subclass that handles menu items that are
+ * intended to represent launchable applications.
+ *
+ * Copyright (c) 2004,2009 Brian Tarricone <bjt23 at cornell.edu>
+ *
+ * This library 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.
+ *
+ * This library 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 this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFDESKTOP_APP_MENU_ITEM_H__
+#define __XFDESKTOP_APP_MENU_ITEM_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define XFDESKTOP_TYPE_APP_MENU_ITEM (xfdesktop_app_menu_item_get_type())
+#define XFDESKTOP_APP_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDESKTOP_TYPE_APP_MENU_ITEM, XfdesktopAppMenuItem))
+#define XFDESKTOP_APP_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFDESKTOP_TYPE_APP_MENU_ITEM, XfdesktopAppMenuItemClass))
+#define XFCE_IS_APP_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDESKTOP_TYPE_APP_MENU_ITEM))
+#define XFCE_IS_APP_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFDESKTOP_TYPE_APP_MENU_ITEM))
+#define XFDESKTOP_APP_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFDESKTOP_TYPE_APP_MENU_ITEM, XfdesktopAppMenuItemClass))
+
+typedef struct _XfdesktopAppMenuItem XfdesktopAppMenuItem;
+
+GType xfdesktop_app_menu_item_get_type () G_GNUC_CONST;
+
+GtkWidget *xfdesktop_app_menu_item_new ();
+
+GtkWidget *xfdesktop_app_menu_item_new_with_label (const gchar *label);
+
+GtkWidget *xfdesktop_app_menu_item_new_with_mnemonic (const gchar *label);
+
+GtkWidget *xfdesktop_app_menu_item_new_with_command (const gchar *label,
+ const gchar *command);
+
+GtkWidget *xfdesktop_app_menu_item_new_full (const gchar *label,
+ const gchar *command,
+ const gchar *icon_filename,
+ gboolean needs_term,
+ gboolean snotify);
+
+GtkWidget *xfdesktop_app_menu_item_new_from_desktop_entry (XfceDesktopEntry *entry,
+ gboolean show_icon);
+
+void xfdesktop_app_menu_item_set_name (XfdesktopAppMenuItem *app_menu_item,
+ const gchar *name);
+
+void xfdesktop_app_menu_item_set_icon_name (XfdesktopAppMenuItem *app_menu_item,
+ const gchar *filename);
+
+void xfdesktop_app_menu_item_set_command (XfdesktopAppMenuItem *app_menu_item,
+ const gchar *command);
+
+void xfdesktop_app_menu_item_set_needs_term (XfdesktopAppMenuItem *app_menu_item,
+ gboolean needs_term);
+
+void xfdesktop_app_menu_item_set_startup_notification (XfdesktopAppMenuItem *app_menu_item,
+ gboolean snotify);
+
+G_CONST_RETURN gchar *xfdesktop_app_menu_item_get_name (XfdesktopAppMenuItem *app_menu_item);
+
+G_CONST_RETURN gchar *xfdesktop_app_menu_item_get_icon_name(XfdesktopAppMenuItem *app_menu_item);
+
+G_CONST_RETURN gchar *xfdesktop_app_menu_item_get_command (XfdesktopAppMenuItem *app_menu_item);
+
+gboolean xfdesktop_app_menu_item_get_needs_term (XfdesktopAppMenuItem *app_menu_item);
+
+gboolean xfdesktop_app_menu_item_get_startup_notification (XfdesktopAppMenuItem *app_menu_item);
+
+void xfdesktop_app_menu_item_set_icon_theme_name (const gchar *theme_name);
+
+G_END_DECLS
+
+#endif /* !def __XFDESKTOP_APP_MENU_ITEM_H__ */
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 0e0076b..3cf3f6d 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -7,7 +7,7 @@ xfce4_menu_plugin_SOURCES = \
xfce4_menu_plugin_CFLAGS = \
-I$(top_srcdir)/common \
$(LIBX11_CFLAGS) \
- $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
$(LIBXFCE4PANEL_CFLAGS) \
$(THUNAR_VFS_CFLAGS) \
$(LIBEXO_CFLAGS) \
@@ -23,7 +23,7 @@ xfce4_menu_plugin_LDADD = \
$(top_builddir)/common/libxfdesktop-menu.la \
$(top_builddir)/common/libxfdesktop.la \
$(LIBX11_LIBS) \
- $(LIBXFCEGUI4_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
$(LIBXFCE4PANEL_LIBS) \
$(THUNAR_VFS_LIBS) \
$(LIBEXO_LIBS)
diff --git a/panel-plugin/desktop-menu-plugin.c b/panel-plugin/desktop-menu-plugin.c
index 6f3c365..83cbc92 100644
--- a/panel-plugin/desktop-menu-plugin.c
+++ b/panel-plugin/desktop-menu-plugin.c
@@ -49,7 +49,7 @@
#define PATH_MAX 4096
#endif
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-panel-convenience.h>
@@ -115,18 +115,42 @@ static GdkPixbuf *
dmp_get_icon(const gchar *icon_name, gint size, GtkOrientation orientation)
{
GdkPixbuf *pix = NULL;
- gchar *filename;
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
+ GtkIconInfo *iinfo;
+ const gchar *filename;
gint w, h;
- filename = xfce_themed_icon_lookup(icon_name, size);
- if(!filename)
+ iinfo = gtk_icon_theme_lookup_icon(itheme, icon_name, size, 0);
+ if(!iinfo)
return NULL;
-
+
w = orientation == GTK_ORIENTATION_HORIZONTAL ? -1 : size;
h = orientation == GTK_ORIENTATION_VERTICAL ? -1 : size;
- pix = gdk_pixbuf_new_from_file_at_scale(filename, w, h, TRUE, NULL);
+
+ filename = gtk_icon_info_get_filename(iinfo);
+ if(filename)
+ pix = gdk_pixbuf_new_from_file_at_scale(filename, w, h, TRUE, NULL);
+ else {
+ GdkPixbuf *tmp = gtk_icon_info_get_builtin_pixbuf(iinfo);
+
+ if(tmp) {
+ gint pw = gdk_pixbuf_get_width(tmp);
+ gint ph = gdk_pixbuf_get_height(tmp);
+
+ if((w != -1 && pw != w) || (h != -1 && ph != h)) {
+ if(w == -1)
+ w = ((gdouble)h / ph) * pw;
+ else
+ h = ((gdouble)w / pw) * ph;
+
+ pix = gdk_pixbuf_scale_simple(tmp, w, h, GDK_INTERP_BILINEAR);
+ g_object_unref(G_OBJECT(tmp));
+ } else
+ pix = tmp;
+ }
+ }
- g_free(filename);
+ gtk_icon_info_free(iinfo);
return pix;
}
@@ -735,7 +759,7 @@ dmp_create_options(XfcePanelPlugin *plugin, DMPlugin *dmp)
gtk_widget_show(topvbox);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), topvbox, TRUE, TRUE, 0);
- frame = xfce_create_framebox(_("Button"), &frame_bin);
+ frame = xfce_gtk_frame_box_new(_("Button"), &frame_bin);
gtk_widget_show(frame);
gtk_box_pack_start(GTK_BOX(topvbox), frame, FALSE, FALSE, 0);
@@ -768,7 +792,7 @@ dmp_create_options(XfcePanelPlugin *plugin, DMPlugin *dmp)
g_signal_connect(G_OBJECT(chk), "toggled",
G_CALLBACK(show_title_toggled_cb), dmp);
- frame = xfce_create_framebox(_("Menu File"), &frame_bin);
+ frame = xfce_gtk_frame_box_new(_("Menu File"), &frame_bin);
gtk_widget_show(frame);
gtk_box_pack_start(GTK_BOX(topvbox), frame, FALSE, FALSE, 0);
@@ -837,7 +861,7 @@ dmp_create_options(XfcePanelPlugin *plugin, DMPlugin *dmp)
G_CALLBACK(dmp_edit_menu_clicked_cb), dmp);
#endif
- frame = xfce_create_framebox(_("Icons"), &frame_bin);
+ frame = xfce_gtk_frame_box_new(_("Icons"), &frame_bin);
gtk_widget_show(frame);
gtk_box_pack_start(GTK_BOX(topvbox), frame, FALSE, FALSE, 0);
diff --git a/settings/Makefile.am b/settings/Makefile.am
index 91f31f5..c3129d8 100644
--- a/settings/Makefile.am
+++ b/settings/Makefile.am
@@ -9,7 +9,7 @@ xfdesktop_settings_CFLAGS = \
-I$(top_srcdir)/common \
-I$(top_srcdir)/src \
$(LIBEXO_CFLAGS) \
- $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBGLADE_CFLAGS) \
$(GTHREAD_CFLAGS) \
@@ -22,7 +22,7 @@ xfdesktop_settings_CFLAGS = \
xfdesktop_settings_LDADD = \
$(top_builddir)/common/libxfdesktop.la \
$(XFCONF_LIBS) \
- $(LIBXFCEGUI4_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
$(LIBGLADE_LIBS) \
$(LIBEXO_LIBS) \
$(GTHREAD_LIBS)
diff --git a/settings/main.c b/settings/main.c
index 9bc5d6e..dfa2b28 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -45,7 +45,7 @@
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#ifdef HAVE_LIBEXO
#include <exo/exo.h>
@@ -290,9 +290,9 @@ setup_special_icon_list(GladeXML *gxml,
GdkPixbuf *pix = NULL;
if(gtk_icon_theme_has_icon(itheme, icons[i].icon))
- pix = xfce_themed_icon_load(icons[i].icon, w);
+ pix = gtk_icon_theme_load_icon(itheme, icons[i].icon, w, 0, NULL);
else
- pix = xfce_themed_icon_load(icons[i].icon_fallback, w);
+ pix = gtk_icon_theme_load_icon(itheme, icons[i].icon_fallback, w, 0, NULL);
gtk_list_store_append(ls, &iter);
gtk_list_store_set(ls, &iter,
@@ -518,7 +518,7 @@ xfdesktop_settings_dialog_create_load_list(AppearancePanel *panel)
primary,
_("Overwriting the file will cause its contents to be lost."),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- XFCE_CUSTOM_STOCK_BUTTON, _("Replace"), GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ XFCE_BUTTON_TYPE_MIXED, GTK_STOCK_SAVE, _("Replace"), GTK_RESPONSE_ACCEPT,
NULL);
g_free(primary);
g_free(shortfile);
diff --git a/src/Makefile.am b/src/Makefile.am
index 81102ab..43bdd49 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,7 +59,9 @@ xfdesktop_CFLAGS = \
$(LIBX11_CFLAGS) \
$(GTHREAD_CFLAGS) \
$(GMODULE_CFLAGS) \
- $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
+ $(LIBXFCE4SMCLIENT_PRIVATE_CFLAGS) \
$(LIBWNCK_CFLAGS) \
$(XFCONF_CFLAGS)
@@ -76,7 +78,9 @@ xfdesktop_LDADD += \
$(LIBX11_LDFLAGS) \
$(LIBX11_LIBS) \
$(GTHREAD_LIBS) \
- $(LIBXFCEGUI4_LIBS) \
+ $(LIBXFCE4UTIL_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
+ $(LIBXFCE4SMCLIENT_PRIVATE_LIBS) \
$(LIBWNCK_LIBS) \
$(XFCONF_LIBS)
diff --git a/src/main.c b/src/main.c
index 0b813ab..cb86355 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,7 @@
/*
* xfdesktop - xfce4's desktop manager
*
- * Copyright (c) 2004-2008 Brian Tarricone, <bjt23 at cornell.edu>
+ * Copyright (c) 2004-2009 Brian Tarricone, <bjt23 at cornell.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,7 +47,8 @@
#include <gtk/gtk.h>
#include <xfconf/xfconf.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
+#include <libxfce4smclient-private/eggsmclient.h>
#ifdef ENABLE_FILE_ICONS
#include <dbus/dbus-glib.h>
@@ -60,14 +61,12 @@
#include "menu.h"
#include "windowlist.h"
-static SessionClient *client_session = NULL;
-static gboolean is_session_managed = FALSE;
+static XfceSMClient *sm_client = NULL;
static void
session_logout(void)
{
- g_return_if_fail(is_session_managed);
- logout_session(client_session);
+ xfce_sm_client_request_shutdown(sm_client, XFCE_SM_CLIENT_SHUTDOWN_HINT_ASK);
}
static void
@@ -182,10 +181,8 @@ client_message_received(GtkWidget *w, GdkEventClient *evt, gpointer user_data)
GDK_CURRENT_TIME);
return TRUE;
} else if(!strcmp(QUIT_MESSAGE, evt->data.b)) {
- if(is_session_managed) {
- client_session_set_restart_style(client_session,
- SESSION_RESTART_IF_RUNNING);
- }
+ xfce_sm_client_set_restart_style(sm_client,
+ XFCE_SM_CLIENT_RESTART_NORMAL);
gtk_main_quit();
return TRUE;
}
@@ -215,6 +212,7 @@ xfdesktop_handle_quit_signals(gint sig,
int
main(int argc, char **argv)
{
+ GOptionContext *octx;
GdkDisplay *gdpy;
GtkWidget **desktops;
gint i, nscreens;
@@ -224,6 +222,17 @@ main(int argc, char **argv)
gboolean already_running;
gchar buf[1024];
GError *error = NULL;
+ gboolean opt_version = FALSE, opt_reload = FALSE;
+ gboolean opt_menu = FALSE, opt_windowlist = FALSE;
+ gboolean opt_quit = FALSE;
+ const GOptionEntry main_entries[] = {
+ { "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_version, N_("Display version information"), NULL },
+ { "reload", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_reload, N_("Reload all settings, refresh image list"), NULL },
+ { "menu", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_menu, N_("Pop up the menu (at the current mouse position)"), NULL },
+ { "windowlist", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_windowlist, N_("Pop up the window list (at the current mouse position)"), NULL },
+ { "quit", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_quit, N_("Cause xfdesktop to quit"), NULL },
+ { NULL, 0, 0, 0, NULL, NULL, NULL }
+ };
/* bind gettext textdomain */
xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -234,9 +243,21 @@ main(int argc, char **argv)
#ifdef ENABLE_FILE_ICONS
dbus_g_thread_init();
#endif
- gtk_init(&argc, &argv);
-
- if(argc > 1 && (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-V"))) {
+
+ octx = g_option_context_new("");
+ g_option_context_add_main_entries(octx, main_entries, NULL);
+ g_option_context_add_group(octx, gtk_get_option_group(TRUE));
+ g_option_context_add_group(octx, xfce_sm_client_get_option_group(argc, argv));
+
+ if(!g_option_context_parse(octx, &argc, &argv, &error)) {
+ g_printerr(_("Failed to parse arguments: %s\n"), error->message);
+ g_error_free(error);
+ return 1;
+ }
+
+ g_option_context_free(octx);
+
+ if(opt_version) {
g_print(_("This is %s version %s, running on Xfce %s.\n"), PACKAGE,
VERSION, xfce_version_string());
g_print(_("Built with GTK+ %d.%d.%d, linked with GTK+ %d.%d.%d."),
@@ -267,36 +288,14 @@ main(int argc, char **argv)
);
return 0;
- }
-
- if(argc > 1) {
- const gchar *argument = argv[1];
-
- /* allow both --(option) and -(option) */
- if('-' == argument[0] && '-' == argument[1])
- ++argument;
-
- if(!strcmp("-reload", argument))
- message = RELOAD_MESSAGE;
- else if(!strcmp("-menu", argument))
- message = MENU_MESSAGE;
- else if(!strcmp("-windowlist", argument))
- message = WINDOWLIST_MESSAGE;
- else if(!strcmp("-quit", argument))
- message = QUIT_MESSAGE;
- else if(!strcmp("--sm-client-id", argv[1])) {
- /* do nothing */
- } else {
- g_printerr(_("%s: Unknown option: %s\n"), PACKAGE, argv[1]);
- g_printerr(_("Options are:\n"));
- g_printerr(_(" --reload Reload all settings, refresh image list\n"));
- g_printerr(_(" --menu Pop up the menu (at the current mouse position)\n"));
- g_printerr(_(" --windowlist Pop up the window list (at the current mouse position)\n"));
- g_printerr(_(" --quit Cause xfdesktop to quit\n"));
-
- return 1;
- }
- }
+ } else if(opt_reload)
+ message = RELOAD_MESSAGE;
+ else if(opt_menu)
+ message = MENU_MESSAGE;
+ else if(opt_windowlist)
+ message = WINDOWLIST_MESSAGE;
+ else if(opt_quit)
+ message = QUIT_MESSAGE;
signal(SIGPIPE, SIG_IGN);
@@ -309,8 +308,6 @@ main(int argc, char **argv)
}
}
- g_print("%s[%d]: starting up\n", PACKAGE, getpid());
-
if(message) {
if(!already_running)
g_printerr(_("%s is not running.\n"), PACKAGE);
@@ -320,10 +317,17 @@ main(int argc, char **argv)
return (already_running ? 0 : 1);
}
- client_session = client_session_new(argc, argv, NULL,
- SESSION_RESTART_IMMEDIATELY, 40);
- client_session->die = session_die;
- is_session_managed = session_init(client_session);
+ g_print("%s[%d]: starting up\n", PACKAGE, getpid());
+
+ sm_client = xfce_sm_client_get();
+ xfce_sm_client_set_restart_style(sm_client, XFCE_SM_CLIENT_RESTART_IMMEDIATELY);
+ g_signal_connect(sm_client, "quit",
+ G_CALLBACK(session_die), NULL);
+
+ if(!xfce_sm_client_connect(sm_client, &error) && error) {
+ g_printerr("Failed to connect to session manager: %s\n", error->message);
+ g_error_free(error);
+ }
#ifdef ENABLE_FILE_ICONS
thunar_vfs_init();
@@ -357,12 +361,11 @@ main(int argc, char **argv)
gdk_window_lower(desktops[i]->window);
}
- if(is_session_managed) {
- for(i = 0; i < nscreens; ++i)
- xfce_desktop_set_session_logout_func(XFCE_DESKTOP(desktops[i]),
- session_logout);
+ for(i = 0; i < nscreens; ++i) {
+ xfce_desktop_set_session_logout_func(XFCE_DESKTOP(desktops[i]),
+ session_logout);
}
-
+
menu_init(channel);
windowlist_init(channel);
diff --git a/src/windowlist.c b/src/windowlist.c
index f785fd3..deaa341 100644
--- a/src/windowlist.c
+++ b/src/windowlist.c
@@ -38,7 +38,7 @@
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include "windowlist.h"
#include "xfdesktop-common.h"
diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 1bc7727..35d0437 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -74,7 +74,7 @@
#endif
#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <xfconf/xfconf.h>
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 19934f2..d4a2eb7 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -69,10 +69,11 @@
#include "xfdesktop-dbus-bindings-trash.h"
#include "xfdesktop-dbus-bindings-filemanager.h"
#include "xfdesktop-file-icon-manager.h"
+#include "xfdesktop-common.h"
#include "xfce-desktop.h"
#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#define SAVE_DELAY 7000
#define BORDER 8
@@ -552,7 +553,7 @@ xfdesktop_file_icon_create_entry_dialog(const gchar *title,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
- btn = xfce_create_mixed_button(GTK_STOCK_OK, accept_button_str);
+ btn = xfce_gtk_button_new_mixed(GTK_STOCK_OK, accept_button_str);
GTK_WIDGET_SET_FLAGS(btn, GTK_CAN_DEFAULT);
gtk_widget_show(btn);
gtk_dialog_add_action_widget(GTK_DIALOG(dlg), btn, GTK_RESPONSE_ACCEPT);
@@ -597,7 +598,7 @@ xfdesktop_file_icon_create_entry_dialog(const gchar *title,
gtk_widget_show(entry);
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
- xfce_gtk_window_center_on_monitor_with_pointer(GTK_WINDOW(dlg));
+ xfce_gtk_window_center_on_active_screen(GTK_WINDOW(dlg));
*entry_return = entry;
return dlg;
@@ -699,7 +700,7 @@ xfdesktop_file_icon_manager_delete_files(XfdesktopFileIconManager *fmanager,
GTK_STOCK_DIALOG_QUESTION,
primary,
_("If you delete a file, it is permanently lost."),
- NULL);
+ NULL, NULL);
g_free(primary);
vbox = GTK_DIALOG(dlg)->vbox;
@@ -1154,7 +1155,9 @@ xfdesktop_menu_item_from_mime_handler(XfdesktopFileIconManager *fmanager,
(GDestroyNotify)g_object_unref);
if(icon_name) {
- GdkPixbuf *pix = xfce_themed_icon_load(icon_name, icon_size);
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
+ GdkPixbuf *pix = gtk_icon_theme_load_icon(itheme, icon_name, icon_size,
+ ITHEME_FLAGS, NULL);
if(pix) {
img = gtk_image_new_from_pixbuf(pix);
g_object_unref(G_OBJECT(pix));
@@ -1235,7 +1238,7 @@ xfdesktop_file_icon_menu_create_launcher(GtkWidget *widget,
display_name, type, pathstr);
}
- if(!xfce_exec(cmd, FALSE, FALSE, &error)) {
+ if(!xfce_spawn_command_line_on_screen(NULL, cmd, FALSE, FALSE, &error)) {
GtkWidget *toplevel = gtk_widget_get_toplevel(GTK_WIDGET(fmanager->priv->icon_view));
xfce_message_dialog(GTK_WINDOW(toplevel), _("Launch Error"),
GTK_STOCK_DIALOG_ERROR,
@@ -1265,10 +1268,12 @@ xfdesktop_file_icon_menu_create_folder(GtkWidget *widget,
"inode/directory");
if(minfo) {
gint w, h;
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
const gchar *icon_name = thunar_vfs_mime_info_lookup_icon_name(minfo,
- gtk_icon_theme_get_default());
+ itheme);
+
gtk_icon_size_lookup(GTK_ICON_SIZE_DIALOG, &w, &h);
- pix = xfce_themed_icon_load(icon_name, w);
+ pix = gtk_icon_theme_load_icon(itheme, icon_name, w, ITHEME_FLAGS, NULL);
thunar_vfs_mime_info_unref(minfo);
}
@@ -1349,6 +1354,7 @@ xfdesktop_file_icon_template_item_activated(GtkWidget *mi,
toplevel = gtk_widget_get_toplevel(GTK_WIDGET(fmanager->priv->icon_view));
if(info) {
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
gchar *title;
const gchar *icon_name;
gint w, h;
@@ -1361,7 +1367,7 @@ xfdesktop_file_icon_template_item_activated(GtkWidget *mi,
icon_name = thunar_vfs_mime_info_lookup_icon_name(info->mime_info,
gtk_icon_theme_get_default());
gtk_icon_size_lookup(GTK_ICON_SIZE_DIALOG, &w, &h);
- pix = xfce_themed_icon_load(icon_name, w);
+ pix = gtk_icon_theme_load_icon(itheme, icon_name, w, ITHEME_FLAGS, NULL);
dlg = xfdesktop_file_icon_create_entry_dialog(title,
GTK_WINDOW(toplevel),
@@ -1627,7 +1633,7 @@ xfdesktop_settings_launch(GtkWidget *w,
if(!cmd)
cmd = g_strdup(BINDIR "/xfdesktop-settings");
- if(!xfce_exec_on_screen(fmanager->priv->gscreen, cmd, FALSE, TRUE, &error)) {
+ if(!xfce_spawn_command_line_on_screen(fmanager->priv->gscreen, cmd, FALSE, TRUE, &error)) {
GtkWidget *toplevel = gtk_widget_get_toplevel(GTK_WIDGET(fmanager->priv->icon_view));
/* printf is to be translator-friendly */
gchar *primary = g_strdup_printf(_("Unable to launch \"%s\":"), cmd);
@@ -1730,13 +1736,16 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
if(file_icon == fmanager->priv->desktop_icon) {
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
+
mi = gtk_image_menu_item_new_with_mnemonic(_("Create _Launcher..."));
minfo = thunar_vfs_mime_database_get_info(thunar_mime_database,
"application/x-desktop");
if(minfo) {
- const gchar *icon_name = thunar_vfs_mime_info_lookup_icon_name(minfo,
- gtk_icon_theme_get_default());
- pix = xfce_themed_icon_load(icon_name, w);
+ const gchar *icon_name = thunar_vfs_mime_info_lookup_icon_name(minfo, itheme);
+
+ pix = gtk_icon_theme_load_icon(itheme, icon_name, w,
+ ITHEME_FLAGS, NULL);
if(pix) {
img = gtk_image_new_from_pixbuf(pix);
gtk_widget_show(img);
@@ -1752,9 +1761,12 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
fmanager);
mi = gtk_image_menu_item_new_with_mnemonic(_("Create _URL Link..."));
- pix = xfce_themed_icon_load("gnome-fs-bookmark", w);
+ pix = gtk_icon_theme_load_icon(itheme, "gnome-fs-bookmark",
+ w, ITHEME_FLAGS, NULL);
if(!pix)
- pix = xfce_themed_icon_load("emblem-favorite", w);
+ pix = gtk_icon_theme_load_icon(itheme,
+ "emblem-favorite", w,
+ ITHEME_FLAGS, NULL);
if(pix) {
img = gtk_image_new_from_pixbuf(pix);
gtk_widget_show(img);
@@ -1774,7 +1786,8 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
if(minfo) {
const gchar *icon_name = thunar_vfs_mime_info_lookup_icon_name(minfo,
gtk_icon_theme_get_default());
- pix = xfce_themed_icon_load(icon_name, w);
+ pix = gtk_icon_theme_load_icon(itheme, icon_name, w,
+ ITHEME_FLAGS, NULL);
if(pix) {
img = gtk_image_new_from_pixbuf(pix);
gtk_widget_show(img);
@@ -1796,9 +1809,7 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
gtk_widget_show(tmpl_menu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi), tmpl_menu);
-#if GLIB_CHECK_VERSION(2, 14, 0)
templates_path_str = g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_TEMPLATES));
-#endif
if(!templates_path_str) {
templates_path_str = xfce_get_homefile("Templates",
NULL);
@@ -1806,9 +1817,7 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
templates_path = thunar_vfs_path_new(templates_path_str, NULL);
templates_dir_is_home = exo_str_is_equal(templates_path_str, xfce_get_homedir());
if(templates_path
-#if GLIB_CHECK_VERSION(2, 14, 0)
&& !templates_dir_is_home
-#endif
)
{
have_templates = xfdesktop_file_icon_menu_fill_template_menu(tmpl_menu,
@@ -3270,8 +3279,13 @@ xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
myargv[i++] = cwd;
myargv[i++] = NULL;
- if(xfce_exec_argv(myargv, FALSE, FALSE, NULL))
+ if(xfce_spawn_on_screen(fmanager->priv->gscreen, NULL, myargv,
+ NULL, G_SPAWN_SEARCH_PATH, TRUE,
+ gtk_get_current_event_time(),
+ NULL, NULL))
+ {
drop_ok = TRUE;
+ }
g_free(cwd);
}
diff --git a/src/xfdesktop-file-icon.c b/src/xfdesktop-file-icon.c
index b4e9bc6..e96a9a7 100644
--- a/src/xfdesktop-file-icon.c
+++ b/src/xfdesktop-file-icon.c
@@ -24,7 +24,7 @@
#include <glib-object.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include "xfdesktop-file-utils.h"
#include "xfdesktop-file-icon.h"
diff --git a/src/xfdesktop-file-properties-dialog.c b/src/xfdesktop-file-properties-dialog.c
index 0c54703..96ca2b1 100644
--- a/src/xfdesktop-file-properties-dialog.c
+++ b/src/xfdesktop-file-properties-dialog.c
@@ -24,7 +24,7 @@
#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <thunar-vfs/thunar-vfs.h>
@@ -36,6 +36,7 @@
#include "xfdesktop-file-icon.h"
#include "xfdesktop-file-utils.h"
#include "xfdesktop-file-properties-dialog.h"
+#include "xfdesktop-common.h"
#define BORDER 8
@@ -294,8 +295,11 @@ xfdesktop_file_properties_dialog_show(GtkWindow *parent,
icon_name = thunar_vfs_mime_handler_lookup_icon_name(handler,
gtk_icon_theme_get_default());
- if(icon_name)
- pix = xfce_themed_icon_load(icon_name, mw);
+ if(icon_name) {
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
+ pix = gtk_icon_theme_load_icon(itheme, icon_name, mw,
+ ITHEME_FLAGS, NULL);
+ }
gtk_list_store_set(ls, &itr,
OPENWITH_COL_PIX, pix,
diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c
index bdec471..42bf1dd 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -28,7 +28,7 @@
#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <exo/exo.h>
@@ -42,6 +42,7 @@
#include "xfdesktop-dbus-bindings-filemanager.h"
#include "xfdesktop-file-icon.h"
+#include "xfdesktop-common.h"
#include "xfdesktop-file-utils.h"
ThunarVfsInteractiveJobResponse
@@ -54,7 +55,7 @@ xfdesktop_file_utils_interactive_job_ask(GtkWindow *parent,
dlg = xfce_message_dialog_new(parent, _("Question"),
GTK_STOCK_DIALOG_QUESTION, NULL, message,
- NULL);
+ NULL, NULL);
if(choices & THUNAR_VFS_INTERACTIVE_JOB_RESPONSE_CANCEL) {
btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
@@ -222,24 +223,31 @@ xfdesktop_file_utils_get_file_icon(const gchar *custom_icon_name,
const GdkPixbuf *emblem,
guint opacity)
{
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
GdkPixbuf *pix_theme = NULL, *pix = NULL;
const gchar *icon_name;
- if(custom_icon_name)
- pix_theme = xfce_themed_icon_load(custom_icon_name, size);
+ if(custom_icon_name) {
+ pix_theme = gtk_icon_theme_load_icon(itheme, custom_icon_name, size,
+ ITHEME_FLAGS, NULL);
+ }
if(!pix_theme && info) {
icon_name = thunar_vfs_info_get_custom_icon(info);
- if(icon_name)
- pix_theme = xfce_themed_icon_load(icon_name, size);
+ if(icon_name) {
+ pix_theme = gtk_icon_theme_load_icon(itheme, icon_name, size,
+ ITHEME_FLAGS, NULL);
+ }
}
if(!pix_theme && info && info->mime_info) {
icon_name = thunar_vfs_mime_info_lookup_icon_name(info->mime_info,
gtk_icon_theme_get_default());
DBG("got mime info icon name: %s", icon_name);
- if(icon_name)
- pix_theme = xfce_themed_icon_load(icon_name, size);
+ if(icon_name) {
+ pix_theme = gtk_icon_theme_load_icon(itheme, icon_name, size,
+ ITHEME_FLAGS, NULL);
+ }
}
if(G_LIKELY(pix_theme)) {
@@ -335,13 +343,12 @@ xfdesktop_file_utils_launch_fallback(const ThunarVfsInfo *info,
display_name = gdk_screen_make_display_name(screen);
uri = thunar_vfs_path_dup_uri(info->path);
- commandline = g_strconcat("env DISPLAY=\"", display_name,
- "\" \"", file_manager_app, "\" \"",
+ commandline = g_strconcat("\"", file_manager_app, "\" \"",
uri, "\"", NULL);
DBG("executing:\n%s\n", commandline);
- ret = xfce_exec(commandline, FALSE, TRUE, NULL);
+ ret = xfce_spawn_command_line_on_screen(screen, commandline, FALSE, TRUE, NULL);
g_free(commandline);
g_free(file_manager_app);
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index afa6c51..daf23d2 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -46,7 +46,7 @@
#include "xfdesktop-marshal.h"
#include <libwnck/libwnck.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#define DEFAULT_FONT_SIZE 12
#define DEFAULT_ICON_SIZE 32
diff --git a/src/xfdesktop-regular-file-icon.c b/src/xfdesktop-regular-file-icon.c
index ab1f6c7..898e4e7 100644
--- a/src/xfdesktop-regular-file-icon.c
+++ b/src/xfdesktop-regular-file-icon.c
@@ -43,13 +43,14 @@
#define PATH_MAX 4096
#endif
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#ifdef HAVE_THUNARX
#include <thunarx/thunarx.h>
#endif
#include "xfdesktop-file-utils.h"
+#include "xfdesktop-common.h"
#include "xfdesktop-regular-file-icon.h"
#define EMBLEM_SYMLINK "emblem-symbolic-link"
@@ -209,9 +210,12 @@ xfdesktop_regular_file_icon_peek_pixbuf(XfdesktopIcon *icon,
}
if(file_icon->priv->info->flags & THUNAR_VFS_FILE_FLAGS_SYMLINK) {
+ GtkIconTheme *itheme = gtk_icon_theme_get_default();
gint sym_pix_size = size * 2 / 3;
- emblem_pix = xfce_themed_icon_load(EMBLEM_SYMLINK, sym_pix_size);
+ emblem_pix = gtk_icon_theme_load_icon(itheme, EMBLEM_SYMLINK,
+ sym_pix_size, ITHEME_FLAGS,
+ NULL);
if(emblem_pix) {
if(gdk_pixbuf_get_width(emblem_pix) != sym_pix_size
|| gdk_pixbuf_get_height(emblem_pix) != sym_pix_size)
diff --git a/src/xfdesktop-special-file-icon.c b/src/xfdesktop-special-file-icon.c
index bab1f82..5e8c602 100644
--- a/src/xfdesktop-special-file-icon.c
+++ b/src/xfdesktop-special-file-icon.c
@@ -39,7 +39,7 @@
#define PATH_MAX 4096
#endif
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <dbus/dbus-glib.h>
diff --git a/src/xfdesktop-volume-icon.c b/src/xfdesktop-volume-icon.c
index 9de606d..12ca833 100644
--- a/src/xfdesktop-volume-icon.c
+++ b/src/xfdesktop-volume-icon.c
@@ -43,7 +43,7 @@
#define PATH_MAX 4096
#endif
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#ifdef HAVE_THUNARX
#include <thunarx/thunarx.h>
diff --git a/src/xfdesktop-window-icon-manager.c b/src/xfdesktop-window-icon-manager.c
index ff414e7..4b0f262 100644
--- a/src/xfdesktop-window-icon-manager.c
+++ b/src/xfdesktop-window-icon-manager.c
@@ -28,7 +28,8 @@
#include <glib-object.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <libwnck/libwnck.h>
#include "xfdesktop-icon-view.h"
diff --git a/src/xfdesktop-window-icon.c b/src/xfdesktop-window-icon.c
index 52c4d30..853d331 100644
--- a/src/xfdesktop-window-icon.c
+++ b/src/xfdesktop-window-icon.c
@@ -28,7 +28,7 @@
#include <libwnck/libwnck.h>
#include <libwnck/window-action-menu.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include "xfdesktop-window-icon.h"
diff --git a/src/xfdesktop-window-icon.h b/src/xfdesktop-window-icon.h
index 31b33d6..670f5e7 100644
--- a/src/xfdesktop-window-icon.h
+++ b/src/xfdesktop-window-icon.h
@@ -22,7 +22,7 @@
#define __XFDESKTOP_WINDOW_ICON_H__
#include <glib-object.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
#include "xfdesktop-icon.h"
More information about the Xfce4-commits
mailing list