"Eject" support for E-Mountbox.

SVN revision: 2007
This commit is contained in:
Christian Kreibich 2000-02-02 18:57:06 +00:00
parent 7a28b8b00d
commit cfeace2a40
6 changed files with 51 additions and 7 deletions

View File

@ -1941,3 +1941,10 @@ Tue Feb 1 12:26:41 PST 2000
(KainX)
Patches and an icon from Jerome De Greef <jerome_degreef@hotmail.com>.
-------------------------------------------------------------------------------
Wed Feb 2 13:53:44 EST 2000
(Christian)
"Eject" support for E-Mountbox.

View File

@ -286,6 +286,12 @@
/* Do we have OpenGL? */
#undef HAVE_LIBGL
/* E-Mountbox stuff */
#undef EJECT
#undef MOUNT
#undef UMOUNT
#undef HAVE_EJECT
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:

View File

@ -295,6 +295,18 @@ fi
AC_CHECK_LIB(cdaudio, cd_advance, PLAYCD_PROGS=E-PlayCD.epplet, PLAYCD_PROGS="")
AC_SUBST(PLAYCD_PROGS)
# Stuff for E-Mountbox
AC_PATH_PROG(MOUNT, mount)
AC_PATH_PROG(UMOUNT, umount)
AC_PATH_PROG(EJECT, eject)
AC_DEFINE_UNQUOTED(MOUNT, "$MOUNT")
AC_DEFINE_UNQUOTED(UMOUNT, "$UMOUNT")
AC_DEFINE_UNQUOTED(EJECT, "$EJECT")
if test -n "$EJECT"; then
AC_DEFINE(HAVE_EJECT, 1)
fi
CFLAGS=${CFLAGS--O}
LDFLAGS=${LDFLAGS--O}
LIBS="$LIBS $GRLIBS"

View File

@ -78,7 +78,9 @@ using the control elements below.
<page columns=1 padding=16 name=config background=bg.png linkcolor=#88dddd>
<font face=aircut3/12 color=#ffffff>
<p>
<p>
You can also make E-Mountbox try to eject media after unmounting. This option
is available only when the "eject" program is available on your system
(if not, look at sunsite.unc.edu:/pub/Linux/utils/disk-management).
<p>
<p>
<p>

View File

@ -328,12 +328,19 @@ CallbackConfigure(void *data)
if (!config_win)
{
#ifdef HAVE_EJECT
config_win =
Epplet_create_window_config (420, 210 , "E-Mountbox Configuration",
Callback_ConfigOK, &config_win,
Callback_ConfigApply, &config_win,
Callback_ConfigCancel, &config_win);
#else
config_win =
Epplet_create_window_config (420, 190 , "E-Mountbox Configuration",
Callback_ConfigOK, &config_win,
Callback_ConfigApply, &config_win,
Callback_ConfigCancel, &config_win);
#endif
Epplet_gadget_show (Epplet_create_label (12, 10,
"Default icon",
2));
@ -365,7 +372,10 @@ CallbackConfigure(void *data)
button_add_long = Epplet_create_button("Add mountpoint type", NULL, 165, 120, 110, 16, NULL, 0, NULL, Callback_ConfigAdd, NULL);
button_del = Epplet_create_button("Delete", NULL, 216, 140, 36, 12, NULL, 0, NULL, Callback_ConfigDel, NULL);
arrow_right = Epplet_create_button(NULL, NULL, 257, 140, 0, 0, "ARROW_RIGHT", 0, NULL, Callback_ConfigRight, NULL);
#ifdef HAVE_EJECT
Epplet_gadget_show(Epplet_create_togglebutton("Try to eject when unmounting", NULL, 150, 160, 145, 16, &do_eject, NULL, NULL));
#endif
Epplet_window_pop_context ();
}
@ -834,7 +844,7 @@ Mount(MountPoint * mp)
return;
if (mp->path)
{
Esnprintf(s, sizeof(s), "%s %s", MOUNT_CMD, mp->path);
Esnprintf(s, sizeof(s), "%s %s", MOUNT, mp->path);
if (!Epplet_run_command(s))
{
mp->mounted = 1;
@ -865,12 +875,19 @@ Umount(MountPoint * mp)
return;
if (mp->path)
{
Esnprintf(s, sizeof(s), "%s %s", UMOUNT_CMD, mp->path);
Esnprintf(s, sizeof(s), "%s %s", UMOUNT, mp->path);
if (!Epplet_run_command(s))
{
mp->mounted = 0;
anim_mount = 0;
Epplet_timer(CallbackAnimate, NULL, 0, "Anim");
#ifdef HAVE_EJECT
if (do_eject)
{
Esnprintf(s, sizeof(s), "%s %s", EJECT, mp->device);
Epplet_run_command(s);
}
#endif
}
else
{

View File

@ -19,6 +19,7 @@
*/
#include "epplet.h"
#include "config.h"
#include <math.h>
#include <sys/types.h>
#include <dirent.h>
@ -27,8 +28,6 @@
#define FSTAB "/etc/fstab"
#define PROCMOUNTS "/proc/mounts"
#define ETCMTAB "/etc/mtab"
#define MOUNT_CMD "/bin/mount"
#define UMOUNT_CMD "/bin/umount"
#define __BG_IMAGE EROOT"/epplet_data/E-Mountbox/E-Mountbox-bg.png"
#define __DEFAULT EROOT"/epplet_data/E-Mountbox/E-Mountbox-blockdev.png"
@ -90,6 +89,7 @@ Epplet_gadget arrow_left, arrow_right, button_add, button_del, button_add_long
Epplet_gadget label_key, label_file;
Window config_win = 0;
MountPointType *current_type = NULL;
int do_eject = 1;
RGB_buf window_buf = NULL;
RGB_buf widescreen_buf = NULL;