E-Mountbox: You can now automatically eject media, not eject at all or
eject manually. Updated docs too. SVN revision: 2276
This commit is contained in:
parent
07150af6c2
commit
6fbe38e5ab
|
@ -2030,3 +2030,11 @@ Sat Mar 11 02:30:13 GMT 2000
|
|||
E-Net* epplets: Call Epplet_unremember before exiting on failure to find the
|
||||
device.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Sat Mar 18 17:15:58 CET 2000
|
||||
(Christian)
|
||||
|
||||
E-Mountbox: You can now automatically eject media, not eject at all or
|
||||
eject manually. Updated docs too.
|
||||
|
||||
|
|
|
@ -78,9 +78,11 @@ using the control elements below.
|
|||
<page columns=1 padding=16 name=config background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
E-Mountbox ejects media after unmounting. You can disable this feature in the
|
||||
configuration dialog. However, ejecting is available only when the "eject"
|
||||
program is available on your system (if not, look at sunsite.unc.edu:/pub/Linux/utils/disk-management).
|
||||
By default, E-Mountbox ejects media after unmounting. You can disable
|
||||
this feature in the configuration dialog completely or enable manual
|
||||
ejecting for unmounted media using the third mouse button.
|
||||
Note that ejecting 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>
|
||||
By default E-Mountbox also polls the mountpoints on your system in regular
|
||||
intervals to see if their status has changed and updates its display accordingly.
|
||||
|
|
|
@ -351,6 +351,36 @@ Callback_ConfigInterval(void *data)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
Callback_EjectType(void *data)
|
||||
{
|
||||
EjectMode ej_mode = (EjectMode)data;
|
||||
|
||||
mode.eject_mode = ej_mode;
|
||||
|
||||
switch (ej_mode)
|
||||
{
|
||||
case NO_EJECT:
|
||||
ejectbuttons[0] = 1; ejectbuttons[1] = 0; ejectbuttons[2] = 0;
|
||||
break;
|
||||
case MANUAL_EJECT:
|
||||
ejectbuttons[0] = 0; ejectbuttons[1] = 1; ejectbuttons[2] = 0;
|
||||
break;
|
||||
case AUTO_EJECT:
|
||||
default:
|
||||
ejectbuttons[0] = 0; ejectbuttons[1] = 0; ejectbuttons[2] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
Epplet_gadget_data_changed(togglebutton_no_eject);
|
||||
Epplet_gadget_data_changed(togglebutton_manual_eject);
|
||||
Epplet_gadget_data_changed(togglebutton_auto_eject);
|
||||
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CallbackConfigure(void *data)
|
||||
{
|
||||
|
@ -362,7 +392,7 @@ CallbackConfigure(void *data)
|
|||
/* on whether eject is available or not ... */
|
||||
#ifdef HAVE_EJECT
|
||||
config_win =
|
||||
Epplet_create_window_config (420, 240 , "E-Mountbox Configuration",
|
||||
Epplet_create_window_config (420, 280 , "E-Mountbox Configuration",
|
||||
Callback_ConfigOK, &config_win,
|
||||
Callback_ConfigApply, &config_win,
|
||||
Callback_ConfigCancel, &config_win);
|
||||
|
@ -406,13 +436,35 @@ CallbackConfigure(void *data)
|
|||
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_label(170, 160, "Eject media when unmounting", 2));
|
||||
Epplet_gadget_show(Epplet_create_togglebutton("", NULL, 150, 160, 12, 12, &mode.do_eject, NULL, NULL));
|
||||
Epplet_gadget_show(Epplet_create_label(170, 180, "Watch status of mountpoints", 2));
|
||||
Epplet_gadget_show(Epplet_create_togglebutton("", NULL, 150, 180, 12, 12, &mode.do_polling, ConfigUpdateDialog, NULL));
|
||||
Epplet_gadget_show(label_slider = Epplet_create_label(170, 200, "Interval:", 2));
|
||||
Epplet_gadget_show(hslider_interval = Epplet_create_hslider(230, 202, 60, 1, 60, 1, 10, &mode.polling_interval, Callback_ConfigInterval, NULL));
|
||||
Epplet_gadget_show(label_interval = Epplet_create_label(300, 200, "", 2));
|
||||
switch (mode.eject_mode)
|
||||
{
|
||||
case NO_EJECT:
|
||||
ejectbuttons[0] = 1; ejectbuttons[1] = 0; ejectbuttons[2] = 0;
|
||||
break;
|
||||
case MANUAL_EJECT:
|
||||
ejectbuttons[0] = 0; ejectbuttons[1] = 1; ejectbuttons[2] = 0;
|
||||
break;
|
||||
case AUTO_EJECT:
|
||||
default:
|
||||
ejectbuttons[0] = 0; ejectbuttons[1] = 0; ejectbuttons[2] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(170, 160, "Don't eject media when unmounting", 2));
|
||||
Epplet_gadget_show((togglebutton_no_eject =
|
||||
Epplet_create_togglebutton("", NULL, 150, 160, 12, 12, &ejectbuttons[0], Callback_EjectType, (void*)NO_EJECT)));
|
||||
Epplet_gadget_show(Epplet_create_label(170, 180, "Manually eject unmounted media", 2));
|
||||
Epplet_gadget_show((togglebutton_manual_eject =
|
||||
Epplet_create_togglebutton("", NULL, 150, 180, 12, 12, &ejectbuttons[1], Callback_EjectType, (void*)MANUAL_EJECT)));
|
||||
Epplet_gadget_show(Epplet_create_label(170, 200, "Eject media when unmounting", 2));
|
||||
Epplet_gadget_show((togglebutton_auto_eject =
|
||||
Epplet_create_togglebutton("", NULL, 150, 200, 12, 12, &ejectbuttons[2], Callback_EjectType, (void*)AUTO_EJECT)));
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(170, 220, "Watch status of mountpoints", 2));
|
||||
Epplet_gadget_show(Epplet_create_togglebutton("", NULL, 150, 220, 12, 12, &mode.do_polling, ConfigUpdateDialog, NULL));
|
||||
Epplet_gadget_show(label_slider = Epplet_create_label(170, 240, "Interval:", 2));
|
||||
Epplet_gadget_show(hslider_interval = Epplet_create_hslider(230, 242, 60, 1, 60, 1, 10, &mode.polling_interval, Callback_ConfigInterval, NULL));
|
||||
Epplet_gadget_show(label_interval = Epplet_create_label(300, 240, "", 2));
|
||||
#else
|
||||
Epplet_gadget_show(Epplet_create_label(170, 160, "Watch status of mountpoints", 2));
|
||||
Epplet_gadget_show(Epplet_create_togglebutton("", NULL, 150, 160, 12, 12, &mode.do_polling, ConfigUpdateDialog, NULL));
|
||||
|
@ -920,7 +972,7 @@ Umount(MountPoint * mp)
|
|||
mode.anim_mount = 0;
|
||||
Epplet_timer(CallbackAnimate, NULL, 0, "Anim");
|
||||
#ifdef HAVE_EJECT
|
||||
if (mode.do_eject)
|
||||
if (mode.eject_mode == AUTO_EJECT)
|
||||
{
|
||||
Esnprintf(s, sizeof(s), "%s %s", EJECT, mp->device);
|
||||
Epplet_run_command(s);
|
||||
|
@ -1253,6 +1305,13 @@ CallbackButtonUp (void *data, Window win, int x, int y, int b)
|
|||
else
|
||||
Mount(mountpoint);
|
||||
}
|
||||
#ifdef HAVE_EJECT
|
||||
else if (b == 3 && mode.eject_mode == MANUAL_EJECT)
|
||||
{
|
||||
Esnprintf(s, sizeof(s), "%s %s", EJECT, mountpoint->device);
|
||||
Epplet_run_command(s);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
Epplet_gadget popup = Epplet_create_popup();
|
||||
|
@ -1341,7 +1400,7 @@ SetupDefaults(void)
|
|||
Esnprintf(s2, sizeof(s), "%i", ++instance);
|
||||
Epplet_modify_config("INSTANCE", s2);
|
||||
|
||||
mode.do_eject = atoi(Epplet_query_config("DO_EJECT"));
|
||||
mode.eject_mode = (EjectMode)atoi(Epplet_query_config("EJECT_MODE"));
|
||||
mode.do_polling = atoi(Epplet_query_config("DO_POLL"));
|
||||
mode.polling_interval = atoi(Epplet_query_config("POLLINTVAL"));
|
||||
mode.anim_mount = 0;
|
||||
|
@ -1515,12 +1574,12 @@ SyncConfigs(void)
|
|||
int i;
|
||||
MountPointType *mpt = NULL;
|
||||
|
||||
Esnprintf(s, sizeof(s), "%i", (int)mode.eject_mode);
|
||||
Epplet_modify_config("EJECT_MODE", s);
|
||||
|
||||
Esnprintf(s, sizeof(s), "%i", mode.do_polling);
|
||||
Epplet_modify_config("DO_POLL", s);
|
||||
|
||||
Esnprintf(s, sizeof(s), "%i", mode.do_eject);
|
||||
Epplet_modify_config("DO_EJECT", s);
|
||||
|
||||
Esnprintf(s, sizeof(s), "%i", mode.polling_interval);
|
||||
Epplet_modify_config("POLLINTVAL", s);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
ConfigItem defaults[] = {
|
||||
{"BG_IMAGE", EROOT"/epplet_data/E-Mountbox/E-Mountbox-bg.png"},
|
||||
{"DEFAULT", EROOT"/epplet_data/E-Mountbox/E-Mountbox-blockdev.png"},
|
||||
{"DO_EJECT", "1"},
|
||||
{"EJECT_MODE", "2"},
|
||||
{"DO_POLL", "1"},
|
||||
{"POLLINTVAL", "5"}
|
||||
};
|
||||
|
@ -47,13 +47,21 @@ char *default_types[] = {
|
|||
"jazz "EROOT"/epplet_data/E-Mountbox/E-Mountbox-jazz.png"
|
||||
};
|
||||
|
||||
typedef enum eject_mode
|
||||
{
|
||||
NO_EJECT,
|
||||
MANUAL_EJECT,
|
||||
AUTO_EJECT
|
||||
}
|
||||
EjectMode;
|
||||
|
||||
typedef struct _tile Tile;
|
||||
typedef struct _mountpointtype MountPointType;
|
||||
typedef struct _mode Mode;
|
||||
|
||||
struct _mode
|
||||
{
|
||||
int do_eject;
|
||||
EjectMode eject_mode;
|
||||
int do_polling;
|
||||
int polling_interval;
|
||||
int anim_mount;
|
||||
|
@ -101,6 +109,8 @@ Epplet_gadget action_area, button_close, button_config, button_help;
|
|||
Epplet_gadget tbox_key, tbox_file, tbox_default, tbox_bg;
|
||||
Epplet_gadget arrow_left, arrow_right, button_add, button_del, button_add_long;
|
||||
Epplet_gadget label_key, label_file, label_interval, label_slider, hslider_interval;
|
||||
Epplet_gadget togglebutton_no_eject, togglebutton_manual_eject, togglebutton_auto_eject;
|
||||
int ejectbuttons[3];
|
||||
Window config_win = 0;
|
||||
MountPointType *current_type = NULL;
|
||||
RGB_buf window_buf = NULL; /* the currently displayed mountpoint */
|
||||
|
@ -158,6 +168,7 @@ static void Callback_ConfigRight(void *data);
|
|||
static void Callback_ConfigAdd(void *data);
|
||||
static void Callback_ConfigDel(void *data);
|
||||
static void Callback_ConfigInterval(void *data);
|
||||
static void Callback_EjectType(void *data);
|
||||
|
||||
/* config stuff */
|
||||
void SetupDefaults(void);
|
||||
|
|
Loading…
Reference in New Issue