1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>

* gicon.h (gicon_image_to_name): Added prototype for
	gicon_image_to_name().

	* gicon.c (gicon_get_icon_for_file):
	(gicon_get_icon_for_file_speed): Added a "directory" argument.
	It is needed because the file_entry structure only contains the
	pruned filename, and we need the complete name for the metadata
	functions.

	* gdesktop.c (desktop_icon_info_new): Pass the directory to
	gicon_get_icon_for_file_speed().

	* gpageprop.c (item_properties): Build the directory name and pass
	it to gicon_get_icon_for_file_speed().

	* gscreen.c: Do not #include "directory.xpm".  Do #include "setup.h".
	Removed unused function button_switch_to().

	* gscreen.c (panel_fill_panel_icons): Pass the directory to
	gicon_get_icon_for_file().

	* gscreen.c (panel_create_tree_view): Allow button 2 to start the
	drag as well.
	(panel_clist_scrolling_is_desirable): Make both scrolling
	thresholds consistent.  Also, do not allow scrolling past the
	correct limit.
	(panel_icon_list_scrolling_is_desirable): Likewise.
	(panel_tree_scrolling_is_desirable): Likewise.
	(panel_clist_scroll): Do not allow scrolling past the correct limits.
	(panel_icon_list_scroll): Likewise.
	(panel_tree_scroll): Likewise.
This commit is contained in:
Miguel de Icaza 1999-01-20 10:40:21 +00:00
parent cc1590b9d1
commit 88cd0bdfc4
7 changed files with 655 additions and 268 deletions

View File

@ -1,3 +1,42 @@
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gicon.h (gicon_image_to_name): Added prototype for
gicon_image_to_name().
* gicon.c (gicon_get_icon_for_file):
(gicon_get_icon_for_file_speed): Added a "directory" argument.
It is needed because the file_entry structure only contains the
pruned filename, and we need the complete name for the metadata
functions.
* gdesktop.c (desktop_icon_info_new): Pass the directory to
gicon_get_icon_for_file_speed().
* gpageprop.c (item_properties): Build the directory name and pass
it to gicon_get_icon_for_file_speed().
* gscreen.c: Do not #include "directory.xpm". Do #include "setup.h".
Removed unused function button_switch_to().
* gscreen.c (panel_fill_panel_icons): Pass the directory to
gicon_get_icon_for_file().
* gscreen.c (panel_create_tree_view): Allow button 2 to start the
drag as well.
(panel_clist_scrolling_is_desirable): Make both scrolling
thresholds consistent. Also, do not allow scrolling past the
correct limit.
(panel_icon_list_scrolling_is_desirable): Likewise.
(panel_tree_scrolling_is_desirable): Likewise.
(panel_clist_scroll): Do not allow scrolling past the correct limits.
(panel_icon_list_scroll): Likewise.
(panel_tree_scroll): Likewise.
1999-01-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gscreen.c (panel_create_icon_display): Do not set the style of
the icon list.
1999-01-20 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gprefs.c (apply_callback): Update the directory contents after

View File

@ -1279,7 +1279,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_speed (fe, FALSE);
icon_im = gicon_get_icon_for_file_speed (desktop_directory, fe, FALSE);
dii = g_new (DesktopIconInfo, 1);
dii->dicon = desktop_icon_new (icon_im, filename);

View File

