Add a couple of icons for devices and symlinks

This commit is contained in:
Miguel de Icaza 1998-03-10 06:31:01 +00:00
parent e78e0bd556
commit c6d65c1bd3
9 changed files with 113 additions and 44 deletions

View File

@ -1,3 +1,22 @@
Tue Mar 10 00:10:32 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gscreen.c (panel_drop_data_available): Now drop support uses the
new coords.x and coords.y fields from the DropDataAvailableEvent
to find out which directory receives the drop.
* gwidget.c (x_radio_focus_item): Add support for focusing radio
buttons.
Mon Mar 9 15:12:00 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtools.c (translate_gdk_keysym_to_curses), dlg.c
(dlg_key_event): Support for backtab.
* gwidget.c: highlight properly the focused radio entry.
* gmain.c (x_init_dlg): After setting up the X widget, set the
Gtk focus to h->current;
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gscreen.c (x_panel_select_item): Set the colors of the row.

View File

@ -8,7 +8,7 @@ CFLAGS = $(XCFLAGS) @X_CFLAGS@
CPPFLAGS = $(XCPPFLAGS) -I$(vfsdir) -I$(slangdir) -DHAVE_X -DHAVE_GNOME
LDFLAGS = $(XLDFLAGS) @X_LIBS@
DEFS = $(XDEFS)
LIBS = -lgnomeui -lgnome -lgtk -lgdk -lglib @X_EXTRA_LIBS@ -lX11 @X_PRE_LIBS@ $(XLIBS) $(XLIB) @TERMNET@
LIBS = -lgnomeui -lgdk_imlib -lgnome -lgnomesupport -lgtk -lgdk -lglib @X_EXTRA_LIBS@ -lX11 @X_PRE_LIBS@ $(XLIBS) $(XLIB) @TERMNET@
EXTRALIBS = @LVFS@ @LSLANG@ @LEDIT@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -58,7 +58,7 @@ OBJS = $(LOBJS) $(OOBJS) \
# Distribution variables
#
PIXMAPS = directory.xpm
PIXMAPS = directory.xpm link.xpm
DISTGNOME = Makefile.in gnome.TODO layout $(PIXMAPS) $(GNOMESRCS) $(GNOMEHDRS)

View File

@ -17,6 +17,9 @@
#define PORT_HAS_PANEL_RESET_SORT_LABELS 1
#define PORT_HAS_FLUSH_EVENTS 1
#define PORT_HAS_SET_IDLE 1
#define PORT_HAS_BACKTAB_CHAR 1
#define PORT_NOT_FOCUS_SELECT_ITEM 1
#define PORT_NOT_UNFOCUS_UNSELECT_ITEM 1
#define mi_getch() fprintf (stderr, "mi_getch is not implemented in this port\n")
#define frontend_run_dlg(x) gtkrundlg_event (x)

View File

@ -271,8 +271,7 @@ drop_on_panel (GdkEventDropDataAvailable *event, char *dest)
int x, y;
int operation;
gdk_window_get_pointer (NULL, &x, &y, NULL);
operation = get_operation (x, y);
operation = get_operation (event->coords.x, event->coords.y);
source_panel = find_panel_owning_window_id (event->requestor);
@ -570,12 +569,13 @@ desktop_setup_default (char *desktop_dir)
mc_desktop_dir = concat_dir_and_file (mc_home, MC_LIB_DESKTOP);
if (exist_file (mc_desktop_dir)){
create_op_win (OP_COPY, 0);
file_mask_defaults ();
copy_dir_dir (mc_desktop_dir, desktop_dir);
destroy_op_win ();
}
free (mc_desktop_dir);
}
void

View File

@ -183,12 +183,6 @@ x_panel_container_show (widget_data wdata)
gtk_widget_show (GTK_WIDGET (wdata));
}
void
x_focus_widget (Widget_Item *p)
{
gtk_widget_grab_focus (GTK_WIDGET (p->widget->wdata));
}
void
x_add_widget (Dlg_head *h, Widget_Item *w)
{
@ -218,6 +212,7 @@ x_init_dlg (Dlg_head *h)
gtk_widget_show (GTK_WIDGET (h->wdata));
}
x_focus_widget (h->current);
}

