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"
406
399
static GtkWidget *
407
get_desktop_manager_selection (GdkDisplay *display, int screen)
400
get_desktop_manager_selection (GdkScreen *screen)
409
402
char selection_name[32];
410
403
GdkAtom selection_atom;
411
404
Window selection_owner;
412
406
GtkWidget *selection_widget;
414
g_snprintf (selection_name, sizeof (selection_name), "_NET_DESKTOP_MANAGER_S%d", screen);
408
g_snprintf (selection_name, sizeof (selection_name),
409
"_NET_DESKTOP_MANAGER_S%d", gdk_screen_get_number (screen));
415
410
selection_atom = gdk_atom_intern (selection_name, FALSE);
411
display = gdk_screen_get_display (screen);
417
413
selection_owner = XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
418
414
gdk_x11_atom_to_xatom_for_display (display,
464
460
nautilus_application_create_desktop_windows (NautilusApplication *application)
467
463
NautilusDesktopWindow *window;
468
464
GtkWidget *selection_widget;
471
display = gdk_display_get_default ();
472
screens = gdk_display_get_n_screens (display);
474
for (i = 0; i < screens; i++) {
476
DEBUG ("Creating a desktop window for screen %d", i);
466
screen = gdk_screen_get_default ();
468
DEBUG ("Creating desktop window");
478
selection_widget = get_desktop_manager_selection (display, i);
479
if (selection_widget != NULL) {
480
window = nautilus_desktop_window_new (GTK_APPLICATION (application),
481
gdk_display_get_screen (display, i));
483
g_signal_connect (selection_widget, "selection-clear-event",
484
G_CALLBACK (selection_clear_event_cb), window);
486
g_signal_connect (window, "unrealize",
487
G_CALLBACK (desktop_unrealize_cb), selection_widget);
489
/* We realize it immediately so that the NAUTILUS_DESKTOP_WINDOW_ID
490
property is set so gnome-settings-daemon doesn't try to set the
491
background. And we do a gdk_flush() to be sure X gets it. */
492
gtk_widget_realize (GTK_WIDGET (window));
495
nautilus_application_desktop_windows =
496
g_list_prepend (nautilus_application_desktop_windows, window);
470
selection_widget = get_desktop_manager_selection (screen);
471
if (selection_widget != NULL) {
472
window = nautilus_desktop_window_new (GTK_APPLICATION (application), screen);
474
g_signal_connect (selection_widget, "selection-clear-event",
475
G_CALLBACK (selection_clear_event_cb), window);
477
g_signal_connect (window, "unrealize",
478
G_CALLBACK (desktop_unrealize_cb), selection_widget);
480
/* We realize it immediately so that the NAUTILUS_DESKTOP_WINDOW_ID
481
property is set so gnome-settings-daemon doesn't try to set the
482
background. And we do a gdk_flush() to be sure X gets it. */
483
gtk_widget_realize (GTK_WIDGET (window));
486
nautilus_application_desktop_windows =
487
g_list_prepend (nautilus_application_desktop_windows, window);
1376
1366
/* Initialize the desktop link monitor singleton */
1377
1367
nautilus_desktop_link_monitor_get ();
1379
if (nautilus_application_desktop_windows == NULL) {
1380
nautilus_application_create_desktop_windows (application);
1369
nautilus_application_create_desktop_windows (application);
1385
1373
nautilus_application_close_desktop (void)
1387
if (nautilus_application_desktop_windows != NULL) {
1388
g_list_foreach (nautilus_application_desktop_windows,
1389
(GFunc) gtk_widget_destroy, NULL);
1390
g_list_free (nautilus_application_desktop_windows);
1391
nautilus_application_desktop_windows = NULL;
1375
g_list_foreach (nautilus_application_desktop_windows,
1376
(GFunc) gtk_widget_destroy, NULL);
1377
g_list_free (nautilus_application_desktop_windows);
1378
nautilus_application_desktop_windows = NULL;
1393
1380
nautilus_desktop_link_monitor_shutdown ();
1602
1589
/* initialize preferences and create the global GSettings objects */
1603
1590
nautilus_global_preferences_init ();
1605
/* register views */
1606
nautilus_profile_start ("Register views");
1607
nautilus_canvas_view_register ();
1608
nautilus_desktop_canvas_view_register ();
1609
nautilus_list_view_register ();
1610
#if ENABLE_EMPTY_VIEW
1611
nautilus_empty_view_register ();
1613
nautilus_profile_end ("Register views");
1615
1592
/* register property pages */
1616
1593
nautilus_image_properties_page_register ();