mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
1998-03-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdesktop.c (icon_properties): * gpageprop.c (item_properties): Modified to accept dentry title changes as well. (item_properties): Fixed base and fname confusion in call to concat_dir_and_file(). * gprop.c (gprop_general_new): (gprop_general_get_data): Renamed to general from icon. The general Gprop now lets you enter the title and icon filename for a dentry.
This commit is contained in:
parent
8dc04e93bd
commit
25d833d805
@ -1,3 +1,16 @@
|
|||||||
|
1998-03-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||||
|
|
||||||
|
* gdesktop.c (icon_properties):
|
||||||
|
* gpageprop.c (item_properties): Modified to accept dentry title
|
||||||
|
changes as well.
|
||||||
|
(item_properties): Fixed base and fname confusion in call to
|
||||||
|
concat_dir_and_file().
|
||||||
|
|
||||||
|
* gprop.c (gprop_general_new):
|
||||||
|
(gprop_general_get_data): Renamed to general from icon. The
|
||||||
|
general Gprop now lets you enter the title and icon filename for a
|
||||||
|
dentry.
|
||||||
|
|
||||||
1998-03-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
1998-03-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||||
|
|
||||||
* gdesktop.c (icon_properties): Whoops, actually save the dentry.
|
* gdesktop.c (icon_properties): Whoops, actually save the dentry.
|
||||||
|
@ -670,7 +670,7 @@ icon_properties (GtkWidget *widget, desktop_icon_t *di)
|
|||||||
|
|
||||||
retval = item_properties (di->widget, di->pathname, di);
|
retval = item_properties (di->widget, di->pathname, di);
|
||||||
|
|
||||||
if (retval & GPROP_ICON) {
|
if (retval & (GPROP_TITLE | GPROP_ICON)) {
|
||||||
gtk_widget_destroy (di->widget);
|
gtk_widget_destroy (di->widget);
|
||||||
|
|
||||||
di->widget = get_transparent_window_for_dentry (di->dentry);
|
di->widget = get_transparent_window_for_dentry (di->dentry);
|
||||||
@ -698,14 +698,14 @@ desktop_icon_context_popup (GdkEventButton *event, desktop_icon_t *di)
|
|||||||
item = gtk_menu_item_new_with_label (_("Properties"));
|
item = gtk_menu_item_new_with_label (_("Properties"));
|
||||||
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (icon_properties), di);
|
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (icon_properties), di);
|
||||||
gtk_signal_connect_object_after (GTK_OBJECT (item), "activate",
|
gtk_signal_connect_object_after (GTK_OBJECT (item), "activate",
|
||||||
GTK_SIGNAL_FUNC (gtk_widget_destroy), menu);
|
GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (menu));
|
||||||
gtk_menu_append (GTK_MENU (menu), item);
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
gtk_widget_show (item);
|
gtk_widget_show (item);
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_label (_("Delete"));
|
item = gtk_menu_item_new_with_label (_("Delete"));
|
||||||
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (icon_delete), di);
|
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (icon_delete), di);
|
||||||
gtk_signal_connect_object_after (GTK_OBJECT (item), "activate",
|
gtk_signal_connect_object_after (GTK_OBJECT (item), "activate",
|
||||||
GTK_SIGNAL_FUNC (gtk_widget_destroy), menu);
|
GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (menu));
|
||||||
gtk_menu_append (GTK_MENU (menu), item);
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
gtk_widget_show (item);
|
gtk_widget_show (item);
|
||||||
|
|
||||||
|
@ -48,21 +48,22 @@ kill_toplevel ()
|
|||||||
int
|
int
|
||||||
item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
|
item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
|
||||||
{
|
{
|
||||||
GtkWidget *parent_window;
|
GtkWidget *parent_window;
|
||||||
GdkCursor *clock_cursor;
|
GdkCursor *clock_cursor;
|
||||||
GtkWidget *notebook, *ok, *cancel;
|
GtkWidget *notebook, *ok, *cancel;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GpropGeneral *gene;
|
GpropFilename *name;
|
||||||
GpropPerm *perm;
|
GpropPerm *perm;
|
||||||
GpropIcon *icon;
|
GpropGeneral *gene;
|
||||||
GtkDialog *toplevel;
|
GtkDialog *toplevel;
|
||||||
|
|
||||||
umode_t new_mode;
|
umode_t new_mode;
|
||||||
char *new_group;
|
char *new_group;
|
||||||
char *new_owner;
|
char *new_owner;
|
||||||
char *new_name;
|
char *new_title;
|
||||||
char *new_icon;
|
char *new_icon;
|
||||||
char *base;
|
char *new_name;
|
||||||
|
char *base;
|
||||||
|
|
||||||
struct stat s;
|
struct stat s;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
@ -83,16 +84,17 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
|
|||||||
base = x_basename (fname);
|
base = x_basename (fname);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 6);
|
vbox = gtk_vbox_new (FALSE, 6);
|
||||||
gene = gprop_general_new (fname, base);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), gene->top, FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
perm = gprop_perm_new (s.st_mode, get_owner (s.st_uid), get_group (s.st_gid));
|
|
||||||
|
|
||||||
if (di && di->dentry) {
|
if (di && di->dentry) {
|
||||||
icon = gprop_icon_new (di->dentry->icon);
|
gene = gprop_general_new (di->dentry->name, di->dentry->icon);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), icon->top, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), gene->top, FALSE, FALSE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name = gprop_filename_new (fname, base);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), name->top, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
perm = gprop_perm_new (s.st_mode, get_owner (s.st_uid), get_group (s.st_gid));
|
||||||
|
|
||||||
/* Pack them into nice notebook */
|
/* Pack them into nice notebook */
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), c_spacing (vbox), gtk_label_new ("General"));
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), c_spacing (vbox), gtk_label_new ("General"));
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), c_spacing (perm->top), gtk_label_new ("Permissions"));
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), c_spacing (perm->top), gtk_label_new ("Permissions"));
|
||||||
@ -181,7 +183,7 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
|
|||||||
|
|
||||||
/* Check and change filename */
|
/* Check and change filename */
|
||||||
|
|
||||||
gprop_general_get_data (gene, &new_name);
|
gprop_filename_get_data (name, &new_name);
|
||||||
|
|
||||||
if (strchr (new_name, '/'))
|
if (strchr (new_name, '/'))
|
||||||
message (1, "Error", "The new name includes the `/' character");
|
message (1, "Error", "The new name includes the `/' character");
|
||||||
@ -191,7 +193,7 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
|
|||||||
char *full_target;
|
char *full_target;
|
||||||
|
|
||||||
*base = 0;
|
*base = 0;
|
||||||
full_target = concat_dir_and_file (base, new_name);
|
full_target = concat_dir_and_file (fname, new_name);
|
||||||
*base = save;
|
*base = save;
|
||||||
|
|
||||||
create_op_win (OP_MOVE, 0);
|
create_op_win (OP_MOVE, 0);
|
||||||
@ -208,10 +210,17 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
|
|||||||
retval |= GPROP_FILENAME;
|
retval |= GPROP_FILENAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check and change icon -- change is handled by caller */
|
/* Check and change title and icon -- change is handled by caller */
|
||||||
|
|
||||||
if (di && di->dentry) {
|
if (di && di->dentry) {
|
||||||
gprop_icon_get_data (icon, &new_icon);
|
gprop_general_get_data (gene, &new_title, &new_icon);
|
||||||
|
|
||||||
|
if (strcmp (new_title, di->dentry->name) != 0) {
|
||||||
|
g_free (di->dentry->name);
|
||||||
|
|
||||||
|
di->dentry->name = new_title;
|
||||||
|
retval |= GPROP_TITLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp (new_icon, di->dentry->icon) != 0) {
|
if (strcmp (new_icon, di->dentry->icon) != 0) {
|
||||||
g_free (di->dentry->icon);
|
g_free (di->dentry->icon);
|
||||||
|
@ -21,7 +21,8 @@ typedef enum {
|
|||||||
GPROP_MODE = 1 << 1,
|
GPROP_MODE = 1 << 1,
|
||||||
GPROP_UID = 1 << 2,
|
GPROP_UID = 1 << 2,
|
||||||
GPROP_GID = 1 << 3,
|
GPROP_GID = 1 << 3,
|
||||||
GPROP_ICON = 1 << 4
|
GPROP_ICON = 1 << 4,
|
||||||
|
GPROP_TITLE = 1 << 5
|
||||||
} GpropChanged;
|
} GpropChanged;
|
||||||
|
|
||||||
/* Returns a mask of the above specifying what changed.
|
/* Returns a mask of the above specifying what changed.
|
||||||
|
238
gnome/gprop.c
238
gnome/gprop.c
@ -30,12 +30,12 @@ free_stuff (GtkWidget *widget, gpointer data)
|
|||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** General *****/
|
/***** Filename *****/
|
||||||
|
|
||||||
GpropGeneral *
|
GpropFilename *
|
||||||
gprop_general_new (char *complete_filename, char *filename)
|
gprop_filename_new (char *complete_filename, char *filename)
|
||||||
{
|
{
|
||||||
GpropGeneral *gpg;
|
GpropFilename *gp;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
@ -44,15 +44,15 @@ gprop_general_new (char *complete_filename, char *filename)
|
|||||||
g_return_val_if_fail (complete_filename != NULL, NULL);
|
g_return_val_if_fail (complete_filename != NULL, NULL);
|
||||||
g_return_val_if_fail (filename != NULL, NULL);
|
g_return_val_if_fail (filename != NULL, NULL);
|
||||||
|
|
||||||
gpg = g_new (GpropGeneral, 1);
|
gp = g_new (GpropFilename, 1);
|
||||||
|
|
||||||
gpg->top = gtk_vbox_new (FALSE, 6);
|
gp->top = gtk_vbox_new (FALSE, 6);
|
||||||
gtk_signal_connect (GTK_OBJECT (gpg->top), "destroy",
|
gtk_signal_connect (GTK_OBJECT (gp->top), "destroy",
|
||||||
(GtkSignalFunc) free_stuff,
|
(GtkSignalFunc) free_stuff,
|
||||||
gpg);
|
gp);
|
||||||
|
|
||||||
frame = gtk_frame_new ("Name");
|
frame = gtk_frame_new ("Filename");
|
||||||
gtk_box_pack_start (GTK_BOX (gpg->top), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (gp->top), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 6);
|
vbox = gtk_vbox_new (FALSE, 6);
|
||||||
@ -68,25 +68,25 @@ gprop_general_new (char *complete_filename, char *filename)
|
|||||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label_new ("Name", 0.0, 0.5), FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label_new ("Filename", 0.0, 0.5), FALSE, FALSE, 0);
|
||||||
|
|
||||||
gpg->filename = gnome_entry_new ("gprop_general_filename");
|
gp->filename = gnome_entry_new ("gprop_filename_filename");
|
||||||
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gpg->filename))), filename);
|
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gp->filename))), filename);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), gpg->filename, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), gp->filename, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (gpg->filename);
|
gtk_widget_show (gp->filename);
|
||||||
|
|
||||||
return gpg;
|
return gp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gprop_general_get_data (GpropGeneral *gpg, char **filename)
|
gprop_filename_get_data (GpropFilename *gp, char **filename)
|
||||||
{
|
{
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
|
|
||||||
g_return_if_fail (gpg != NULL);
|
g_return_if_fail (gp != NULL);
|
||||||
|
|
||||||
if (filename) {
|
if (filename) {
|
||||||
entry = gnome_entry_gtk_entry (GNOME_ENTRY (gpg->filename));
|
entry = gnome_entry_gtk_entry (GNOME_ENTRY (gp->filename));
|
||||||
*filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
*filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ gprop_general_get_data (GpropGeneral *gpg, char **filename)
|
|||||||
/***** Permissions *****/
|
/***** Permissions *****/
|
||||||
|
|
||||||
static umode_t
|
static umode_t
|
||||||
perm_get_umode (GpropPerm *gpp)
|
perm_get_umode (GpropPerm *gp)
|
||||||
{
|
{
|
||||||
umode_t umode;
|
umode_t umode;
|
||||||
|
|
||||||
@ -102,21 +102,21 @@ perm_get_umode (GpropPerm *gpp)
|
|||||||
|
|
||||||
umode = 0;
|
umode = 0;
|
||||||
|
|
||||||
SETBIT (gpp->suid, S_ISUID);
|
SETBIT (gp->suid, S_ISUID);
|
||||||
SETBIT (gpp->sgid, S_ISGID);
|
SETBIT (gp->sgid, S_ISGID);
|
||||||
SETBIT (gpp->svtx, S_ISVTX);
|
SETBIT (gp->svtx, S_ISVTX);
|
||||||
|
|
||||||
SETBIT (gpp->rusr, S_IRUSR);
|
SETBIT (gp->rusr, S_IRUSR);
|
||||||
SETBIT (gpp->wusr, S_IWUSR);
|
SETBIT (gp->wusr, S_IWUSR);
|
||||||
SETBIT (gpp->xusr, S_IXUSR);
|
SETBIT (gp->xusr, S_IXUSR);
|
||||||
|
|
||||||
SETBIT (gpp->rgrp, S_IRGRP);
|
SETBIT (gp->rgrp, S_IRGRP);
|
||||||
SETBIT (gpp->wgrp, S_IWGRP);
|
SETBIT (gp->wgrp, S_IWGRP);
|
||||||
SETBIT (gpp->xgrp, S_IXGRP);
|
SETBIT (gp->xgrp, S_IXGRP);
|
||||||
|
|
||||||
SETBIT (gpp->roth, S_IROTH);
|
SETBIT (gp->roth, S_IROTH);
|
||||||
SETBIT (gpp->woth, S_IWOTH);
|
SETBIT (gp->woth, S_IWOTH);
|
||||||
SETBIT (gpp->xoth, S_IXOTH);
|
SETBIT (gp->xoth, S_IXOTH);
|
||||||
|
|
||||||
return umode;
|
return umode;
|
||||||
|
|
||||||
@ -127,12 +127,12 @@ static void
|
|||||||
perm_set_mode_label (GtkWidget *widget, gpointer data)
|
perm_set_mode_label (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
umode_t umode;
|
umode_t umode;
|
||||||
GpropPerm *gpp;
|
GpropPerm *gp;
|
||||||
char s_mode[5];
|
char s_mode[5];
|
||||||
|
|
||||||
gpp = data;
|
gp = data;
|
||||||
|
|
||||||
umode = perm_get_umode (gpp);
|
umode = perm_get_umode (gp);
|
||||||
|
|
||||||
s_mode[0] = '0' + ((umode & (S_ISUID | S_ISGID | S_ISVTX)) >> 9);
|
s_mode[0] = '0' + ((umode & (S_ISUID | S_ISGID | S_ISVTX)) >> 9);
|
||||||
s_mode[1] = '0' + ((umode & (S_IRUSR | S_IWUSR | S_IXUSR)) >> 6);
|
s_mode[1] = '0' + ((umode & (S_IRUSR | S_IWUSR | S_IXUSR)) >> 6);
|
||||||
@ -140,11 +140,11 @@ perm_set_mode_label (GtkWidget *widget, gpointer data)
|
|||||||
s_mode[3] = '0' + ((umode & (S_IROTH | S_IWOTH | S_IXOTH)) >> 0);
|
s_mode[3] = '0' + ((umode & (S_IROTH | S_IWOTH | S_IXOTH)) >> 0);
|
||||||
s_mode[4] = 0;
|
s_mode[4] = 0;
|
||||||
|
|
||||||
gtk_label_set (GTK_LABEL (gpp->mode_label), s_mode);
|
gtk_label_set (GTK_LABEL (gp->mode_label), s_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
perm_check_new (char *text, int state, GpropPerm *gpp)
|
perm_check_new (char *text, int state, GpropPerm *gp)
|
||||||
{
|
{
|
||||||
GtkWidget *check;
|
GtkWidget *check;
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ perm_check_new (char *text, int state, GpropPerm *gpp)
|
|||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (check), "toggled",
|
gtk_signal_connect (GTK_OBJECT (check), "toggled",
|
||||||
(GtkSignalFunc) perm_set_mode_label,
|
(GtkSignalFunc) perm_set_mode_label,
|
||||||
gpp);
|
gp);
|
||||||
|
|
||||||
gtk_widget_show (check);
|
gtk_widget_show (check);
|
||||||
return check;
|
return check;
|
||||||
@ -172,9 +172,9 @@ gtk_table_attach (GTK_TABLE (table), widget, \
|
|||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
#define PERMSET(name, r, w, x, rmask, wmask, xmask, y) do { \
|
#define PERMSET(name, r, w, x, rmask, wmask, xmask, y) do { \
|
||||||
r = perm_check_new (NULL, umode & rmask, gpp); \
|
r = perm_check_new (NULL, umode & rmask, gp); \
|
||||||
w = perm_check_new (NULL, umode & wmask, gpp); \
|
w = perm_check_new (NULL, umode & wmask, gp); \
|
||||||
x = perm_check_new (NULL, umode & xmask, gpp); \
|
x = perm_check_new (NULL, umode & xmask, gp); \
|
||||||
\
|
\
|
||||||
ATTACH (table, label_new (name, 0.0, 0.5), 0, 1, y, y + 1); \
|
ATTACH (table, label_new (name, 0.0, 0.5), 0, 1, y, y + 1); \
|
||||||
ATTACH (table, r, 1, 2, y, y + 1); \
|
ATTACH (table, r, 1, 2, y, y + 1); \
|
||||||
@ -183,7 +183,7 @@ gtk_table_attach (GTK_TABLE (table), widget, \
|
|||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
perm_mode_new (GpropPerm *gpp, umode_t umode)
|
perm_mode_new (GpropPerm *gp, umode_t umode)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
@ -203,8 +203,8 @@ perm_mode_new (GpropPerm *gpp, umode_t umode)
|
|||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label_new ("Current mode: ", 0.0, 0.5), FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label_new ("Current mode: ", 0.0, 0.5), FALSE, FALSE, 0);
|
||||||
|
|
||||||
gpp->mode_label = label_new ("0000", 0.0, 0.5);
|
gp->mode_label = label_new ("0000", 0.0, 0.5);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), gpp->mode_label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), gp->mode_label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
table = gtk_table_new (4, 5, FALSE);
|
table = gtk_table_new (4, 5, FALSE);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
@ -221,21 +221,21 @@ perm_mode_new (GpropPerm *gpp, umode_t umode)
|
|||||||
|
|
||||||
/* Permissions */
|
/* Permissions */
|
||||||
|
|
||||||
PERMSET ("User", gpp->rusr, gpp->wusr, gpp->xusr, S_IRUSR, S_IWUSR, S_IXUSR, 1);
|
PERMSET ("User", gp->rusr, gp->wusr, gp->xusr, S_IRUSR, S_IWUSR, S_IXUSR, 1);
|
||||||
PERMSET ("Group", gpp->rgrp, gpp->wgrp, gpp->xgrp, S_IRGRP, S_IWGRP, S_IXGRP, 2);
|
PERMSET ("Group", gp->rgrp, gp->wgrp, gp->xgrp, S_IRGRP, S_IWGRP, S_IXGRP, 2);
|
||||||
PERMSET ("Other", gpp->roth, gpp->woth, gpp->xoth, S_IROTH, S_IWOTH, S_IXOTH, 3);
|
PERMSET ("Other", gp->roth, gp->woth, gp->xoth, S_IROTH, S_IWOTH, S_IXOTH, 3);
|
||||||
|
|
||||||
/* Special */
|
/* Special */
|
||||||
|
|
||||||
gpp->suid = perm_check_new ("Set UID", umode & S_ISUID, gpp);
|
gp->suid = perm_check_new ("Set UID", umode & S_ISUID, gp);
|
||||||
gpp->sgid = perm_check_new ("Set GID", umode & S_ISGID, gpp);
|
gp->sgid = perm_check_new ("Set GID", umode & S_ISGID, gp);
|
||||||
gpp->svtx = perm_check_new ("Sticky", umode & S_ISVTX, gpp);
|
gp->svtx = perm_check_new ("Sticky", umode & S_ISVTX, gp);
|
||||||
|
|
||||||
ATTACH (table, gpp->suid, 4, 5, 1, 2);
|
ATTACH (table, gp->suid, 4, 5, 1, 2);
|
||||||
ATTACH (table, gpp->sgid, 4, 5, 2, 3);
|
ATTACH (table, gp->sgid, 4, 5, 2, 3);
|
||||||
ATTACH (table, gpp->svtx, 4, 5, 3, 4);
|
ATTACH (table, gp->svtx, 4, 5, 3, 4);
|
||||||
|
|
||||||
perm_set_mode_label (NULL, gpp);
|
perm_set_mode_label (NULL, gp);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ perm_group_new (char *group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
perm_ownership_new (GpropPerm *gpp, char *owner, char *group)
|
perm_ownership_new (GpropPerm *gp, char *owner, char *group)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
@ -337,13 +337,13 @@ perm_ownership_new (GpropPerm *gpp, char *owner, char *group)
|
|||||||
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK,
|
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
gpp->owner = perm_owner_new (owner);
|
gp->owner = perm_owner_new (owner);
|
||||||
gtk_table_attach (GTK_TABLE (table), gpp->owner,
|
gtk_table_attach (GTK_TABLE (table), gp->owner,
|
||||||
1, 2, 0, 1,
|
1, 2, 0, 1,
|
||||||
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||||
GTK_FILL | GTK_SHRINK,
|
GTK_FILL | GTK_SHRINK,
|
||||||
0, 0);
|
0, 0);
|
||||||
gtk_widget_show (gpp->owner);
|
gtk_widget_show (gp->owner);
|
||||||
|
|
||||||
/* Group */
|
/* Group */
|
||||||
|
|
||||||
@ -352,13 +352,13 @@ perm_ownership_new (GpropPerm *gpp, char *owner, char *group)
|
|||||||
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK,
|
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
gpp->group = perm_group_new (group);
|
gp->group = perm_group_new (group);
|
||||||
gtk_table_attach (GTK_TABLE (table), gpp->group,
|
gtk_table_attach (GTK_TABLE (table), gp->group,
|
||||||
1, 2, 1, 2,
|
1, 2, 1, 2,
|
||||||
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||||
GTK_FILL | GTK_SHRINK,
|
GTK_FILL | GTK_SHRINK,
|
||||||
0, 0);
|
0, 0);
|
||||||
gtk_widget_show (gpp->group);
|
gtk_widget_show (gp->group);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
@ -366,89 +366,125 @@ perm_ownership_new (GpropPerm *gpp, char *owner, char *group)
|
|||||||
GpropPerm *
|
GpropPerm *
|
||||||
gprop_perm_new (umode_t umode, char *owner, char *group)
|
gprop_perm_new (umode_t umode, char *owner, char *group)
|
||||||
{
|
{
|
||||||
GpropPerm *gpp;
|
GpropPerm *gp;
|
||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
|
|
||||||
g_return_val_if_fail (owner != NULL, NULL);
|
g_return_val_if_fail (owner != NULL, NULL);
|
||||||
g_return_val_if_fail (group != NULL, NULL);
|
g_return_val_if_fail (group != NULL, NULL);
|
||||||
|
|
||||||
gpp = g_new (GpropPerm, 1);
|
gp = g_new (GpropPerm, 1);
|
||||||
|
|
||||||
gpp->top = gtk_vbox_new (FALSE, 6);
|
gp->top = gtk_vbox_new (FALSE, 6);
|
||||||
gtk_signal_connect (GTK_OBJECT (gpp->top), "destroy",
|
gtk_signal_connect (GTK_OBJECT (gp->top), "destroy",
|
||||||
(GtkSignalFunc) free_stuff,
|
(GtkSignalFunc) free_stuff,
|
||||||
gpp);
|
gp);
|
||||||
|
|
||||||
w = perm_mode_new (gpp, umode);
|
w = perm_mode_new (gp, umode);
|
||||||
gtk_box_pack_start (GTK_BOX (gpp->top), w, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (gp->top), w, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (w);
|
gtk_widget_show (w);
|
||||||
|
|
||||||
w = perm_ownership_new (gpp, owner, group);
|
w = perm_ownership_new (gp, owner, group);
|
||||||
gtk_box_pack_start (GTK_BOX (gpp->top), w, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (gp->top), w, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (w);
|
gtk_widget_show (w);
|
||||||
|
|
||||||
return gpp;
|
return gp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gprop_perm_get_data (GpropPerm *gpp, umode_t *umode, char **owner, char **group)
|
gprop_perm_get_data (GpropPerm *gp, umode_t *umode, char **owner, char **group)
|
||||||
{
|
{
|
||||||
g_return_if_fail (gpp != NULL);
|
g_return_if_fail (gp != NULL);
|
||||||
|
|
||||||
if (umode)
|
if (umode)
|
||||||
*umode = perm_get_umode (gpp);
|
*umode = perm_get_umode (gp);
|
||||||
|
|
||||||
if (owner)
|
if (owner)
|
||||||
*owner = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gpp->owner)))));
|
*owner = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gp->owner)))));
|
||||||
|
|
||||||
if (group)
|
if (group)
|
||||||
*group = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gpp->group)))));
|
*group = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gp->group)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Icon *****/
|
/***** General *****/
|
||||||
|
|
||||||
GpropIcon *
|
GpropGeneral *
|
||||||
gprop_icon_new (char *icon_filename)
|
gprop_general_new (char *title, char *icon_filename)
|
||||||
{
|
{
|
||||||
GpropIcon *gpi;
|
GpropGeneral *gp;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *vbox;
|
GtkWidget *table;
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
|
|
||||||
gpi = g_new (GpropIcon, 1);
|
g_return_val_if_fail (title != NULL, NULL);
|
||||||
|
g_return_val_if_fail (icon_filename != NULL, NULL);
|
||||||
|
|
||||||
gpi->top = gtk_vbox_new (FALSE, 6);
|
gp = g_new (GpropGeneral, 1);
|
||||||
gtk_signal_connect (GTK_OBJECT (gpi->top), "destroy",
|
|
||||||
|
gp->top = gtk_vbox_new (FALSE, 6);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gp->top), "destroy",
|
||||||
(GtkSignalFunc) free_stuff,
|
(GtkSignalFunc) free_stuff,
|
||||||
gpi);
|
gp);
|
||||||
|
|
||||||
frame = gtk_frame_new ("Icon");
|
frame = gtk_frame_new ("General");
|
||||||
gtk_box_pack_start (GTK_BOX (gpi->top), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (gp->top), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 6);
|
table = gtk_table_new (2, 2, FALSE);
|
||||||
gtk_container_border_width (GTK_CONTAINER (vbox), 6);
|
gtk_container_border_width (GTK_CONTAINER (table), 6);
|
||||||
gtk_container_add(GTK_CONTAINER (frame), vbox);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||||
gtk_widget_show (vbox);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
gtk_widget_show (table);
|
||||||
|
|
||||||
gpi->icon_filename = gnome_file_entry_new ("gprop_icon_filename", "Select icon");
|
gtk_table_attach (GTK_TABLE (table), label_new ("Title", 0.0, 0.5),
|
||||||
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (gpi->icon_filename));
|
0, 1, 0, 1,
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), icon_filename ? icon_filename : "");
|
GTK_FILL | GTK_SHRINK,
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), gpi->icon_filename, FALSE, FALSE, 0);
|
GTK_FILL | GTK_SHRINK,
|
||||||
gtk_widget_show (gpi->icon_filename);
|
0, 0);
|
||||||
|
|
||||||
return gpi;
|
gp->title = gnome_entry_new ("gprop_general_title");
|
||||||
|
entry = gnome_entry_gtk_entry (GNOME_ENTRY (gp->title));
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), title);
|
||||||
|
gtk_table_attach (GTK_TABLE (table), gp->title,
|
||||||
|
1, 2, 0, 1,
|
||||||
|
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||||
|
GTK_FILL | GTK_SHRINK,
|
||||||
|
0, 0);
|
||||||
|
gtk_widget_show (gp->title);
|
||||||
|
|
||||||
|
gtk_table_attach (GTK_TABLE (table), label_new ("Icon", 0.0, 0.5),
|
||||||
|
0, 1, 1, 2,
|
||||||
|
GTK_FILL | GTK_SHRINK,
|
||||||
|
GTK_FILL | GTK_SHRINK,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
gp->icon_filename = gnome_file_entry_new ("gprop_general_icon_filename", "Select icon");
|
||||||
|
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (gp->icon_filename));
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), icon_filename);
|
||||||
|
gtk_table_attach (GTK_TABLE (table), gp->icon_filename,
|
||||||
|
1, 2, 1, 2,
|
||||||
|
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||||
|
GTK_FILL | GTK_SHRINK,
|
||||||
|
0, 0);
|
||||||
|
gtk_widget_show (gp->icon_filename);
|
||||||
|
|
||||||
|
return gp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gprop_icon_get_data (GpropIcon *gpi, char **icon_filename)
|
gprop_general_get_data (GpropGeneral *gp, char **title, char **icon_filename)
|
||||||
{
|
{
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
|
|
||||||
g_return_if_fail (gpi != NULL);
|
g_return_if_fail (gp != NULL);
|
||||||
|
|
||||||
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (gpi->icon_filename));
|
if (title) {
|
||||||
|
entry = gnome_entry_gtk_entry (GNOME_ENTRY (gp->title));
|
||||||
|
*title = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||||
|
}
|
||||||
|
|
||||||
if (icon_filename)
|
if (icon_filename) {
|
||||||
|
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (gp->icon_filename));
|
||||||
*icon_filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
*icon_filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
/***** General *****/
|
/***** Filename *****/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWidget *top;
|
GtkWidget *top;
|
||||||
|
|
||||||
GtkWidget *filename;
|
GtkWidget *filename;
|
||||||
} GpropGeneral;
|
} GpropFilename;
|
||||||
|
|
||||||
GpropGeneral *gprop_general_new (char *complete_filename, char *filename);
|
GpropFilename *gprop_filename_new (char *complete_filename, char *filename);
|
||||||
void gprop_general_get_data (GpropGeneral *gpg, char **filename);
|
void gprop_filename_get_data (GpropFilename *gp, char **filename);
|
||||||
|
|
||||||
/***** Permissions *****/
|
/***** Permissions *****/
|
||||||
|
|
||||||
@ -42,17 +42,19 @@ typedef struct {
|
|||||||
} GpropPerm;
|
} GpropPerm;
|
||||||
|
|
||||||
GpropPerm *gprop_perm_new (umode_t umode, char *owner, char *group);
|
GpropPerm *gprop_perm_new (umode_t umode, char *owner, char *group);
|
||||||
void gprop_perm_get_data (GpropPerm *gpp, umode_t *umode, char **owner, char **group);
|
void gprop_perm_get_data (GpropPerm *gp, umode_t *umode, char **owner, char **group);
|
||||||
|
|
||||||
/***** Icon *****/
|
/***** General *****/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWidget *top;
|
GtkWidget *top;
|
||||||
|
|
||||||
|
GtkWidget *title;
|
||||||
GtkWidget *icon_filename;
|
GtkWidget *icon_filename;
|
||||||
} GpropIcon;
|
} GpropGeneral;
|
||||||
|
|
||||||
|
GpropGeneral *gprop_general_new (char *title, char *icon_filename);
|
||||||
|
void gprop_general_get_data (GpropGeneral *gp, char **title, char **icon_filename);
|
||||||
|
|
||||||
GpropIcon *gprop_icon_new (char *icon_filename);
|
|
||||||
void gprop_icon_get_data (GpropIcon *gpi, char **icon_filename);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user