1999-02-26 Miguel de Icaza <miguel@nuclecu.unam.mx>

* gdesktop.c (desktop_icon_info_open): Add needs terminal support.

	* gnome-file-property-dialog.c (create_settings_pane): Add Needs
	terminal check box

1999-02-25  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* gaction.c (gmc_open_filename): Add support for needsterminal.

	* gscreen.c: Add New Folder option to the panel popup.
This commit is contained in:
Miguel de Icaza 1999-02-26 07:17:51 +00:00
parent 7ceb10c81f
commit 8578ca5e2e
17 changed files with 430 additions and 332 deletions

View File

@ -1,10 +1,21 @@
1999-02-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdesktop.c (desktop_icon_info_open): Add needs terminal support.
* gnome-file-property-dialog.c (create_settings_pane): Add Needs
terminal check box
1999-02-25 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gaction.c (gmc_open_filename): Add support for needsterminal.
* gscreen.c: Add New Folder option to the panel popup.
1999-02-25 Owen Taylor <otaylor@redhat.com>
* gdialogs.c (file_delete_query_recursive): GNOME
replacement for recursive delete query dialog.
1999-02-25 Owen Taylor <otaylor@redhat.com>
* gprefs.c gcustom-layout.[ch]: Add a new page to
the preferences dialog to allow the user to change
the columns in the custom view.

View File

@ -18,9 +18,9 @@
#include "../vfs/vfs.h"
static void
gmc_execute (const char *fname, const char *buf)
gmc_execute (const char *fname, const char *buf, int needs_terminal)
{
exec_extension (fname, buf, NULL, NULL, 0);
exec_extension (fname, buf, NULL, NULL, 0, needs_terminal);
}
int
@ -30,20 +30,36 @@ gmc_open_filename (char *fname, GList *args)
const char *cmd;
char *buf;
int size;
int needs_terminal = 0;
mime_type = gnome_mime_type_or_default (fname, NULL);
/*
* We accept needs_terminal as -1, which means our caller
* did not want to do the work
*/
if (gnome_metadata_get (fname, "flags", &size, &buf) == 0){
needs_terminal = (strstr (buf, "needsterminal") != 0);
g_free (buf);
} else if (mime_type){
const char *flags;
flags = gnome_mime_type_or_default (mime_type, "flags");
needs_terminal = (strstr (flags, "needsterminal") != 0);
}
if (gnome_metadata_get (fname, "fm-open", &size, &buf) == 0){
gmc_execute (fname, buf);
gmc_execute (fname, buf, needs_terminal);
g_free (buf);
return 1;
}
if (gnome_metadata_get (fname, "open", &size, &buf) == 0){
gmc_execute (fname, buf);
gmc_execute (fname, buf, needs_terminal);
g_free (buf);
return 1;
}
mime_type = gnome_mime_type_or_default (fname, NULL);
if (!mime_type)
return 0;
@ -51,13 +67,13 @@ gmc_open_filename (char *fname, GList *args)
cmd = gnome_mime_get_value (mime_type, "fm-open");
if (cmd){
gmc_execute (fname, cmd);
gmc_execute (fname, cmd, needs_terminal);
return 1;
}
cmd = gnome_mime_get_value (mime_type, "open");
if (cmd){
gmc_execute (fname, cmd);
gmc_execute (fname, cmd, needs_terminal);
return 1;
}
@ -85,7 +101,7 @@ gmc_edit_filename (char *fname)
int on_terminal;
if (gnome_metadata_get (fname, "edit", &size, &buf) == 0){
gmc_execute (fname, buf);
gmc_execute (fname, buf, 0);
g_free (buf);
return 1;
}
@ -95,7 +111,7 @@ gmc_edit_filename (char *fname)
cmd = gnome_mime_get_value (mime_type, "edit");
if (cmd){
gmc_execute (fname, cmd);
gmc_execute (fname, cmd, 0);
return 1;
}
}
@ -123,7 +139,7 @@ gmc_edit_filename (char *fname)
} else {
char *cmd = g_strconcat (editor, " %s", NULL);
gmc_execute (fname, cmd);
gmc_execute (fname, cmd, 0);
g_free (cmd);
}
@ -141,7 +157,7 @@ gmc_open (file_entry *fe)
static void
gmc_run_view (const char *filename, const char *buf)
{
exec_extension (filename, buf, NULL, NULL, 0);
exec_extension (filename, buf, NULL, NULL, 0, 0);
}
int

