From 772cae09e01a218838c415da186db73c8df58680 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 23 Oct 1998 14:31:02 +0000 Subject: [PATCH] Fixes for desktop icons - Federico --- gnome/gdesktop-icon.c | 15 +++++++++++++++ gnome/gdesktop.c | 6 ++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gnome/gdesktop-icon.c b/gnome/gdesktop-icon.c index bf02a01bb..7c73dd312 100644 --- a/gnome/gdesktop-icon.c +++ b/gnome/gdesktop-icon.c @@ -17,6 +17,7 @@ static void desktop_icon_class_init (DesktopIconClass *class); static void desktop_icon_init (DesktopIcon *dicon); +static void desktop_icon_realize (GtkWidget *widget); static GtkWindowClass *parent_class; @@ -55,6 +56,8 @@ desktop_icon_class_init (DesktopIconClass *class) widget_class = (GtkWidgetClass *) class; parent_class = gtk_type_class (gtk_window_get_type ()); + + widget_class->realize = desktop_icon_realize; } /* Computes and sets a new window shape for the desktop icon */ @@ -196,6 +199,18 @@ desktop_icon_init (DesktopIcon *dicon) dicon); } +static void +desktop_icon_realize (GtkWidget *widget) +{ + g_return_if_fail (widget != NULL); + g_return_if_fail (IS_DESKTOP_ICON (widget)); + + if (GTK_WIDGET_CLASS (parent_class)->realize) + (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); + + /* FIXME: set the appropriate WM hints for desktop icons */ +} + GtkWidget * desktop_icon_new (char *image_file, char *text) { diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 3947262aa..88dca42dc 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -171,8 +171,6 @@ desktop_icon_set_position (desktop_icon_t *di) } } - gtk_widget_size_request (di->widget, &di->widget->requisition); - if (icons_snap_to_grid){ if (x == -1){ x = current_x; @@ -195,7 +193,7 @@ desktop_icon_set_position (desktop_icon_t *di) x = current_x; y = current_y; - current_y += di->widget->requisition.height + 8; + current_y += DESKTOP_ICON (di)->height + 8; if (current_y > gdk_screen_height ()){ current_x += SNAP_X; current_y = 0; @@ -1073,10 +1071,10 @@ post_setup_desktop_icon (desktop_icon_t *di, int show) /* 2. Double clicking executes the command */ gtk_signal_connect (GTK_OBJECT (child->data), "button_press_event", GTK_SIGNAL_FUNC (dentry_button_click), di); +#endif if (show) gtk_widget_show (di->widget); -#endif /* lower the window */ gdk_window_lower (di->widget->window); }