31
31
#include "nautilus-application.h"
34
#include "nautilus-empty-view.h"
35
#endif /* ENABLE_EMPTY_VIEW */
37
33
#include "nautilus-bookmarks-window.h"
38
34
#include "nautilus-connect-server-dialog.h"
39
#include "nautilus-desktop-canvas-view.h"
40
35
#include "nautilus-desktop-window.h"
41
36
#include "nautilus-file-management-properties.h"
42
37
#include "nautilus-freedesktop-dbus.h"
43
#include "nautilus-canvas-view.h"
44
38
#include "nautilus-image-properties-page.h"
45
#include "nautilus-list-view.h"
46
39
#include "nautilus-previewer.h"
47
40
#include "nautilus-progress-ui-handler.h"
48
41
#include "nautilus-self-check-functions.h"
410
403
static GtkWidget *
411
get_desktop_manager_selection (GdkDisplay *display, int screen)
404
get_desktop_manager_selection (GdkScreen *screen)
413
406
char selection_name[32];
414
407
GdkAtom selection_atom;
415
408
Window selection_owner;
416
410
GtkWidget *selection_widget;
418
g_snprintf (selection_name, sizeof (selection_name), "_NET_DESKTOP_MANAGER_S%d", screen);
412
g_snprintf (selection_name, sizeof (selection_name),
413
"_NET_DESKTOP_MANAGER_S%d", gdk_screen_get_number (screen));
419
414
selection_atom = gdk_atom_intern (selection_name, FALSE);
415
display = gdk_screen_get_display (screen);
421
417
selection_owner = XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
422
418
gdk_x11_atom_to_xatom_for_display (display,
468
464
nautilus_application_create_desktop_windows (NautilusApplication *application)
471
467
NautilusDesktopWindow *window;
472
468
GtkWidget *selection_widget;
475
display = gdk_display_get_default ();
476
screens = gdk_display_get_n_screens (display);
478
for (i = 0; i < screens; i++) {
480
DEBUG ("Creating a desktop window for screen %d", i);
470
screen = gdk_screen_get_default ();
472
DEBUG ("Creating desktop window");
482
selection_widget = get_desktop_manager_selection (display, i);
483
if (selection_widget != NULL) {
484
window = nautilus_desktop_window_new (GTK_APPLICATION (application),
485
gdk_display_get_screen (display, i));
487
g_signal_connect (selection_widget, "selection-clear-event",
488
G_CALLBACK (selection_clear_event_cb), window);
490
g_signal_connect (window, "unrealize",
491
G_CALLBACK (desktop_unrealize_cb), selection_widget);
493
/* We realize it immediately so that the NAUTILUS_DESKTOP_WINDOW_ID
494
property is set so gnome-settings-daemon doesn't try to set the
495
background. And we do a gdk_flush() to be sure X gets it. */
496
gtk_widget_realize (GTK_WIDGET (window));
499
nautilus_application_desktop_windows =
500
g_list_prepend (nautilus_application_desktop_windows, window);
474
selection_widget = get_desktop_manager_selection (screen);
475
if (selection_widget != NULL) {
476
window = nautilus_desktop_window_new (GTK_APPLICATION (application), screen);
478
g_signal_connect (selection_widget, "selection-clear-event",
479
G_CALLBACK (selection_clear_event_cb), window);
481
g_signal_connect (window, "unrealize",
482
G_CALLBACK (desktop_unrealize_cb), selection_widget);
484
/* We realize it immediately so that the NAUTILUS_DESKTOP_WINDOW_ID
485
property is set so gnome-settings-daemon doesn't try to set the
486
background. And we do a gdk_flush() to be sure X gets it. */
487
gtk_widget_realize (GTK_WIDGET (window));
490
nautilus_application_desktop_windows =
491
g_list_prepend (nautilus_application_desktop_windows, window);
1380
1370
/* Initialize the desktop link monitor singleton */
1381
1371
nautilus_desktop_link_monitor_get ();
1383
if (nautilus_application_desktop_windows == NULL) {
1384
nautilus_application_create_desktop_windows (application);
1373
nautilus_application_create_desktop_windows (application);
1389
1377
nautilus_application_close_desktop (void)
1391
if (nautilus_application_desktop_windows != NULL) {
1392
g_list_foreach (nautilus_application_desktop_windows,
1393
(GFunc) gtk_widget_destroy, NULL);
1394
g_list_free (nautilus_application_desktop_windows);
1395
nautilus_application_desktop_windows = NULL;
1379
g_list_foreach (nautilus_application_desktop_windows,
1380
(GFunc) gtk_widget_destroy, NULL);
1381
g_list_free (nautilus_application_desktop_windows);
1382
nautilus_application_desktop_windows = NULL;
1397
1384
nautilus_desktop_link_monitor_shutdown ();
1606
1593
/* initialize preferences and create the global GSettings objects */
1607
1594
nautilus_global_preferences_init ();
1609
/* register views */
1610
nautilus_profile_start ("Register views");
1611
nautilus_canvas_view_register ();
1612
nautilus_desktop_canvas_view_register ();
1613
nautilus_list_view_register ();
1614
#if ENABLE_EMPTY_VIEW
1615
nautilus_empty_view_register ();
1617
nautilus_profile_end ("Register views");
1619
1596
/* register property pages */
1620
1597
nautilus_image_properties_page_register ();