View File

@ -30,13 +30,19 @@
#include "dialog.h"
#include "gdesktop.h"
/* The pixmaps */
#include "directory.xpm"
#include "link.xpm"
#include "dev.xpm"
/* This is used to initialize our pixmaps */
static int pixmaps_ready;
GdkPixmap *directory_pixmap;
GdkBitmap *directory_mask;
GdkPixmap *icon_directory_pixmap;
GdkBitmap *icon_directory_mask;
GdkPixmap *icon_link_pixmap;
GdkBitmap *icon_link_mask;
GdkPixmap *icon_dev_pixmap;
GdkBitmap *icon_dev_mask;
static char *drag_types [] = { "text/plain", "url:ALL" };
static char *drop_types [] = { "url:ALL" };
@ -58,8 +64,6 @@ show_dir (WPanel *panel)
list = g_list_alloc ();
g_list_append (list, panel->cwd);
printf ("show_dir to %s %s\n", panel->cwd, panel->filter ? panel->filter : "<no-filt>");
}
static void
@ -68,7 +72,13 @@ panel_file_list_set_type_bitmap (GtkCList *cl, int row, int column, int color, f
/* Here, add more icons */
switch (color){
case DIRECTORY_COLOR:
gtk_clist_set_pixmap (cl, row, column, directory_pixmap, directory_mask);
gtk_clist_set_pixmap (cl, row, column, icon_directory_pixmap, icon_directory_mask);
break;
case LINK_COLOR:
gtk_clist_set_pixmap (cl, row, column, icon_link_pixmap, icon_link_mask);
break;
case DEVICE_COLOR:
gtk_clist_set_pixmap (cl, row, column, icon_dev_pixmap, icon_dev_mask);
break;
}
}
@ -444,8 +454,6 @@ internal_select_item (GtkWidget *file_list, WPanel *panel, int row)
static void
panel_file_list_select_row (GtkWidget *file_list, int row, int column, GdkEvent *event, WPanel *panel)
{
printf ("panel_file_list_select_row\n");
if (!event) {
internal_select_item (file_list, panel, row);
return;
@ -500,8 +508,6 @@ panel_file_list_compute_lines (GtkCList *file_list, WPanel *panel, int height)
static void
panel_file_list_size_allocate_hook (GtkWidget *file_list, GtkAllocation *allocation, WPanel *panel)
{
printf ("Aqui\n");
panel_file_list_configure_contents (file_list, panel, allocation->width, allocation->height);
panel_file_list_compute_lines (GTK_CLIST (file_list), panel, allocation->height);
@ -540,14 +546,16 @@ panel_create_pixmaps (GtkWidget *parent)
GdkColor color = gtk_widget_get_style (parent)->bg [GTK_STATE_NORMAL];
pixmaps_ready = 1;
directory_pixmap = gdk_pixmap_create_from_xpm_d (parent->window, &directory_mask, &color, directory_xpm);
icon_directory_pixmap = gdk_pixmap_create_from_xpm_d (parent->window, &icon_directory_mask, &color, directory_xpm);
icon_link_pixmap = gdk_pixmap_create_from_xpm_d (parent->window, &icon_link_mask, &color, link_xpm);
icon_dev_pixmap = gdk_pixmap_create_from_xpm_d (parent->window, &icon_dev_mask, &color, dev_xpm);
}
static void
panel_file_list_scrolled (GtkAdjustment *adj, WPanel *panel)
{
if (!GTK_IS_ADJUSTMENT (adj)) {
fprintf (stderr, "CRAP!\n");
fprintf (stderr, "file_list_is_scrolled is called and there are not enough boats!\n");
exit (1);
}
}
@ -656,15 +664,32 @@ panel_drop_enter (GtkWidget *widget, GdkEvent *event)
static void
panel_drop_data_available (GtkWidget *widget, GdkEventDropDataAvailable *data, WPanel *panel)
{
/* Sigh, the DropDataAvailable does not provide the location where the drag
* happened, so for now, the only thing we can do is ask gdk to tell us
* where the pointer is, even if it bears little resemblance with the
* actual spot where the drop happened.
*
* FIXME: gtk+ needs fixing here.
*/
gint winx, winy;
gint dropx, dropy;
gint row;
char *drop_dir;
drop_on_panel (data, panel->cwd);
gdk_window_get_origin (GTK_CLIST (widget)->clist_window, &winx, &winy);
dropx = data->coords.x - winx;
dropy = data->coords.y - winy;
if (dropx < 0 || dropy < 0)
return;
if (gtk_clist_get_selection_info (GTK_CLIST (widget), dropx, dropy, &row, NULL) == 0)
drop_dir = panel->cwd;
else {
g_assert (row < panel->count);
if (S_ISDIR (panel->dir.list [row].buf.st_mode))
drop_dir = concat_dir_and_file (panel->cwd, panel->dir.list [row].fname);
else
drop_dir = panel->cwd;
}
drop_on_panel (data, drop_dir);
if (drop_dir != panel->cwd)
free (drop_dir);
}
/* Workaround for the CList that is not adding its clist-window to the DND windows */
@ -737,6 +762,7 @@ panel_create_file_list (WPanel *panel)
const int items = panel->format->items;
format_e *format = panel->format;
GtkWidget *file_list;
GtkCList *clist;
gchar **titles;
int i;
@ -746,6 +772,7 @@ panel_create_file_list (WPanel *panel)
titles [i++] = format->title;
file_list = gtk_clist_new_with_titles (items, titles);
clist = GTK_CLIST (file_list);
panel_configure_file_list (panel, file_list);
free (titles);
@ -760,7 +787,6 @@ panel_create_file_list (WPanel *panel)
gtk_signal_connect (GTK_OBJECT (file_list), "select_row",
GTK_SIGNAL_FUNC (panel_file_list_select_row), panel);
return file_list;
}
@ -804,8 +830,6 @@ panel_change_filter (GtkWidget *entry, WPanel *panel)
* item to bring up a "set filter" dialog box.
*/
printf ("panel_change_filter\n");
reg_exp = gtk_entry_get_text (GTK_ENTRY (entry));
if (panel->filter) {

View File

@ -125,6 +125,8 @@ translate_gdk_keysym_to_curses (GdkEventKey *event)
case GDK_BackSpace:
return KEY_BACKSPACE;
case GDK_Tab:
if (event->state & GDK_SHIFT_MASK)
return KEY_BACKTAB;
return '\t';
case GDK_KP_Enter:
case GDK_Return:

View File

@ -16,6 +16,14 @@
#include "gwidget.h"
#include "dlg.h"
void
x_focus_widget (Widget_Item *p)
{
GtkWidget *w = GTK_WIDGET (p->widget->wdata);
gtk_widget_grab_focus (GTK_WIDGET (p->widget->wdata));
}
void
x_destroy_cmd (void *w)
{
@ -76,6 +84,24 @@ x_button_set (WButton *b, char *text)
}
/* Radio buttons */
void
x_radio_focus_item (WRadio *radio)
{
GList *children = GTK_BOX (radio->widget.wdata)->children;
int i;
for (i = 0; i < radio->count; i++){
if (i == radio->pos){
GtkBoxChild *bc = (GtkBoxChild *) children->data;
gtk_widget_grab_focus (GTK_WIDGET (bc->widget));
break;
}
children = children->next;
}
}
static void
radio_toggle (GtkObject *object, WRadio *r)
{

View File

@ -136,7 +136,7 @@ flags=snew
text=Directory path
[option-Widget-button-ok]
geometry=1,15,1,1
geometry=2,15,1,1
flags=w
[option-Widget-safe-del]
@ -220,7 +220,7 @@ geometry=2,2,1,1
flags=w
[option-Widget-pause-radio]
geometry=2,12,1,5
geometry=2,10,1,5
flags=nw
[option-Frame-Frame-1]