mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-27 05:29:27 +03:00
Fixes for desktop icons - Federico
This commit is contained in:
parent
652cd17475
commit
772cae09e0
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
static void desktop_icon_class_init (DesktopIconClass *class);
|
static void desktop_icon_class_init (DesktopIconClass *class);
|
||||||
static void desktop_icon_init (DesktopIcon *dicon);
|
static void desktop_icon_init (DesktopIcon *dicon);
|
||||||
|
static void desktop_icon_realize (GtkWidget *widget);
|
||||||
|
|
||||||
|
|
||||||
static GtkWindowClass *parent_class;
|
static GtkWindowClass *parent_class;
|
||||||
@ -55,6 +56,8 @@ desktop_icon_class_init (DesktopIconClass *class)
|
|||||||
widget_class = (GtkWidgetClass *) class;
|
widget_class = (GtkWidgetClass *) class;
|
||||||
|
|
||||||
parent_class = gtk_type_class (gtk_window_get_type ());
|
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 */
|
/* Computes and sets a new window shape for the desktop icon */
|
||||||
@ -196,6 +199,18 @@ desktop_icon_init (DesktopIcon *dicon)
|
|||||||
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 *
|
GtkWidget *
|
||||||
desktop_icon_new (char *image_file, char *text)
|
desktop_icon_new (char *image_file, char *text)
|
||||||
{
|
{
|
||||||
|
@ -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 (icons_snap_to_grid){
|
||||||
if (x == -1){
|
if (x == -1){
|
||||||
x = current_x;
|
x = current_x;
|
||||||
@ -195,7 +193,7 @@ desktop_icon_set_position (desktop_icon_t *di)
|
|||||||
x = current_x;
|
x = current_x;
|
||||||
y = current_y;
|
y = current_y;
|
||||||
|
|
||||||
current_y += di->widget->requisition.height + 8;
|
current_y += DESKTOP_ICON (di)->height + 8;
|
||||||
if (current_y > gdk_screen_height ()){
|
if (current_y > gdk_screen_height ()){
|
||||||
current_x += SNAP_X;
|
current_x += SNAP_X;
|
||||||
current_y = 0;
|
current_y = 0;
|
||||||
@ -1073,10 +1071,10 @@ post_setup_desktop_icon (desktop_icon_t *di, int show)
|
|||||||
/* 2. Double clicking executes the command */
|
/* 2. Double clicking executes the command */
|
||||||
gtk_signal_connect (GTK_OBJECT (child->data), "button_press_event", GTK_SIGNAL_FUNC (dentry_button_click), di);
|
gtk_signal_connect (GTK_OBJECT (child->data), "button_press_event", GTK_SIGNAL_FUNC (dentry_button_click), di);
|
||||||
|
|
||||||
|
#endif
|
||||||
if (show)
|
if (show)
|
||||||
gtk_widget_show (di->widget);
|
gtk_widget_show (di->widget);
|
||||||
|
|
||||||
#endif
|
|
||||||
/* lower the window */
|
/* lower the window */
|
||||||
gdk_window_lower (di->widget->window);
|
gdk_window_lower (di->widget->window);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user