1
1

1998-05-20 Miguel de Icaza <miguel@nuclecu.unam.mx>

* gpageprop.c (item_properties), gprop.c: Add executable editing
	(command, and terminal).  Save the dentry after modification

1998-05-19  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* gprop.c (change_icon): Test for gp, as the combobox emits the
	"changed" signal when shutting down.  Great.

	* gdesktop.c (desktop_reload): Missing mc_closedir
	(desktop_setup_icon): Fix memory leak.
	(get_desktop_icon): Fix memory leak.
	(desktop_create_directory_entry): Set the size of the exec
	vector.
	(desktop_create_launch_entry): Same.

	We now create launch entries instead of trying to support
	regular dropped stuff on the desktop, this makes things easier and
	more consistent.

1998-05-19  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* ext.c: Memory leak fixed.
Этот коммит содержится в:
Miguel de Icaza 1998-05-20 05:49:16 +00:00
родитель 63780b9800
Коммит 4de36e79d8
5 изменённых файлов: 104 добавлений и 33 удалений

Просмотреть файл

@ -1,3 +1,8 @@
1998-05-20 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gpageprop.c (item_properties), gprop.c: Add executable editing
(command, and terminal). Save the dentry after modification
1998-05-19 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-05-19 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gprop.c (change_icon): Test for gp, as the combobox emits the * gprop.c (change_icon): Test for gp, as the combobox emits the

Просмотреть файл

@ -55,6 +55,7 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
GpropFilename *name; GpropFilename *name;
GpropPerm *perm; GpropPerm *perm;
GpropGeneral *gene; GpropGeneral *gene;
GpropExec *exec;
GtkDialog *toplevel; GtkDialog *toplevel;
umode_t new_mode; umode_t new_mode;
@ -88,11 +89,14 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
if (di && di->dentry) { if (di && di->dentry) {
gene = gprop_general_new (di->dentry->name, di->dentry->icon); gene = gprop_general_new (di->dentry->name, di->dentry->icon);
gtk_box_pack_start (GTK_BOX (vbox), gene->top, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), gene->top, FALSE, FALSE, 0);
exec = gprop_exec_new (di->dentry);
gtk_box_pack_start (GTK_BOX (vbox), exec->top, FALSE, FALSE, 0);
} else {
name = gprop_filename_new (fname, base);
gtk_box_pack_start (GTK_BOX (vbox), name->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)); 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 */
@ -183,33 +187,37 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
/* Check and change filename */ /* Check and change filename */
gprop_filename_get_data (name, &new_name); if (di && di->dentry){
gprop_exec_get_data (exec, di->dentry);
} else {
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");
else if (strcmp (new_name, base) != 0) { else if (strcmp (new_name, base) != 0) {
char *base = x_basename (fname); char *base = x_basename (fname);
char save = *base; char save = *base;
char *full_target; char *full_target;
*base = 0; *base = 0;
full_target = concat_dir_and_file (fname, 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);
file_mask_defaults (); file_mask_defaults ();
move_file_file (fname, full_target); move_file_file (fname, full_target);
destroy_op_win (); destroy_op_win ();
if (di) { if (di) {
free (di->pathname); free (di->pathname);
di->pathname = full_target; di->pathname = full_target;
} else } else
free (full_target); free (full_target);
retval |= GPROP_FILENAME; retval |= GPROP_FILENAME;
}
} }
/* Check and change title and 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) {
@ -231,6 +239,5 @@ item_properties (GtkWidget *parent, char *fname, desktop_icon_t *di)
} }
gtk_widget_destroy (GTK_WIDGET (toplevel)); gtk_widget_destroy (GTK_WIDGET (toplevel));
return retval; return retval;
} }

Просмотреть файл

@ -20,6 +20,7 @@ label_new (char *text, double xalign, double yalign)
label = gtk_label_new (text); label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign); gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_widget_show (label); gtk_widget_show (label);
return label; return label;
} }
@ -91,7 +92,58 @@ gprop_filename_get_data (GpropFilename *gp, char **filename)
} }
} }
/***** Permissions *****/ /* Executable */
GpropExec *
gprop_exec_new (GnomeDesktopEntry *dentry)
{
GpropExec *ge;
GtkWidget *frame, *table;
char *s;
ge = g_new (GpropExec, 1);
ge->top = gtk_vbox_new (FALSE, 6);
frame = gtk_frame_new (_("Command"));
gtk_box_pack_start (GTK_BOX (ge->top), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
table = gtk_table_new (0, 0, 0);
gtk_container_border_width (GTK_CONTAINER (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_table_attach (GTK_TABLE (table), label_new (_("Command:"), 0.0, 0.5),
0, 1, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
ge->entry = gnome_entry_new ("gprop_filename_entry");
s = gnome_config_assemble_vector (dentry->exec_length, (const char * const *) dentry->exec);
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (ge->entry))), s);
g_free (s);
gtk_table_attach (GTK_TABLE (table), ge->entry,
1, 2, 0, 1, 0, 0, 0, 0);
ge->check = gtk_check_button_new_with_label (_("Use terminal"));
GTK_TOGGLE_BUTTON (ge->check)->active = dentry->terminal ? 1 : 0;
gtk_table_attach (GTK_TABLE (table), ge->check,
1, 2, 1, 2, 0, 0, 0, 0);
gtk_widget_show_all (ge->top);
return ge;
}
void
gprop_exec_get_data (GpropExec *ge, GnomeDesktopEntry *dentry)
{
GtkEntry *entry;
entry = GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (ge->entry)));
gnome_string_array_free (dentry->exec);
gnome_config_make_vector (gtk_entry_get_text (entry),
&dentry->exec_length, &dentry->exec);
dentry->terminal = GTK_TOGGLE_BUTTON (ge->check)->active;
}
/***** permissions *****/
static umode_t static umode_t
perm_get_umode (GpropPerm *gp) perm_get_umode (GpropPerm *gp)

Просмотреть файл

@ -57,5 +57,12 @@ typedef struct {
GpropGeneral *gprop_general_new (char *title, char *icon_filename); GpropGeneral *gprop_general_new (char *title, char *icon_filename);
void gprop_general_get_data (GpropGeneral *gp, char **title, char **icon_filename); void gprop_general_get_data (GpropGeneral *gp, char **title, char **icon_filename);
typedef struct {
GtkWidget *top;
GtkWidget *entry;
GtkWidget *check;
} GpropExec;
GpropExec *gprop_exec_new (GnomeDesktopEntry *dentry);
#endif #endif

Просмотреть файл

@ -494,9 +494,9 @@ panel_action_properties (GtkWidget *widget, WPanel *panel)
file_entry *fe = &panel->dir.list [panel->selected]; file_entry *fe = &panel->dir.list [panel->selected];
char *full_name = concat_dir_and_file (panel->cwd, fe->fname); char *full_name = concat_dir_and_file (panel->cwd, fe->fname);
if (item_properties (GTK_WIDGET (panel->list), full_name, NULL) != 0) if (item_properties (GTK_WIDGET (panel->list), full_name, NULL) != 0){
reread_cmd (); reread_cmd ();
}
free (full_name); free (full_name);
} }