View File

@ -1091,9 +1091,21 @@ desktop_icon_info_open (DesktopIconInfo *dii)
new_panel_at (point);
g_free (point);
} else {
if (is_exe (fe->buf.st_mode) && if_link_is_exe (desktop_directory, fe))
my_system (EXECUTE_AS_SHELL, shell, filename);
if (is_exe (fe->buf.st_mode) && if_link_is_exe (desktop_directory, fe)){
int needs_terminal = 0;
int size;
char *buf;
if (gnome_metadata_get (filename, "flags", &size, &buf) == 0){
needs_terminal = strstr (buf, "needsterminal") != 0;
g_free (buf);
}
if (needs_terminal)
gnome_open_terminal_with_cmd (filename);
else
my_system (EXECUTE_AS_SHELL, shell, filename);
} else
gmc_open_filename (filename, NULL);
}
}

View File

@ -44,7 +44,6 @@ typedef struct {
char *url; /* URL this icon points to */
int selected : 1; /* Is the icon selected? */
int tmp_selected : 1; /* Temp storage for original selection while rubberbanding */
int requires_terminal : 1; /* True if this requires a terminal to run */
} DesktopIconInfo;
void desktop_icon_info_open (DesktopIconInfo *dii);

View File

@ -371,9 +371,9 @@ drop_on_file (GdkDragContext *context, GtkSelectionData *selection_data,
drops[i] = NULL;
if (gnome_metadata_get (full_name, "open", &size, &buf) == 0)
exec_extension (full_name, buf, drops, NULL, 0);
exec_extension (full_name, buf, drops, NULL, 0, 0);
else
exec_extension (full_name, "%f %q", drops, NULL, 0);
exec_extension (full_name, "%f %q", drops, NULL, 0, 0);
g_free (drops);
gnome_uri_list_free_strings (names);

View File

@ -35,12 +35,17 @@ WPanel *new_panel_at (char *dir);
WPanel *new_panel_with_geometry_at (char *dir, char *geometry);
void layout_panel_gone (WPanel *panel);
void gtkrundlg_event (Dlg_head *h);
void x_show_info (WInfo *info, struct my_statfs *s, struct stat *b);
void x_create_info (Dlg_head *h, widget_data parent, WInfo *info);
/*
* stuff from gaction.c
*/
int gmc_open (file_entry *fe);
int gmc_open_filename (char *fname, GList *args);
int gmc_edit_filename (char *fname);
int gmc_view (char *filename, int start_line);
void x_show_info (WInfo *info, struct my_statfs *s, struct stat *b);
void x_create_info (Dlg_head *h, widget_data parent, WInfo *info);
void gmc_window_setup_from_panel (GnomeDialog *dialog, WPanel *panel);

View File

@ -604,6 +604,14 @@ create_settings_pane (GnomeFilePropertyDialog *fp_dlg)
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
table = generate_actions_box (fp_dlg);
gtk_container_add (GTK_CONTAINER (frame), table);
frame = gtk_frame_new (_("Open action"));
fp_dlg->needs_terminal_check = gtk_check_button_new_with_label (_("Needs terminal to run"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fp_dlg->needs_terminal_check),
fp_dlg->needs_terminal);
gtk_container_add (GTK_CONTAINER (frame), fp_dlg->needs_terminal_check);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
return vbox;
}
@ -945,7 +953,7 @@ static void
init_metadata (GnomeFilePropertyDialog *fp_dlg)
{
gint size;
char *mime_type;
char *mime_type, *str;
gchar link_name[MC_MAXPATHLEN];
gint n;
gchar *file_name, *desktop_url;
@ -957,6 +965,15 @@ init_metadata (GnomeFilePropertyDialog *fp_dlg)
gnome_metadata_get (fp_dlg->file_name, "edit", &size, &fp_dlg->edit);
gnome_metadata_get (fp_dlg->file_name, "drop-target", &size, &fp_dlg->drop_target);
/*
* Fetch the needs-terminal setting
*/
if (gnome_metadata_get (fp_dlg->file_name, "flags", &size, &str) == 0){
fp_dlg->needs_terminal = strstr (str, "needsterminal") != 0;
g_free (str);
} else
fp_dlg->needs_terminal = 0;
/* Mime stuff */
file_name = fp_dlg->file_name;
if (S_ISLNK (fp_dlg->st.st_mode)) {
@ -1277,6 +1294,60 @@ apply_metadata_change (GnomeFilePropertyDialog *fpd)
strlen (new_caption)+1, new_caption);
}
/*
* "Needs terminal" check button
*
* This piece of code is more complex than it should, as the "flags"
* metadata value is actually a list of comma separated flags. So
* we need to edit this list when removing the "needsterminal" flag.
*/
{
int toggled = 0 != GTK_TOGGLE_BUTTON (fpd->needs_terminal_check)->active;
int size;
char *buf;
if (gnome_metadata_get (fpd->file_name, "flags", &size, &buf) == 0){
char *p;
p = strstr (buf, "needsterminal");
if (toggled){
if (!p){
p = g_strconcat (buf, ",needsterminal", NULL);
gnome_metadata_set (fpd->file_name, "flags", strlen (p)+1, p);
g_free (p);
}
} else {
if (p){
char *p1, *p2;
if (p != buf){
p1 = g_malloc (p - buf + 1);
strncpy (p1, buf, p - buf);
p1 [p - buf ] = 0;
} else
p1 = g_strdup ("");
p += strlen ("needsterminal");
p2 = g_strconcat (p1, p, NULL);
if (strcmp (p2, ",") == 0)
gnome_metadata_remove (fpd->file_name, "flags");
else
gnome_metadata_set (fpd->file_name, "flags",
strlen (p2)+1, p2);
g_free (p2);
g_free (p1);
}
}
} else {
if (toggled){
gnome_metadata_set (fpd->file_name, "flags",
sizeof ("needsterminal"), "needsterminal");
}
}
}
if (!fpd->can_set_icon)
return 1;
/* And finally, we set the metadata on the icon filename */

