1 diff -Naur xfce4-places-plugin-1.2.0.orig/config.h.in xfce4-places-plugin-1.2.0/config.h.in
2 --- xfce4-places-plugin-1.2.0.orig/config.h.in 2009-07-31 08:21:07.000000000 +0200
3 +++ xfce4-places-plugin-1.2.0/config.h.in 2011-03-22 09:55:16.000000000 +0100
5 /* Define if the GNU gettext() function is already present or preinstalled. */
8 +/* Define if gio-unix-2.0 >= 2.18.0 present */
11 /* Define to 1 if you have the <inttypes.h> header file. */
12 #undef HAVE_INTTYPES_H
14 /* Define if your <locale.h> file defines LC_MESSAGES. */
15 #undef HAVE_LC_MESSAGES
17 -/* Define if libxfce4panel-1.0 >= 4.5.92 present */
18 -#undef HAVE_LIBXFCE4PANEL_46
19 +/* Define if libnotify >= 0.4.0 present */
20 +#undef HAVE_LIBNOTIFY
22 /* Define to 1 if you have the <locale.h> header file. */
25 /* Define to 1 if you have the <unistd.h> header file. */
28 +/* Define to the sub-directory in which libtool stores uninstalled libraries. */
31 +/* Define to 1 if your C compiler doesn't accept -c and -o together. */
32 +#undef NO_MINUS_C_MINUS_O
38 /* Define to the one symbol short name of this package. */
39 #undef PACKAGE_TARNAME
41 +/* Define to the home page for this package. */
44 /* Define to the version of this package. */
45 #undef PACKAGE_VERSION
47 diff -Naur xfce4-places-plugin-1.2.0.orig/configure.in xfce4-places-plugin-1.2.0/configure.in
48 --- xfce4-places-plugin-1.2.0.orig/configure.in 2011-03-24 11:30:01.000000000 +0100
49 +++ xfce4-places-plugin-1.2.0/configure.in 2011-03-24 12:46:18.097893668 +0100
52 dnl check for basic programs
59 dnl check for required packages
60 -XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
61 -XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.90.2])
62 +XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.22.0])
63 +XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.22.0])
64 +XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.22.0])
65 +XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.22.0])
66 +XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.22.0])
67 +XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
68 +XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.8.0])
69 XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.3.90.2])
70 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.90.2])
71 -XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.3.2])
72 XDT_CHECK_PACKAGE([EXO], [exo-1], [0.5.0])
74 -dnl check for optional packages/versions
75 -XDT_CHECK_OPTIONAL_PACKAGE([LIBXFCE4PANEL_46], [libxfce4panel-1.0], [4.5.92], [libxfce4panel46], [Take advantage of Xfce 4.6 panel changes])
76 +XDT_CHECK_OPTIONAL_PACKAGE([GIO_UNIX], [gio-unix-2.0], [2.22.0], [gio-unix],
77 + [gio-unix, for special treatment of mount points on UNIX])
79 +dnl *** Optional support for libnotify ***
80 +XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY], [libnotify], [0.4.0], [notifications],
81 + [Mount notification support], [yes])
83 dnl check for i18n support
84 XDT_I18N([ar be ca cs da de dz el en_GB eo es et eu fi fr gl he hu id it ja ka ko lt lv mk nb nl pa pl pt_BR pt ro ru sq sv tr uk ur ur_PK zh_CN zh_TW])
85 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/Makefile.am xfce4-places-plugin-1.2.0/panel-plugin/Makefile.am
86 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/Makefile.am 2008-11-23 12:07:43.000000000 +0100
87 +++ xfce4-places-plugin-1.2.0/panel-plugin/Makefile.am 2011-03-24 18:21:18.505054556 +0100
90 xfce4_popup_places_CFLAGS = \
95 xfce4_popup_places_LDADD = \
107 +xfce4_places_plugin_notify_sources = \
108 + model_volumes_notify.c \
109 + model_volumes_notify.h
112 xfce4_places_plugin_SOURCES = \
113 + $(xfce4_places_plugin_notify_sources) \
131 -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
133 + $(GIO_UNIX_CFLAGS) \
135 + $(GTHREAD_CFLAGS) \
137 + $(LIBNOTIFY_CFLAGS) \
139 $(LIBXFCE4UTIL_CFLAGS) \
140 $(LIBXFCEGUI4_CFLAGS) \
141 $(LIBXFCE4PANEL_CFLAGS) \
142 - $(THUNAR_VFS_CFLAGS) \
146 xfce4_places_plugin_LDADD = \
152 + $(LIBNOTIFY_LIBS) \
153 + $(LIBX11_LDFLAGS) \
155 $(LIBXFCE4UTIL_LIBS) \
156 $(LIBXFCEGUI4_LIBS) \
157 $(LIBXFCE4PANEL_LIBS) \
163 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/Makefile.in xfce4-places-plugin-1.2.0/panel-plugin/Makefile.in
164 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/Makefile.in 2009-07-31 08:21:07.000000000 +0200
165 +++ xfce4-places-plugin-1.2.0/panel-plugin/Makefile.in 2011-03-24 18:25:56.366054338 +0100
167 xfce4_places_plugin-model_system.$(OBJEXT) \
168 xfce4_places_plugin-model_user.$(OBJEXT) \
169 xfce4_places_plugin-model_volumes.$(OBJEXT) \
170 - xfce4_places_plugin-button.$(OBJEXT) \
171 - xfce4_places_plugin-xfce46-compat.$(OBJEXT)
172 + xfce4_places_plugin-button.$(OBJEXT)
173 xfce4_places_plugin_OBJECTS = $(am_xfce4_places_plugin_OBJECTS)
175 xfce4_places_plugin_DEPENDENCIES = $(am__DEPENDENCIES_1) \
176 @@ -269,15 +268,25 @@
178 xfce4_popup_places_CFLAGS = \
183 xfce4_popup_places_LDADD = \
189 plugindir = $(libexecdir)/xfce4/panel-plugins
192 +xfce4_places_plugin_notify_sources = \
193 + model_volumes_notify.c \
194 + model_volumes_notify.h
197 xfce4_places_plugin_SOURCES = \
198 + $(xfce4_places_plugin_notify_sources) \
202 @@ -295,26 +304,38 @@
211 xfce4_places_plugin_CFLAGS = \
214 -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
216 + $(GIO_UNIX_CFLAGS) \
218 + $(GTHREAD_CFLAGS) \
220 + $(LIBNOTIFY_CFLAGS) \
222 $(LIBXFCE4UTIL_CFLAGS) \
223 $(LIBXFCEGUI4_CFLAGS) \
224 $(LIBXFCE4PANEL_CFLAGS) \
225 - $(THUNAR_VFS_CFLAGS) \
229 xfce4_places_plugin_LDADD = \
235 + $(LIBNOTIFY_LIBS) \
236 + $(LIBX11_LDFLAGS) \
238 $(LIBXFCE4UTIL_LIBS) \
239 $(LIBXFCEGUI4_LIBS) \
240 $(LIBXFCE4PANEL_LIBS) \
246 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/model.h xfce4-places-plugin-1.2.0/panel-plugin/model.h
247 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/model.h 2008-01-09 02:20:42.000000000 +0100
248 +++ xfce4-places-plugin-1.2.0/panel-plugin/model.h 2011-03-24 18:06:48.743019371 +0100
250 #define _XFCE_PANEL_PLACES_MODEL_H
253 +#include <gio/gio.h>
255 /* Places Bookmark Action */
256 typedef struct _PlacesBookmarkAction PlacesBookmarkAction;
258 gchar *label; /* must not be NULL */
259 gchar *uri; /* may be NULL */
260 places_uri_scheme uri_scheme;
261 - gchar *icon; /* may be NULL */
262 + GIcon *icon; /* may be NULL */
263 PlacesBookmarkAction *primary_action; /* may be NULL */
265 GList *actions; /* may be NULL (empty) */
266 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/model_system.c xfce4-places-plugin-1.2.0/panel-plugin/model_system.c
267 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/model_system.c 2009-05-24 07:23:15.000000000 +0200
268 +++ xfce4-places-plugin-1.2.0/panel-plugin/model_system.c 2011-03-22 11:11:25.000000000 +0100
273 +#include <gio/gio.h>
275 #include <libxfce4util/libxfce4util.h>
277 -#define EXO_API_SUBJECT_TO_CHANGE
278 -#include <thunar-vfs/thunar-vfs.h>
280 -#define TRASH THUNAR_VFS_CHECK_VERSION(0,4,0)
282 #define XDG_USER_DIRS GLIB_CHECK_VERSION(2,14,0)
284 #define pbg_priv(pbg) ((PBSysData*) pbg->priv)
286 gchar *desktop_dir; /* NULL => no desktop or desktop is same as home */
288 gboolean trash_is_empty;
289 - ThunarVfsPath *trash_path;
295 g_assert(bookmark != NULL);
297 if(bookmark->uri != NULL){
298 - g_free(bookmark->uri);
299 + g_object_unref(bookmark->icon);
300 bookmark->uri = NULL;
307 -pbsys_trash_is_empty(const ThunarVfsInfo *trash_info)
308 +pbsys_trash_is_empty(GFileInfo *trash_info)
310 - if (trash_info->custom_icon == NULL)
312 - if (strcmp("user-trash-full", trash_info->custom_icon) == 0)
314 - if (strcmp("gnome-fs-trash-full", trash_info->custom_icon) == 0)
315 + guint item_count = g_file_info_get_attribute_uint32(trash_info,
316 + G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT);
317 + if(item_count == 0)
326 PlacesBookmark *bookmark;
327 PlacesBookmarkAction *open, *terminal;
329 - ThunarVfsInfo *trash_info;
330 + GFileInfo *trash_info;
332 const gchar *home_dir = xfce_get_homedir();
336 bookmark = places_bookmark_create((gchar*) g_get_user_name());
337 bookmark->uri = (gchar*) home_dir;
338 - bookmark->icon = "user-home";
339 + bookmark->icon = g_themed_icon_new("user-home");
341 terminal = places_create_open_terminal_action(bookmark);
342 bookmark->actions = g_list_prepend(bookmark->actions, terminal);
343 @@ -159,15 +156,20 @@
344 bookmark->uri_scheme = PLACES_URI_SCHEME_TRASH;
345 bookmark->finalize = pbsys_finalize_trash_bookmark;;
347 - /* Try for an icon from ThunarVFS to indicate whether trash is empty or not */
348 + /* Try for an icon to indicate whether trash is empty or not */
350 - trash_info = thunar_vfs_info_new_for_path(pbg_priv(bookmark_group)->trash_path, NULL);
351 + trash_info = g_file_query_info(pbg_priv(bookmark_group)->trash_path,
353 + G_FILE_QUERY_INFO_NONE,
355 pbg_priv(bookmark_group)->trash_is_empty = pbsys_trash_is_empty(trash_info);
356 - if(trash_info->custom_icon != NULL)
357 - bookmark->icon = g_strdup(trash_info->custom_icon);
358 + if (bookmark->icon != NULL)
359 + g_object_unref(bookmark->icon);
360 + if (pbg_priv(bookmark_group)->trash_is_empty)
361 + bookmark->icon = g_themed_icon_new("user-trash");
363 - bookmark->icon = g_strdup("user-trash-full");
364 - thunar_vfs_info_unref(trash_info);
365 + bookmark->icon = g_themed_icon_new("user-trash-full");
366 + g_object_unref(trash_info);
368 open = places_create_open_action(bookmark);
369 bookmark->actions = g_list_prepend(bookmark->actions, open);
371 if(desktop_dir != NULL){
372 bookmark = places_bookmark_create(_("Desktop"));
373 bookmark->uri = desktop_dir;
374 - bookmark->icon = "user-desktop";
375 + bookmark->icon = g_themed_icon_new("user-desktop");
376 bookmark->finalize = pbsys_finalize_desktop_bookmark;
380 /* File System (/) */
381 bookmark = places_bookmark_create(_("File System"));
383 - bookmark->icon = "gtk-harddisk";
384 + bookmark->icon = g_themed_icon_new("gtk-harddisk");
386 terminal = places_create_open_terminal_action(bookmark);
387 bookmark->actions = g_list_prepend(bookmark->actions, terminal);
391 gboolean trash_is_empty;
392 - ThunarVfsInfo *trash_info;
393 + GFileInfo *trash_info;
396 if(!pbg_priv(bookmark_group)->check_changed)
400 /* see if trash gets a different icon (e.g., was empty, now full) */
401 - trash_info = thunar_vfs_info_new_for_path(pbg_priv(bookmark_group)->trash_path, NULL);
402 + trash_info = g_file_query_info(pbg_priv(bookmark_group)->trash_path,
404 + G_FILE_QUERY_INFO_NONE,
406 trash_is_empty = pbsys_trash_is_empty(trash_info);
407 - thunar_vfs_info_unref(trash_info);
408 + g_object_unref(trash_info);
410 if(trash_is_empty != pbg_priv(bookmark_group)->trash_is_empty)
413 pbsys_finalize(PlacesBookmarkGroup *bookmark_group)
416 - thunar_vfs_path_unref(pbg_priv(bookmark_group)->trash_path);
417 - thunar_vfs_shutdown();
418 + g_object_unref(pbg_priv(bookmark_group)->trash_path);
421 g_free(pbg_priv(bookmark_group)->desktop_dir);
423 bookmark_group->priv = g_new0(PBSysData, 1);
427 - pbg_priv(bookmark_group)->trash_path = thunar_vfs_path_get_for_trash();
428 + pbg_priv(bookmark_group)->trash_path = g_file_new_for_uri("trash:///");
431 return bookmark_group;
432 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/model_user.c xfce4-places-plugin-1.2.0/panel-plugin/model_user.c
433 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/model_user.c 2009-05-24 07:23:15.000000000 +0200
434 +++ xfce4-places-plugin-1.2.0/panel-plugin/model_user.c 2011-03-22 11:12:37.000000000 +0100
436 /* create the BookmarkInfo container */
437 bookmark = places_bookmark_create(name); /* label needs to be freed */
438 bookmark->uri = path; /* uri needs to be freed */
439 - bookmark->icon = "folder";
440 + bookmark->icon = g_themed_icon_new("folder");
441 bookmark->priv = GINT_TO_POINTER(pbuser_dir_exists(path));
442 bookmark->finalize = pbuser_finalize_bookmark;
445 clone = places_bookmark_create(g_strdup(orig->label));
446 clone->uri = g_strdup(orig->uri);
447 clone->uri_scheme = orig->uri_scheme;
448 - clone->icon = orig->icon;
449 + clone->icon = g_object_ref(orig->icon);
450 clone->finalize = pbuser_finalize_bookmark;
452 terminal = places_create_open_terminal_action(clone);
453 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/model_volumes.c xfce4-places-plugin-1.2.0/panel-plugin/model_volumes.c
454 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/model_volumes.c 2009-07-31 07:31:42.000000000 +0200
455 +++ xfce4-places-plugin-1.2.0/panel-plugin/model_volumes.c 2011-03-22 11:42:26.000000000 +0100
457 #include "model_volumes.h"
460 -#define EXO_API_SUBJECT_TO_CHANGE
461 -#include <thunar-vfs/thunar-vfs.h>
462 +#include <gio/gio.h>
463 +#ifdef HAVE_GIO_UNIX
464 +#include <gio/gunixmounts.h>
466 +#include <gtk/gtk.h>
468 +#ifdef HAVE_LIBNOTIFY
469 +#include "model_volumes_notify.h"
472 #include <libxfce4util/libxfce4util.h>
478 - ThunarVfsVolumeManager *volume_manager;
479 + GVolumeMonitor *volume_monitor;
481 gboolean mount_and_open_by_default;
486 /********** Actions Callbacks **********/
488 +pbvol_eject_finish(GObject *object,
489 + GAsyncResult *result,
490 + gpointer user_data)
492 + GVolume *volume = G_VOLUME(object);
493 + GError *error = NULL;
495 + g_return_if_fail(G_IS_VOLUME(object));
496 + g_return_if_fail(G_IS_ASYNC_RESULT(result));
498 + if (!g_volume_eject_with_operation_finish(volume, result, &error)) {
499 + /* ignore GIO errors handled internally */
500 + if(error->domain != G_IO_ERROR || error->code != G_IO_ERROR_FAILED_HANDLED) {
501 + gchar *volume_name = g_volume_get_name(volume);
502 + places_show_error_dialog(error,
503 + _("Failed to eject \"%s\""),
505 + g_free(volume_name);
507 + g_error_free(error);
510 +#ifdef HAVE_LIBNOTIFY
511 + pbvol_notify_eject_finish(volume);
516 pbvol_eject(PlacesBookmarkAction *action)
518 - GError *error = NULL;
519 - ThunarVfsVolume *volume;
524 - g_return_if_fail(THUNAR_VFS_IS_VOLUME(action->priv));
525 - volume = THUNAR_VFS_VOLUME(action->priv);
526 + g_return_if_fail(G_IS_VOLUME(action->priv));
527 + volume = G_VOLUME(action->priv);
529 - if(!thunar_vfs_volume_eject(volume, NULL, &error)){
530 - places_show_error_dialog(error,
531 - _("Failed to eject \"%s\""),
532 - thunar_vfs_volume_get_name (volume));
533 - g_error_free (error);
534 + if (g_volume_can_eject(volume)) {
535 +#ifdef HAVE_LIBNOTIFY
536 + pbvol_notify_eject(volume);
538 + g_volume_eject_with_operation(volume, G_MOUNT_UNMOUNT_NONE, NULL,
540 + pbvol_eject_finish,
541 + g_object_ref(volume));
546 -pbvol_unmount(PlacesBookmarkAction *action)
547 +pbvol_unmount_finish(GObject *object,
548 + GAsyncResult *result,
549 + gpointer user_data)
551 + GMount *mount = G_MOUNT(object);
552 GError *error = NULL;
553 - ThunarVfsVolume *volume;
555 + g_return_if_fail(G_IS_MOUNT(object));
556 + g_return_if_fail(G_IS_ASYNC_RESULT(result));
558 + if (!g_mount_unmount_with_operation_finish(mount, result, &error)) {
559 + /* ignore GIO errors handled internally */
560 + if (error->domain != G_IO_ERROR || error->code != G_IO_ERROR_FAILED_HANDLED) {
561 + gchar *mount_name = g_mount_get_name(mount);
562 + places_show_error_dialog(error,
563 + _("Failed to unmount \"%s\""),
565 + g_free(mount_name);
567 + g_error_free (error);
570 +#ifdef HAVE_LIBNOTIFY
571 + pbvol_notify_unmount_finish(mount);
576 +pbvol_unmount(PlacesBookmarkAction *action)
583 - g_return_if_fail(THUNAR_VFS_IS_VOLUME(action->priv));
584 - volume = THUNAR_VFS_VOLUME(action->priv);
585 + g_return_if_fail(G_IS_VOLUME(action->priv));
586 + volume = G_VOLUME(action->priv);
587 + mount = g_volume_get_mount(volume);
590 +#ifdef HAVE_LIBNOTIFY
591 + pbvol_notify_unmount(mount);
593 + g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, NULL,
595 + pbvol_unmount_finish,
596 + g_object_ref(volume));
601 +pbvol_mount_finish(GObject *object,
602 + GAsyncResult *result,
603 + gpointer user_data)
605 + GVolume *volume = G_VOLUME(object);
606 + GError *error = NULL;
608 - if(thunar_vfs_volume_is_mounted(volume)){
609 - if(!thunar_vfs_volume_unmount(volume, NULL, &error)){
610 + DBG("Mount finish");
612 - places_show_error_dialog(error,
613 - _("Failed to unmount \"%s\""),
614 - thunar_vfs_volume_get_name (volume));
615 - g_error_free (error);
617 + if (!g_volume_mount_finish(volume, result, &error)) {
618 + /* ignore GIO errors handled internally */
619 + if (error->domain != G_IO_ERROR || error->code != G_IO_ERROR_FAILED_HANDLED) {
620 + gchar *volume_name = g_volume_get_name(volume);
621 + places_show_error_dialog(error,
622 + _("Failed to mount \"%s\""),
624 + g_free(volume_name);
626 + g_error_free (error);
631 pbvol_mount(PlacesBookmarkAction *action)
633 - GError *error = NULL;
634 - ThunarVfsVolume *volume;
640 - g_return_if_fail(THUNAR_VFS_IS_VOLUME(action->priv));
641 - volume = THUNAR_VFS_VOLUME(action->priv);
642 + g_return_if_fail(G_IS_VOLUME(action->priv));
643 + volume = G_VOLUME(action->priv);
644 + mount = g_volume_get_mount(volume);
647 + GMountOperation *operation = gtk_mount_operation_new(NULL);
649 + g_volume_mount(volume, G_MOUNT_MOUNT_NONE, operation, NULL,
650 + pbvol_mount_finish,
651 + g_object_ref(volume));
653 - if(!thunar_vfs_volume_is_mounted(volume)){
654 - if(!thunar_vfs_volume_mount(volume, NULL, &error)){
656 - places_show_error_dialog(error,
657 - _("Failed to mount \"%s\""),
658 - thunar_vfs_volume_get_name (volume));
659 - g_error_free (error);
661 + g_object_unref(operation);
665 @@ -115,33 +204,166 @@
666 pbvol_mount_and_open(PlacesBookmarkAction *action)
669 - ThunarVfsVolume *volume;
673 DBG("Mount and open");
675 - g_return_if_fail(THUNAR_VFS_IS_VOLUME(action->priv));
676 - volume = THUNAR_VFS_VOLUME(action->priv);
677 + g_return_if_fail(G_IS_VOLUME(action->priv));
678 + volume = G_VOLUME(action->priv);
679 + mount = g_volume_get_mount(volume);
681 - if(!thunar_vfs_volume_is_mounted(volume))
685 - if(thunar_vfs_volume_is_mounted(volume)){
686 - uri = thunar_vfs_path_dup_uri(thunar_vfs_volume_get_mount_point(volume));
688 + GFile *file = g_mount_get_root(mount);
689 + uri = g_file_get_uri(file);
690 places_load_file_browser(uri);
692 + g_object_unref(file);
693 + g_object_unref(mount);
697 +#ifdef HAVE_GIO_UNIX
699 +pbvol_mount_is_internal (GMount *mount)
701 + const gchar *point_mount_path;
702 + gboolean is_internal = FALSE;
705 + GList *mount_points;
708 + g_return_val_if_fail(G_IS_MOUNT(mount), FALSE);
710 + /* determine the mount path */
711 + root = g_mount_get_root(mount);
712 + mount_path = g_file_get_path(root);
713 + g_object_unref(root);
715 + /* assume non-internal if we cannot determine the path */
719 + if (g_unix_is_mount_path_system_internal(mount_path)) {
720 + /* mark as internal */
721 + is_internal = TRUE;
723 + /* get a list of all mount points */
724 + mount_points = g_unix_mount_points_get(NULL);
726 + /* search for the mount point associated with the mount entry */
727 + for (lp = mount_points; !is_internal && lp != NULL; lp = lp->next) {
728 + point_mount_path = g_unix_mount_point_get_mount_path(lp->data);
730 + /* check if this is the mount point we are looking for */
731 + if (g_strcmp0(mount_path, point_mount_path) == 0) {
732 + /* mark as internal if the user cannot mount this device */
733 + if (!g_unix_mount_point_is_user_mountable(lp->data))
734 + is_internal = TRUE;
737 + /* free the mount point, we no longer need it */
738 + g_unix_mount_point_free(lp->data);
741 + /* free the mount point list */
742 + g_list_free(mount_points);
745 + g_free(mount_path);
748 + return is_internal;
754 +pbvol_is_removable(GVolume *volume)
756 + gboolean can_eject = FALSE;
757 + gboolean can_mount = FALSE;
758 + gboolean can_unmount = FALSE;
759 + gboolean is_removable = FALSE;
760 + gboolean is_internal = FALSE;
764 + g_return_val_if_fail(G_IS_VOLUME(volume), FALSE);
766 + /* check if the volume can be ejected */
767 + can_eject = g_volume_can_eject(volume);
769 + /* determine the drive for the volume */
770 + drive = g_volume_get_drive(volume);
772 + /* check if the drive media can be removed */
773 + is_removable = g_drive_is_media_removable(drive);
775 + /* release the drive */
776 + g_object_unref(drive);
778 + /* determine the mount for the volume (if it is mounted at all) */
779 + mount = g_volume_get_mount(volume);
781 +#ifdef HAVE_GIO_UNIX
782 + is_internal = pbvol_mount_is_internal (mount);
785 + /* check if the volume can be unmounted */
786 + can_unmount = g_mount_can_unmount(mount);
788 + /* release the mount */
789 + g_object_unref(mount);
792 + /* determine whether the device can be mounted */
793 + can_mount = g_volume_can_mount(volume);
795 + return (!is_internal) && (can_eject || can_unmount || is_removable || can_mount);
799 +pbvol_is_present(GVolume *volume)
801 + gboolean has_media = FALSE;
802 + gboolean is_shadowed = FALSE;
806 + g_return_val_if_fail(G_IS_VOLUME(volume), FALSE);
808 + drive = g_volume_get_drive (volume);
810 + has_media = g_drive_has_media(drive);
811 + g_object_unref(drive);
814 + mount = g_volume_get_mount(volume);
816 + is_shadowed = g_mount_is_shadowed(mount);
817 + g_object_unref(mount);
820 + return has_media && !is_shadowed;
823 static inline gboolean
824 -pbvol_show_volume(ThunarVfsVolume *volume){
826 - DBG("Volume: %s [mounted=%x removable=%x present=%x]", thunar_vfs_volume_get_name(volume),
827 - thunar_vfs_volume_is_mounted(volume),
828 - thunar_vfs_volume_is_removable(volume),
829 - thunar_vfs_volume_is_present(volume));
830 +pbvol_show_volume(GVolume *volume){
831 + GMount *mount = g_volume_get_mount(volume);
832 + DBG("Volume: %s [mounted=%x removable=%x present=%x]", g_volume_get_name(volume),
834 + pbvol_is_removable(volume),
835 + pbvol_is_present(volume));
837 + g_object_unref(mount);
839 - return thunar_vfs_volume_is_removable(volume) &&
840 - thunar_vfs_volume_is_present(volume);
841 + return pbvol_is_removable(volume) &&
842 + pbvol_is_present(volume);
846 @@ -153,29 +375,23 @@
850 -pbvol_volumes_added(ThunarVfsVolumeManager *volman, GList *volumes, PlacesBookmarkGroup *bookmark_group)
851 +pbvol_volume_added(GVolumeMonitor *monitor, GVolume *volume, PlacesBookmarkGroup *bookmark_group)
855 pbg_priv(bookmark_group)->changed = TRUE;
856 - while(volumes != NULL){
857 - g_signal_connect_swapped(THUNAR_VFS_VOLUME(volumes->data), "changed",
858 - G_CALLBACK(pbvol_set_changed), bookmark_group);
859 - volumes = volumes->next;
861 + g_signal_connect_swapped(G_VOLUME(volume), "changed",
862 + G_CALLBACK(pbvol_set_changed), bookmark_group);
866 -pbvol_volumes_removed(ThunarVfsVolumeManager *volman, GList *volumes, PlacesBookmarkGroup *bookmark_group)
867 +pbvol_volume_removed(GVolumeMonitor *monitor, GVolume *volume, PlacesBookmarkGroup *bookmark_group)
871 pbg_priv(bookmark_group)->changed = TRUE;
872 - while(volumes != NULL){
873 - g_signal_handlers_disconnect_by_func(THUNAR_VFS_VOLUME(volumes->data),
874 - G_CALLBACK(pbvol_set_changed), bookmark_group);
875 - volumes = volumes->next;
877 + g_signal_handlers_disconnect_by_func(G_VOLUME(volume),
878 + G_CALLBACK(pbvol_set_changed), bookmark_group);
883 pbvol_bookmark_action_finalize(PlacesBookmarkAction *action){
884 g_assert(action != NULL && action->priv != NULL);
886 - ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(action->priv);
887 + GVolume *volume = G_VOLUME(action->priv);
888 g_object_unref(volume);
891 @@ -203,24 +419,28 @@
892 PlacesBookmark *bookmark;
893 PlacesBookmarkAction *action, *terminal, *open;
894 const GList *volumes;
895 - ThunarVfsVolume *volume;
896 - GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
898 - volumes = thunar_vfs_volume_manager_get_volumes(pbg_priv(bookmark_group)->volume_manager);
899 - while(volumes != NULL){
900 - volume = THUNAR_VFS_VOLUME(volumes->data);
905 + volumes = g_volume_monitor_get_volumes(pbg_priv(bookmark_group)->volume_monitor);
906 + while (volumes != NULL) {
907 + volume = volumes->data;
908 + mount = g_volume_get_mount(volume);
910 if(pbvol_show_volume(volume)){
912 - bookmark = places_bookmark_create((gchar*) thunar_vfs_volume_get_name(volume));
913 - if(thunar_vfs_volume_is_mounted(volume))
914 - bookmark->uri = thunar_vfs_path_dup_uri(thunar_vfs_volume_get_mount_point(volume));
916 + bookmark = places_bookmark_create((gchar*) g_volume_get_name(volume));
918 + GFile *file = g_mount_get_root(mount);
919 + bookmark->uri = g_file_get_uri(file);
920 + g_object_unref(file);
922 bookmark->uri = NULL;
923 - bookmark->icon = (gchar*) thunar_vfs_volume_lookup_icon_name(volume, icon_theme);
924 + bookmark->icon = g_volume_get_icon(volume);
925 bookmark->finalize = pbvol_bookmark_finalize;
927 - if(!thunar_vfs_volume_is_mounted(volume)){
930 g_object_ref(volume);
931 action = places_bookmark_action_create(_("Mount and Open"));
936 - if(thunar_vfs_volume_is_ejectable(volume)){
937 + if (g_volume_can_eject(volume)) {
939 g_object_ref(volume);
940 action = places_bookmark_action_create(_("Eject"));
941 @@ -263,18 +483,15 @@
942 action->finalize = pbvol_bookmark_action_finalize;
943 bookmark->actions = g_list_append(bookmark->actions, action);
946 - if(thunar_vfs_volume_is_mounted(volume)){
948 - g_object_ref(volume);
949 - action = places_bookmark_action_create(_("Unmount"));
950 - action->may_block = TRUE;
951 - action->priv = volume;
952 - action->action = pbvol_unmount;
953 - action->finalize = pbvol_bookmark_action_finalize;
954 - bookmark->actions = g_list_append(bookmark->actions, action);
959 + g_object_ref(volume);
960 + action = places_bookmark_action_create(_("Unmount"));
961 + action->may_block = TRUE;
962 + action->priv = volume;
963 + action->action = pbvol_unmount;
964 + action->finalize = pbvol_bookmark_action_finalize;
965 + bookmark->actions = g_list_append(bookmark->actions, action);
968 bookmarks = g_list_prepend(bookmarks, bookmark);
969 @@ -300,22 +517,21 @@
971 const GList *volumes;
973 - volumes = thunar_vfs_volume_manager_get_volumes(pbg_priv(bookmark_group)->volume_manager);
974 + volumes = g_volume_monitor_get_volumes(pbg_priv(bookmark_group)->volume_monitor);
975 while(volumes != NULL){
976 - g_signal_handlers_disconnect_by_func(THUNAR_VFS_VOLUME(volumes->data),
977 + g_signal_handlers_disconnect_by_func(G_VOLUME(volumes->data),
978 G_CALLBACK(pbvol_set_changed), bookmark_group);
979 volumes = volumes->next;
982 - g_signal_handlers_disconnect_by_func(pbg_priv(bookmark_group)->volume_manager,
983 - G_CALLBACK(pbvol_volumes_added), bookmark_group);
984 - g_signal_handlers_disconnect_by_func(pbg_priv(bookmark_group)->volume_manager,
985 - G_CALLBACK(pbvol_volumes_removed), bookmark_group);
987 - g_object_unref(pbg_priv(bookmark_group)->volume_manager);
988 - pbg_priv(bookmark_group)->volume_manager = NULL;
989 - thunar_vfs_shutdown();
991 + g_signal_handlers_disconnect_by_func(pbg_priv(bookmark_group)->volume_monitor,
992 + G_CALLBACK(pbvol_volume_added), bookmark_group);
993 + g_signal_handlers_disconnect_by_func(pbg_priv(bookmark_group)->volume_monitor,
994 + G_CALLBACK(pbvol_volume_removed), bookmark_group);
996 + g_object_unref(pbg_priv(bookmark_group)->volume_monitor);
997 + pbg_priv(bookmark_group)->volume_monitor = NULL;
999 g_free(pbg_priv(bookmark_group));
1000 bookmark_group->priv = NULL;
1003 PlacesBookmarkGroup*
1004 places_bookmarks_volumes_create(gboolean mount_and_open_by_default)
1006 - const GList *volumes;
1008 PlacesBookmarkGroup *bookmark_group;
1010 bookmark_group = places_bookmark_group_create();
1011 @@ -331,24 +547,25 @@
1012 bookmark_group->changed = pbvol_changed;
1013 bookmark_group->finalize = pbvol_finalize;
1014 bookmark_group->priv = g_new0(PBVolData, 1);
1016 - thunar_vfs_init();
1017 - pbg_priv(bookmark_group)->volume_manager = thunar_vfs_volume_manager_get_default();
1019 + pbg_priv(bookmark_group)->volume_monitor = g_volume_monitor_get();
1020 pbg_priv(bookmark_group)->changed = TRUE;
1021 pbg_priv(bookmark_group)->mount_and_open_by_default = mount_and_open_by_default;
1023 - volumes = thunar_vfs_volume_manager_get_volumes(pbg_priv(bookmark_group)->volume_manager);
1024 - while(volumes != NULL){
1025 - g_signal_connect_swapped(THUNAR_VFS_VOLUME(volumes->data), "changed",
1027 + volumes = g_volume_monitor_get_volumes(pbg_priv(bookmark_group)->volume_monitor);
1028 + while(volumes != NULL) {
1029 + g_signal_connect_swapped(G_OBJECT(volumes->data), "changed",
1030 G_CALLBACK(pbvol_set_changed), bookmark_group);
1031 + g_object_unref(volumes->data);
1032 volumes = volumes->next;
1034 + g_list_free(volumes);
1036 - g_signal_connect(pbg_priv(bookmark_group)->volume_manager, "volumes-added",
1037 - G_CALLBACK(pbvol_volumes_added), bookmark_group);
1038 + g_signal_connect(pbg_priv(bookmark_group)->volume_monitor, "volume-added",
1039 + G_CALLBACK(pbvol_volume_added), bookmark_group);
1041 - g_signal_connect(pbg_priv(bookmark_group)->volume_manager, "volumes-removed",
1042 - G_CALLBACK(pbvol_volumes_removed), bookmark_group);
1043 + g_signal_connect(pbg_priv(bookmark_group)->volume_monitor, "volume-removed",
1044 + G_CALLBACK(pbvol_volume_removed), bookmark_group);
1046 return bookmark_group;
1048 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/model_volumes_notify.c xfce4-places-plugin-1.2.0/panel-plugin/model_volumes_notify.c
1049 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/model_volumes_notify.c 1970-01-01 01:00:00.000000000 +0100
1050 +++ xfce4-places-plugin-1.2.0/panel-plugin/model_volumes_notify.c 2011-03-22 11:48:32.000000000 +0100
1052 +/* vi:set et ai sw=2 sts=2 ts=2: */
1054 + * Copyright (c) 2010 Jannis Pohlmann <jannis@xfce.org>
1056 + * This program is free software; you can redistribute it and/or
1057 + * modify it under the terms of the GNU General Public License as
1058 + * published by the Free Software Foundation; either version 2 of
1059 + * the License, or (at your option) any later version.
1061 + * This program is distributed in the hope that it will be useful,
1062 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1063 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1064 + * GNU General Public License for more details.
1066 + * You should have received a copy of the GNU General Public
1067 + * License along with this program; if not, write to the Free
1068 + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1069 + * Boston, MA 02110-1301, USA.
1071 + * NOTE: THIS FILE WAS COPIED FROM THUNAR. FUNCTION PREFIXES WERE
1072 + * ALIGNED TO PLACES PLUGIN AND A FEW TRANSLATOR HINTS WERE ADDED.
1075 +#ifdef HAVE_CONFIG_H
1076 +#include <config.h>
1080 +#include <gio/gio.h>
1082 +#include <libnotify/notify.h>
1084 +#include <libxfce4util/libxfce4util.h>
1086 +#include "model_volumes_notify.h"
1090 +static gboolean pbvol_notify_initted = FALSE;
1095 +pbvol_notify_init (void)
1097 + gchar *spec_version = NULL;
1099 + if (!pbvol_notify_initted
1100 + && notify_init (PACKAGE_NAME))
1102 + /* we do this to work around bugs in libnotify < 0.6.0. Older
1103 + * versions crash in notify_uninit() when no notifications are
1104 + * displayed before. These versions also segfault when the
1105 + * ret_spec_version parameter of notify_get_server_info is
1107 + notify_get_server_info (NULL, NULL, NULL, &spec_version);
1108 + g_free (spec_version);
1110 + pbvol_notify_initted = TRUE;
1113 + return pbvol_notify_initted;
1119 +pbvol_notify_unmount (GMount *mount)
1121 + const gchar * const *icon_names;
1122 + NotifyNotification *notification = NULL;
1123 + const gchar *summary;
1125 + gboolean read_only = FALSE;
1127 + GFile *mount_point;
1129 + gchar *icon_name = NULL;
1133 + g_return_if_fail (G_IS_MOUNT (mount));
1135 + if (!pbvol_notify_init ())
1138 + mount_point = g_mount_get_root (mount);
1140 + info = g_file_query_info (mount_point, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
1141 + G_FILE_QUERY_INFO_NONE, NULL, NULL);
1145 + read_only = !g_file_info_get_attribute_boolean (info,
1146 + G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
1148 + g_object_unref (info);
1151 + g_object_unref (mount_point);
1153 + name = g_mount_get_name (mount);
1155 + icon = g_mount_get_icon (mount);
1156 + if (G_IS_THEMED_ICON (icon))
1158 + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon));
1159 + if (icon_names != NULL)
1160 + icon_name = g_strdup (icon_names[0]);
1162 + else if (G_IS_FILE_ICON (icon))
1164 + icon_file = g_file_icon_get_file (G_FILE_ICON (icon));
1165 + if (icon_file != NULL)
1167 + icon_name = g_file_get_path (icon_file);
1168 + g_object_unref (icon_file);
1171 + g_object_unref (icon);
1173 + if (icon_name == NULL)
1174 + icon_name = g_strdup ("drive-removable-media");
1178 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1179 + summary = _("Unmounting device");
1181 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1182 + message = g_strdup_printf (_("The device \"%s\" is being unmounted by the system. "
1183 + "Please do not remove the media or disconnect the "
1188 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1189 + summary = _("Writing data to device");
1191 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1192 + message = g_strdup_printf (_("There is data that needs to be written to the "
1193 + "device \"%s\" before it can be removed. Please "
1194 + "do not remove the media or disconnect the drive"),
1198 +#ifdef NOTIFY_CHECK_VERSION
1199 +#if NOTIFY_CHECK_VERSION (0, 7, 0)
1200 + notification = notify_notification_new (summary, message, icon_name);
1202 + notification = notify_notification_new (summary, message, icon_name, NULL);
1205 + notification = notify_notification_new (summary, message, icon_name, NULL);
1207 + notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
1208 + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
1209 + notify_notification_show (notification, NULL);
1211 + g_object_set_data_full (G_OBJECT (mount), "pbvol-notification", notification,
1215 + g_free (icon_name);
1222 +pbvol_notify_unmount_finish (GMount *mount)
1224 + NotifyNotification *notification;
1226 + g_return_if_fail (G_IS_MOUNT (mount));
1228 + notification = g_object_get_data (G_OBJECT (mount), "pbvol-notification");
1229 + if (notification != NULL)
1231 + notify_notification_close (notification, NULL);
1232 + g_object_set_data (G_OBJECT (mount), "pbvol-notification", NULL);
1239 +pbvol_notify_eject (GVolume *volume)
1241 + const gchar * const *icon_names;
1242 + NotifyNotification *notification = NULL;
1243 + const gchar *summary;
1245 + gboolean read_only = FALSE;
1248 + GFile *mount_point;
1250 + gchar *icon_name = NULL;
1254 + g_return_if_fail (G_IS_VOLUME (volume));
1256 + if (!pbvol_notify_init ())
1259 + mount = g_volume_get_mount (volume);
1260 + if (mount != NULL)
1262 + mount_point = g_mount_get_root (mount);
1264 + info = g_file_query_info (mount_point, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
1265 + G_FILE_QUERY_INFO_NONE, NULL, NULL);
1270 + !g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
1272 + g_object_unref (info);
1275 + g_object_unref (mount_point);
1278 + name = g_volume_get_name (volume);
1280 + icon = g_volume_get_icon (volume);
1281 + if (G_IS_THEMED_ICON (icon))
1283 + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon));
1284 + if (icon_names != NULL)
1285 + icon_name = g_strdup (icon_names[0]);
1287 + else if (G_IS_FILE_ICON (icon))
1289 + icon_file = g_file_icon_get_file (G_FILE_ICON (icon));
1290 + if (icon_file != NULL)
1292 + icon_name = g_file_get_path (icon_file);
1293 + g_object_unref (icon_file);
1296 + g_object_unref (icon);
1298 + if (icon_name == NULL)
1299 + icon_name = g_strdup ("drive-removable-media");
1303 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1304 + summary = _("Ejecting device");
1306 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1307 + message = g_strdup_printf (_("The device \"%s\" is being ejected. "
1308 + "This may take some time"), name);
1312 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1313 + summary = _("Writing data to device");
1315 + /* TRANSLATORS: Please use the same translation here as in Thunar */
1316 + message = g_strdup_printf (_("There is data that needs to be written to the "
1317 + "device \"%s\" before it can be removed. Please "
1318 + "do not remove the media or disconnect the drive"),
1322 +#ifdef NOTIFY_CHECK_VERSION
1323 +#if NOTIFY_CHECK_VERSION (0, 7, 0)
1324 + notification = notify_notification_new (summary, message, icon_name);
1326 + notification = notify_notification_new (summary, message, icon_name, NULL);
1329 + notification = notify_notification_new (summary, message, icon_name, NULL);
1331 + notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
1332 + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
1333 + notify_notification_show (notification, NULL);
1335 + g_object_set_data_full (G_OBJECT (volume), "pbvol-notification", notification,
1339 + g_free (icon_name);
1346 +pbvol_notify_eject_finish (GVolume *volume)
1348 + NotifyNotification *notification;
1350 + g_return_if_fail (G_IS_VOLUME (volume));
1352 + notification = g_object_get_data (G_OBJECT (volume), "pbvol-notification");
1353 + if (notification != NULL)
1355 + notify_notification_close (notification, NULL);
1356 + g_object_set_data (G_OBJECT (volume), "pbvol-notification", NULL);
1363 +pbvol_notify_uninit (void)
1365 + if (pbvol_notify_initted
1366 + && notify_is_initted ())
1369 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/model_volumes_notify.h xfce4-places-plugin-1.2.0/panel-plugin/model_volumes_notify.h
1370 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/model_volumes_notify.h 1970-01-01 01:00:00.000000000 +0100
1371 +++ xfce4-places-plugin-1.2.0/panel-plugin/model_volumes_notify.h 2011-03-22 11:49:53.000000000 +0100
1373 +/* vi:set et ai sw=2 sts=2 ts=2: */
1375 + * Copyright (c) 2010 Jannis Pohlmann <jannis@xfce.org>
1377 + * This program is free software; you can redistribute it and/or
1378 + * modify it under the terms of the GNU General Public License as
1379 + * published by the Free Software Foundation; either version 2 of
1380 + * the License, or (at your option) any later version.
1382 + * This program is distributed in the hope that it will be useful,
1383 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1384 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1385 + * GNU General Public License for more details.
1387 + * You should have received a copy of the GNU General Public
1388 + * License along with this program; if not, write to the Free
1389 + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1390 + * Boston, MA 02110-1301, USA.
1393 +#ifndef _XFCE_PANEL_PLACES_MODEL_VOLUMES_NOTIFY_H__
1394 +#define _XFCE_PANEL_PLACES_MODEL_VOLUMES_NOTIFY_H__
1397 +#include <gio/gio.h>
1401 +void pbvol_notify_unmount (GMount *mount);
1402 +void pbvol_notify_unmount_finish (GMount *mount);
1403 +void pbvol_notify_eject (GVolume *volume);
1404 +void pbvol_notify_eject_finish (GVolume *volume);
1405 +void pbvol_notify_uninit (void);
1409 +#endif /* !_XFCE_PANEL_PLACES_MODEL_VOLUMES_NOTIFY_H__ */
1410 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/view.c xfce4-places-plugin-1.2.0/panel-plugin/view.c
1411 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/view.c 2011-03-24 11:34:16.000000000 +0100
1412 +++ xfce4-places-plugin-1.2.0/panel-plugin/view.c 2011-03-24 18:12:57.479026034 +0100
1417 -#include "xfce46-compat.h"
1420 #include "support.h"
1423 #include "xfce4-popup-places.h"
1426 +#ifdef HAVE_LIBNOTIFY
1427 +#include "model_volumes_notify.h"
1430 struct _PlacesViewCfgIface
1432 PlacesView *places_view;
1433 @@ -454,6 +456,42 @@
1435 /********** UI Helpers **********/
1438 +pview_get_icon(GIcon *icon)
1440 + GtkIconTheme *itheme = gtk_icon_theme_get_default();
1441 + GdkPixbuf *pix = NULL;
1442 + gint width, height, size;
1444 + g_return_val_if_fail(icon != NULL, NULL);
1446 + if (gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height))
1447 + size = MAX(width, height);
1451 + if (G_IS_THEMED_ICON(icon)) {
1452 + GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(itheme,
1454 + GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_FORCE_SIZE);
1456 + GdkPixbuf *pix_theme = gtk_icon_info_load_icon(icon_info, NULL);
1457 + pix = gdk_pixbuf_copy(pix_theme);
1458 + gtk_icon_info_free(icon_info);
1459 + g_object_unref(G_OBJECT(pix_theme));
1461 + } else if(G_IS_LOADABLE_ICON(icon)) {
1462 + GInputStream *stream = g_loadable_icon_load(G_LOADABLE_ICON(icon),
1463 + size, NULL, NULL, NULL);
1465 + pix = gdk_pixbuf_new_from_stream(stream, NULL, NULL);
1466 + g_object_unref(stream);
1474 pview_destroy_menu(PlacesView *view)
1476 @@ -503,13 +541,7 @@
1478 /* try to set icon */
1479 if(view->cfg->show_icons && bookmark->icon != NULL){
1481 - gint width, height;
1482 - if (gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height))
1483 - icon_size = MAX(width, height);
1486 - pb = xfce_themed_icon_load(bookmark->icon, icon_size);
1487 + pb = pview_get_icon(bookmark->icon);
1489 if(G_LIKELY(pb != NULL)){
1490 image = gtk_image_new_from_pixbuf(pb);
1491 @@ -910,6 +942,10 @@
1492 view->view_cfg_iface = NULL;
1496 +#ifdef HAVE_LIBNOTIFY
1497 + pbvol_notify_uninit();
1501 /* vim: set ai et tabstop=4: */
1502 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/xfce46-compat.c xfce4-places-plugin-1.2.0/panel-plugin/xfce46-compat.c
1503 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/xfce46-compat.c 2009-07-31 07:36:11.000000000 +0200
1504 +++ xfce4-places-plugin-1.2.0/panel-plugin/xfce46-compat.c 1970-01-01 01:00:00.000000000 +0100
1507 - * Code was taken from libxfce4panel (LGPL2 or any later version),
1508 - * distributed here under the GPL.
1510 - * Copyright (c) 2005-2007 Jasper Huijsmans <jasper@xfce.org>
1512 - * This program is free software; you can redistribute it and/or modify
1513 - * it under the terms of the GNU General Public License as published by
1514 - * the Free Software Foundation; either version 2 of the License, or
1515 - * (at your option) any later version.
1517 - * This program is distributed in the hope that it will be useful,
1518 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1519 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1520 - * GNU Library General Public License for more details.
1522 - * You should have received a copy of the GNU General Public License
1523 - * along with this program; if not, write to the Free Software
1524 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1527 -#ifdef HAVE_CONFIG_H
1528 -# include <config.h>
1531 -#ifndef HAVE_LIBXFCE4PANEL_46
1533 -#include "xfce46-compat.h"
1535 -#include <libxfce4panel/xfce-panel-plugin.h>
1536 -#include <libxfce4panel/xfce-panel-macros.h>
1538 -/* support macros for debugging */
1540 -#define _panel_assert(expr) g_assert (expr)
1541 -#define _panel_assert_not_reached() g_assert_not_reached ()
1542 -#define _panel_return_if_fail(expr) g_return_if_fail (expr)
1543 -#define _panel_return_val_if_fail(expr, val) g_return_val_if_fail (expr, (val))
1545 -#define _panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
1546 -#define _panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
1547 -#define _panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
1548 -#define _panel_return_val_if_fail(expr, val) G_STMT_START{ (void)0; }G_STMT_END
1552 - * xfce_panel_plugin_arrow_type:
1553 - * @plugin : an #XfcePanelPlugin
1555 - * Determine the #GtkArrowType for a widget that opens a menu and uses
1556 - * xfce_panel_plugin_position_menu() to position the menu.
1558 - * Returns: The #GtkArrowType to use.
1561 -xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin)
1563 - XfceScreenPosition position;
1564 - GdkScreen *screen;
1565 - GdkRectangle geom;
1568 - if (!GTK_WIDGET_REALIZED (plugin))
1569 - return GTK_ARROW_UP;
1571 - position = xfce_panel_plugin_get_screen_position (plugin);
1575 - case XFCE_SCREEN_POSITION_NW_H:
1576 - case XFCE_SCREEN_POSITION_N:
1577 - case XFCE_SCREEN_POSITION_NE_H:
1578 - return GTK_ARROW_DOWN;
1581 - case XFCE_SCREEN_POSITION_NW_V:
1582 - case XFCE_SCREEN_POSITION_W:
1583 - case XFCE_SCREEN_POSITION_SW_V:
1584 - return GTK_ARROW_RIGHT;
1587 - case XFCE_SCREEN_POSITION_NE_V:
1588 - case XFCE_SCREEN_POSITION_E:
1589 - case XFCE_SCREEN_POSITION_SE_V:
1590 - return GTK_ARROW_LEFT;
1593 - case XFCE_SCREEN_POSITION_SW_H:
1594 - case XFCE_SCREEN_POSITION_S:
1595 - case XFCE_SCREEN_POSITION_SE_H:
1596 - return GTK_ARROW_UP;
1600 - /* get the screen information */
1601 - screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
1602 - mon = gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (plugin)->window);
1603 - gdk_screen_get_monitor_geometry (screen, mon, &geom);
1604 - gdk_window_get_root_origin (GTK_WIDGET (plugin)->window, &x, &y);
1606 - /* get the position based on the screen position */
1607 - if (position == XFCE_SCREEN_POSITION_FLOATING_H)
1608 - return ((y < (geom.y + geom.height / 2)) ? GTK_ARROW_DOWN : GTK_ARROW_UP);
1610 - return ((x < (geom.x + geom.width / 2)) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT);
1617 - * xfce_panel_plugin_position_widget:
1618 - * @plugin : an #XfcePanelPlugin
1619 - * @menu_widget : a #GtkWidget that will be used as popup menu
1620 - * @attach_widget : a #GtkWidget relative to which the menu should be positioned
1621 - * @x : return location for the x coordinate
1622 - * @y : return location for the y coordinate
1624 - * The menu widget is positioned relative to @attach_widget.
1625 - * If @attach_widget is NULL, the menu widget is instead positioned
1626 - * relative to @panel_plugin.
1628 - * This function is intended for custom menu widgets.
1629 - * For a regular #GtkMenu you should use xfce_panel_plugin_position_menu()
1630 - * instead (as callback argument to gtk_menu_popup()).
1632 - * See also: xfce_panel_plugin_position_menu().
1635 -xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
1636 - GtkWidget *menu_widget,
1637 - GtkWidget *attach_widget,
1641 - GtkRequisition req;
1642 - GdkScreen *screen;
1643 - GdkRectangle geom;
1646 - _panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
1647 - _panel_return_if_fail (GTK_IS_WIDGET (menu_widget));
1648 - _panel_return_if_fail (attach_widget == NULL || GTK_IS_WIDGET (attach_widget));
1650 - if (attach_widget == NULL)
1651 - attach_widget = GTK_WIDGET (plugin);
1653 - if (!GTK_WIDGET_REALIZED (menu_widget))
1654 - gtk_widget_realize (menu_widget);
1656 - gtk_widget_size_request (menu_widget, &req);
1657 - gdk_window_get_origin (attach_widget->window, x, y);
1659 - switch (xfce_panel_plugin_arrow_type (plugin))
1661 - case GTK_ARROW_UP:
1665 - case GTK_ARROW_DOWN:
1666 - *y += attach_widget->allocation.height;
1669 - case GTK_ARROW_LEFT:
1673 - default: /* GTK_ARROW_RIGHT and GTK_ARROW_NONE */
1674 - *x += attach_widget->allocation.width;
1678 - screen = gtk_widget_get_screen (attach_widget);
1679 - mon = gdk_screen_get_monitor_at_window (screen, attach_widget->window);
1680 - gdk_screen_get_monitor_geometry (screen, mon, &geom);
1682 - /* keep inside the screen */
1683 - if (*x > geom.x + geom.width - req.width)
1684 - *x = geom.x + geom.width - req.width;
1687 - if (*y > geom.y + geom.height - req.height)
1688 - *y = geom.y + geom.height - req.height;
1692 - if (G_LIKELY (GTK_IS_MENU (menu_widget)))
1693 - gtk_menu_set_screen (GTK_MENU (menu_widget), screen);
1694 - else if (GTK_IS_WINDOW (menu_widget))
1695 - gtk_window_set_screen (GTK_WINDOW (menu_widget), screen);
1701 - * xfce_panel_plugin_position_menu:
1702 - * @menu : a #GtkMenu
1703 - * @x : return location for the x coordinate
1704 - * @y : return location for the y coordinate
1705 - * @push_in : keep inside the screen (see #GtkMenuPositionFunc)
1706 - * @panel_plugin : a pointer to an #XfcePanelPlugin
1708 - * Function to be used as #GtkMenuPositionFunc in a call to gtk_menu_popup().
1709 - * As data argument it needs an #XfcePanelPlugin.
1711 - * The menu is normally positioned relative to @panel_plugin. If you want the
1712 - * menu to be positioned relative to another widget, you can use
1713 - * gtk_menu_attach_to_widget() to explicitly set a 'parent' widget.
1715 - * As a convenience, xfce_panel_plugin_position_menu() calls
1716 - * xfce_panel_plugin_register_menu() for the menu.
1720 - * myplugin_popup_menu (XfcePanelPlugin *plugin,
1722 - * GdkEventButton *ev)
1724 - * gtk_menu_popup (menu, NULL, NULL,
1725 - * xfce_panel_plugin_position_menu, plugin,
1726 - * ev->button, ev->time );
1730 - * For a custom widget that will be used as a popup menu, use
1731 - * xfce_panel_plugin_position_widget() instead.
1733 - * See also: gtk_menu_popup().
1736 -xfce_panel_plugin_position_menu (GtkMenu *menu,
1739 - gboolean *push_in,
1740 - gpointer panel_plugin)
1742 - XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (panel_plugin);
1743 - GtkWidget *attach_widget;
1745 - attach_widget = gtk_menu_get_attach_widget (menu);
1747 - xfce_panel_plugin_position_widget (plugin,
1748 - GTK_WIDGET (menu),
1752 - /* keep inside screen */
1755 - xfce_panel_plugin_register_menu (plugin, menu);
1759 diff -Naur xfce4-places-plugin-1.2.0.orig/panel-plugin/xfce46-compat.h xfce4-places-plugin-1.2.0/panel-plugin/xfce46-compat.h
1760 --- xfce4-places-plugin-1.2.0.orig/panel-plugin/xfce46-compat.h 2008-11-23 12:09:10.000000000 +0100
1761 +++ xfce4-places-plugin-1.2.0/panel-plugin/xfce46-compat.h 1970-01-01 01:00:00.000000000 +0100
1763 -#ifndef _XFCE46_COMPAT
1764 -#define _XFCE46_COMPAT
1766 -#ifdef HAVE_CONFIG_H
1767 -# include <config.h>
1770 -#ifndef HAVE_LIBXFCE4PANEL_46
1772 -#include <gtk/gtk.h>
1774 -void xfce_panel_plugin_position_menu (GtkMenu *menu,
1777 - gboolean *push_in,
1778 - gpointer panel_plugin);