mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Merge from MC_MIME_TYPE branch. It has so many bug fixes you wont
even recognize it. 1998-12-16 Miguel de Icaza <miguel@nuclecu.unam.mx> * gdialogs.c (create_op_win): Remove second spurious packing. (create_op_win): OP_MOVE uses the same stuff OP_COPY does. Fix this. (file_progress_show_target): More compliant to the original functions. (file_progress_show_source): More compliant to the original functions. * gdesktop.c (create_desktop_dir): Fix mem leak. Miguel.
This commit is contained in:
parent
d5cb676e0b
commit
3ac4cfa567
@ -1,3 +1,15 @@
|
||||
1998-12-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* gdialogs.c (create_op_win): Remove second spurious packing.
|
||||
(create_op_win): OP_MOVE uses the same stuff OP_COPY does. Fix
|
||||
this.
|
||||
(file_progress_show_target): More compliant to the original
|
||||
functions.
|
||||
(file_progress_show_source): More compliant to the original
|
||||
functions.
|
||||
|
||||
* gdesktop.c (create_desktop_dir): Fix mem leak.
|
||||
|
||||
Tue Dec 15 10:51:12 1998 Gregory McLean <gregm@comstar.net>
|
||||
|
||||
* gdesktop-icon.c : Attach a desktop_icon wmclass to the desktop
|
||||
|
@ -8,7 +8,7 @@ GNOMEDEFS = -DHAVE_X -DHAVE_GNOME @GNOME_INCLUDEDIR@
|
||||
CFLAGS = -g $(XCFLAGS) @X_CFLAGS@
|
||||
CPPFLAGS = $(XCPPFLAGS) -I$(vfsdir) -I$(slangdir) $(GNOMEDEFS)
|
||||
LDFLAGS = $(XLDFLAGS) @GNOME_LIBDIR@ @GNOMEUI_LIBS@
|
||||
CORBA_LDFLAGS = $(XLDFLAGS) @GNOME_LIBDIR@ @GNOMEGNORBA_LIBS@
|
||||
pCORBA_LDFLAGS = $(XLDFLAGS) @GNOME_LIBDIR@ @GNOMEGNORBA_LIBS@
|
||||
DEFS = $(XDEFS)
|
||||
LIBS = $(XLIBS) @TERMNET@
|
||||
EXTRALIBS = @LVFS@ -lgtkedit @LINTL@
|
||||
@ -117,6 +117,7 @@ CORBAOBJS = \
|
||||
OBJS = \
|
||||
$(LOBJS) \
|
||||
$(OOBJS) \
|
||||
gaction.o \
|
||||
gblist.o \
|
||||
gcache.o \
|
||||
gcliplabel.o \
|
||||
|
@ -70,7 +70,7 @@ gmc_run_view (char *filename, char *buf)
|
||||
exec_extension (filename, buf, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
gmc_view (char *filename, int start_line)
|
||||
{
|
||||
char *mime_type, *cmd;
|
||||
|
121
gnome/gdesktop.c
121
gnome/gdesktop.c
@ -230,9 +230,11 @@ remove_from_slot (struct desktop_icon_info *dii)
|
||||
layout_slots[dii->slot].icons = g_list_remove (layout_slots[dii->slot].icons, dii);
|
||||
}
|
||||
|
||||
/* Places a desktop icon. If auto_pos is true, then the function will look for a place to position
|
||||
* the icon automatically, else it will use the specified coordinates, snapped to the grid if the
|
||||
* global desktop_snap_icons flag is set.
|
||||
/*
|
||||
* Places a desktop icon. If auto_pos is true, then the function will
|
||||
* look for a place to position the icon automatically, else it will
|
||||
* use the specified coordinates, snapped to the grid if the global
|
||||
* desktop_snap_icons flag is set.
|
||||
*/
|
||||
static void
|
||||
desktop_icon_info_place (struct desktop_icon_info *dii, int auto_pos, int xpos, int ypos)
|
||||
@ -281,7 +283,10 @@ desktop_icon_info_place (struct desktop_icon_info *dii, int auto_pos, int xpos,
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
/* Returns TRUE if there is already an icon in the desktop for the specified filename, FALSE otherwise. */
|
||||
/*
|
||||
* Returns TRUE if there is already an icon in the desktop for the
|
||||
* specified filename, FALSE otherwise.
|
||||
*/
|
||||
static int
|
||||
icon_exists (char *filename)
|
||||
{
|
||||
@ -299,9 +304,11 @@ icon_exists (char *filename)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Reads the ~/Desktop directory and creates the desktop icons. If incremental is TRUE, then an
|
||||
* icon will not be created for a file if there is already an icon for it, and icons will be created
|
||||
* starting at the specified position.
|
||||
/*
|
||||
* Reads the ~/Desktop directory and creates the desktop icons. If
|
||||
* incremental is TRUE, then an icon will not be created for a file if
|
||||
* there is already an icon for it, and icons will be created starting
|
||||
* at the specified position.
|
||||
*/
|
||||
static void
|
||||
load_desktop_icons (int incremental, int xpos, int ypos)
|
||||
@ -386,8 +393,10 @@ destroy_desktop_icons (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Reloads the desktop icons. If incremental is TRUE, then the existing icons will not be destroyed
|
||||
* first, and the new icons will be put at the specified position.
|
||||
/*
|
||||
* Reloads the desktop icons. If incremental is TRUE, then the
|
||||
* existing icons will not be destroyed first, and the new icons will
|
||||
* be put at the specified position.
|
||||
*/
|
||||
static void
|
||||
reload_desktop_icons (int incremental, int x, int y)
|
||||
@ -484,7 +493,8 @@ select_range (struct desktop_icon_info *dii, int sel)
|
||||
}
|
||||
}
|
||||
|
||||
/* Handles icon selection and unselection due to button presses. The
|
||||
/*
|
||||
* Handles icon selection and unselection due to button presses. The
|
||||
* event_state is the state field of the event.
|
||||
*/
|
||||
static void
|
||||
@ -558,8 +568,10 @@ file_entry_free (file_entry *fe)
|
||||
g_free (fe);
|
||||
}
|
||||
|
||||
/* Callback used when an icon's text changes. We must validate the rename and return the
|
||||
* appropriate value. The desktop icon info structure is passed in the user data.
|
||||
/*
|
||||
* Callback used when an icon's text changes. We must validate the
|
||||
* rename and return the appropriate value. The desktop icon info
|
||||
* structure is passed in the user data.
|
||||
*/
|
||||
static int
|
||||
text_changed (GnomeIconTextItem *iti, gpointer data)
|
||||
@ -589,8 +601,10 @@ text_changed (GnomeIconTextItem *iti, gpointer data)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Callback used when the user begins editing the icon text item in a desktop icon. It installs the
|
||||
* mouse and keyboard grabs that are required while an icon is being edited.
|
||||
/*
|
||||
* Callback used when the user begins editing the icon text item in a
|
||||
* desktop icon. It installs the mouse and keyboard grabs that are
|
||||
* required while an icon is being edited.
|
||||
*/
|
||||
static void
|
||||
editing_started (GnomeIconTextItem *iti, gpointer data)
|
||||
@ -635,8 +649,9 @@ setup_icon_dnd_actions (struct desktop_icon_info *dii)
|
||||
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
|
||||
}
|
||||
|
||||
/* Callback used when the user finishes editing the icon text item in a desktop icon. It removes
|
||||
* the mouse and keyboard grabs.
|
||||
/*
|
||||
* Callback used when the user finishes editing the icon text item in
|
||||
* a desktop icon. It removes the mouse and keyboard grabs.
|
||||
*/
|
||||
static void
|
||||
editing_stopped (GnomeIconTextItem *iti, gpointer data)
|
||||
@ -1076,9 +1091,12 @@ setup_icon_dnd_dest (struct desktop_icon_info *dii)
|
||||
dii);
|
||||
}
|
||||
|
||||
/* Creates a new desktop icon. The filename is the pruned filename inside the desktop directory.
|
||||
* If auto_pos is false, it will use the specified coordinates for the icon. Else, it will use
|
||||
* auto- positioning trying to start at the specified coordinates. It does not show the icon.
|
||||
/*
|
||||
* Creates a new desktop icon. The filename is the pruned filename
|
||||
* inside the desktop directory. If auto_pos is false, it will use
|
||||
* the specified coordinates for the icon. Else, it will use auto-
|
||||
* positioning trying to start at the specified coordinates. It does
|
||||
* not show the icon.
|
||||
*/
|
||||
static struct desktop_icon_info *
|
||||
desktop_icon_info_new (char *filename, int auto_pos, int xpos, int ypos)
|
||||
@ -1092,7 +1110,7 @@ desktop_icon_info_new (char *filename, int auto_pos, int xpos, int ypos)
|
||||
|
||||
full_name = g_concat_dir_and_file (desktop_directory, filename);
|
||||
fe = file_entry_from_file (full_name);
|
||||
icon_im = gicon_get_icon_for_file (fe);
|
||||
icon_im = gicon_get_icon_for_file_speed (fe, FALSE);
|
||||
|
||||
dii = g_new (struct desktop_icon_info, 1);
|
||||
dii->dicon = desktop_icon_new (icon_im, filename);
|
||||
@ -1143,8 +1161,9 @@ desktop_icon_info_new (char *filename, int auto_pos, int xpos, int ypos)
|
||||
return dii;
|
||||
}
|
||||
|
||||
/* Frees a desktop icon information structure, and destroy the icon widget. Does not remove the
|
||||
* structure from the desktop_icons list!
|
||||
/*
|
||||
* Frees a desktop icon information structure, and destroy the icon
|
||||
* widget. Does not remove the structure from the desktop_icons list!
|
||||
*/
|
||||
static void
|
||||
desktop_icon_info_free (struct desktop_icon_info *dii)
|
||||
@ -1167,8 +1186,28 @@ create_layout_info (void)
|
||||
layout_slots = g_new0 (struct layout_slot, layout_cols * layout_rows);
|
||||
}
|
||||
|
||||
/* Check that the user's desktop directory exists, and if not, create it with a symlink to the
|
||||
* user's home directory so that an icon will be displayed.
|
||||
static void
|
||||
setup_trashcan (char *desktop_dir)
|
||||
{
|
||||
char *trashcan_dir;
|
||||
char *trash_pix;
|
||||
|
||||
trashcan_dir = g_concat_dir_and_file (desktop_directory, _("Trashcan"));
|
||||
trash_pix = g_concat_dir_and_file (ICONDIR, "trash.xpm");
|
||||
|
||||
if (!g_file_exists (trashcan_dir)){
|
||||
mkdir (trashcan_dir, 0777);
|
||||
gnome_metadata_set (
|
||||
trashcan_dir, "icon-filename", strlen (trash_pix)+1, trash_pix);
|
||||
}
|
||||
|
||||
g_free (trashcan_dir);
|
||||
g_free (trash_pix);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the user's desktop directory exists, and if not, create
|
||||
* the default desktop setup.
|
||||
*/
|
||||
static void
|
||||
create_desktop_dir (void)
|
||||
@ -1183,7 +1222,6 @@ create_desktop_dir (void)
|
||||
mkdir (desktop_directory, 0777);
|
||||
|
||||
/* Create the link to the user's home directory so that he will have an icon */
|
||||
|
||||
home_link_name = g_concat_dir_and_file (desktop_directory, _("Home directory"));
|
||||
|
||||
if (mc_symlink (gnome_user_home_dir, home_link_name) != 0) {
|
||||
@ -1191,12 +1229,11 @@ create_desktop_dir (void)
|
||||
_("Warning"),
|
||||
_("Could not symlink %s to %s; will not have initial desktop icons."),
|
||||
gnome_user_home_dir, home_link_name);
|
||||
}
|
||||
g_free (home_link_name);
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (home_link_name);
|
||||
}
|
||||
setup_trashcan (desktop_directory);
|
||||
}
|
||||
|
||||
/* Sets up a proxy window for DnD on the specified X window. Courtesy of Owen Taylor */
|
||||
@ -1314,7 +1351,8 @@ find_icon_by_drag_context (GdkDragContext *context)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Performs a drop of desktop icons onto the desktop. It basically moves the icons from their
|
||||
/*
|
||||
* Performs a drop of desktop icons onto the desktop. It basically moves the icons from their
|
||||
* original position to the new coordinates.
|
||||
*/
|
||||
static void
|
||||
@ -1408,7 +1446,7 @@ setup_desktop_dnd (void)
|
||||
gtk_widget_show (dnd_proxy_window);
|
||||
|
||||
if (!setup_xdnd_proxy (GDK_ROOT_WINDOW (), dnd_proxy_window->window))
|
||||
g_warning ("Eeeeek, some moron is already taking drops on the root window!");
|
||||
g_warning ("There is already a process taking drop windows on the desktop\n");
|
||||
|
||||
gtk_drag_dest_set (dnd_proxy_window,
|
||||
GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
|
||||
@ -1527,7 +1565,8 @@ draw_rubberband (int x, int y)
|
||||
gdk_draw_rectangle (GDK_ROOT_PARENT (), click_gc, FALSE, x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
|
||||
/* Stores dii->selected into dii->tmp_selected to keep the original selection
|
||||
/*
|
||||
* Stores dii->selected into dii->tmp_selected to keep the original selection
|
||||
* around while the user is rubberbanding.
|
||||
*/
|
||||
static void
|
||||
@ -1545,7 +1584,11 @@ store_temp_selection (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns TRUE if the specified icon is at least partially inside the specified
|
||||
/**
|
||||
* icon_is_in_area:
|
||||
* @dii: the desktop icon information
|
||||
*
|
||||
* Returns TRUE if the specified icon is at least partially inside the specified
|
||||
* area, or FALSE otherwise.
|
||||
*/
|
||||
static int
|
||||
@ -1721,7 +1764,8 @@ click_proxy_motion (GtkWidget *widget, GdkEventMotion *event, gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Filter that translates proxied events from virtual root windows into normal
|
||||
/*
|
||||
* Filter that translates proxied events from virtual root windows into normal
|
||||
* Gdk events for the click_proxy_invisible widget.
|
||||
*/
|
||||
static GdkFilterReturn
|
||||
@ -1773,8 +1817,9 @@ click_proxy_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
/* Creates a proxy window to receive clicks from the root window and sets up the
|
||||
* necessary event filters.
|
||||
/*
|
||||
* Creates a proxy window to receive clicks from the root window and
|
||||
* sets up the necessary event filters.
|
||||
*/
|
||||
static void
|
||||
setup_desktop_click_proxy_window (void)
|
||||
@ -1791,7 +1836,8 @@ setup_desktop_click_proxy_window (void)
|
||||
/* Add our filter to get events */
|
||||
gdk_window_add_filter (click_proxy_gdk_window, click_proxy_filter, NULL);
|
||||
|
||||
/* The proxy window for clicks sends us button press events with
|
||||
/*
|
||||
* The proxy window for clicks sends us button press events with
|
||||
* SubstructureNotifyMask. We need StructureNotifyMask to receive
|
||||
* DestroyNotify events, too.
|
||||
*/
|
||||
@ -1800,7 +1846,8 @@ setup_desktop_click_proxy_window (void)
|
||||
SubstructureNotifyMask | StructureNotifyMask);
|
||||
}
|
||||
|
||||
/* Handler for PropertyNotify events from the root window; it must change the
|
||||
/*
|
||||
* Handler for PropertyNotify events from the root window; it must change the
|
||||
* proxy window to a new one.
|
||||
*/
|
||||
static gint
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <gnome.h>
|
||||
#include "file.h"
|
||||
#include "filegui.h"
|
||||
#include "regex.h"
|
||||
#include "../vfs/vfs.h"
|
||||
|
||||
static GtkWidget *op_win = NULL;
|
||||
@ -63,11 +64,16 @@ file_progress_show_source (char *path)
|
||||
gchar *path_copy = NULL;
|
||||
|
||||
g_return_val_if_fail (op_source_label != NULL, FILE_CONT);
|
||||
g_return_val_if_fail (path != NULL, FILE_CONT);
|
||||
|
||||
if (!from_width)
|
||||
if (path == NULL){
|
||||
gtk_label_set (GTK_LABEL (op_source_label), "");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!from_width){
|
||||
from_width = gdk_string_width (op_source_label->style->font,
|
||||
GDIALOG_FROM_STRING);
|
||||
}
|
||||
path_width = gdk_string_width (op_source_label->style->font, path);
|
||||
if (from_width + path_width < GDIALOG_PROGRESS_WIDTH)
|
||||
gtk_label_set (GTK_LABEL (op_source_label), path);
|
||||
@ -89,7 +95,11 @@ file_progress_show_target (char *path)
|
||||
gchar *path_copy = NULL;
|
||||
|
||||
g_return_val_if_fail (op_target_label != NULL, FILE_CONT);
|
||||
g_return_val_if_fail (path != NULL, FILE_CONT);
|
||||
|
||||
if (path == NULL){
|
||||
gtk_label_set (GTK_LABEL (op_target_label), "");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!to_width)
|
||||
to_width = gdk_string_width (op_target_label->style->font,
|
||||
@ -110,7 +120,6 @@ FileProgressStatus
|
||||
file_progress_show_deleting (char *path)
|
||||
{
|
||||
g_warning ("memo: file_progress_show_deleting!\npath\t%s\n",path);
|
||||
return FILE_CONT;
|
||||
}
|
||||
|
||||
FileProgressStatus
|
||||
@ -148,12 +157,61 @@ file_progress_show_bytes (double done, double total)
|
||||
}
|
||||
|
||||
FileProgressStatus
|
||||
file_progress_real_query_replace (enum OperationMode mode, char *destname, struct stat *_s_stat, struct stat *_d_stat)
|
||||
file_progress_real_query_replace (enum OperationMode mode, char *destname, struct stat *_s_stat,
|
||||
struct stat *_d_stat)
|
||||
{
|
||||
g_warning ("memo: file_progress_real_query_replace!\n");
|
||||
return FILE_CONT;
|
||||
|
||||
/* Better to have something than nothing at all */
|
||||
if (file_progress_replace_result < REPLACE_ALWAYS){
|
||||
file_progress_replace_filename = destname;
|
||||
s_stat = _s_stat;
|
||||
d_stat = _d_stat;
|
||||
init_replace (mode);
|
||||
run_dlg (replace_dlg);
|
||||
file_progress_replace_result = replace_dlg->ret_value;
|
||||
if (file_progress_replace_result == B_CANCEL)
|
||||
file_progress_replace_result = REPLACE_ABORT;
|
||||
destroy_dlg (replace_dlg);
|
||||
}
|
||||
|
||||
switch (file_progress_replace_result){
|
||||
case REPLACE_UPDATE:
|
||||
do_refresh ();
|
||||
if (_s_stat->st_mtime > _d_stat->st_mtime)
|
||||
return FILE_CONT;
|
||||
else
|
||||
return FILE_SKIP;
|
||||
|
||||
case REPLACE_SIZE:
|
||||
do_refresh ();
|
||||
if (_s_stat->st_size == _d_stat->st_size)
|
||||
return FILE_SKIP;
|
||||
else
|
||||
return FILE_CONT;
|
||||
|
||||
case REPLACE_REGET:
|
||||
/* Carefull: we fall through and set do_append */
|
||||
file_progress_do_reget = _d_stat->st_size;
|
||||
|
||||
case REPLACE_APPEND:
|
||||
file_progress_do_append = 1;
|
||||
|
||||
case REPLACE_YES:
|
||||
case REPLACE_ALWAYS:
|
||||
do_refresh ();
|
||||
return FILE_CONT;
|
||||
case REPLACE_NO:
|
||||
case REPLACE_NEVER:
|
||||
do_refresh ();
|
||||
return FILE_SKIP;
|
||||
case REPLACE_ABORT:
|
||||
default:
|
||||
return FILE_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
file_progress_set_stalled_label (char *stalled_msg)
|
||||
{
|
||||
@ -355,12 +413,21 @@ create_op_win (FileOperation op, int with_eta)
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *prog;
|
||||
g_print ("in create_op_win\n");
|
||||
|
||||
switch (op) {
|
||||
case OP_MOVE:
|
||||
op_win = gnome_dialog_new ("Move Progress", GNOME_STOCK_BUTTON_CANCEL, NULL);
|
||||
break;
|
||||
case OP_COPY:
|
||||
op_win = gnome_dialog_new ("Copy Progress", GNOME_STOCK_BUTTON_CANCEL, NULL);
|
||||
break;
|
||||
case OP_DELETE:
|
||||
op_win = gnome_dialog_new ("Delete Progress", GNOME_STOCK_BUTTON_CANCEL, NULL);
|
||||
gtk_widget_show_all (GNOME_DIALOG (op_win)->vbox);
|
||||
gtk_widget_show_now (op_win);
|
||||
return;
|
||||
}
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), hbox);
|
||||
@ -404,26 +471,21 @@ create_op_win (FileOperation op, int with_eta)
|
||||
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (op_win)->vbox),
|
||||
GTK_WIDGET (byte_prog), FALSE, FALSE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (op_win)->vbox),
|
||||
alignment, FALSE, FALSE, 0);
|
||||
|
||||
break;
|
||||
case OP_DELETE:
|
||||
op_win = gnome_dialog_new ("Delete Progress", GNOME_STOCK_BUTTON_CANCEL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
/*done with things */
|
||||
gtk_widget_show_all (GNOME_DIALOG (op_win)->vbox);
|
||||
gtk_widget_show_now (op_win);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
destroy_op_win (void)
|
||||
{
|
||||
if (op_win)
|
||||
if (op_win){
|
||||
gtk_widget_destroy (op_win);
|
||||
op_win = NULL;
|
||||
op_source_label = NULL;
|
||||
op_target_label = NULL;
|
||||
}
|
||||
}
|
||||
void
|
||||
fmd_init_i18n()
|
||||
|
@ -120,11 +120,11 @@ perform_action_on_panel (WPanel *source_panel, GdkDragAction action, char *destd
|
||||
{
|
||||
switch (action) {
|
||||
case GDK_ACTION_COPY:
|
||||
panel_operate (source_panel, OP_COPY, destdir);
|
||||
panel_operate_def (source_panel, OP_COPY, destdir);
|
||||
break;
|
||||
|
||||
case GDK_ACTION_MOVE:
|
||||
panel_operate (source_panel, OP_MOVE, destdir);
|
||||
panel_operate_def (source_panel, OP_MOVE, destdir);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -134,6 +134,8 @@ perform_action_on_panel (WPanel *source_panel, GdkDragAction action, char *destd
|
||||
/* Finish up */
|
||||
|
||||
update_one_panel_widget (source_panel, FALSE, UP_KEEPSEL);
|
||||
|
||||
if (action == GDK_ACTION_MOVE)
|
||||
panel_update_contents (source_panel);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ static gid_t our_gid;
|
||||
/*
|
||||
* If true, we choose the icon in a way that might be a bit slow
|
||||
*/
|
||||
static int we_can_affort_the_speed = 1;
|
||||
static int we_can_affort_the_speed = 0;
|
||||
|
||||
/**
|
||||
* gicon_init:
|
||||
@ -173,7 +173,7 @@ gnome_file_entry_color (file_entry *fe)
|
||||
* icon for it. Including a lookup in the metadata.
|
||||
*/
|
||||
GdkImlibImage *
|
||||
gicon_get_icon_for_file (file_entry *fe)
|
||||
gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
|
||||
{
|
||||
GdkImlibImage *image;
|
||||
int size;
|
||||
@ -229,7 +229,7 @@ gicon_get_icon_for_file (file_entry *fe)
|
||||
/*
|
||||
* 2. Expensive tests
|
||||
*/
|
||||
if (we_can_affort_the_speed){
|
||||
if (!do_quick || we_can_affort_the_speed){
|
||||
/*
|
||||
* 2.1 Try to fetch the icon as an inline png from the metadata.
|
||||
*/
|
||||
@ -248,6 +248,8 @@ gicon_get_icon_for_file (file_entry *fe)
|
||||
if (gnome_metadata_get (fe->fname, "icon-filename", &size, &buf) == 0){
|
||||
image = gicon_get_by_filename (buf);
|
||||
|
||||
free (buf);
|
||||
|
||||
if (image)
|
||||
return image;
|
||||
}
|
||||
@ -280,3 +282,9 @@ gicon_get_icon_for_file (file_entry *fe)
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
GdkImlibImage *
|
||||
gicon_get_icon_for_file (file_entry *fe)
|
||||
{
|
||||
gicon_get_icon_for_file_speed (fe, TRUE);
|
||||
}
|
||||
|
@ -4,5 +4,7 @@
|
||||
GdkImlibImage *gicon_get_by_filename (char *fname);
|
||||
GdkImlibImage *gicon_stock_load (char *basename);
|
||||
GdkImlibImage *gicon_get_icon_for_file (file_entry *fe);
|
||||
GdkImlibImage *gicon_get_icon_for_file_speed (file_entry *fe,
|
||||
gboolean do_quick);
|
||||
|
||||
#endif
|
||||
|
@ -332,28 +332,35 @@ get_label_text (GtkMenuItem *item)
|
||||
}
|
||||
|
||||
static void
|
||||
regex_command_from_panel (GtkMenuItem *item, WPanel *panel)
|
||||
mime_command_from_panel (GtkMenuItem *item, WPanel *panel)
|
||||
{
|
||||
char *filename;
|
||||
char *action;
|
||||
int movedir;
|
||||
|
||||
/* This is broken */
|
||||
filename = panel->dir.list[panel->selected].fname;
|
||||
action = get_label_text (item);
|
||||
|
||||
regex_command (filename, action, NULL, &movedir);
|
||||
/*
|
||||
* This is broken, but we dont mind. Federico
|
||||
* needs to explain me what was he intending here.
|
||||
* panel->selected does not mean, it was the icon
|
||||
* that got clicked.
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
regex_command_from_desktop_icon (GtkMenuItem *item, char *filename)
|
||||
mime_command_from_desktop_icon (GtkMenuItem *item, char *filename)
|
||||
{
|
||||
char *action;
|
||||
int movedir;
|
||||
|
||||
char *key, *mime_type, *val;
|
||||
action = get_label_text (item);
|
||||
|
||||
regex_command (filename, action, NULL, &movedir);
|
||||
key = gtk_object_get_user_data (GTK_OBJECT (item));
|
||||
mime_type = gnome_mime_type_or_default (filename, NULL);
|
||||
if (!mime_type)
|
||||
return;
|
||||
|
||||
val = gnome_mime_get_value (mime_type, key);
|
||||
exec_extension (filename, val, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
/* Create the menu items common to files from panel window and desktop icons, and also the items for
|
||||
@ -366,8 +373,8 @@ create_regexp_actions (GtkWidget *menu, WPanel *panel, int panel_row, char *file
|
||||
GnomeUIInfo *a_uiinfo;
|
||||
int i;
|
||||
GtkSignalFunc regex_callback;
|
||||
char *p, *q;
|
||||
int c;
|
||||
char *mime_type;
|
||||
GList *keys, *l;
|
||||
GnomeUIInfo uiinfo[] = {
|
||||
{ 0 },
|
||||
GNOMEUIINFO_END
|
||||
@ -376,12 +383,12 @@ create_regexp_actions (GtkWidget *menu, WPanel *panel, int panel_row, char *file
|
||||
if (panel) {
|
||||
a_uiinfo = panel_actions;
|
||||
closure = panel;
|
||||
regex_callback = regex_command_from_desktop_icon;
|
||||
regex_callback = mime_command_from_desktop_icon;
|
||||
regex_closure = filename;
|
||||
} else {
|
||||
a_uiinfo = desktop_icon_actions;
|
||||
closure = filename;
|
||||
regex_callback = regex_command_from_desktop_icon;
|
||||
regex_callback = mime_command_from_desktop_icon;
|
||||
regex_closure = filename;
|
||||
}
|
||||
|
||||
@ -395,30 +402,34 @@ create_regexp_actions (GtkWidget *menu, WPanel *panel, int panel_row, char *file
|
||||
|
||||
/* Fill in the regex command part */
|
||||
|
||||
p = regex_command (filename, NULL, NULL, NULL);
|
||||
if (!p)
|
||||
mime_type = gnome_mime_type_or_default (filename, NULL);
|
||||
if (!mime_type)
|
||||
return;
|
||||
|
||||
for (;;) {
|
||||
/* Strip off an entry */
|
||||
keys = gnome_mime_get_keys (mime_type);
|
||||
|
||||
while (*p == ' ' || *p == '\t')
|
||||
p++;
|
||||
for (l = keys; l; l = l->next) {
|
||||
char *key = l->data;
|
||||
char *str;
|
||||
|
||||
if (!*p)
|
||||
break;
|
||||
str = key;
|
||||
if (strncmp (key, "open.", 5) != 0)
|
||||
continue;
|
||||
|
||||
q = p;
|
||||
while (*q && *q != '=' && *q != '\t')
|
||||
q++;
|
||||
str += 5;
|
||||
while (*str && *str != '.')
|
||||
str++;
|
||||
|
||||
c = *q;
|
||||
*q = 0;
|
||||
if (*str)
|
||||
str++;
|
||||
|
||||
if (!*str)
|
||||
continue;
|
||||
|
||||
/* Create the item for that entry */
|
||||
|
||||
uiinfo[0].type = GNOME_APP_UI_ITEM;
|
||||
uiinfo[0].label = p;
|
||||
uiinfo[0].label = str;
|
||||
uiinfo[0].hint = NULL;
|
||||
uiinfo[0].moreinfo = regex_callback;
|
||||
uiinfo[0].user_data = regex_closure;
|
||||
@ -430,14 +441,9 @@ create_regexp_actions (GtkWidget *menu, WPanel *panel, int panel_row, char *file
|
||||
uiinfo[0].widget = NULL;
|
||||
|
||||
fill_menu (GTK_MENU_SHELL (menu), uiinfo, insert_pos++);
|
||||
|
||||
/* Next! */
|
||||
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
p = q + 1;
|
||||
gtk_object_set_user_data (GTK_OBJECT (uiinfo [0].widget), key);
|
||||
}
|
||||
g_list_free (keys);
|
||||
}
|
||||
|
||||
/* Convenience callback to exit the main loop of a modal popup menu when it is deactivated*/
|
||||
|
@ -296,6 +296,7 @@ x_select_item (WPanel *panel)
|
||||
gnome_icon_list_select_icon (list, panel->selected);
|
||||
|
||||
if (list->icon_list){
|
||||
if (GTK_WIDGET (list)->allocation.x != -1)
|
||||
if (gnome_icon_list_icon_is_visible (list, panel->selected) != GTK_VISIBILITY_FULL)
|
||||
gnome_icon_list_moveto (list, panel->selected, 0.5);
|
||||
}
|
||||
@ -1108,6 +1109,8 @@ panel_icon_list_select_icon (GtkWidget *widget, int index, GdkEvent *event, WPan
|
||||
display_mini_info (panel);
|
||||
execute_hooks (select_file_hook);
|
||||
|
||||
if (event)
|
||||
printf ("Icon list select icon, event->type= %d %d %d\n", event->type, GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
@ -2096,7 +2099,8 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
|
||||
"Switch view to detailed view.", NULL);
|
||||
dock = gnome_dock_item_new ("gmc-toolbar", GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL);
|
||||
gtk_container_add (GTK_CONTAINER(dock),status_line);
|
||||
gnome_dock_add_item (GNOME_DOCK(GNOME_APP (panel->xwindow)->dock), dock, GNOME_DOCK_TOP, 1, 0, 0, FALSE);
|
||||
gnome_dock_add_item (GNOME_DOCK(GNOME_APP (panel->xwindow)->dock),
|
||||
GNOME_DOCK_ITEM (dock), GNOME_DOCK_TOP, 1, 0, 0, FALSE);
|
||||
gtk_widget_show_all (dock);
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ ALLICONS = a.xpm application.xpm binary.xpm bitmap.xpm blackhole.xpm \
|
||||
DECENTICONS = \
|
||||
c.xpm h.xpm calendar.xpm compressed.xpm html.xpm o.xpm \
|
||||
sound.xpm makefile.xpm word.xpm zip.xpm tex.xpm cc.xpm man.xpm \
|
||||
postscript.xpm tex.xpm text.xpm
|
||||
postscript.xpm tex.xpm text.xpm trash.xpm
|
||||
|
||||
all:
|
||||
|
||||
|
@ -174,6 +174,11 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
|
||||
if (internal){
|
||||
char view_entry [32];
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
if (!gmc_view (filename, start_line)){
|
||||
view (0, filename, &move_dir, start_line);
|
||||
}
|
||||
#else
|
||||
if (start_line != 0)
|
||||
sprintf (view_entry, "View:%d", start_line);
|
||||
else
|
||||
@ -183,6 +188,7 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
|
||||
view (0, filename, &move_dir, start_line);
|
||||
repaint_screen ();
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
char *localcopy;
|
||||
|
||||
|
@ -52,8 +52,7 @@
|
||||
#ifdef SCO_FLAVOR
|
||||
#include <sys/wait.h>
|
||||
#endif /* SCO_FLAVOR */
|
||||
|
||||
/* "$Id$" */
|
||||
#include <glib.h>
|
||||
|
||||
/* If set, we execute the file command to check the file type */
|
||||
int use_file_to_check_type = 1;
|
||||
@ -102,7 +101,7 @@ quote_block (quote_func_t quote_func, char **quoting_block)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
exec_extension (char *filename, char *data, char **drops, int *move_dir, int start_line)
|
||||
{
|
||||
char *file_name;
|
||||
@ -124,6 +123,9 @@ exec_extension (char *filename, char *data, char **drops, int *move_dir, int sta
|
||||
struct stat mystat;
|
||||
quote_func_t quote_func = name_quote;
|
||||
|
||||
g_return_if_fail (filename != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
/* Avoid making a local copy if we are doing a cd */
|
||||
if (!vfs_file_is_local(filename))
|
||||
do_local_copy = 1;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __EXT_H
|
||||
|
||||
char *regex_command (char *filename, char *action, char **drops, int *move_dir);
|
||||
void exec_extension (char *filename, char *data, char **drops, int *move_dir, int start_line);
|
||||
|
||||
/* Call it after the user has edited the mc.ext file,
|
||||
* to flush the cached mc.ext file
|
||||
|
35
src/file.c
35
src/file.c
@ -980,7 +980,7 @@ copy_dir_dir (char *s, char *d, int toplevel,
|
||||
* If the destination directory exists, we want to copy the whole
|
||||
* directory, but we only want this to happen once.
|
||||
*
|
||||
* Escape sequences added to the * to avoid compiler warnings.
|
||||
* Escape sequences added to the * to compiler warnings.
|
||||
* so, say /bla exists, if we copy /tmp/\* to /bla, we get /bla/tmp/\*
|
||||
* or ( /bla doesn't exist ) /tmp/\* to /bla -> /bla/\*
|
||||
*/
|
||||
@ -1668,8 +1668,8 @@ panel_compute_totals (WPanel *panel, long *ret_marked, double *ret_total)
|
||||
* Returns 1 if did change the directory
|
||||
* structure, Returns 0 if user aborted
|
||||
*/
|
||||
int
|
||||
panel_operate (void *source_panel, FileOperation operation, char *thedefault)
|
||||
static int
|
||||
panel_operate_flags (void *source_panel, FileOperation operation, char *thedefault, int ask_user)
|
||||
{
|
||||
WPanel *panel = source_panel;
|
||||
#ifdef WITH_FULL_PATHS
|
||||
@ -1716,6 +1716,11 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault)
|
||||
if (i != 0)
|
||||
return 0;
|
||||
} else if (operation != OP_DELETE){
|
||||
file_mask_rx.buffer = (char *) xmalloc (MC_MAXPATHLEN, "mask copying");
|
||||
file_mask_rx.allocated = MC_MAXPATHLEN;
|
||||
file_mask_rx.translate = 0;
|
||||
|
||||
if (ask_user){
|
||||
char *dest_dir;
|
||||
|
||||
if (thedefault != NULL)
|
||||
@ -1725,9 +1730,6 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault)
|
||||
else
|
||||
dest_dir = panel->cwd;
|
||||
|
||||
file_mask_rx.buffer = (char *) xmalloc (MC_MAXPATHLEN, "mask copying");
|
||||
file_mask_rx.allocated = MC_MAXPATHLEN;
|
||||
file_mask_rx.translate = 0;
|
||||
dest = file_mask_dialog (operation, cmd_buf, dest_dir, only_one, &do_bg);
|
||||
if (!dest){
|
||||
free (file_mask_rx.buffer);
|
||||
@ -1738,6 +1740,15 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault)
|
||||
free (dest);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
char *all = "^\\(.*\\)$";
|
||||
|
||||
re_compile_pattern (all, strlen (all), &file_mask_rx);
|
||||
file_mask_dest_mask = strdup ("*");
|
||||
do_bg = FALSE;
|
||||
dest = strdup (thedefault);
|
||||
file_mask_defaults ();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_BACKGROUND
|
||||
@ -2008,6 +2019,18 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
panel_operate_def (void *source_panel, FileOperation operation, char *thedefault)
|
||||
{
|
||||
panel_operate_flags (source_panel, operation, thedefault, FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
panel_operate (void *source_panel, FileOperation operation, char *thedefault)
|
||||
{
|
||||
panel_operate_flags (source_panel, operation, thedefault, TRUE);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Query/status report routines */
|
||||
|
@ -48,7 +48,10 @@ int erase_dir_iff_empty (char *s);
|
||||
void create_op_win (FileOperation op, int with_eta);
|
||||
void destroy_op_win (void);
|
||||
void refresh_op_win (void);
|
||||
int panel_operate (void *source_panel, FileOperation op, char *thedefault);
|
||||
int panel_operate (void *source_panel, FileOperation op,
|
||||
char *thedefault);
|
||||
int panel_operate_def (void *source_panel, FileOperation op,
|
||||
char *thedefault);
|
||||
void file_mask_defaults (void);
|
||||
char *file_mask_dialog (FileOperation operation, char *text, char *def_text,
|
||||
int only_one, int *do_background);
|
||||
|
@ -59,7 +59,6 @@
|
||||
|
||||
#include "x.h"
|
||||
|
||||
/* "$Id$" */
|
||||
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
|
||||
|
||||
/* If true, show the mini-info on the panel */
|
||||
@ -2057,7 +2056,14 @@ do_enter_on_file_entry (file_entry *fe)
|
||||
} else {
|
||||
char *p;
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
if (gmc_open (fe))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
#else
|
||||
p = regex_command (fe->fname, "Open", NULL, 0);
|
||||
#endif
|
||||
if (p && (strcmp (p, "Success") == 0))
|
||||
return 1;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user