View File

@ -70,6 +70,7 @@ struct _GnomeFilePropertyDialog
GtkWidget *button;
GtkWidget *desktop_entry;
GtkWidget *caption_entry;
GtkWidget *needs_terminal_check;
gchar *fm_open;
gchar *fm_view;
@ -84,6 +85,8 @@ struct _GnomeFilePropertyDialog
gchar *caption;
gboolean can_set_icon;
gboolean needs_terminal;
GdkImlibImage *im;
/* Private Data */

View File

@ -1,36 +1,10 @@
New task list:
- Use notebook to hold CLIst/IconList on the main windown
- Put stuff inside a frame to make it look shrunken
- Menu option to toggle tree on/off.
- Make the tree faster (cache loaded directories)
- Add focus management to the tree
- tree should not move the selected menu item when
auto-expanding/collapsing.
- Auto-expand, and the timeout need to be optional
(and possibly disabled by default)
- Options - "Show hidden files" needs to work for
the tree as well as for the icon list.
- Right button on icon list (not on icon) should also
bring up menu. Should have back-forward (like
Netscape, create folder, etc... Eventually
Explorer style "create new word document" would
be nice). Rubber banding is silly.
- Dragging within icon list should reorder or do
nothing. Copying is silly. (But can be done
on ACTION_ASK)
- Add to the gnome-panel mime-type support
- Drop the MC event handling off for the main window.
- Remote control of the file manager (corba client command).
@ -39,81 +13,22 @@ New task list:
- Dynamic thumbnail generation
Federico:
- Make the popup menus work on the desktop
- Root window stuff.
Other features requested:
- Make the default action on drop configurable.
- Remove extra space on the panels (the in-between
icons)
- Remove the bottom scrollabar on the views.
- Status line uses too much space, it might be fixed
by changing it to merge both status in a single
status line.
[ Status | 0 bytes in nnnnnnn ]
^ ^
| + miniinfo.
|
print_vfs_message
- The input line and the navigations icons should be part of an
expert mode.
- Layout of dialog boxes suck.
- Add help button to dialog boxes.
- Add an advanced/simple checkbox.
- All of the configuration pages should be in a single
GnomePropertyBox.
- Optional "hidden menu" option.
- Fix the progress dialog box to be nicer.
- Adding more things to the toolbar.
- Dialogs are popping in the wrong place, this should be fixed
by using:
gtk_window_position (GDK_WINDOW_POSITION)
- Entering compressed tar files crashes the program.
- Substructure notify is taking too much time of processing
I need to a dd a filter and discard everything non-ClientMessage
that is sent to the wroot window.
IMPORTANTE:
file actions dont cause panels to be refreshed automatically
- Copy/Move/Delete operations on the treeview.
EXTENSIONS:
- Add special destkop entries ("Network neighborhood")
- In the find-file results, it would be nice if 'chdir' popped up a new
panel instead of changing the directory of the present one (optionally).
- (Cool but low priority) it would be nice if 'Arrange icons'
were configurable to allow stacking the icons along a particular edge
OR if gmc could automatically find areas of free screen (i.e. no windows
on them) and then place icons there.
Panels:
- Global bindings (some shortcuts are not implemented)
- Split view.
Viewer:
- Toolbar