@ -173,13 +173,14 @@ gnome_file_entry_color (file_entry *fe)
* icon for it. Including a lookup in the metadata.
*/
GdkImlibImage *
gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
gicon_get_icon_for_file_speed (char *directory, file_entry *fe, gboolean do_quick)
{
GdkImlibImage *image;
int size;
char *buf, *mime_type;
mode_t mode;
g_return_val_if_fail (directory != NULL, NULL);
g_return_val_if_fail (fe != NULL, NULL);
if (!gicon_inited)
@ -232,30 +233,40 @@ gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
/*
* 2. Expensive tests
*/
if (!do_quick || we_can_affort_the_speed){
if (!do_quick || we_can_affort_the_speed) {
char *full_name;
full_name = g_concat_dir_and_file (directory, fe->fname);
/*
* 2.1 Try to fetch the icon as an inline png from the metadata.
*/
if (gnome_metadata_get (fe->fname, "icon-inline-png", &size, &buf) == 0){
if (gnome_metadata_get (full_name, "icon-inline-png", &size, &buf) == 0){
image = gdk_imlib_inlined_png_to_image (buf, size);
g_free (buf);
if (image)
if (image) {
g_free (full_name);
return image;
}
}
/*
* 2.2. Try to fetch the icon from the metadata.
*/
if (gnome_metadata_get (fe->fname, "icon-filename", &size, &buf) == 0){
if (gnome_metadata_get (full_name, "icon-filename", &size, &buf) == 0){
image = gicon_get_by_filename (buf);
g_free (buf);
if (image)
if (image) {
g_free (full_name);
return image;
}
}
g_free (full_name);
}
/*
@ -287,9 +298,9 @@ gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
}
GdkImlibImage *
gicon_get_icon_for_file (file_entry *fe)
gicon_get_icon_for_file (char *directory, file_entry *fe)
{
return gicon_get_icon_for_file_speed (fe, TRUE);
return gicon_get_icon_for_file_speed (directory, fe, TRUE);
}
typedef struct {

View File

@ -3,8 +3,9 @@
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);
GdkImlibImage *gicon_get_icon_for_file (char *directory, file_entry *fe);
GdkImlibImage *gicon_get_icon_for_file_speed (char *directory, file_entry *fe, gboolean do_quick);
char *gicon_image_to_name (GdkImlibImage *image);
#endif

View File

@ -68,8 +68,6 @@ item_properties (GtkWidget *parent, char *fname, DesktopIconInfo *dii)
char *new_name;
char *base;
char *icon_filename;
int size;
struct stat s;
int retval = 0;
@ -96,10 +94,16 @@ item_properties (GtkWidget *parent, char *fname, DesktopIconInfo *dii)
if (dii) {
GdkImlibImage *icon;
file_entry *fe;
char *name;
char *dirname;
char *p;
p = strrchr (fname, PATH_SEP);
g_assert (p != NULL);
dirname = g_strndup (fname, p - fname);
fe = file_entry_from_file (fname);
icon = gicon_get_icon_for_file_speed (fe, FALSE);
icon = gicon_get_icon_for_file_speed (dirname, fe, FALSE);
g_free (dirname);
file_entry_free (fe);
icon_filename = gicon_image_to_name (icon);
if (icon_filename == NULL)

View File

@ -27,6 +27,7 @@
#include "gscreen.h"
#include "dir.h"
#include "dialog.h"
#include "setup.h"
#include "gdesktop.h"
#include "gdnd.h"
#include "gtkdtree.h"
@ -42,7 +43,6 @@
int tree_panel_visible = -1;
/* The pixmaps */
#include "directory.xpm"
#include "dir-close.xpm"
#include "link.xpm"
#include "dev.xpm"
@ -233,7 +233,7 @@ panel_fill_panel_icons (WPanel *panel)
file_entry *fe = &panel->dir.list [i];
int p;
image = gicon_get_icon_for_file (fe);
image = gicon_get_icon_for_file (panel->cwd, fe);
p = gnome_icon_list_append_imlib (icons, image, fe->fname);
if (fe->f.marked)
gnome_icon_list_select_icon (icons, p);
@ -946,7 +946,7 @@ panel_widget_motion (GtkWidget *widget, GdkEventMotion *event, WPanel *panel)
if (panel->maybe_start_drag == 2)
action = GDK_ACTION_ASK;
else
action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK;
context = gtk_drag_begin (widget, list, action,
panel->maybe_start_drag, (GdkEvent *) event);
@ -995,8 +995,8 @@ panel_clist_scrolling_is_desirable (WPanel *panel, int x, int y)
if (va->value > va->lower)
return TRUE;
} else {
if (y > (GTK_WIDGET (panel->list)->allocation.height-20)){
if (va->value < va->upper)
if (y > (GTK_WIDGET (panel->list)->allocation.height - 10)){
if (va->value < va->upper - va->page_size)
return TRUE;
}
}
@ -1015,14 +1015,24 @@ panel_clist_scroll (gpointer data)
{
WPanel *panel = data;
GtkAdjustment *va;
double v;
va = scrolled_window_get_vadjustment (panel->list);
if (panel->drag_motion_y < 10)
gtk_adjustment_set_value (va, va->value - va->step_increment);
else{
gtk_adjustment_set_value (va, va->value + va->step_increment);
if (panel->drag_motion_y < 10) {
v = va->value - va->step_increment;
if (v < va->lower)
v = va->lower;
gtk_adjustment_set_value (va, v);
} else {
v = va->value + va->step_increment;
if (v > va->upper - va->page_size)
v = va->upper - va->page_size;
gtk_adjustment_set_value (va, v);
}
return TRUE;
}
@ -1075,8 +1085,8 @@ panel_icon_list_scrolling_is_desirable (WPanel *panel, int x, int y)
if (va->value > va->lower)
return TRUE;
} else {
if (y > (GTK_WIDGET (panel->icons)->allocation.height-20)){
if (va->value < va->upper)
if (y > (GTK_WIDGET (panel->icons)->allocation.height - 10)){
if (va->value < va->upper - va->page_size)
return TRUE;
}
}
@ -1095,14 +1105,24 @@ panel_icon_list_scroll (gpointer data)
{
WPanel *panel = data;
GtkAdjustment *va;
double v;
va = GNOME_ICON_LIST (panel->icons)->adj;
if (panel->drag_motion_y < 10)
gtk_adjustment_set_value (va, va->value - va->step_increment);
else{
gtk_adjustment_set_value (va, va->value + va->step_increment);
if (panel->drag_motion_y < 10) {
v = va->value - va->step_increment;
if (v < va->lower)
v = va->lower;
gtk_adjustment_set_value (va, v);
} else {
v = va->value + va->step_increment;
if (v > va->upper - va->page_size)
v = va->upper - va->page_size;
gtk_adjustment_set_value (va, v);
}
return TRUE;
}
/**
@ -1347,14 +1367,9 @@ static GtkWidget *
panel_create_icon_display (WPanel *panel)
{
GnomeIconList *ilist;
GtkStyle *style;
ilist = GNOME_ICON_LIST (gnome_icon_list_new (90, NULL, TRUE));
/* Set the background of the icon list to white */
style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (ilist)));
style->bg [GTK_STATE_NORMAL] = style->bg [GTK_STATE_PRELIGHT];
gtk_widget_set_style (GTK_WIDGET (ilist), style);
gnome_icon_list_set_separators (ilist, " /-_.");
gnome_icon_list_set_row_spacing (ilist, 2);
gnome_icon_list_set_col_spacing (ilist, 2);
@ -1790,8 +1805,8 @@ panel_tree_scrolling_is_desirable (WPanel *panel, int x, int y)
if (va->value > va->lower)
return TRUE;
} else {
if (y > (GTK_WIDGET (dtree)->allocation.height-20)){
if (va->value < va->upper)
if (y > (GTK_WIDGET (dtree)->allocation.height - 10)){
if (va->value < va->upper - va->page_size)
return TRUE;
}
}
@ -1878,14 +1893,24 @@ panel_tree_scroll (gpointer data)
{
WPanel *panel = data;
GtkAdjustment *va;
double v;
va = scrolled_window_get_vadjustment (panel->tree_scrolled_window);
if (panel->drag_motion_y < 10)
gtk_adjustment_set_value (va, va->value - va->step_increment);
else{
gtk_adjustment_set_value (va, va->value + va->step_increment);
if (panel->drag_motion_y < 10) {
v = va->value - va->step_increment;
if (v < va->lower)
v = va->lower;
gtk_adjustment_set_value (va, v);
} else {
v = va->value + va->step_increment;
if (v > va->upper - va->page_size)
v = va->upper - va->page_size;
gtk_adjustment_set_value (va, v);
}
return TRUE;
}
@ -2030,9 +2055,9 @@ panel_create_tree_view (WPanel *panel)
GTK_SIGNAL_FUNC (panel_tree_drag_data_get), panel);
/* Make directories draggable */
gtk_drag_source_set (GTK_WIDGET (tree), GDK_BUTTON1_MASK,
gtk_drag_source_set (GTK_WIDGET (tree), GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
drag_types, ELEMENTS (drag_types),
GDK_ACTION_LINK | GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK);
GDK_ACTION_LINK | GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK | GDK_ACTION_DEFAULT);
/* Mouse is being moved over ourselves */
gtk_signal_connect (GTK_OBJECT (tree), "drag_motion",
@ -2098,19 +2123,6 @@ panel_up (GtkWidget *button, WPanel *panel)
do_panel_cd (panel, "..", cd_exact);
}
static GtkWidget *
button_switch_to (char **icon, GtkSignalFunc fn, void *closure)
{
GtkWidget *button, *pix;
button = gtk_button_new ();
pix = gnome_pixmap_new_from_xpm_d (icon);
gtk_container_add (GTK_CONTAINER (button), pix);
gtk_signal_connect (GTK_OBJECT (button), "clicked", fn, closure);
return button;
}
static void
do_switch_to_iconic (GtkWidget *widget, WPanel *panel)
{
@ -2204,9 +2216,6 @@ do_ui_signal_connect (GnomeUIInfo *uiinfo, gchar *signal_name,
static void
tree_size_allocate (GtkWidget *widget, GtkAllocation *allocation, WPanel *panel)
{
GtkWidget *tree = panel->tree;
GdkFont *tree_font = tree->style->font;
if (allocation->width <= 0){
tree_panel_visible = 0;
} else {

735
po/mc.pot

File diff suppressed because it is too large Load Diff