[Xfce4-commits] <exo:master> Drop hal-related code.
Nick Schermer
noreply at xfce.org
Wed Jul 21 18:16:01 CEST 2010
Updating branch refs/heads/master
to 5d698bf98b190d7c76a6b406bd5f542b915d0bd1 (commit)
from 3623e5d4f7fa65138222ea228660cba6d0c5c7a4 (commit)
commit 5d698bf98b190d7c76a6b406bd5f542b915d0bd1
Author: Nick Schermer <nick at xfce.org>
Date: Wed Jul 21 18:08:19 2010 +0200
Drop hal-related code.
The exo-hal library is not used in the core components and the new
thunar-volman is ported to gudev and GIO.
Exo-mount will only couse problems with GIO a suitable replacement
is the udisks executable.
Exo-mount-notify will be moved to Thunar.
Makefile.am | 7 -
configure.in.in | 67 +--
docs/reference/exo-docs.xml | 1 -
docs/reference/exo-sections.txt | 11 -
exo-hal/Makefile.am | 35 --
exo-hal/exo-hal-1.pc.in | 13 -
exo-hal/exo-hal.c | 907 ------------------------------
exo-hal/exo-hal.h | 62 --
exo-mount-notify/Makefile.am | 29 -
exo-mount-notify/README | 10 -
exo-mount-notify/main.c | 265 ---------
exo-mount/Makefile.am | 61 --
exo-mount/README | 13 -
exo-mount/exo-mount-hal.c | 1180 ---------------------------------------
exo-mount/exo-mount-hal.h | 50 --
exo-mount/main.c | 508 -----------------
exo-mount/mount.rc | 54 --
exo.spec.in | 3 -
po/POTFILES.in | 7 -
19 files changed, 4 insertions(+), 3279 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8c13ac9..7517cfa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,4 @@
-if HAVE_LIBNOTIFY
-EXO_MOUNT_NOTIFY_SUBDIR=exo-mount-notify
-endif
-
if HAVE_PYTHON
PYTHON_SUBDIR=python
endif
@@ -13,10 +9,7 @@ SUBDIRS = \
exo-support \
exo-desktop-item-edit \
exo-gio-module \
- exo-hal \
exo-helper \
- exo-mount \
- $(EXO_MOUNT_NOTIFY_SUBDIR) \
exo-open \
docs \
icons \
diff --git a/configure.in.in b/configure.in.in
index cb7f893..7a7c248 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -94,16 +94,6 @@ AC_PROG_INTLTOOL([0.31], [no-xml])
AC_PROG_LIBTOOL()
AC_CHECK_PROGS([PERL], [perl5 perl])
-dnl ************************************************
-dnl *** Loopup hardcoded paths we use internally ***
-dnl ************************************************
-AC_PATH_PROG([PATH_MOUNT], [mount], [/bin/mount])
-AC_PATH_PROG([PATH_UMOUNT], [umount], [/bin/umount])
-AC_PATH_PROG([PATH_EJECT], [eject], [/usr/bin/eject])
-AC_SUBST([PATH_MOUNT])
-AC_SUBST([PATH_UMOUNT])
-AC_SUBST([PATH_EJECT])
-
dnl ***************************************
dnl *** Check for required Perl modules ***
dnl ***************************************
@@ -116,18 +106,15 @@ dnl ***************************************
dnl *** Check for standard header files ***
dnl ***************************************
AC_HEADER_STDC()
-AC_CHECK_HEADERS([assert.h errno.h fcntl.h fnmatch.h fstab.h libintl.h \
- locale.h math.h mmintrin.h mntent.h \
- paths.h regex.h signal.h stdarg.h string.h sys/mman.h \
- sys/mnttab.h sys/mount.h sys/param.h sys/resource.h \
- sys/statvfs.h sys/stat.h sys/time.h sys/types.h sys/ucred.h \
- sys/wait.h time.h])
+AC_CHECK_HEADERS([assert.h errno.h fcntl.h fnmatch.h libintl.h \
+ locale.h math.h mmintrin.h paths.h regex.h \
+ signal.h stdarg.h string.h sys/mman.h \
+ sys/stat.h sys/time.h sys/types.h sys/wait.h time.h])
dnl ************************************
dnl *** Check for standard functions ***
dnl ************************************
AC_FUNC_MMAP()
-AC_CHECK_FUNCS([getfsstat getmntent getvfsstat regexec setfsent setmntent])
dnl ***************************************
dnl *** Check for strftime() extensions ***
@@ -188,38 +175,6 @@ dnl *** Check for X11 ***
dnl *********************
XDT_CHECK_LIBX11_REQUIRE()
-dnl **************************************
-dnl *** Check for libnotify (optional) ***
-dnl **************************************
-XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY], [libnotify], [0.4.0], [notifications], [Notifications support], [yes])
-
-dnl ********************************
-dnl *** Check for HAL (optional) ***
-dnl ********************************
-XDT_CHECK_OPTIONAL_PACKAGE([HAL], [hal-storage], [0.5.7], [hal], [HAL support], [yes])
-if test x"$HAL_FOUND" = x"yes"; then
- dnl # substituted into exo-hal-1.pc
- HAL_STORAGE_DEPENDENCY="hal-storage"
-
- dnl # Check if LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL is declared
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $HAL_CFLAGS"
- AC_MSG_CHECKING([whether LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL is declared])
- AC_COMPILE_IFELSE(AC_LANG_SOURCE(
- [#include <libhal-storage.h>
- int main (int argc, char **argv) { return LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL; }
- ]),
- [
- AC_DEFINE([HAVE_LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL], [1], [Define if LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL present])
- AC_MSG_RESULT([yes])
- ],
- [
- AC_MSG_RESULT([no])
- ])
- CFLAGS="$save_CFLAGS"
-fi
-AC_SUBST([HAL_STORAGE_DEPENDENCY])
-
dnl *************************
dnl *** Check for gtk-doc ***
dnl *************************
@@ -374,12 +329,8 @@ exo/exo-config.h
exo-csource/Makefile
exo-desktop-item-edit/Makefile
exo-gio-module/Makefile
-exo-hal/Makefile
-exo-hal/exo-hal-1.pc
exo-helper/Makefile
exo-helper/helpers/Makefile
-exo-mount/Makefile
-exo-mount-notify/Makefile
exo-open/Makefile
exo-support/Makefile
icons/Makefile
@@ -399,16 +350,6 @@ dnl ***************************
echo
echo "Build Configuration:"
echo
-if test x"$HAL_FOUND" = x"yes"; then
-echo "* HAL support: yes"
-else
-echo "* HAL support: no"
-fi
-if test x"$LIBNOTIFY_FOUND" = x"yes"; then
-echo "* Notification support: yes"
-else
-echo "* Notification support: no"
-fi
if test x"$GIO_UNIX_FOUND" = x"yes"; then
echo "* GIO-Unix features: yes"
echo " - GIO Module Dir: $GIOMODULEDIR"
diff --git a/docs/reference/exo-docs.xml b/docs/reference/exo-docs.xml
index 64a4b20..eb20cec 100644
--- a/docs/reference/exo-docs.xml
+++ b/docs/reference/exo-docs.xml
@@ -271,7 +271,6 @@
<xi:include href="xml/exo-execute.xml"/>
<xi:include href="xml/exo-string.xml"/>
<xi:include href="xml/exo-utils.xml"/>
- <xi:include href="xml/exo-hal.xml"/>
<xi:include href="xml/exo-xsession-client.xml"/>
</part>
diff --git a/docs/reference/exo-sections.txt b/docs/reference/exo-sections.txt
index 8e29fd8..d9a865d 100644
--- a/docs/reference/exo-sections.txt
+++ b/docs/reference/exo-sections.txt
@@ -457,17 +457,6 @@ exo_atomic_dec
</SECTION>
<SECTION>
-<FILE>exo-hal</FILE>
-<TITLE>HAL Support Functions</TITLE>
-exo_hal_init
-exo_hal_udi_validate
-exo_hal_drive_compute_display_name
-exo_hal_drive_compute_icon_list
-exo_hal_volume_compute_display_name
-exo_hal_volume_compute_icon_list
-</SECTION>
-
-<SECTION>
<FILE>exo-xsession-client</FILE>
<TITLE>ExoXsessionClient</TITLE>
ExoXsessionClient
diff --git a/exo-hal/Makefile.am b/exo-hal/Makefile.am
deleted file mode 100644
index 9414aff..0000000
--- a/exo-hal/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-
-INCLUDES = \
- -I$(top_srcdir) \
- -DDBUS_API_SUBJECT_TO_CHANGE \
- -DG_LOG_DOMAIN=\"exo-hal\" \
- -DPACKAGE_LOCALE_DIR=\"$(localedir)\"
-
-libexohalincludedir = $(includedir)/exo-1/exo-hal
-libexohalinclude_HEADERS = exo-hal.h
-
-lib_LTLIBRARIES = \
- libexo-hal-1.la
-
-libexo_hal_1_la_SOURCES = \
- $(libexohalinclude_HEADERS) \
- exo-hal.c
-
-libexo_hal_1_la_CFLAGS = \
- $(GLIB_CFLAGS) \
- $(HAL_CFLAGS)
-
-libexo_hal_1_la_LDFLAGS = \
- -export-dynamic \
- -version-info $(LIBEXO_VERINFO) \
- -export-symbols-regex "^[^_].*" \
- -no-undefined
-
-libexo_hal_1_la_LIBADD = \
- $(GLIB_LIBS) \
- $(HAL_LIBS)
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = exo-hal-$(LIBEXO_VERSION_API).pc
-
-# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/exo-hal/exo-hal-1.pc.in b/exo-hal/exo-hal-1.pc.in
deleted file mode 100644
index 809ac2e..0000000
--- a/exo-hal/exo-hal-1.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-exo_api_version=@LIBEXO_VERSION_API@
-
-Name: exo-hal
-Description: HAL support library for exo
-Requires: glib-2.0 @HAL_STORAGE_DEPENDENCY@
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lexo-hal-${exo_api_version}
-Cflags: -I${includedir}/exo-${exo_api_version}
diff --git a/exo-hal/exo-hal.c b/exo-hal/exo-hal.c
deleted file mode 100644
index a72d9f3..0000000
--- a/exo-hal/exo-hal.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/*-
- * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>.
- *
- * 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 the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; 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_LIBINTL_h
-#include <libintl.h>
-#endif
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#ifdef HAVE_HAL
-#include <libhal-storage.h>
-#endif
-
-#include <glib/gi18n-lib.h>
-
-#include <exo-hal/exo-hal.h>
-
-/**
- * SECTION: exo-hal
- * @title: HAL Support Functions
- * @short_description: Miscellaneous Utility Functions for HAL integration
- * @include: exo-hal/exo-hal.h
- * @see_also: <ulink type="http" url="http://gitweb.freedesktop.org/?p=hal.git;a=blob_plain;f=doc/spec/hal-spec.html">
- * HAL Specification</ulink>
- *
- * This is an additional library that ships with the
- * <application>exo</application> package and offers support functions
- * for HAL integration, that are used by <command>exo-mount</command>
- * and <command>Thunar</command> to figure out display names and icons
- * to visually present HAL devices to the user. The library may also be
- * used by other components to offer smooth integration between various
- * parts of the desktop, making sure that the same names and icons are
- * used for devices everywhere.
- *
- * Since HAL is currently an optional dependency for Xfce, you should
- * first check whether HAL support is really available by calling the
- * <link linkend="exo-hal-init"><function>exo_hal_init()</function></link>
- * function, which returns <literal>TRUE</literal> if HAL support is
- * available and the other functions will be able to do their work, or
- * <literal>FALSE</literal> if the functions will return hardcoded default
- * values instead. The <link linkend="exo-hal-init">
- * <function>exo_hal_init()</function></link> also takes care of setting
- * up the internationalization support, so make sure you call it first.
- *
- * The HAL support module is not part of the main <filename>exo</filename>
- * library, so you if you want to use any of these functions you will
- * need to explicitly link to the <filename>exo-hal</filename> library.
- * This is done with the <command>pkg-config</command> utility, using
- * <filename>exo-hal-1</filename> as the package name.
- **/
-
-
-
-#ifdef HAVE_HAL
-/* HAL icon mappings, borrowed from gnome-vfs-hal-mounts.c (Revision 5187) */
-typedef enum
-{
- HAL_ICON_DRIVE_REMOVABLE_DISK = 0x10000,
- HAL_ICON_DRIVE_REMOVABLE_DISK_IDE = 0x10001,
- HAL_ICON_DRIVE_REMOVABLE_DISK_SCSI = 0x10002,
- HAL_ICON_DRIVE_REMOVABLE_DISK_USB = 0x10003,
- HAL_ICON_DRIVE_REMOVABLE_DISK_IEEE1394 = 0x10004,
- HAL_ICON_DRIVE_REMOVABLE_DISK_CCW = 0x10005,
- HAL_ICON_DRIVE_DISK = 0x10100,
- HAL_ICON_DRIVE_DISK_IDE = 0x10101,
- HAL_ICON_DRIVE_DISK_SCSI = 0x10102,
- HAL_ICON_DRIVE_DISK_USB = 0x10103,
- HAL_ICON_DRIVE_DISK_IEEE1394 = 0x10104,
- HAL_ICON_DRIVE_DISK_CCW = 0x10105,
- HAL_ICON_DRIVE_CDROM = 0x10200,
- HAL_ICON_DRIVE_CDWRITER = 0x102ff,
- HAL_ICON_DRIVE_FLOPPY = 0x10300,
- HAL_ICON_DRIVE_TAPE = 0x10400,
- HAL_ICON_DRIVE_COMPACT_FLASH = 0x10500,
- HAL_ICON_DRIVE_MEMORY_STICK = 0x10600,
- HAL_ICON_DRIVE_SMART_MEDIA = 0x10700,
- HAL_ICON_DRIVE_SD_MMC = 0x10800,
- HAL_ICON_DRIVE_CAMERA = 0x10900,
- HAL_ICON_DRIVE_PORTABLE_AUDIO_PLAYER = 0x10a00,
- HAL_ICON_DRIVE_ZIP = 0x10b00,
- HAL_ICON_DRIVE_JAZ = 0x10c00,
- HAL_ICON_DRIVE_FLASH_KEY = 0x10d00,
-
- HAL_ICON_VOLUME_REMOVABLE_DISK = 0x20000,
- HAL_ICON_VOLUME_REMOVABLE_DISK_IDE = 0x20001,
- HAL_ICON_VOLUME_REMOVABLE_DISK_SCSI = 0x20002,
- HAL_ICON_VOLUME_REMOVABLE_DISK_USB = 0x20003,
- HAL_ICON_VOLUME_REMOVABLE_DISK_IEEE1394 = 0x20004,
- HAL_ICON_VOLUME_REMOVABLE_DISK_CCW = 0x20005,
- HAL_ICON_VOLUME_DISK = 0x20100,
- HAL_ICON_VOLUME_DISK_IDE = 0x20101,
- HAL_ICON_VOLUME_DISK_SCSI = 0x20102,
- HAL_ICON_VOLUME_DISK_USB = 0x20103,
- HAL_ICON_VOLUME_DISK_IEEE1394 = 0x20104,
- HAL_ICON_VOLUME_DISK_CCW = 0x20105,
- /* specifically left out as we use icons based on media type in the optical drive
- HAL_ICON_VOLUME_CDROM = 0x20200 */
- HAL_ICON_VOLUME_FLOPPY = 0x20300,
- HAL_ICON_VOLUME_TAPE = 0x20400,
- HAL_ICON_VOLUME_COMPACT_FLASH = 0x20500,
- HAL_ICON_VOLUME_MEMORY_STICK = 0x20600,
- HAL_ICON_VOLUME_SMART_MEDIA = 0x20700,
- HAL_ICON_VOLUME_SD_MMC = 0x20800,
- HAL_ICON_VOLUME_CAMERA = 0x20900,
- HAL_ICON_VOLUME_PORTABLE_AUDIO_PLAYER = 0x20a00,
- HAL_ICON_VOLUME_ZIP = 0x20b00,
- HAL_ICON_VOLUME_JAZ = 0x20c00,
- HAL_ICON_VOLUME_FLASH_KEY = 0x20d00,
-
- HAL_ICON_DISC_CDROM = 0x30000,
- HAL_ICON_DISC_CDR = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_CDR,
- HAL_ICON_DISC_CDRW = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_CDRW,
- HAL_ICON_DISC_DVDROM = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDROM,
- HAL_ICON_DISC_DVDRAM = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDRAM,
- HAL_ICON_DISC_DVDR = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDR,
- HAL_ICON_DISC_DVDRW = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDRW,
- HAL_ICON_DISC_DVDPLUSR = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR,
- HAL_ICON_DISC_DVDPLUSRW = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDPLUSRW,
- HAL_ICON_DISC_DVDPLUSR_DL = HAL_ICON_DISC_CDROM + LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR_DL,
-} HalIcon;
-
-typedef struct
-{
- HalIcon icon;
- const gchar name[25];
-} HalIconPair;
-
-/* by design, the enums are laid out so we can do easy computations */
-static const HalIconPair hal_icon_mapping[] =
-{
-#if 0 /* gnome-dev-removable is the fallback */
- { HAL_ICON_DRIVE_REMOVABLE_DISK, "gnome-dev-removable" },
- { HAL_ICON_DRIVE_REMOVABLE_DISK_IDE, "gnome-dev-removable" },
- { HAL_ICON_DRIVE_REMOVABLE_DISK_SCSI, "gnome-dev-removable" },
-#endif
- { HAL_ICON_DRIVE_REMOVABLE_DISK_USB, "gnome-dev-removable-usb" },
- { HAL_ICON_DRIVE_REMOVABLE_DISK_IEEE1394, "gnome-dev-removable-1394" },
-#if 0 /* gnome-dev-removable is the fallback */
- { HAL_ICON_DRIVE_REMOVABLE_DISK_CCW, "gnome-dev-removable" },
- { HAL_ICON_DRIVE_DISK, "gnome-dev-removable" },
- { HAL_ICON_DRIVE_DISK_IDE, "gnome-dev-removable" },
- { HAL_ICON_DRIVE_DISK_SCSI, "gnome-dev-removable" }, /* TODO: gnome-dev-removable-scsi */
-#endif
- { HAL_ICON_DRIVE_DISK_USB, "gnome-dev-removable-usb" },
- { HAL_ICON_DRIVE_DISK_IEEE1394, "gnome-dev-removable-1394" },
-#if 0 /* gnome-dev-removable is the fallback */
- { HAL_ICON_DRIVE_DISK_CCW, "gnome-dev-removable" },
- { HAL_ICON_DRIVE_CDROM, "gnome-dev-removable" }, /* TODO: gnome-dev-removable-cdrom */
- { HAL_ICON_DRIVE_CDWRITER, "gnome-dev-removable" }, /* TODO: gnome-dev-removable-cdwriter */
-#endif
- { HAL_ICON_DRIVE_FLOPPY, "gnome-dev-floppy" },
-#if 0 /* gnome-dev-removable is the fallback */
- { HAL_ICON_DRIVE_TAPE, "gnome-dev-removable" }, /* TODO: gnome-dev-removable-tape */
-#endif
- { HAL_ICON_DRIVE_COMPACT_FLASH, "gnome-dev-media-cf" },
- { HAL_ICON_DRIVE_MEMORY_STICK, "gnome-dev-media-ms" },
- { HAL_ICON_DRIVE_SMART_MEDIA, "gnome-dev-media-sm" },
- { HAL_ICON_DRIVE_SD_MMC, "gnome-dev-media-sdmmc" },
- { HAL_ICON_DRIVE_CAMERA, "camera-photo" },
- { HAL_ICON_DRIVE_PORTABLE_AUDIO_PLAYER, "gnome-dev-ipod" },
- { HAL_ICON_DRIVE_ZIP, "gnome-dev-zipdisk" },
- { HAL_ICON_DRIVE_JAZ, "gnome-dev-jazdisk" },
-#if 0 /* gnome-dev-removable is the fallback */
- { HAL_ICON_DRIVE_FLASH_KEY, "gnome-dev-removable" }, /* TODO: gnome-dev-removable-pendrive */
-#endif
-
- { HAL_ICON_VOLUME_REMOVABLE_DISK, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_REMOVABLE_DISK_IDE, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_REMOVABLE_DISK_SCSI, "gnome-dev-harddisk" }, /* TODO: gnome-dev-harddisk-scsi */
- { HAL_ICON_VOLUME_REMOVABLE_DISK_USB, "gnome-dev-harddisk-usb" },
- { HAL_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394" },
- { HAL_ICON_VOLUME_REMOVABLE_DISK_CCW, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_DISK, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_DISK_IDE, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_DISK_SCSI, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_DISK_USB, "gnome-dev-harddisk-usb" },
- { HAL_ICON_VOLUME_DISK_IEEE1394, "gnome-dev-harddisk-1394" },
- { HAL_ICON_VOLUME_DISK_CCW, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_FLOPPY, "gnome-dev-floppy" },
- { HAL_ICON_VOLUME_TAPE, "gnome-dev-harddisk" },
- { HAL_ICON_VOLUME_COMPACT_FLASH, "gnome-dev-media-cf" },
- { HAL_ICON_VOLUME_MEMORY_STICK, "gnome-dev-media-ms" },
- { HAL_ICON_VOLUME_SMART_MEDIA, "gnome-dev-media-sm" },
- { HAL_ICON_VOLUME_SD_MMC, "gnome-dev-media-sdmmc" },
- { HAL_ICON_VOLUME_CAMERA, "camera-photo" },
- { HAL_ICON_VOLUME_PORTABLE_AUDIO_PLAYER, "gnome-dev-ipod" },
- { HAL_ICON_VOLUME_ZIP, "gnome-dev-zipdisk" },
- { HAL_ICON_VOLUME_JAZ, "gnome-dev-jazdisk" },
- { HAL_ICON_VOLUME_FLASH_KEY, "gnome-dev-harddisk" }, /* TODO: gnome-dev-pendrive */
-
- { HAL_ICON_DISC_CDROM, "gnome-dev-cdrom" },
- { HAL_ICON_DISC_CDR, "gnome-dev-disc-cdr" },
- { HAL_ICON_DISC_CDRW, "gnome-dev-disc-cdrw" },
- { HAL_ICON_DISC_DVDROM, "gnome-dev-disc-dvdrom" },
- { HAL_ICON_DISC_DVDRAM, "gnome-dev-disc-dvdram" },
- { HAL_ICON_DISC_DVDR, "gnome-dev-disc-dvdr" },
- { HAL_ICON_DISC_DVDRW, "gnome-dev-disc-dvdrw" },
- { HAL_ICON_DISC_DVDPLUSR, "gnome-dev-disc-dvdr-plus" },
- { HAL_ICON_DISC_DVDPLUSRW, "gnome-dev-disc-dvdrw" }, /* TODO: gnome-dev-disc-dvdrw-plus */
- { HAL_ICON_DISC_DVDPLUSR_DL, "gnome-dev-disc-dvdr-plus" }, /* TODO: gnome-dev-disc-dvdr-plus-dl */
-};
-
-static const gchar*
-exo_hal_lookup_icon_name (HalIcon icon)
-{
- guint n;
-
- for (n = 0; n < G_N_ELEMENTS (hal_icon_mapping); ++n)
- if (hal_icon_mapping[n].icon == icon)
- return hal_icon_mapping[n].name;
-
- return NULL;
-}
-#endif
-
-
-
-/**
- * exo_hal_init:
- *
- * Initializes the HAL support module, which includes setting up the
- * internationalization support. Returns %TRUE if support for HAL was
- * enabled at compile time, %FALSE otherwise.
- *
- * Make sure you call this function first prior to calling any of the
- * functions below.
- *
- * Return value: %TRUE if HAL support is available, %FALSE otherwise.
- *
- * Since: 0.3.1.13
- **/
-gboolean
-exo_hal_init (void)
-{
-#ifdef HAVE_HAL
- /* setup the i18n support */
- bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
-#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
- /* tell the caller that we generally support HAL */
- return TRUE;
-#else
- /* tell the caller that we do not support HAL */
- return FALSE;
-#endif
-}
-
-
-
-/**
- * exo_hal_udi_validate:
- * @udi : the HAL device UDI.
- * @len : the max number of bytes to validate, or <literal>-1</literal> to go until NUL.
- * @end : return location for end of valid data.
- *
- * Checks that the given range of the @udi is a valid HAL device UDI (i.e. a valid
- * D-BUS object path name in the D-BUS protocol). Part of the validation ensures
- * that the @udi contains only ASCII.
- *
- * If @end is non-%NULL, then then end of the valid range will be stored there (i.e. the
- * start of the first invalid character if some bytes were invalid, or the end of the
- * text being validated otherwise).
- *
- * Returns %TRUE if all of @udi was valid. All HAL routines <emphasis>require</emphasis>
- * valid UDIs as input; so data read from a file or the command line should be checked
- * with exo_hal_udi_validate() before doing anything else with it.
- *
- * Note that exo_hal_udi_validate() is always available, no matter if HAL support was
- * enabled at compile time.
- *
- * Return value: %TRUE if @udi was a valid HAL device UDI.
- *
- * Since: 0.3.1.13
- **/
-gboolean
-exo_hal_udi_validate (const gchar *udi,
- gssize len,
- gchar **end)
-{
- const gchar *last_slash;
- const gchar *e;
- const gchar *s;
-
- g_return_val_if_fail (udi != NULL, FALSE);
- g_return_val_if_fail (len >= -1, FALSE);
-
- /* determine the length if not specified */
- if (G_LIKELY (len == -1))
- len = strlen (udi);
-
- /* let end point to the first character */
- if (G_UNLIKELY (end != NULL))
- *end = (gchar *) udi;
-
- /* empty strings are never valid HAL UDIs */
- if (G_UNLIKELY (len == 0))
- return FALSE;
-
- /* valid HAL device UDIs start with a "/" */
- if (G_UNLIKELY (*udi != '/'))
- return FALSE;
-
- for (last_slash = udi, e = udi + len, s = udi + 1; s != e; ++s)
- {
- if (*s == '/')
- {
- if ((s - last_slash) < 2)
- {
- /* no empty path components allowed */
- if (G_UNLIKELY (end != NULL))
- *end = (gchar *) s;
- return FALSE;
- }
- last_slash = s;
- }
- else if (!g_ascii_isalnum (*s) && *s != '_')
- {
- /* only alphanumeric charaters and '_' */
- if (G_UNLIKELY (end != NULL))
- *end = (gchar *) s;
- return FALSE;
- }
- }
-
- if ((e - last_slash) < 2 && len > 1)
- {
- /* trailing slash not allowed unless the string is "/" */
- if (G_UNLIKELY (end != NULL))
- *end = (gchar *) last_slash;
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-
-/**
- * exo_hal_drive_compute_display_name:
- * @context : a #LibHalContext, connected to the HAL daemon.
- * @drive : a #LibHalDrive.
- *
- * Computes a usable display name that should be used to present
- * @drive to the user. May return %NULL if it's unable to determine
- * a display name (i.e. if HAL support is not available), in which
- * case the caller should try to come up with a fallback name on
- * it's own (i.e. using the basename of the @drive<!---->s device
- * file or something like that).
- *
- * The caller is responsible to free the returned string using
- * g_free() when no longer needed.
- *
- * Return value: a display name for the @drive that should be used
- * to present the @drive to the user or %NULL if the
- * function is unable to come up with a usable name
- * and the caller should figure out a fallback name
- * on its own.
- *
- * Since: 0.3.1.13
- **/
-gchar*
-exo_hal_drive_compute_display_name (struct LibHalContext_s *context,
- struct LibHalDrive_s *drive)
-{
-#ifdef HAVE_HAL
- LibHalDriveCdromCaps cdrom_caps;
- const gchar *vendor;
- const gchar *model;
- const gchar *second;
- const gchar *first;
- gchar *display_name;
- gchar *name;
-
- g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail (drive != NULL, NULL);
-
- /* determine the vendor and the model */
- vendor = libhal_drive_get_vendor (drive);
- model = libhal_drive_get_model (drive);
-
- /* display name depends on the drive type */
- switch (libhal_drive_get_type (drive))
- {
- case LIBHAL_DRIVE_TYPE_CDROM:
- /* determine the capabilities of the CD-ROM drive */
- cdrom_caps = libhal_drive_get_cdrom_caps (drive);
-
- /* determine the first capability of the drive */
- if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_CDRW) != 0)
- first = "CD-RW";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_CDR) != 0)
- first = "CD-R";
- else
- first = "CD-ROM";
-
- /* determine the second capability of the drive (if any) */
- if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW) != 0)
- second = "/HD DVD-RW";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_HDDVDR) != 0)
- second = "/HD DVD-R";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_HDDVDROM) != 0)
- second = "/HD DVD-ROM";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_BDRE) != 0)
- second = "/BD-RE";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_BDR) != 0)
- second = "/BD-R";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_BDROM) != 0)
- second = "/BD-ROM";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDRW) != 0
- && (cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW) != 0)
- {
- if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL) != 0
-#ifdef HAVE_LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL
- || (cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL) != 0
-#endif
- )
- second = "/DVD±RW DL";
- else
- second = "/DVD±RW";
- }
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDR) != 0
- && (cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSR) != 0)
- {
- if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL) != 0)
- second = "/DVD±R DL";
- else
- second = "/DVD±R";
- }
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDRAM) != 0)
- second = "/DVD-RAM";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDRW) != 0)
- second = "/DVD-RW";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDR) != 0)
- second = "/DVD-R";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW) != 0)
- second = "/DVD+RW";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSR) != 0)
- second = "/DVD+R";
- else if ((cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDROM) != 0)
- second = "/DVD-ROM";
- else
- second = "";
-
- /* combine the capabilities */
- name = g_strconcat (first, second, NULL);
-
- /* now the exact name depends on whether the drive is hotpluggable */
- if (G_UNLIKELY (libhal_drive_is_hotpluggable (drive)))
- display_name = g_strdup_printf (_("External %s Drive"), name);
- else
- display_name = g_strdup_printf (_("%s Drive"), name);
-
- /* cleanup */
- g_free (name);
- break;
-
- case LIBHAL_DRIVE_TYPE_FLOPPY:
- /* we support both internal and external floppy drives */
- if (G_UNLIKELY (libhal_drive_is_hotpluggable (drive)))
- display_name = g_strdup (_("External Floppy Drive"));
- else
- display_name = g_strdup (_("Floppy Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_COMPACT_FLASH:
- display_name = g_strdup (_("Compact Flash Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
- display_name = g_strdup (_("Memory Stick Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_SMART_MEDIA:
- display_name = g_strdup (_("Smart Media Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_SD_MMC:
- display_name = g_strdup (_("SD/MMC Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_ZIP:
- display_name = g_strdup (_("Zip Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_JAZ:
- display_name = g_strdup (_("Jaz Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_FLASHKEY:
- display_name = g_strdup (_("Pen Drive"));
- break;
-
- case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
- /* combine the vendor and model (dropping any redundant whitespace) */
- name = g_strdup_printf ("%s %s", (vendor != NULL) ? vendor : "", (model != NULL) ? model : "");
- g_strstrip (name);
-
- /* TRANSLATORS: This string requires special care as %s may be the empty string. Trailing/leading whitespace will be removed. */
- display_name = g_strdup_printf (_("%s Music Player"), name);
-
- /* strip the display name */
- g_strstrip (display_name);
-
- /* cleanup */
- g_free (name);
- break;
-
- case LIBHAL_DRIVE_TYPE_CAMERA:
- /* combine the vendor and model (dropping any redundant whitespace) */
- name = g_strdup_printf ("%s %s", (vendor != NULL) ? vendor : "", (model != NULL) ? model : "");
- g_strstrip (name);
-
- /* TRANSLATORS: This string requires special care as %s may be the empty string. Trailing/leading whitespace will be removed. */
- display_name = g_strdup_printf (_("%s Digital Camera"), name);
-
- /* strip the display name */
- g_strstrip (display_name);
-
- /* cleanup */
- g_free (name);
- break;
-
- default:
- /* generate a display name from the vendor and the model */
- display_name = g_strdup_printf ("%s %s", (vendor != NULL) ? vendor : "", (model != NULL) ? model : "");
-
- /* drop additional whitespace */
- g_strstrip (display_name);
-
- /* check if we still don't have a name */
- if (G_UNLIKELY (*display_name == '\0'))
- {
- /* cleanup */
- g_free (display_name);
-
- /* last fallback to "Drive" */
- display_name = g_strdup (_("Drive"));
- }
- break;
- }
-
- return display_name;
-#else
- /* HAL is not available, impossible to figure out
- * a usable display name for the given drive...
- */
- return NULL;
-#endif
-}
-
-
-
-/**
- * exo_hal_drive_compute_icon_list:
- * @context : a #LibHalContext, connected to the HAL daemon.
- * @drive : a #LibHalDrive.
- *
- * Tries to find a list of icon names that may be used to visually present @drive
- * to the user. The list is sorted by relevance, with the best icon matches
- * appearing first in the list.
- *
- * The caller is responsible to free the returned list using
- * <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_free, NULL);
- * g_list_free (list);
- * </programlisting></informalexample>
- * when no longer needed.
- *
- * Return value: a list of icon names for icons that can be used to visually
- * represent the @drive to the user.
- *
- * Since: 0.3.1.13
- **/
-GList*
-exo_hal_drive_compute_icon_list (struct LibHalContext_s *context,
- struct LibHalDrive_s *drive)
-{
- GList *icon_list = NULL;
-
-#ifdef HAVE_HAL
- LibHalDriveCdromCaps cdrom_caps;
- LibHalDriveType type;
- LibHalDriveBus bus;
- const gchar *icon_name;
-
- g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail (drive != NULL, NULL);
-
- /* check if a dedicated drive icon name is known */
- icon_name = libhal_drive_get_dedicated_icon_drive (drive);
- if (G_UNLIKELY (icon_name != NULL))
- icon_list = g_list_append (icon_list, g_strdup (icon_name));
-
- /* determine the type and bus of the drive */
- type = libhal_drive_get_type (drive);
- bus = libhal_drive_get_bus (drive);
-
- /* lookup depends on the drive type */
- switch (type)
- {
- case LIBHAL_DRIVE_TYPE_CDROM:
- /* determine the CD-ROM capabilities */
- cdrom_caps = libhal_drive_get_cdrom_caps (drive);
-
- /* check if this is a CD/DVD writer */
- if ((cdrom_caps & (LIBHAL_DRIVE_CDROM_CAPS_CDROM | LIBHAL_DRIVE_CDROM_CAPS_DVDROM)) != cdrom_caps)
- {
- /* check if we have a specific writer icon here */
- icon_name = exo_hal_lookup_icon_name (0x10000 + type * 0x100 + 0xff);
- if (G_LIKELY (icon_name != NULL))
- icon_list = g_list_append (icon_list, g_strdup (icon_name));
- }
- break;
-
- case LIBHAL_DRIVE_TYPE_DISK:
- case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK:
- /* lookup an icon based on the type and the bus */
- icon_name = exo_hal_lookup_icon_name (0x10000 + type * 0x100 + bus);
- if (G_LIKELY (icon_name != NULL))
- icon_list = g_list_append (icon_list, g_strdup (icon_name));
- break;
-
- default:
- /* fallback below */
- break;
- }
-
- /* lookup an icon based solely on the drive type */
- icon_name = exo_hal_lookup_icon_name (0x10000 + type * 0x100);
- if (G_LIKELY (icon_name != NULL))
- icon_list = g_list_append (icon_list, g_strdup (icon_name));
-#endif
-
- /* gnome-dev-removable is always the last fallback */
- return g_list_append (icon_list, g_strdup ("gnome-dev-removable"));
-}
-
-
-
-/**
- * exo_hal_volume_compute_display_name:
- * @context : a #LibHalContext, connected to the HAL daemon.
- * @volume : a #LibHalVolume.
- * @drive : the #LibHalDrive of the @volume.
- *
- * Similar to exo_hal_drive_compute_display_name(), but tries to find a
- * suitable display name for the @volume first, falling back to @drive
- * under certain conditions. This function may return %NULL if no
- * suitable display name was found.
- *
- * The caller is responsible to free the returned string using g_free()
- * when no longer needed.
- *
- * Return value: the display name for the @volume or %NULL if the
- * function is unable to determine the display name.
- *
- * Since: 0.3.1.13
- **/
-gchar*
-exo_hal_volume_compute_display_name (struct LibHalContext_s *context,
- struct LibHalVolume_s *volume,
- struct LibHalDrive_s *drive)
-{
-#ifdef HAVE_HAL
- static const gchar UNITS[] = "KMGT";
- const gchar *label;
- guint64 size;
- guint64 m;
- gchar *display_name;
- gchar *size_string;
- guint n;
-
-
- g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail (volume != NULL, NULL);
- g_return_val_if_fail (drive != NULL, NULL);
-
- /* check if the volume specifies a usable label */
- label = libhal_volume_get_label (volume);
- if (G_LIKELY (label != NULL && *label != '\0'))
- {
- /* just use the volume label */
- display_name = g_strdup (label);
- }
- else
- {
- /* guess display name based on the drive type */
- switch (libhal_drive_get_type (drive))
- {
- case LIBHAL_DRIVE_TYPE_CDROM:
- /* check if we don't have a pure audio disc */
- if (libhal_volume_disc_has_data (volume) || !libhal_volume_disc_has_audio (volume))
- {
- /* handle (blank) data discs */
- switch (libhal_volume_get_disc_type (volume))
- {
- case LIBHAL_VOLUME_DISC_TYPE_CDR:
- label = "CD-R";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_CDRW:
- label = "CD-RW";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDROM:
- label = "DVD-ROM";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDRAM:
- label = "DVD-RAM";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDR:
- label = "DVD-R";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDRW:
- label = "DVD-RW";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR:
- label = "DVD+R";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSRW:
- label = "DVD+RW";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR_DL:
- label = "DVD+R DL";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_BDROM:
- label = "BD-ROM";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_BDR:
- label = "BD-R";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_BDRE:
- label = "BD-RE";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_HDDVDROM:
- label = "HD DVD-ROM";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_HDDVDR:
- label = "HD DVD-R";
- break;
-
- case LIBHAL_VOLUME_DISC_TYPE_HDDVDRW:
- label = "HD DVD-RW";
- break;
-
- default: /* everything else is just a CD-ROM */
- label = "CD-ROM";
- break;
- }
-
- /* display name depends on whether the disc is blank */
- if (G_UNLIKELY (libhal_volume_disc_is_blank (volume)))
- display_name = g_strdup_printf (_("Blank %s Disc"), label);
- else
- display_name = g_strdup_printf (_("%s Disc"), label);
- }
- else
- {
- /* special case for pure audio disc */
- display_name = g_strdup (_("Audio CD"));
- }
- break;
-
- case LIBHAL_DRIVE_TYPE_FLOPPY:
- case LIBHAL_DRIVE_TYPE_COMPACT_FLASH:
- case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
- case LIBHAL_DRIVE_TYPE_SMART_MEDIA:
- case LIBHAL_DRIVE_TYPE_SD_MMC:
- case LIBHAL_DRIVE_TYPE_ZIP:
- case LIBHAL_DRIVE_TYPE_JAZ:
- case LIBHAL_DRIVE_TYPE_FLASHKEY:
- case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
- /* use the display name of the drive instead */
- display_name = exo_hal_drive_compute_display_name (context, drive);
- break;
-
- default:
- /* fallback to size of media */
- size = libhal_volume_get_size (volume);
- for (m = 1000, n = 0;; m *= 1000, ++n)
- {
- /* check if we found the unit */
- if (UNITS[n + 1] == '\0' || size < m * 1000u)
- {
- /* display a comma number if result is a single digit */
- if (G_LIKELY (size < n * 10))
- size_string = g_strdup_printf ("%.01f%c", ((gdouble) size) / ((gdouble) m), UNITS[n]);
- else
- size_string = g_strdup_printf ("%" G_GUINT64_FORMAT "%c", size / m, UNITS[n]);
- break;
- }
- }
-
- /* generate the display name from the size string */
- if (G_UNLIKELY (libhal_drive_uses_removable_media (drive)))
- display_name = g_strdup_printf (_("%s Removable Volume"), size_string);
- else
- display_name = g_strdup_printf (_("%s Volume"), size_string);
- g_free (size_string);
- }
- }
-
- return display_name;
-#else
- /* HAL is not available, impossible to figure out
- * a usable display name for the given volume...
- */
- return NULL;
-#endif
-}
-
-
-
-/**
- * exo_hal_volume_compute_icon_list:
- * @context : a #LibHalContext, connected to the HAL daemon.
- * @volume : a #LibHalVolume.
- * @drive : the #LibHalDrive of the @volume.
- *
- * Similar to exo_hal_drive_compute_icon_name(), but first looks for
- * icons for @volume, falling back to an icons for @drive.
- *
- * The caller is responsible to free the returned list using
- * <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_free, NULL);
- * g_list_free (list);
- * </programlisting></informalexample>
- * when no longer needed.
- *
- * Return value: a list of icon names for icons that can be used to visually
- * represent the @volume to the user.
- *
- * Since: 0.3.1.13
- **/
-GList*
-exo_hal_volume_compute_icon_list (struct LibHalContext_s *context,
- struct LibHalVolume_s *volume,
- struct LibHalDrive_s *drive)
-{
- GList *icon_list = NULL;
-
-#ifdef HAVE_HAL
- const gchar *icon_name;
-
- g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail (volume != NULL, NULL);
- g_return_val_if_fail (drive != NULL, NULL);
-
- /* check if a dedicated volume icon name is known */
- icon_name = libhal_drive_get_dedicated_icon_volume (drive);
- if (G_UNLIKELY (icon_name != NULL))
- icon_list = g_list_append (icon_list, g_strdup (icon_name));
-
- /* check if we have a disc based volume */
- if (libhal_volume_is_disc (volume))
- {
- /* look for an icon for this specific disc type */
- icon_name = exo_hal_lookup_icon_name (HAL_ICON_DISC_CDROM + libhal_volume_get_disc_type (volume));
- if (G_LIKELY (icon_name != NULL))
- icon_list = g_list_append (icon_list, g_strdup (icon_name));
- }
-#endif
-
- /* merge with the drive specific icon list */
- return g_list_concat (icon_list, exo_hal_drive_compute_icon_list (context, drive));
-}
-
-
diff --git a/exo-hal/exo-hal.h b/exo-hal/exo-hal.h
deleted file mode 100644
index a8380c9..0000000
--- a/exo-hal/exo-hal.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>.
- *
- * 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 the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#ifndef __EXO_HAL_H__
-#define __EXO_HAL_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS;
-
-/* forward declarations for libhal-storage */
-#ifndef LIBHAL_STORAGE_H
-struct LibHalContext_s;
-struct LibHalVolume_s;
-struct LibHalDrive_s;
-#endif
-
-/* verify that G_GNUC_WARN_UNUSED_RESULT is defined */
-#if !defined(G_GNUC_WARN_UNUSED_RESULT)
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#else
-#define G_GNUC_WARN_UNUSED_RESULT
-#endif /* __GNUC__ */
-#endif /* !defined(G_GNUC_WARN_UNUSED_RESULT) */
-
-gboolean exo_hal_init (void);
-
-gboolean exo_hal_udi_validate (const gchar *udi,
- gssize len,
- gchar **end);
-
-gchar *exo_hal_drive_compute_display_name (struct LibHalContext_s *context,
- struct LibHalDrive_s *drive) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-GList *exo_hal_drive_compute_icon_list (struct LibHalContext_s *context,
- struct LibHalDrive_s *drive) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-
-gchar *exo_hal_volume_compute_display_name (struct LibHalContext_s *context,
- struct LibHalVolume_s *volume,
- struct LibHalDrive_s *drive) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-GList *exo_hal_volume_compute_icon_list (struct LibHalContext_s *context,
- struct LibHalVolume_s *volume,
- struct LibHalDrive_s *drive) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-
-G_END_DECLS;
-
-#endif /* !__EXO_HAL_H__ */
diff --git a/exo-mount-notify/Makefile.am b/exo-mount-notify/Makefile.am
deleted file mode 100644
index 364142f..0000000
--- a/exo-mount-notify/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-
-INCLUDES = \
- -I$(top_srcdir) \
- -DG_LOG_DOMAIN=\"exo-mount-notify\" \
- -DPACKAGE_LOCALE_DIR=\"$(localedir)\"
-
-libexec_PROGRAMS = \
- exo-mount-notify-1
-
-exo_mount_notify_1_SOURCES = \
- main.c
-
-exo_mount_notify_1_CFLAGS = \
- $(GTK_CFLAGS) \
- $(LIBNOTIFY_CFLAGS) \
- $(LIBXFCE4UTIL_CFLAGS)
-
-exo_mount_notify_1_LDFLAGS = \
- -no-undefined
-
-exo_mount_notify_1_LDADD = \
- $(GTK_LIBS) \
- $(LIBNOTIFY_LIBS) \
- $(LIBXFCE4UTIL_LIBS)
-
-EXTRA_DIST = \
- README
-
-# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/exo-mount-notify/README b/exo-mount-notify/README
deleted file mode 100644
index 7b64d05..0000000
--- a/exo-mount-notify/README
+++ /dev/null
@@ -1,10 +0,0 @@
-What is this?
-=============
-
-exo-mount-notify is a small, internal utility used by exo-mount to display a
-notification while unmounting/ejecting devices and a hint after a device was
-unmounted that the user can remove the device.
-
-This utility requires libnotify and a running notification daemon. exo-mount
-will work even if exo-mount-notify is not installed, so libnotify is a soft
-dependency.
diff --git a/exo-mount-notify/main.c b/exo-mount-notify/main.c
deleted file mode 100644
index 002a867..0000000
--- a/exo-mount-notify/main.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny at xfce.org>.
- *
- * 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 the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; 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_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <libxfce4util/libxfce4util.h>
-
-#include <libnotify/notify.h>
-
-#include <glib/gstdio.h>
-#include <exo/exo.h>
-#include <gtk/gtk.h>
-
-/* make sure all defines are present */
-#ifndef NOTIFY_EXPIRES_NEVER
-#define NOTIFY_EXPIRES_NEVER 0
-#endif
-#ifndef NOTIFY_EXPIRES_DEFAULT
-#define NOTIFY_EXPIRES_DEFAULT -1
-#endif
-
-
-
-/* --- globals --- */
-static gboolean opt_eject = FALSE;
-static gchar *opt_icon = NULL;
-static gchar *opt_name = NULL;
-static gboolean opt_readonly = FALSE;
-static gboolean opt_version = FALSE;
-static gint signal_fds[2];
-static NotifyNotification *notification = NULL;
-
-
-
-/* --- command line options --- */
-static GOptionEntry entries[] =
-{
- { "eject", 'e', 0, G_OPTION_ARG_NONE, &opt_eject, NULL, NULL, },
- { "icon", 'i', 0, G_OPTION_ARG_STRING, &opt_icon, NULL, NULL, },
- { "name", 'n', 0, G_OPTION_ARG_STRING, &opt_name, NULL, NULL, },
- { "readonly", 'r', 0, G_OPTION_ARG_NONE, &opt_readonly, NULL, NULL, },
- { "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, N_ ("Print version information and exit"), NULL, },
- { NULL, },
-};
-
-
-
-static void
-signal_func (int signo)
-{
- gint ignore;
-
- /* SIGUSR1 means success */
- ignore = write (signal_fds[1], (signo == SIGUSR1) ? "U" : "K", 1);
-}
-
-
-
-static gboolean
-signal_io_func (GIOChannel *channel,
- GIOCondition condition,
- gpointer user_data)
-{
- gchar *message;
- gchar c;
-
- /* read the first character from signal pipe */
- if (read (signal_fds[0], &c, 1) < 1)
- return TRUE;
-
- /* perform the appropriate operation */
- if (c == 'U') /* SIGUSR1 */
- {
- /* the operation succeed */
- if (G_LIKELY (!opt_eject))
- {
- /* tell the user that the device can be removed now */
- message = g_strdup_printf (_("The device \"%s\" is now safe to remove."), opt_name);
- notify_notification_update (notification, _("Device is now safe to remove"), message, opt_icon);
- notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
- notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
- notify_notification_show (notification, NULL);
- g_free (message);
-
- /* release the notification, so it stays active even
- * after the process exits, otherwise we'll block
- * Thunar's unmount operations...
- */
- g_object_unref (G_OBJECT (notification));
- }
- }
-
- /* terminate the process */
- gtk_main_quit ();
-
- return TRUE;
-}
-
-
-
-int
-main (int argc, char **argv)
-{
- const gchar *summary;
- GIOChannel *channel;
- GError *err = NULL;
- gchar *message;
- const gchar *display_name;
-
- /* initialize the i18n support */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-
- /* initialize GTK+ */
- if (!gtk_init_with_args (&argc, &argv, "Xfce Mount Notify", entries, GETTEXT_PACKAGE, &err))
- {
- /* check if we have an error message */
- if (G_LIKELY (err == NULL))
- {
- /* no error message, the GUI initialization failed */
- display_name = gdk_get_display_arg_name ();
- g_fprintf (stderr, "exo-mount-notify: %s: %s\n", _("Failed to open display"), (display_name != NULL) ? display_name : " ");
- }
- else
- {
- /* yep, there's an error, so print it */
- g_fprintf (stderr, "exo-mount-notify: %s\n", err->message);
- }
- return EXIT_FAILURE;
- }
-
- /* check if we should print version */
- if (G_UNLIKELY (opt_version))
- {
- g_print ("%s %s\n\n", g_get_prgname (), PACKAGE_VERSION);
- g_print (_("Copyright (c) %s\n"
- " os-cillation e.K. All rights reserved.\n\n"
- "Written by Benedikt Meurer <benny at xfce.org>.\n\n"),
- "2006-2007");
- g_print (_("%s comes with ABSOLUTELY NO WARRANTY,\n"
- "You may redistribute copies of %s under the terms of\n"
- "the GNU Lesser General Public License which can be found in the\n"
- "%s source package.\n\n"), g_get_prgname (), g_get_prgname (), PACKAGE_TARNAME);
- g_print (_("Please report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
- return EXIT_SUCCESS;
- }
-
- /* icon defaults to "gnome-dev-harddisk" */
- if (G_UNLIKELY (exo_str_is_empty (opt_icon)))
- opt_icon = "gnome-dev-harddisk";
-
- /* make sure that a device name was specified */
- if (G_UNLIKELY (exo_str_is_empty (opt_name)))
- {
- /* the caller must specify a usable device name */
- g_printerr ("%s: %s.\n", g_get_prgname (), "Must specify a device name");
- return EXIT_FAILURE;
- }
-
- /* try to initialize libnotify */
- if (!notify_init ("exo-mount"))
- {
- /* it doesn't make sense to continue from here on */
- g_printerr ("%s: %s.\n", g_get_prgname (), "Failed to initialize libnotify");
- return EXIT_FAILURE;
- }
-
- /* setup the signal pipe */
- if (pipe (signal_fds) < 0)
- {
- g_printerr ("%s: Failed to setup signal pipe: %s.\n", g_get_prgname (), g_strerror (errno));
- return EXIT_FAILURE;
- }
-
- /* register the appropriate signal handlers */
- signal (SIGTERM, signal_func);
- signal (SIGHUP, signal_func);
- signal (SIGINT, signal_func);
- signal (SIGUSR1, signal_func);
-
- /* watch the read side of the signal pipe */
- channel = g_io_channel_unix_new (signal_fds[0]);
- g_io_add_watch (channel, G_IO_IN, signal_io_func, NULL);
- g_io_channel_unref (channel);
-
- /* different summary/message based on whether it's readonly */
- if (G_UNLIKELY (opt_readonly))
- {
- /* check if we eject */
- if (G_LIKELY (opt_eject))
- {
- /* read-only, just ejecting */
- summary = _("Ejecting device");
- message = g_strdup_printf (_("The device \"%s\" is being ejected. This may take some time."), opt_name);
- }
- else
- {
- /* read-only, just unmounting */
- summary = _("Unmounting device");
- message = g_strdup_printf (_("The device \"%s\" is being unmounted by the system. Please do "
- "not remove the media or disconnect the drive."), opt_name);
- }
- }
- else
- {
- /* not read-only, writing back data */
- summary = _("Writing data to device");
- message = g_strdup_printf (_("There is data that needs to be written to the device \"%s\" before it can be "
- "removed. Please do not remove the media or disconnect the drive."), opt_name);
- }
-
- /* setup the notification */
- notification = notify_notification_new (summary, message, opt_icon, NULL);
- g_signal_connect (G_OBJECT (notification), "closed", G_CALLBACK (gtk_main_quit), NULL);
- g_object_add_weak_pointer (G_OBJECT (notification), (gpointer) ¬ification);
- notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
- notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
- notify_notification_show (notification, NULL);
- g_free (message);
-
- /* enter the main loop */
- gtk_main ();
-
- /* release the notification */
- if (G_LIKELY (notification != NULL))
- {
- notify_notification_close (notification, NULL);
- g_object_unref (G_OBJECT (notification));
- }
-
- return EXIT_SUCCESS;
-}
diff --git a/exo-mount/Makefile.am b/exo-mount/Makefile.am
deleted file mode 100644
index 869266d..0000000
--- a/exo-mount/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-
-INCLUDES = \
- -I$(top_srcdir) \
- -DDBUS_API_SUBJECT_TO_CHANGE \
- -DG_LOG_DOMAIN=\"exo-mount\" \
- -DLIBEXECDIR=\"$(libexecdir)\" \
- -DLIBEXO_VERSION_API=\"$(LIBEXO_VERSION_API)\" \
- -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
- -DPATH_MOUNT=\"$(PATH_MOUNT)\" \
- -DPATH_UMOUNT=\"$(PATH_UMOUNT)\" \
- -DPATH_EJECT=\"$(PATH_EJECT)\"
-
-defaultsdir = $(sysconfdir)/xdg/xfce4
-defaults_DATA = mount.rc
-
-bin_PROGRAMS = \
- exo-mount
-
-exo_mount_SOURCES = \
- main.c
-
-if HAVE_HAL
-exo_mount_SOURCES += \
- exo-mount-hal.c \
- exo-mount-hal.h
-endif
-
-exo_mount_CFLAGS = \
- $(GTK_CFLAGS) \
- $(HAL_CFLAGS) \
- $(LIBXFCE4UTIL_CFLAGS) \
- $(GIO_CFLAGS) \
- $(GIO_UNIX_CFLAGS)
-
-exo_mount_LDFLAGS = \
- -no-undefined
-
-exo_mount_DEPENDENCIES = \
- $(top_builddir)/exo/libexo-$(LIBEXO_VERSION_API).la \
- $(top_builddir)/exo-hal/libexo-hal-$(LIBEXO_VERSION_API).la
-
-exo_mount_LDADD = \
- $(GTK_LIBS) \
- $(HAL_LIBS) \
- $(LIBXFCE4UTIL_LIBS) \
- $(GIO_LIBS) \
- $(GIO_UNIX_LIBS) \
- $(top_builddir)/exo/libexo-$(LIBEXO_VERSION_API).la \
- $(top_builddir)/exo-hal/libexo-hal-$(LIBEXO_VERSION_API).la
-
-# install apppropriate symlinks
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(bindir)
- -( cd $(DESTDIR)$(bindir) ; ln -sf exo-mount exo-eject )
- -( cd $(DESTDIR)$(bindir) ; ln -sf exo-mount exo-unmount )
-
-EXTRA_DIST = \
- $(defaults_DATA) \
- README
-
-# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/exo-mount/README b/exo-mount/README
deleted file mode 100644
index 2fd9724..0000000
--- a/exo-mount/README
+++ /dev/null
@@ -1,13 +0,0 @@
-What is this?
-=============
-
-exo-mount is a volume mounter, which is used to mount, eject or unmount volumes
-based on their HAL UDIs or their device files. The HAL support is optional, but
-highly recommended. See the output of
-
- exo-mount --help
-
-for available command line options.
-
-For the mount options used by HAL, see the mount.rc file installed by exo in the
-$prefix/etc/xdg/xfce4 directory.
diff --git a/exo-mount/exo-mount-hal.c b/exo-mount/exo-mount-hal.c
deleted file mode 100644
index 4605324..0000000
--- a/exo-mount/exo-mount-hal.c
+++ /dev/null
@@ -1,1180 +0,0 @@
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny at xfce.org>.
- *
- * 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 the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; 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_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <libhal-storage.h>
-
-#include <exo-hal/exo-hal.h>
-
-#include <exo-mount/exo-mount-hal.h>
-
-
-
-static gboolean exo_mount_hal_init (GError **error);
-static void exo_mount_hal_propagate_error (GError **error,
- DBusError *derror);
-
-
-
-struct _ExoMountHalDevice
-{
- gchar *udi;
- LibHalDrive *drive;
- LibHalVolume *volume;
-
- /* device internals */
- gchar *file;
- gchar *name;
-
- /* file system options */
- gchar **fsoptions;
- const gchar *fstype;
- gchar *altfstype;
- LibHalVolumeUsage fsusage;
-};
-
-
-
-static LibHalContext *hal_context = NULL;
-static DBusConnection *dbus_connection = NULL;
-
-
-
-static gboolean
-exo_mount_hal_init (GError **error)
-{
- DBusError derror;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- /* check if HAL support is already initialized */
- if (G_LIKELY (hal_context == NULL))
- {
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* try to connect to the system bus */
- dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
- if (G_LIKELY (dbus_connection != NULL))
- {
- /* try to allocate a new HAL context */
- hal_context = libhal_ctx_new ();
- if (G_LIKELY (hal_context != NULL))
- {
- /* setup the D-Bus connection for the HAL context */
- libhal_ctx_set_dbus_connection (hal_context, dbus_connection);
-
- /* try to initialize the HAL context */
- libhal_ctx_init (hal_context, &derror);
- }
- else
- {
- /* record the allocation failure of the context */
- dbus_set_error_const (&derror, DBUS_ERROR_NO_MEMORY, g_strerror (ENOMEM));
- }
- }
-
- /* check if we failed */
- if (dbus_error_is_set (&derror))
- {
- /* check if a HAL context was allocated */
- if (G_UNLIKELY (hal_context != NULL))
- {
- /* drop the allocated HAL context */
- libhal_ctx_shutdown (hal_context, NULL);
- libhal_ctx_free (hal_context);
- hal_context = NULL;
- }
-
- /* propagate the error */
- exo_mount_hal_propagate_error (error, &derror);
- }
- }
-
- return (hal_context != NULL);
-}
-
-
-
-static void
-exo_mount_hal_propagate_error (GError **error,
- DBusError *derror)
-{
- g_return_if_fail (error == NULL || *error == NULL);
-
- /* check if we need to propragate an error */
- if (G_LIKELY (derror != NULL && dbus_error_is_set (derror)))
- {
- /* propagate the error */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "%s", derror->message);
-
- /* reset the D-Bus error */
- dbus_error_free (derror);
- }
-}
-
-
-
-static gint
-exo_mount_hal_udi_is_volume (const gchar *udi,
- GError **error)
-{
- gchar **interfaces;
- DBusError derror;
- guint n;
- gint is_volume = -1;
-
- g_return_val_if_fail (udi != NULL, -1);
- g_return_val_if_fail (error == NULL || *error == NULL, -1);
-
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* determine the info.interfaces property of the device */
- interfaces = libhal_device_get_property_strlist (hal_context, udi, "info.interfaces", &derror);
- if (G_LIKELY (interfaces != NULL))
- {
- /* verify that we have a mountable device here */
- for (is_volume = 0, n = 0; is_volume == 0 && interfaces[n] != NULL; ++n)
- if (strcmp (interfaces[n], "org.freedesktop.Hal.Device.Volume") == 0)
- is_volume = 1;
- libhal_free_string_array (interfaces);
- }
- else
- {
- exo_mount_hal_propagate_error (error, &derror);
- }
-
- return is_volume;
-}
-
-
-
-static gchar *
-exo_mount_hal_get_volume_udi (const gchar *udi,
- GError **error)
-{
- DBusError derror;
- gint result;
- gchar *volume_udi = NULL;
- gchar **parent_udis;
- gint n, n_parent_udis;
-
- g_return_val_if_fail (udi != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- result = exo_mount_hal_udi_is_volume (udi, error);
- if (G_LIKELY (result == 1))
- {
- /* this udi is a valid volume */
- volume_udi = g_strdup (udi);
- }
- else if (result == 0)
- {
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* ok, but maybe we have a volume whose parent is identified by the udi */
- parent_udis = libhal_manager_find_device_string_match (hal_context, "info.parent", udi, &n_parent_udis, &derror);
- if (G_LIKELY (parent_udis != NULL))
- {
- for (n = 0; n < n_parent_udis; n++)
- {
- /* check if this udi is a volume, or one of its parents */
- volume_udi = exo_mount_hal_get_volume_udi (parent_udis[n], error);
- if (volume_udi != NULL || *error != NULL)
- break;
- }
- }
- else
- {
- exo_mount_hal_propagate_error (error, &derror);
- }
- }
-
- return volume_udi;
-}
-
-
-
-/**
- * exo_mount_hal_device_from_udi:
- * @udi : UDI of a volume or drive.
- * @error : return location for errors or %NULL.
- *
- * The returned object must be freed when no longer
- * needed using exo_mount_hal_device_free().
- *
- * Return value: the #ExoMountHalDevice for the @udi
- * or %NULL in case of an error.
- **/
-ExoMountHalDevice*
-exo_mount_hal_device_from_udi (const gchar *udi,
- GError **error)
-{
- ExoMountHalDevice *device = NULL;
- DBusError derror;
- gchar *volume_udi;
- gchar *key;
-
- g_return_val_if_fail (udi != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- /* make sure the HAL support is initialized */
- if (!exo_mount_hal_init (error))
- return NULL;
-
- /* find the volume udi for this udi (either this udi or one of its parents) */
- volume_udi = exo_mount_hal_get_volume_udi (udi, error);
- if (G_UNLIKELY (volume_udi == NULL))
- {
-err0: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"%s\" is not a volume or drive"), udi);
- return NULL;
- }
-
- /* setup the device struct */
- device = g_new0 (ExoMountHalDevice, 1);
- device->udi = volume_udi;
-
- /* check if we have a volume here */
- device->volume = libhal_volume_from_udi (hal_context, device->udi);
- if (G_LIKELY (device->volume != NULL))
- {
- /* determine the storage drive for the volume */
- device->drive = libhal_drive_from_udi (hal_context, libhal_volume_get_storage_device_udi (device->volume));
- if (G_LIKELY (device->drive != NULL))
- {
- /* setup the device internals */
- device->file = g_strdup (libhal_volume_get_device_file (device->volume));
- device->name = exo_hal_volume_compute_display_name (hal_context, device->volume, device->drive);
-
- /* setup the file system internals */
- device->fstype = libhal_volume_get_fstype (device->volume);
- device->altfstype = libhal_device_get_property_string (hal_context, device->udi, "volume.fstype.alternative.preferred", NULL);
- device->fsusage = libhal_volume_get_fsusage (device->volume);
- }
- }
- else
- {
- /* check if we have a drive here (i.e. floppy) */
- device->drive = libhal_drive_from_udi (hal_context, device->udi);
- if (G_LIKELY (device->drive != NULL))
- {
- /* setup the device internals */
- device->file = g_strdup (libhal_drive_get_device_file (device->drive));
- device->name = exo_hal_drive_compute_display_name (hal_context, device->drive);
-
- /* setup the file system internals */
- device->fstype = "";
- device->fsusage = LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM;
- }
- }
-
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* determine the valid mount options from the UDI */
- if (device->altfstype != NULL)
- {
- key = g_strdup_printf ("volume.mount.%s.valid_options", device->altfstype);
- device->fsoptions = libhal_device_get_property_strlist (hal_context, device->udi, key, &derror);
- g_free (key);
- }
- else
- {
- device->fsoptions = libhal_device_get_property_strlist (hal_context, device->udi, "volume.mount.valid_options", &derror);
- }
-
- /* sanity checking */
- if (G_UNLIKELY (device->file == NULL || device->name == NULL))
- {
- exo_mount_hal_device_free (device);
- goto err0;
- }
-
- /* check if we failed */
- if (G_LIKELY (device->drive == NULL))
- {
- /* definitely not a device that we're able to mount, eject or unmount */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"%s\" is not a volume or drive"), device->udi);
- exo_mount_hal_device_free (device);
- device = NULL;
- }
-
- return device;
-}
-
-
-
-/**
- * exo_mount_hal_device_from_file:
- * @file : absolute path to a device file.
- * @error : return location for errors or %NULL.
- *
- * The returned object must be freed using
- * exo_mount_hal_device_free() when no longer
- * needed.
- *
- * Return value: the #ExoMountHalDevice for the device
- * @file, or %NULL in case of an error.
- **/
-ExoMountHalDevice*
-exo_mount_hal_device_from_file (const gchar *file,
- GError **error)
-{
- ExoMountHalDevice *device = NULL;
- DBusError derror;
- gchar **interfaces;
- gchar **udis;
- gint n_udis;
- gint n, m;
-
- g_return_val_if_fail (g_path_is_absolute (file), NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- /* make sure the HAL support is initialized */
- if (!exo_mount_hal_init (error))
- return NULL;
-
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* query matching UDIs from HAL */
- udis = libhal_manager_find_device_string_match (hal_context, "block.device", file, &n_udis, &derror);
- if (G_UNLIKELY (udis == NULL))
- {
- /* propagate the error */
- exo_mount_hal_propagate_error (error, &derror);
- return NULL;
- }
-
- /* look for an UDI that specifies the Volume interface */
- for (n = 0; n < n_udis; ++n)
- {
- /* check if we should ignore this device */
- if (libhal_device_get_property_bool (hal_context, udis[n], "info.ignore", NULL))
- continue;
-
- /* determine the info.interfaces property of the device */
- interfaces = libhal_device_get_property_strlist (hal_context, udis[n], "info.interfaces", NULL);
- if (G_UNLIKELY (interfaces == NULL))
- continue;
-
- /* check if we have a mountable device here */
- for (m = 0; interfaces[m] != NULL; ++m)
- if (strcmp (interfaces[m], "org.freedesktop.Hal.Device.Volume") == 0)
- break;
-
- /* check if it's a usable device */
- if (interfaces[m] != NULL)
- {
- libhal_free_string_array (interfaces);
- break;
- }
-
- /* next one, please */
- libhal_free_string_array (interfaces);
- }
-
- /* check if we have an UDI */
- if (G_LIKELY (n < n_udis))
- {
- /* try to query the device from the HAL daemon */
- device = exo_mount_hal_device_from_udi (udis[n], error);
- }
- else
- {
- /* tell the caller that no matching device was found */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("Device \"%s\" not found in file system device table"), file);
- }
-
- /* cleanup */
- libhal_free_string_array (udis);
-
- return device;
-}
-
-
-
-/**
- * exo_mount_hal_device_free:
- * @device : an #ExoMountHalDevice or %NULL.
- *
- * Releases the resources allocated to the @device.
- **/
-void
-exo_mount_hal_device_free (ExoMountHalDevice *device)
-{
- /* check if we have a device */
- if (G_LIKELY (device != NULL))
- {
- libhal_free_string_array (device->fsoptions);
- libhal_volume_free (device->volume);
- libhal_drive_free (device->drive);
- g_free (device->file);
- g_free (device->name);
- g_free (device->udi);
- g_free (device->altfstype);
- g_free (device);
- }
-}
-
-
-
-/**
- * exo_mount_hal_device_get_file:
- * @device : an #ExoMountHalDevice.
- *
- * Returns the path of the @device file. The caller
- * is responsible to free the returned string using
- * g_free() when no longer needed.
- *
- * Return value: the @device file path.
- **/
-gchar*
-exo_mount_hal_device_get_file (ExoMountHalDevice *device)
-{
- g_return_val_if_fail (device != NULL, NULL);
- return g_strdup (device->file);
-}
-
-
-
-/**
- * exo_mount_hal_device_get_name:
- * @device : an #ExoMountHalDevice.
- *
- * Returns the visible name of the @device. The caller
- * is responsible to free the returned string using
- * g_free() when no longer needed.
- *
- * Return value: the @device<!---->s visible name.
- **/
-gchar*
-exo_mount_hal_device_get_name (ExoMountHalDevice *device)
-{
- g_return_val_if_fail (device != NULL, NULL);
- return g_strdup (device->name);
-}
-
-
-
-/**
- * exo_mount_hal_device_get_icon:
- * @device : an #ExoMountHalDevice.
- *
- * Returns the icon name for the @device or %NULL if no
- * icon could be determined. The caller is responsible
- * to free the returned string icon using g_free() when
- * no longer needed.
- *
- * Return value: the icon name for @device or %NULL.
- **/
-gchar*
-exo_mount_hal_device_get_icon (ExoMountHalDevice *device)
-{
- GtkIconTheme *icon_theme;
- gchar *icon_name = NULL;
- GList *icon_list;
- GList *lp;
-
- g_return_val_if_fail (device != NULL, NULL);
-
- /* compute the list of possible icons for the device */
- icon_list = G_UNLIKELY (device->volume == NULL)
- ? exo_hal_drive_compute_icon_list (hal_context, device->drive)
- : exo_hal_volume_compute_icon_list (hal_context, device->volume, device->drive);
-
- /* determine the default icon theme */
- icon_theme = gtk_icon_theme_get_default ();
-
- /* look for a usable icon in the list */
- for (lp = icon_list; lp != NULL; lp = lp->next)
- if (gtk_icon_theme_has_icon (icon_theme, lp->data))
- {
- icon_name = g_strdup (lp->data);
- break;
- }
-
- /* release the icon list */
- g_list_foreach (icon_list, (GFunc) g_free, NULL);
- g_list_free (icon_list);
-
- /* last fallback is "gnome-dev-removable" */
- if (G_UNLIKELY (icon_name == NULL))
- icon_name = g_strdup ("gnome-dev-removable");
-
- return icon_name;
-}
-
-
-
-/**
- * exo_mount_hal_device_is_readonly:
- * @device : an #ExoMountHalDevice.
- *
- * Guesses whether the @device is most probably
- * a read-only data storage (i.e. a CD-ROM).
- *
- * Return value: %TRUE if readonly, %FALSE otherwise.
- **/
-gboolean
-exo_mount_hal_device_is_readonly (ExoMountHalDevice *device)
-{
- g_return_val_if_fail (device != NULL, FALSE);
-
- /* the "volume.is_mounted_read_only" property might be a good start */
- if (libhal_device_get_property_bool (hal_context, device->udi, "volume.is_mounted_read_only", NULL))
- return TRUE;
-
- /* otherwise guess based on the drive type */
- switch (libhal_drive_get_type (device->drive))
- {
- /* CD-ROMs and floppies are read-only... */
- case LIBHAL_DRIVE_TYPE_CDROM:
- case LIBHAL_DRIVE_TYPE_FLOPPY:
- return TRUE;
-
- /* ...everything else is writable */
- default:
- return FALSE;
- }
-}
-
-
-
-/**
- * exo_mount_hal_device_eject:
- * @device : an #ExoMountHalDevice.
- * @error : return location for errors or %NULL.
- *
- * Ejects the specified @device, returns %TRUE if
- * successfull, %FALSE if an error occurred.
- *
- * Return value: %TRUE if ejected, %FALSE otherwise.
- **/
-gboolean
-exo_mount_hal_device_eject (ExoMountHalDevice *device,
- GError **error)
-{
- const gchar **options = { NULL };
- const guint n_options = 0;
- DBusMessage *message;
- DBusMessage *result;
- DBusError derror;
- const gchar *backing_udi = NULL;
-
- g_return_val_if_fail (device != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- /* see if the udi is a crypto fs, in which case we'll have to tear down the crypto layer. */
- backing_udi = libhal_volume_crypto_get_backing_volume_udi(device->volume);
-
- if (backing_udi)
- {
- /* never eject a LUKS-encrypted device */
- return exo_mount_hal_device_unmount(device, error);
- }
-
- /* allocate the D-Bus message for the "Eject" method */
- message = dbus_message_new_method_call ("org.freedesktop.Hal", device->udi, "org.freedesktop.Hal.Device.Volume", "Eject");
- if (G_UNLIKELY (message == NULL))
- {
- /* out of memory */
-oom: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, "%s", g_strerror (ENOMEM));
- return FALSE;
- }
-
- /* append the (empty) eject options array */
- if (!dbus_message_append_args (message, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, n_options, DBUS_TYPE_INVALID))
- {
- dbus_message_unref (message);
- goto oom;
- }
-
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* send the message to the HAL daemon and block for the reply */
- result = dbus_connection_send_with_reply_and_block (dbus_connection, message, -1, &derror);
- if (G_LIKELY (result != NULL))
- {
- /* check if an error was returned */
- if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR)
- dbus_set_error_from_message (&derror, result);
-
- /* release the result */
- dbus_message_unref (result);
- }
-
- /* release the message */
- dbus_message_unref (message);
-
- /* check if we failed */
- if (G_UNLIKELY (dbus_error_is_set (&derror)))
- {
- /* try to translate the error appropriately */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0)
- {
- /* TRANSLATORS: The user tried to eject a device although he's not privileged to do so. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("You are not privileged to eject the volume \"%s\""), device->name);
- }
- else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.Busy") == 0)
- {
- /* TRANSLATORS: An application is blocking a mounted volume from being ejected. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("An application is preventing the volume \"%s\" from being ejected"), device->name);
- }
- else
- {
- /* no precise error message, use the HAL one */
- exo_mount_hal_propagate_error (error, &derror);
- }
-
- /* release the DBus error */
- dbus_error_free (&derror);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-
-/**
- * exo_mount_hal_device_mount:
- * @device : an #ExoMountHalDevice.
- * @error : return location for errors or %NULL.
- *
- * Mounts the specified @device and returns %TRUE if
- * successfull, %FALSE in case of an error.
- *
- * Return value: %TRUE if mounted, %FALSE otherwise.
- **/
-gboolean
-exo_mount_hal_device_mount (ExoMountHalDevice *device,
- GError **error)
-{
- DBusMessage *message;
- DBusMessage *result;
- DBusError derror;
- gchar *mount_point;
- gchar **options;
- gchar *fstype;
- const gchar *fs;
- gchar *s;
- guint m, n;
- const gchar *charset;
- XfceRc *rc;
- gchar *key;
- gchar *option;
- GSList *lp, *fsoptions = NULL;
- gsize len;
- const gchar *value;
-
- g_return_val_if_fail (device != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- /* determine the required mount options */
- options = g_new0 (gchar *, 20);
-
- /* determin the fsoptions based on the preferrer alternative
- * fstype if we have one */
- if (G_UNLIKELY (device->altfstype != NULL))
- fs = device->altfstype;
- else
- fs = device->fstype;
-
- /* open the config file and look for the filesystem group */
- rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "xfce4" G_DIR_SEPARATOR_S "mount.rc", FALSE);
- if (G_LIKELY (rc != NULL))
- {
- if (xfce_rc_has_group (rc, fs))
- {
- /* set the filesystem group */
- xfce_rc_set_group (rc, fs);
- }
- else
- {
- /* config is not usable */
- xfce_rc_close (rc);
- rc = NULL;
- }
- }
-
- /* check if we know any valid mount options */
- if (G_LIKELY (device->fsoptions != NULL))
- {
- /* process all valid mount options */
- for (m = 0; device->fsoptions[m] != NULL; ++m)
- {
- option = NULL;
-
- if (strcmp (device->fsoptions[m], "sync") == 0
- && device->volume == NULL)
- {
- /* non-pollable drive... */
- option = g_strdup ("sync");
- }
- else if (rc != NULL)
- {
- /* option with value or enabled/disabled */
- if (g_str_has_suffix (device->fsoptions[m], "="))
- {
- len = strlen (device->fsoptions[m]) - 1;
- key = g_strndup (device->fsoptions[m], len);
- value = xfce_rc_read_entry_untranslated (rc, key, NULL);
-
- if (value != NULL)
- {
- /* substitute the <auto> options */
- if (strcmp (value, "<auto>") == 0)
- {
- if (strcmp (key, "uid") == 0)
- {
- option = g_strdup_printf ("uid=%u", (guint) getuid ());
- }
- else if (strcmp (key, "gid") == 0)
- {
- option = g_strdup_printf ("gid=%u", (guint) getgid ());
- }
- else if (strcmp (key, "iocharset") == 0)
- {
- charset = g_getenv ("EXO_MOUNT_IOCHARSET");
- if (charset == NULL
- && g_get_charset (&charset))
- charset = "utf8";
- option = g_strdup_printf ("iocharset=%s", charset);
- }
- }
- else
- {
- /* use the value from the rc file */
- option = g_strdup_printf ("%s=%s", key, value);
- }
- }
-
- g_free (key);
- }
- else if (xfce_rc_has_entry (rc, device->fsoptions[m]))
- {
- if (xfce_rc_read_bool_entry (rc, device->fsoptions[m], FALSE))
- option = g_strdup (device->fsoptions[m]);
- }
- }
-
- /* add the option */
- if (option != NULL)
- fsoptions = g_slist_prepend (fsoptions, option);
- }
- }
-
- if (rc != NULL)
- xfce_rc_close (rc);
-
- /* create the filesystem options (+2 for possible "ro" and null terminate) */
- options = g_new0 (gchar *, g_slist_length (fsoptions) + 2);
- for (n = 0, lp = fsoptions; lp != NULL; lp = lp->next, ++n)
- options[n] = lp->data;
- g_slist_free (fsoptions);
-
- /* try to determine a usable mount point */
- if (G_LIKELY (device->volume != NULL))
- {
- /* maybe we can use the volume's label... */
- mount_point = (gchar *) libhal_volume_get_label (device->volume);
- }
- else
- {
- /* maybe we can use the the textual type... */
- mount_point = (gchar *) libhal_drive_get_type_textual (device->drive);
- }
-
- /* make sure that the mount point is usable (i.e. does not contain G_DIR_SEPARATOR's) */
- if (!exo_str_is_empty (mount_point))
- mount_point = exo_str_replace (mount_point, G_DIR_SEPARATOR_S, "_");
- else
- mount_point = g_strdup ("");
-
- /* let HAL guess the fstype, unless we have an alternative preferred fstype */
- if (G_UNLIKELY (device->altfstype != NULL))
- fstype = g_strdup (device->altfstype);
- else
- fstype = g_strdup ("");
-
- /* setup the D-Bus error */
- dbus_error_init (&derror);
-
- /* now several times... */
- for (;;)
- {
- /* prepare the D-Bus message for the "Mount" method */
- message = dbus_message_new_method_call ("org.freedesktop.Hal", device->udi, "org.freedesktop.Hal.Device.Volume", "Mount");
- if (G_UNLIKELY (message == NULL))
- {
-oom: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, "%s", g_strerror (ENOMEM));
- g_strfreev (options);
- g_free (mount_point);
- g_free (fstype);
- return FALSE;
- }
-
- /* append the message parameters */
- if (!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &mount_point,
- DBUS_TYPE_STRING, &fstype,
- DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, n,
- DBUS_TYPE_INVALID))
- {
- dbus_message_unref (message);
- goto oom;
- }
-
- /* send the message to the HAL daemon */
- result = dbus_connection_send_with_reply_and_block (dbus_connection, message, -1, &derror);
- if (G_LIKELY (result != NULL))
- {
- /* check if an error was returned */
- if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR)
- dbus_set_error_from_message (&derror, result);
-
- /* release the result */
- dbus_message_unref (result);
- }
-
- /* release the messages */
- dbus_message_unref (message);
-
- /* check if we succeed */
- if (!dbus_error_is_set (&derror))
- break;
-
- /* check if the device was already mounted */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.AlreadyMounted") == 0)
- {
- dbus_error_free (&derror);
- break;
- }
-
- /* check if the specified mount point was invalid */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.InvalidMountpoint") == 0 && *mount_point != '\0')
- {
- /* try again without a mount point */
- g_free (mount_point);
- mount_point = g_strdup ("");
-
- /* reset the error */
- dbus_error_free (&derror);
- continue;
- }
-
- /* check if the specified mount point is not available */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.MountPointNotAvailable") == 0 && *mount_point != '\0')
- {
- /* try again with a new mount point */
- s = g_strconcat (mount_point, "_", NULL);
- g_free (mount_point);
- mount_point = s;
-
- /* reset the error */
- dbus_error_free (&derror);
- continue;
- }
-
-#if defined(__FreeBSD__)
- /* check if an unknown error occurred while trying to mount a floppy */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.UnknownError") == 0
- && libhal_drive_get_type (device->drive) == LIBHAL_DRIVE_TYPE_FLOPPY)
- {
- /* check if no file system type was specified */
- if (G_LIKELY (*fstype == '\0'))
- {
- /* try again with msdosfs */
- g_free (fstype);
- fstype = g_strdup ("msdosfs");
-
- /* reset the error */
- dbus_error_free (&derror);
- continue;
- }
- }
-#endif
-
- /* it's also possible that we need to include "ro" in the options */
- for (n = 0; options[n] != NULL; ++n)
- if (strcmp (options[n], "ro") == 0)
- break;
- if (G_UNLIKELY (options[n] != NULL))
- {
- /* we already included "ro" in the options, no way
- * to mount that device then... we simply give up.
- */
- break;
- }
-
- /* add "ro" to the options and try again */
- options[n++] = g_strdup ("ro");
-
- /* reset the error */
- dbus_error_free (&derror);
- }
-
- /* cleanup */
- g_strfreev (options);
- g_free (mount_point);
- g_free (fstype);
-
- /* check if we failed */
- if (dbus_error_is_set (&derror))
- {
- /* try to translate the error appropriately */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0)
- {
- /* TRANSLATORS: User tried to mount a volume, but is not privileged to do so. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("You are not privileged to mount the volume \"%s\""), device->name);
- }
- else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.AlreadyMounted") == 0)
- {
- /* Ups, already mounted, we succeed! */
- dbus_error_free (&derror);
- return TRUE;
- }
- else
- {
- /* try to come up with a useful error message */
- if (device->volume != NULL && libhal_volume_is_disc (device->volume) && libhal_volume_disc_is_blank (device->volume))
- {
- /* TRANSLATORS: User tried to mount blank disc, which is not going to work. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
- _("Blank discs cannot be mounted, use a CD "
- "recording application like Xfburn to "
- "record audio or data on the disc"));
- }
- else if (device->volume != NULL
- && libhal_volume_is_disc (device->volume)
- && !libhal_volume_disc_has_data (device->volume)
- && libhal_volume_disc_has_audio (device->volume))
- {
- /* TRANSLATORS: User tried to mount an Audio CD that doesn't contain a data track. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
- _("Audio CDs cannot be mounted, use your favorite audio "
- "player to play the audio tracks"));
- }
- else
- {
- /* unknown error, use HAL's message */
- exo_mount_hal_propagate_error (error, &derror);
- }
- }
-
- /* release D-Bus error */
- dbus_error_free (&derror);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static gboolean
-exo_mount_teardown_crypto_volume(const gchar *udi, GError **error)
-{
- DBusMessage *message = NULL;
- DBusMessage *result = NULL;
- DBusError derror;
-
- message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
- "org.freedesktop.Hal.Device.Volume.Crypto",
- "Teardown");
-
- if (G_UNLIKELY (message == NULL))
- {
- /* out of memory */
-oom: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, "%s", g_strerror (ENOMEM));
- return FALSE;
- }
-
- if (!dbus_message_append_args (message,
- DBUS_TYPE_INVALID)) {
- dbus_message_unref (message);
- goto oom;
- }
-
- dbus_error_init (&derror);
-
- result = dbus_connection_send_with_reply_and_block (dbus_connection, message, -1, &derror);
- if (G_LIKELY (result != NULL))
- {
- /* check if an error was returned */
- if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR)
- dbus_set_error_from_message (&derror, result);
-
- /* release the result */
- dbus_message_unref (result);
- }
-
- /* release the message */
- dbus_message_unref (message);
-
- if (G_UNLIKELY (dbus_error_is_set (&derror)))
- {
- /* try to translate the error appropriately */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0)
- {
- /* TRANSLATORS: The user tried to eject a device although he's not privileged to do so. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("You are not privileged to teardown the crypto layer"));
- }
- else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.Busy") == 0)
- {
- /* TRANSLATORS: An application is blocking a mounted volume from being ejected. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("An application is preventing the crypto layer from being torn down"));
- }
- else
- {
- /* no precise error message, use the HAL one */
- exo_mount_hal_propagate_error (error, &derror);
- }
-
- /* release the DBus error */
- dbus_error_free (&derror);
- return FALSE;
- }
- return TRUE;
-}
-
-
-/**
- * exo_mount_hal_device_unmount:
- * @device : an #ExoMountHalDevice.
- * @error : return location for errors or %NULL.
- *
- * Unmounts the specified @device and returns %TRUE if
- * successfull, %FALSE in case of an error.
- *
- * Return value: %TRUE if unmounted, %FALSE otherwise.
- **/
-gboolean
-exo_mount_hal_device_unmount (ExoMountHalDevice *device,
- GError **error)
-{
- const gchar **options = { NULL };
- const guint n_options = 0;
- DBusMessage *message;
- DBusMessage *result;
- DBusError derror;
- const gchar *backing_udi = NULL;
-
- g_return_val_if_fail (device != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- /* see if the udi is a crypto fs, in which case we'll have to teardown the crypto layer. */
- backing_udi = libhal_volume_crypto_get_backing_volume_udi(device->volume);
-
- /* allocate the D-Bus message for the "Unmount" method */
- message = dbus_message_new_method_call ("org.freedesktop.Hal", device->udi, "org.freedesktop.Hal.Device.Volume", "Unmount");
- if (G_UNLIKELY (message == NULL))
- {
- /* out of memory */
-oom: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, "%s", g_strerror (ENOMEM));
- return FALSE;
- }
-
- /* append the (empty) eject options array */
- if (!dbus_message_append_args (message, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, n_options, DBUS_TYPE_INVALID))
- {
- dbus_message_unref (message);
- goto oom;
- }
-
- /* initialize D-Bus error */
- dbus_error_init (&derror);
-
- /* send the message to the HAL daemon and block for the reply */
- result = dbus_connection_send_with_reply_and_block (dbus_connection, message, -1, &derror);
- if (G_LIKELY (result != NULL))
- {
- /* check if an error was returned */
- if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR)
- dbus_set_error_from_message (&derror, result);
-
- /* release the result */
- dbus_message_unref (result);
- }
-
- /* release the message */
- dbus_message_unref (message);
-
- /* check if we failed */
- if (G_UNLIKELY (dbus_error_is_set (&derror)))
- {
- /* try to translate the error appropriately */
- if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0)
- {
- /* TRANSLATORS: User tried to unmount a volume, but is not privileged to do so. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("You are not privileged to unmount the volume \"%s\""), device->name);
- }
- else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.Busy") == 0)
- {
- /* TRANSLATORS: An application is blocking a volume from being unmounted. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("An application is preventing the volume \"%s\" from being unmounted"), device->name);
- }
- else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.NotMountedByHal") == 0)
- {
- /* TRANSLATORS: HAL can only unmount volumes that were mounted via HAL. */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("The volume \"%s\" was probably mounted manually on the command line"), device->name);
- }
- else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.NotMounted") == 0)
- {
- /* Ups, volume not mounted, we succeed! */
- dbus_error_free (&derror);
- goto finish;
- }
- else
- {
- /* unknown error, use the HAL one */
- exo_mount_hal_propagate_error (error, &derror);
- }
-
- /* release the DBus error */
- dbus_error_free (&derror);
- return FALSE;
- }
-
-finish:
- if (G_UNLIKELY(backing_udi != NULL))
- {
- return exo_mount_teardown_crypto_volume(backing_udi, error);
- }
- return TRUE;
-}
-
diff --git a/exo-mount/exo-mount-hal.h b/exo-mount/exo-mount-hal.h
deleted file mode 100644
index 5019ea4..0000000
--- a/exo-mount/exo-mount-hal.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny at xfce.org>.
- *
- * 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 the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#ifndef __EXO_MOUNT_HAL_H__
-#define __EXO_MOUNT_HAL_H__
-
-#include <exo/exo.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ExoMountHalDevice ExoMountHalDevice;
-
-ExoMountHalDevice *exo_mount_hal_device_from_udi (const gchar *udi,
- GError **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-ExoMountHalDevice *exo_mount_hal_device_from_file (const gchar *file,
- GError **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-
-void exo_mount_hal_device_free (ExoMountHalDevice *device);
-
-gchar *exo_mount_hal_device_get_file (ExoMountHalDevice *device) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-gchar *exo_mount_hal_device_get_name (ExoMountHalDevice *device) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-gchar *exo_mount_hal_device_get_icon (ExoMountHalDevice *device) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-
-gboolean exo_mount_hal_device_is_readonly (ExoMountHalDevice *device);
-
-gboolean exo_mount_hal_device_eject (ExoMountHalDevice *device,
- GError **error);
-gboolean exo_mount_hal_device_mount (ExoMountHalDevice *device,
- GError **error);
-gboolean exo_mount_hal_device_unmount (ExoMountHalDevice *device,
- GError **error);
-
-G_END_DECLS
-
-#endif /* !__EXO_MOUNT_HAL_H__ */
diff --git a/exo-mount/main.c b/exo-mount/main.c
deleted file mode 100644
index 87eba30..0000000
--- a/exo-mount/main.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny at xfce.org>.
- *
- * 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 the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; 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_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#include <glib/gstdio.h>
-
-#include <gio/gio.h>
-#ifdef HAVE_GIO_UNIX
-#include <gio/gunixmounts.h>
-#endif
-
-#include <exo-hal/exo-hal.h>
-#include <exo/exo.h>
-#ifdef HAVE_HAL
-#include <exo-mount/exo-mount-hal.h>
-#endif
-
-
-/* --- globals --- */
-static gboolean opt_eject = FALSE;
-static gboolean opt_unmount = FALSE;
-static gchar *opt_hal_udi = NULL;
-static gchar *opt_device = NULL;
-static gboolean opt_noui = FALSE;
-static gboolean opt_version = FALSE;
-
-
-
-/* --- command line options --- */
-static GOptionEntry entries[] =
-{
- { "eject", 'e', 0, G_OPTION_ARG_NONE, &opt_eject, N_ ("Eject rather than mount"), NULL, },
- { "unmount", 'u', 0, G_OPTION_ARG_NONE, &opt_unmount, N_ ("Unmount rather than mount"), NULL, },
-#ifdef HAVE_HAL
- { "hal-udi", 'h', 0, G_OPTION_ARG_STRING, &opt_hal_udi, N_ ("Mount by HAL device UDI"), NULL, },
-#else
- { "hal-udi", 'h', 0, G_OPTION_ARG_STRING, &opt_hal_udi, N_ ("Mount by HAL device UDI (not supported)"), NULL, },
-#endif
- { "device", 'd', 0, G_OPTION_ARG_FILENAME, &opt_device, N_ ("Mount by device file"), NULL, },
- { "no-ui", 'n', 0, G_OPTION_ARG_NONE, &opt_noui, N_ ("Don't show any dialogs"), NULL, },
- { "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, N_ ("Print version information and exit"), NULL, },
- { NULL, },
-};
-
-
-
-static gboolean
-exo_mount_device_is_mounted (const gchar *device_file,
- gboolean *readonly_return)
-{
-#ifdef HAVE_GIO_UNIX
- GList *lp;
- GUnixMountEntry *mount_entry;
- const gchar *device_path;
-
- /* get the mounted devices (from mtab) */
- for (lp = g_unix_mounts_get (NULL); lp != NULL; lp = lp->next)
- {
- mount_entry = lp->data;
-
- device_path = g_unix_mount_get_device_path (mount_entry);
- if (exo_str_is_equal (device_path, device_file))
- {
- if (G_LIKELY (readonly_return != NULL))
- *readonly_return = g_unix_mount_is_readonly (mount_entry);
- return TRUE;
- }
- }
-#endif
-
- return FALSE;
-}
-
-
-
-#ifdef HAVE_GIO_UNIX
-static gboolean
-exo_mount_device_lookup (const gchar *device_file,
- GUnixMountPoint **mount_point_return,
- GError **error)
-{
- GList *lp;
- GUnixMountPoint *mount_point;
- const gchar *device_path;
-
- /* get the known devices (from fstab) */
- for (lp = g_unix_mount_points_get (NULL); lp != NULL; lp = lp->next)
- {
- mount_point = lp->data;
-
- device_path = g_unix_mount_point_get_device_path (mount_point);
- if (exo_str_is_equal (device_path, device_file))
- {
- if (G_LIKELY (mount_point_return != NULL))
- *mount_point_return = mount_point;
- return TRUE;
- }
- }
-
- /* TRANSLATORS: a device is missing from the file system table (usually /etc/fstab) */
- if (G_LIKELY (error != NULL))
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("Device \"%s\" not found in file system device table"), device_file);
-
- return FALSE;
-}
-#endif
-
-
-
-#ifdef HAVE_HAL
-static gboolean
-exo_mount_device_is_mount_point (const gchar *device_file)
-{
-#ifdef HAVE_GIO_UNIX
- return exo_mount_device_lookup (device_file, NULL, NULL);
-#else
- return FALSE;
-#endif
-}
-#endif
-
-
-
-static void
-exo_mount_device_execute (const gchar *device_file,
- const gchar *command,
- GError **error)
-{
- gboolean result;
- gchar *standard_error;
- gchar *command_line;
- gchar *quoted;
- gint status;
- const gchar *argument;
-#ifdef HAVE_GIO_UNIX
- GUnixMountPoint *mount_point;
-
- if (!exo_mount_device_lookup (device_file, &mount_point, error))
- return;
- argument = g_unix_mount_point_get_device_path (mount_point);
-#else
- argument = device_file;
-#endif
-
- /* generate the command line */
- quoted = g_shell_quote (argument);
- command_line = g_strconcat (command, " ", quoted, NULL);
- g_free (quoted);
-
- /* try to execute the command line */
- result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &status, error);
- if (G_LIKELY (result))
- {
- /* check if the command failed */
- if (G_UNLIKELY (status != 0))
- {
- /* drop additional whitespace from the stderr output */
- g_strstrip (standard_error);
-
- /* strip all trailing dots from the stderr output */
- while (*standard_error != '\0' && standard_error[strlen (standard_error) - 1] == '.')
- standard_error[strlen (standard_error) - 1] = '\0';
-
- /* generate an error from the stderr output */
- if (G_LIKELY (*standard_error != '\0'))
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "%s", standard_error);
- else
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
- }
-
- /* release the stderr output */
- g_free (standard_error);
- }
-
- /* cleanup */
- g_free (command_line);
-}
-
-
-
-gint
-main (gint argc, gchar **argv)
-{
-#ifdef HAVE_HAL
- ExoMountHalDevice *device;
-#endif
- GtkWidget *dialog;
- gboolean mounted_readonly = FALSE;
- gboolean mounted;
- GError *err = NULL;
- gchar **nargv;
- gchar *message;
- gchar *icon = NULL;
- gchar *name = NULL;
- GPid pid = 0;
- gint n = 0;
-
- /* initialize the i18n support */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-
- /* unset the CTYPE so we get the native charset for iocharset */
- setlocale (LC_CTYPE, "");
-
- /* initialize GTK+ */
- if (!gtk_init_with_args (&argc, &argv, "Xfce mount", entries, GETTEXT_PACKAGE, &err))
- {
- /* check if we have an error message */
- if (G_LIKELY (err == NULL))
- {
- /* no error message, the GUI initialization failed */
- const gchar *display_name = gdk_get_display_arg_name ();
- g_fprintf (stderr, "exo-mount: %s: %s\n", _("Failed to open display"), (display_name != NULL) ? display_name : " ");
- }
- else
- {
- /* yep, there's an error, so print it */
- g_fprintf (stderr, "exo-mount: %s\n", err->message);
- }
- return EXIT_FAILURE;
- }
-
- /* check if we should print version */
- if (G_UNLIKELY (opt_version))
- {
- g_print ("%s %s\n\n", g_get_prgname (), PACKAGE_VERSION);
- g_print (_("Copyright (c) %s\n"
- " os-cillation e.K. All rights reserved.\n\n"
- "Written by Benedikt Meurer <benny at xfce.org>.\n\n"),
- "2006-2007");
- g_print (_("%s comes with ABSOLUTELY NO WARRANTY,\n"
- "You may redistribute copies of %s under the terms of\n"
- "the GNU Lesser General Public License which can be found in the\n"
- "%s source package.\n\n"), g_get_prgname (), g_get_prgname (), PACKAGE_TARNAME);
- g_print (_("Please report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
- return EXIT_SUCCESS;
- }
-
-#ifndef HAVE_GIO_UNIX
- g_warning (_("%s is compiled without GIO-Unix features. Therefore it will "
- "probably not work on this system."), g_get_prgname ());
-#endif
-
- /* make sure that either a device UDI or file was specified... */
- if (G_UNLIKELY (opt_hal_udi == NULL && opt_device == NULL))
- {
- /* the caller must specify either a HAL UDI or a device file */
- g_printerr ("%s: %s.\n", g_get_prgname (), _("Must specify HAL device UDI or device file"));
- return EXIT_FAILURE;
- }
-
- /* ...but not both an UDI and a device file */
- if (G_UNLIKELY (opt_hal_udi != NULL && opt_device != NULL))
- {
- /* the caller must specify EITHER a HAL UDI or a device file */
- g_printerr ("%s: %s.\n", g_get_prgname (), _("Must not specify both a HAL device UDI and a device file simultaneously"));
- return EXIT_FAILURE;
- }
-
-#ifndef HAVE_HAL
- /* cannot mount by UDI if HAL is not available */
- if (G_UNLIKELY (opt_hal_udi != NULL))
- {
- g_printerr ("%s: %s.\n", g_get_prgname (), _("Cannot mount by HAL device UDI, because HAL support was disabled for this build"));
- return EXIT_FAILURE;
- }
-#else
- /* make sure the UDI passed in is valid */
- if (opt_hal_udi != NULL && !exo_hal_udi_validate (opt_hal_udi, -1, NULL))
- {
- message = g_strdup_printf (_("The specified UDI \"%s\" is not a valid HAL device UDI"), opt_hal_udi);
- g_printerr ("%s: %s.\n", g_get_prgname (), message);
- g_free (message);
- return EXIT_FAILURE;
- }
-#endif
-
- /* infer operation from program name */
- if (strcmp (g_get_prgname (), "exo-unmount") == 0)
- opt_unmount = TRUE;
- else if (strcmp (g_get_prgname (), "exo-eject") == 0)
- opt_eject = TRUE;
-
- /* verify that only a single option was specified */
- if (G_UNLIKELY (opt_eject && opt_unmount))
- {
- /* the caller must not specify both eject and unmount */
- g_printerr ("%s: %s.\n", g_get_prgname (), _("Cannot eject and unmount simultaneously"));
- return EXIT_FAILURE;
- }
-
- /* make sure the device file path is absolute */
- if (opt_device != NULL && !g_path_is_absolute (opt_device))
- {
- /* device is always relative to /dev then */
- opt_device = g_build_filename ("/dev", opt_device, NULL);
- }
-
-#ifdef HAVE_HAL
- /* query the device information from the HAL daemon */
- device = (opt_device != NULL)
- ? exo_mount_hal_device_from_file (opt_device, &err)
- : exo_mount_hal_device_from_udi (opt_hal_udi, &err);
- if (G_UNLIKELY (device == NULL))
- goto err0;
-
- /* determine the device file from the device struct */
- opt_device = exo_mount_hal_device_get_file (device);
-
- /* determine name and icon of the device */
- icon = exo_mount_hal_device_get_icon (device);
- name = exo_mount_hal_device_get_name (device);
-
- /* check if the device is most probably a read-only device */
- mounted_readonly = exo_mount_hal_device_is_readonly (device);
-#endif
-
- /* check if the device is currently mounted */
- mounted = exo_mount_device_is_mounted (opt_device, &mounted_readonly);
- if ((!opt_eject && !opt_unmount && mounted)
- || (opt_unmount && !mounted))
- {
- /* pretend that we succeed */
- return EXIT_SUCCESS;
- }
-
- /* check if a name was found */
- if (G_UNLIKELY (exo_str_is_empty (name)))
- {
- /* release the previous name */
- g_free (name);
-
- /* default to the path of the device file */
- name = g_filename_display_name (opt_device);
- }
-
- /* check if we should display a notification */
- if ((opt_eject && mounted) || opt_unmount)
- {
- /* prepare arguments for the unmount notification */
- nargv = g_new (gchar *, 8);
- nargv[n++] = g_strdup (LIBEXECDIR G_DIR_SEPARATOR_S "exo-mount-notify-" LIBEXO_VERSION_API);
- if (mounted_readonly)
- {
- nargv[n++] = g_strdup ("--readonly");
- }
- if (opt_eject)
- {
- nargv[n++] = g_strdup ("--eject");
- }
- if (!exo_str_is_empty (icon))
- {
- nargv[n++] = g_strdup ("--icon");
- nargv[n++] = g_strdup (icon);
- }
- nargv[n++] = g_strdup ("--name");
- nargv[n++] = g_strdup (name);
- nargv[n] = NULL;
-
- /* try to spawn the unmount notification */
- if (!gdk_spawn_on_screen (gdk_screen_get_default (), NULL, nargv, NULL, 0, NULL, NULL, &pid, NULL))
- {
- /* failed to spawn, don't worry,
- * just remember this fact...
- */
- pid = 0;
- }
-
- /* cleanup */
- g_strfreev (nargv);
- }
-
- /* check if the device appears in the fstab,
- * if so, we cannot use HAL to mount it.
- */
-#ifdef HAVE_HAL
- if (!exo_mount_device_is_mount_point (opt_device))
- {
- /* perform the requested operation */
- if (G_LIKELY (opt_unmount))
- exo_mount_hal_device_unmount (device, &err);
- else if (G_LIKELY (opt_eject))
- exo_mount_hal_device_eject (device, &err);
- else
- exo_mount_hal_device_mount (device, &err);
- }
- else
-#endif
- {
- /* perform the requested operation */
- if (G_LIKELY (opt_unmount))
- exo_mount_device_execute (opt_device, PATH_UMOUNT, &err);
- else if (G_LIKELY (opt_eject))
- exo_mount_device_execute (opt_device, PATH_EJECT, &err);
- else
- exo_mount_device_execute (opt_device, PATH_MOUNT, &err);
- }
-
- /* check if we have a notification process to kill */
- if (G_LIKELY (pid != 0))
- {
- /* send SIGUSR1 if we succeed, SIGTERM otherwise */
- kill (pid, (err == NULL) ? SIGUSR1 : SIGTERM);
-
- /* cleanup the PID */
- g_spawn_close_pid (pid);
- }
-
- /* if we tried to mount, make sure it's really mounted now */
- if (err == NULL && (!opt_eject && !opt_unmount)
- && !exo_mount_device_is_mounted (opt_device, NULL))
- {
- /* although somebody claims that we were successfully, that's not the case */
- g_set_error (&err, G_FILE_ERROR, G_FILE_ERROR_FAILED,
- "Mount operation claims to be successfull, "
- "but kernel doesn't list the volume as mounted");
- }
-
- /* check if we failed */
- if (G_UNLIKELY (err != NULL))
- {
-#ifdef HAVE_HAL
-err0:
-#endif
- /* check if we should display an error dialog */
- if (G_LIKELY (!opt_noui))
- {
- /* make sure we can display a name */
- if (G_UNLIKELY (name == NULL))
- {
- /* either device file or UDI */
- if (G_LIKELY (opt_device != NULL))
- name = g_filename_display_name (opt_device);
- else
- name = g_strdup (opt_hal_udi);
- }
-
- /* determine the appropriate error message */
- if (G_LIKELY (opt_eject))
- message = g_strdup_printf (_("Failed to eject \"%s\""), name);
- else if (G_LIKELY (opt_unmount))
- message = g_strdup_printf (_("Failed to unmount \"%s\""), name);
- else
- message = g_strdup_printf (_("Failed to mount \"%s\""), name);
-
- /* popup an error message dialog */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s.", message);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s.", err->message);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- g_free (message);
- }
- else
- {
- /* otherwise, it's probably called from thunar-vfs,
- * so print the error message to standard error.
- */
- g_printerr ("%s.\n", err->message);
- }
-
- /* release the error */
- g_error_free (err);
- }
-
- /* cleanup */
- g_free (name);
- g_free (icon);
-
- return (err == NULL) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/exo-mount/mount.rc b/exo-mount/mount.rc
deleted file mode 100644
index 723b841..0000000
--- a/exo-mount/mount.rc
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# ABOUT
-# =====
-# This file contains the mount option configuration when exo-mount is used with the HAL
-# back end (which is highly recommended). If mounting using exo is somehow not working
-# for you, you can copy this file to your $XDG_CONFIG_HOME/xfce4 directory and modify it.
-#
-# The options for each filesystem are not used when they are not in the list of
-# valid mount options provided by HAL. You can find those values using lshal and
-# search for the volume.mount.valid_options property.
-#
-#
-# EXAMPLE
-# =======
-# For example your usb device contains the vfat file system and lshal shows the
-# following valid mount options for the device:
-#
-# volume.mount.valid_options = {'ro', 'sync', 'dirsync', 'noatime', 'nodiratime',
-# 'noexec', 'quiet', 'remount', 'exec', 'uid=',
-# 'gid=', 'umask=', 'utf8'} (string list)
-#
-# All the values that end with a = character are options that contain a value,
-# the other options are booleans that can be enabled by for example putting
-# utf8=true in the group.
-#
-#
-# SUBSTITUTIONS
-# =============
-# Some options can be substituted by exo-mount when you set the value to <auto>:
-# uid : The real user ID
-# gid : The real group ID
-# iocharset: To the EXO_MOUNT_IOCHARSET or LC_CTYPE environment variable.
-#
-
-[vfat]
-uid=<auto>
-shortname=winnt
-# FreeBSD specific option
-longnames=true
-
-[iso9660]
-uid=<auto>
-
-[udf]
-uid=<auto>
-iocharset=<auto>
-
-[ntfs]
-uid=<auto>
-
-[ntfs-3g]
-uid=<auto>
-# Make sure the device does not get 0777 permissions
-umask=0077
diff --git a/exo.spec.in b/exo.spec.in
index 3d23466..41c3adf 100644
--- a/exo.spec.in
+++ b/exo.spec.in
@@ -56,11 +56,8 @@ fi
%files
%defattr(-,root,root)
%{_bindir}/exo-desktop-item-edit
-%{_bindir}/exo-eject
-%{_bindir}/exo-mount
%{_bindir}/exo-open
%{_bindir}/exo-preferred-applications
-%{_bindir}/exo-unmount
%{_datadir}/applications
%{_datadir}/icons
%{_datadir}/locale
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d1986dc..7a27696 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -35,8 +35,6 @@ exo-desktop-item-edit/exo-die-enum-types.c
exo-desktop-item-edit/exo-die-utils.c
exo-desktop-item-edit/main.c
-exo-hal/exo-hal.c
-
exo-helper/exo-helper-chooser-dialog.c
exo-helper/exo-helper-chooser.c
exo-helper/exo-helper-launcher-dialog.c
@@ -78,11 +76,6 @@ exo-helper/helpers/urxvt.desktop.in.in
exo-helper/helpers/w3m.desktop.in.in
exo-helper/helpers/xterm.desktop.in.in
-exo-mount/exo-mount-hal.c
-exo-mount/main.c
-
-exo-mount-notify/main.c
-
exo-open/main.c
exo-open/exo-file-manager.desktop.in
exo-open/exo-mail-reader.desktop.in
More information about the Xfce4-commits
mailing list