View File

@ -483,10 +483,12 @@ mime_command_from_panel (GtkMenuItem *item, WPanel *panel)
static void
mime_command_from_desktop_icon (GtkMenuItem *item, char *filename)
{
char *action;
int movedir;
char *key;
const char *mime_type, *val;;
char *action, *buf;
int movedir, size;
char *key, *flag_key;
const char *mime_type, *val, *flags;
int needs_terminal = 0;
action = get_label_text (item);
key = gtk_object_get_user_data (GTK_OBJECT (item));
@ -494,8 +496,22 @@ mime_command_from_desktop_icon (GtkMenuItem *item, char *filename)
if (!mime_type)
return;
/*
* Find out if we need to run this in a terminal
*/
if (gnome_metadata_get (filename, "flags", &size, &buf) == 0){
needs_terminal = strstr (flags, "needsterminal") != 0;
g_free (buf);
} else {
flag_key = g_strconcat ("flags.", key, "flags", NULL);
flags = gnome_mime_get_value (filename, flag_key);
g_free (flag_key);
if (flags)
needs_terminal = strstr (flags, "needsterminal") != 0;
}
val = gnome_mime_get_value (mime_type, key);
exec_extension (filename, val, NULL, NULL, 0);
exec_extension (filename, val, NULL, NULL, 0, needs_terminal);
}
/* Create the menu items common to files from panel window and desktop icons, and also the items for

View File

@ -179,9 +179,11 @@ static void
mime_action_callback (GtkWidget *widget, gpointer data)
{
char *filename;
char *key;
char *mime_type;
char *value;
char *key, *buf;
const char *mime_type;
const char *value;
int needs_terminal = 0;
int size;
filename = data;
key = gtk_object_get_user_data (GTK_OBJECT (widget));
@ -192,8 +194,25 @@ mime_action_callback (GtkWidget *widget, gpointer data)
mime_type = gnome_mime_type_or_default (filename, NULL);
g_assert (mime_type != NULL);
/*
* Find out if we need to run this in a terminal
*/
if (gnome_metadata_get (filename, "flags", &size, &buf) == 0){
needs_terminal = strstr (buf, "needsterminal") != 0;
g_free (buf);
} else {
char *flag_key;
const char *flags;
flag_key = g_strconcat ("flags.", key, "flags", NULL);
flags = gnome_mime_get_value (filename, flag_key);
g_free (flag_key);
if (flags)
needs_terminal = strstr (flags, "needsterminal") != 0;
}
value = gnome_mime_get_value (mime_type, key);
exec_extension (filename, value, NULL, NULL, 0);
exec_extension (filename, value, NULL, NULL, 0, needs_terminal);
}
/* Creates the menu items for actions based on the MIME type of the selected

View File

@ -31,6 +31,7 @@
#include "gtkdtree.h"
#include "gpageprop.h"
#include "gpopup.h"
#include "gcmd.h"
#include "gcliplabel.h"
#include "gicon.h"
#include "../vfs/vfs.h"
@ -1450,6 +1451,8 @@ handle_rescan_directory (GtkWidget *widget, gpointer data)
static GnomeUIInfo file_list_popup_items[] = {
GNOMEUIINFO_ITEM_NONE (N_("Rescan Directory"), N_("Reloads the current directory"),
handle_rescan_directory),
GNOMEUIINFO_ITEM_NONE (N_("New folder"), N_("Creates a new folder here"),
gnome_mkdir_cmd),
GNOMEUIINFO_END
};

View File

@ -105,6 +105,7 @@ view_percent (WView *view, int p, int w)
gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
}
if ((int) adj->value != view->start_display){
printf ("Value=%g s=%d\n", adj->value, view->start_display);
gtk_adjustment_set_value (adj, view->start_display);
}
}

426
po/mc.pot

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@ quote_block (quote_func_t quote_func, char **quoting_block)
}
void
exec_extension (const char *filename, const char *data, char **drops, int *move_dir, int start_line)
exec_extension (const char *filename, const char *data, char **drops, int *move_dir, int start_line, int needs_term)
{
char *file_name;
int cmd_file_fd;
@ -274,7 +274,14 @@ exec_extension (const char *filename, const char *data, char **drops, int *move_
q[1] = 0;
do_cd (p, cd_parse_command);
} else {
#ifdef HAVE_GNOME
if (needs_term)
gnome_open_terminal_with_cmd (file_name);
else
shell_execute (file_name, EXECUTE_INTERNAL | EXECUTE_TEMPFILE);
#else
shell_execute (file_name, EXECUTE_INTERNAL | EXECUTE_TEMPFILE);
#endif
if (console_flag)
{
handle_console (CONSOLE_SAVE);
@ -653,7 +660,7 @@ match_file_output:
if (p < q) {
char *filename_copy = g_strdup (filename);
exec_extension (filename_copy, r + 1, drops, move_dir, view_at_line_number);
exec_extension (filename_copy, r + 1, drops, move_dir, view_at_line_number, 0);
g_free (filename_copy);
to_return = "Success";

View File

@ -2,7 +2,7 @@
#define __EXT_H
char *regex_command (char *filename, char *action, char **drops, int *move_dir);
void exec_extension (const char *filename, const char *data, char **drops, int *move_dir, int start_line);
void exec_extension (const char *filename, const char *data, char **drops, int *move_dir, int start_line, int needs_term);
/* Call it after the user has edited the mc.ext file,
* to flush the cached mc.ext file

View File

@ -821,8 +821,8 @@ setup_gui (void)
g_status_label, TRUE, TRUE, GNOME_PAD_SMALL);
gtk_widget_show_all (g_find_dlg);
gtk_widget_hide (GTK_WIDGET (find_do_view));
gtk_widget_hide (GTK_WIDGET (find_do_edit));
gtk_widget_hide (GTK_WIDGET (g_view));
gtk_widget_hide (GTK_WIDGET (g_edit));
}
static int