1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3
/* fm-desktop-icon-view.c - implementation of icon view for managing the desktop.
5
Copyright (C) 2000, 2001 Eazel, Inc.mou
7
The Mate Library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Library General Public License as
9
published by the Free Software Foundation; either version 2 of the
10
License, or (at your option) any later version.
12
The Mate Library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Library General Public License for more details.
17
You should have received a copy of the GNU Library General Public
18
License along with the Mate Library; see the file COPYING.LIB. If not,
19
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20
Boston, MA 02110-1301, USA.
22
Authors: Mike Engber <engber@eazel.com>
23
Gene Z. Ragan <gzr@eazel.com>
24
Miguel de Icaza <miguel@ximian.com>
28
#include "fm-icon-container.h"
29
#include "fm-desktop-icon-view.h"
30
#include "fm-actions.h"
32
#include <X11/Xatom.h>
34
#include <eel/eel-glib-extensions.h>
35
#include <eel/eel-gtk-extensions.h>
36
#include <eel/eel-vfs-extensions.h>
39
#include <glib/gi18n.h>
40
#include <libcaja-private/caja-desktop-icon-file.h>
41
#include <libcaja-private/caja-directory-background.h>
42
#include <libcaja-private/caja-directory-notify.h>
43
#include <libcaja-private/caja-file-changes-queue.h>
44
#include <libcaja-private/caja-file-operations.h>
45
#include <libcaja-private/caja-file-utilities.h>
46
#include <libcaja-private/caja-ui-utilities.h>
47
#include <libcaja-private/caja-global-preferences.h>
48
#include <libcaja-private/caja-view-factory.h>
49
#include <libcaja-private/caja-link.h>
50
#include <libcaja-private/caja-metadata.h>
51
#include <libcaja-private/caja-monitor.h>
52
#include <libcaja-private/caja-program-choosing.h>
53
#include <libcaja-private/caja-trash-monitor.h>
59
#include <sys/types.h>
62
#if !GTK_CHECK_VERSION(3, 0, 0)
63
#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
64
#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
65
#define GTK_SCROLLABLE GTK_LAYOUT
68
/* Timeout to check the desktop directory for updates */
69
#define RESCAN_TIMEOUT 4
71
struct FMDesktopIconViewDetails
73
GdkWindow *root_window;
74
GtkActionGroup *desktop_action_group;
75
guint desktop_merge_id;
77
/* For the desktop rescanning
79
gulong delayed_init_signal;
80
guint reload_desktop_timeout;
81
gboolean pending_rescan;
84
static void default_zoom_level_changed (gpointer user_data);
85
static gboolean real_supports_auto_layout (FMIconView *view);
86
static gboolean real_supports_scaling (FMIconView *view);
87
static gboolean real_supports_keep_aligned (FMIconView *view);
88
static gboolean real_supports_labels_beside_icons (FMIconView *view);
89
static void real_merge_menus (FMDirectoryView *view);
90
static void real_update_menus (FMDirectoryView *view);
91
static gboolean real_supports_zooming (FMDirectoryView *view);
92
static void fm_desktop_icon_view_update_icon_container_fonts (FMDesktopIconView *view);
93
static void font_changed_callback (gpointer callback_data);
95
G_DEFINE_TYPE (FMDesktopIconView, fm_desktop_icon_view, FM_TYPE_ICON_VIEW)
97
static char *desktop_directory;
98
static time_t desktop_dir_modify_time;
101
desktop_directory_changed_callback (gpointer callback_data)
103
g_free (desktop_directory);
104
desktop_directory = caja_get_desktop_directory ();
107
static CajaIconContainer *
108
get_icon_container (FMDesktopIconView *icon_view)
110
g_return_val_if_fail (FM_IS_DESKTOP_ICON_VIEW (icon_view), NULL);
111
g_return_val_if_fail (CAJA_IS_ICON_CONTAINER (gtk_bin_get_child (GTK_BIN (icon_view))), NULL);
113
return CAJA_ICON_CONTAINER (gtk_bin_get_child (GTK_BIN (icon_view)));
117
icon_container_set_workarea (CajaIconContainer *icon_container,
122
int left, right, top, bottom;
123
int screen_width, screen_height;
126
left = right = top = bottom = 0;
128
screen_width = gdk_screen_get_width (screen);
129
screen_height = gdk_screen_get_height (screen);
131
for (i = 0; i < n_items; i += 4)
133
int x = workareas [i];
134
int y = workareas [i + 1];
135
int width = workareas [i + 2];
136
int height = workareas [i + 3];
138
if ((x + width) > screen_width || (y + height) > screen_height)
141
left = MAX (left, x);
142
right = MAX (right, screen_width - width - x);
144
bottom = MAX (bottom, screen_height - height - y);
147
caja_icon_container_set_margins (icon_container,
148
left, right, top, bottom);
152
net_workarea_changed (FMDesktopIconView *icon_view,
155
long *nworkareas = NULL;
156
long *workareas = NULL;
157
GdkAtom type_returned;
160
CajaIconContainer *icon_container;
163
g_return_if_fail (FM_IS_DESKTOP_ICON_VIEW (icon_view));
165
icon_container = get_icon_container (icon_view);
167
/* Find the number of desktops so we know how long the
168
* workareas array is going to be (each desktop will have four
169
* elements in the workareas array describing
170
* x,y,width,height) */
171
gdk_error_trap_push ();
172
if (!gdk_property_get (window,
173
gdk_atom_intern ("_NET_NUMBER_OF_DESKTOPS", FALSE),
174
gdk_x11_xatom_to_atom (XA_CARDINAL),
179
(guchar **) &nworkareas))
181
g_warning("Can not calculate _NET_NUMBER_OF_DESKTOPS");
183
if (gdk_error_trap_pop()
184
|| nworkareas == NULL
185
|| type_returned != gdk_x11_xatom_to_atom (XA_CARDINAL)
186
|| format_returned != 32)
187
g_warning("Can not calculate _NET_NUMBER_OF_DESKTOPS");
189
/* Note : gdk_property_get() is broken (API documents admit
190
* this). As a length argument, it expects the number of
191
* _bytes_ of data you require. Internally, gdk_property_get
192
* converts that value to a count of 32 bit (4 byte) elements.
193
* However, the length returned is in bytes, but is calculated
194
* via the count of returned elements * sizeof(long). This
195
* means on a 64 bit system, the number of bytes you have to
196
* request does not correspond to the number of bytes you get
197
* back, and is the reason for the workaround below.
199
gdk_error_trap_push ();
200
if (nworkareas == NULL || (*nworkareas < 1)
201
|| !gdk_property_get (window,
202
gdk_atom_intern ("_NET_WORKAREA", FALSE),
203
gdk_x11_xatom_to_atom (XA_CARDINAL),
204
0, ((*nworkareas) * 4 * 4), FALSE,
208
(guchar **) &workareas))
210
g_warning("Can not get _NET_WORKAREA");
214
if (gdk_error_trap_pop ()
216
|| type_returned != gdk_x11_xatom_to_atom (XA_CARDINAL)
217
|| ((*nworkareas) * 4 * sizeof(long)) != length_returned
218
|| format_returned != 32)
220
g_warning("Can not determine workarea, guessing at layout");
221
caja_icon_container_set_margins (icon_container,
226
screen = gdk_window_get_screen (window);
228
icon_container_set_workarea (
229
icon_container, screen, workareas, length_returned / sizeof (long));
232
if (nworkareas != NULL)
235
if (workareas != NULL)
239
static GdkFilterReturn
240
desktop_icon_view_property_filter (GdkXEvent *gdk_xevent,
244
XEvent *xevent = gdk_xevent;
245
FMDesktopIconView *icon_view;
247
icon_view = FM_DESKTOP_ICON_VIEW (data);
249
switch (xevent->type)
252
if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_NET_WORKAREA"))
253
net_workarea_changed (icon_view, event->any.window);
259
return GDK_FILTER_CONTINUE;
263
fm_desktop_icon_view_dispose (GObject *object)
265
FMDesktopIconView *icon_view;
266
GtkUIManager *ui_manager;
268
icon_view = FM_DESKTOP_ICON_VIEW (object);
270
/* Remove desktop rescan timeout. */
271
if (icon_view->details->reload_desktop_timeout != 0)
273
g_source_remove (icon_view->details->reload_desktop_timeout);
274
icon_view->details->reload_desktop_timeout = 0;
277
ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (icon_view));
278
if (ui_manager != NULL)
280
caja_ui_unmerge_ui (ui_manager,
281
&icon_view->details->desktop_merge_id,
282
&icon_view->details->desktop_action_group);
285
g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
286
default_zoom_level_changed,
288
g_signal_handlers_disconnect_by_func (caja_preferences,
289
font_changed_callback,
292
g_signal_handlers_disconnect_by_func (mate_lockdown_preferences,
293
fm_directory_view_update_menus,
295
g_signal_handlers_disconnect_by_func (caja_preferences,
296
desktop_directory_changed_callback,
299
G_OBJECT_CLASS (fm_desktop_icon_view_parent_class)->dispose (object);
303
fm_desktop_icon_view_class_init (FMDesktopIconViewClass *class)
305
G_OBJECT_CLASS (class)->dispose = fm_desktop_icon_view_dispose;
307
FM_DIRECTORY_VIEW_CLASS (class)->merge_menus = real_merge_menus;
308
FM_DIRECTORY_VIEW_CLASS (class)->update_menus = real_update_menus;
309
FM_DIRECTORY_VIEW_CLASS (class)->supports_zooming = real_supports_zooming;
311
FM_ICON_VIEW_CLASS (class)->supports_auto_layout = real_supports_auto_layout;
312
FM_ICON_VIEW_CLASS (class)->supports_scaling = real_supports_scaling;
313
FM_ICON_VIEW_CLASS (class)->supports_keep_aligned = real_supports_keep_aligned;
314
FM_ICON_VIEW_CLASS (class)->supports_labels_beside_icons = real_supports_labels_beside_icons;
316
g_type_class_add_private (class, sizeof (FMDesktopIconViewDetails));
320
fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container,
321
GdkEventButton *event,
322
FMDesktopIconView *desktop_icon_view)
324
XButtonEvent x_event;
326
/* During a mouse click we have the pointer and keyboard grab.
327
* We will send a fake event to the root window which will cause it
328
* to try to get the grab so we need to let go ourselves.
330
gdk_pointer_ungrab (GDK_CURRENT_TIME);
331
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
333
/* Stop the event because we don't want anyone else dealing with it. */
335
g_signal_stop_emission_by_name (icon_container, "middle_click");
337
/* build an X event to represent the middle click. */
338
x_event.type = ButtonPress;
339
x_event.send_event = True;
340
x_event.display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
341
x_event.window = GDK_ROOT_WINDOW ();
342
x_event.root = GDK_ROOT_WINDOW ();
343
x_event.subwindow = 0;
344
x_event.time = event->time;
345
x_event.x = event->x;
346
x_event.y = event->y;
347
x_event.x_root = event->x_root;
348
x_event.y_root = event->y_root;
349
x_event.state = event->state;
350
x_event.button = event->button;
351
x_event.same_screen = True;
353
/* Send it to the root window, the window manager will handle it. */
354
XSendEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), True,
355
ButtonPressMask, (XEvent *) &x_event);
359
unrealized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view)
361
g_return_if_fail (desktop_icon_view->details->root_window != NULL);
363
/* Remove the property filter */
364
gdk_window_remove_filter (desktop_icon_view->details->root_window,
365
desktop_icon_view_property_filter,
367
desktop_icon_view->details->root_window = NULL;
371
realized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view)
373
GdkWindow *root_window;
375
GtkAllocation allocation;
377
g_return_if_fail (desktop_icon_view->details->root_window == NULL);
379
screen = gtk_widget_get_screen (widget);
381
/* Ugly HACK for the problem that the views realize at the
382
* wrong size and then get resized. (This is a problem with
383
* MateComponentPlug.) This was leading to problems where initial
384
* layout was done at 60x60 stacking all desktop icons in
385
* the top left corner.
389
allocation.width = gdk_screen_get_width (screen);
390
allocation.height = gdk_screen_get_height (screen);
391
gtk_widget_size_allocate (GTK_WIDGET(get_icon_container(desktop_icon_view)),
394
root_window = gdk_screen_get_root_window (screen);
396
desktop_icon_view->details->root_window = root_window;
398
/* Read out the workarea geometry and update the icon container accordingly */
399
net_workarea_changed (desktop_icon_view, root_window);
401
/* Setup the property filter */
402
gdk_window_set_events (root_window, GDK_PROPERTY_CHANGE_MASK);
403
gdk_window_add_filter (root_window,
404
desktop_icon_view_property_filter,
409
get_default_zoom_level (void)
411
static gboolean auto_storage_added = FALSE;
412
static CajaZoomLevel default_zoom_level = CAJA_ZOOM_LEVEL_STANDARD;
414
if (!auto_storage_added)
416
auto_storage_added = TRUE;
417
eel_g_settings_add_auto_enum (caja_icon_view_preferences,
418
CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
419
(int *) &default_zoom_level);
422
return CLAMP (default_zoom_level, CAJA_ZOOM_LEVEL_SMALLEST, CAJA_ZOOM_LEVEL_LARGEST);
426
default_zoom_level_changed (gpointer user_data)
428
CajaZoomLevel new_level;
429
FMDesktopIconView *desktop_icon_view;
431
desktop_icon_view = FM_DESKTOP_ICON_VIEW (user_data);
432
new_level = get_default_zoom_level ();
434
caja_icon_container_set_zoom_level (get_icon_container (desktop_icon_view),
439
do_desktop_rescan (gpointer data)
441
FMDesktopIconView *desktop_icon_view;
444
desktop_icon_view = FM_DESKTOP_ICON_VIEW (data);
445
if (desktop_icon_view->details->pending_rescan)
450
if (stat (desktop_directory, &buf) == -1)
455
if (buf.st_ctime == desktop_dir_modify_time)
460
desktop_icon_view->details->pending_rescan = TRUE;
462
caja_directory_force_reload (
463
fm_directory_view_get_model (
464
FM_DIRECTORY_VIEW (desktop_icon_view)));
469
done_loading (CajaDirectory *model,
470
FMDesktopIconView *desktop_icon_view)
474
desktop_icon_view->details->pending_rescan = FALSE;
475
if (stat (desktop_directory, &buf) == -1)
480
desktop_dir_modify_time = buf.st_ctime;
483
/* This function is used because the CajaDirectory model does not
484
* exist always in the desktop_icon_view, so we wait until it has been
488
delayed_init (FMDesktopIconView *desktop_icon_view)
490
/* Keep track of the load time. */
491
g_signal_connect_object (fm_directory_view_get_model (FM_DIRECTORY_VIEW (desktop_icon_view)),
493
G_CALLBACK (done_loading), desktop_icon_view, 0);
495
/* Monitor desktop directory. */
496
desktop_icon_view->details->reload_desktop_timeout =
497
g_timeout_add_seconds (RESCAN_TIMEOUT, do_desktop_rescan, desktop_icon_view);
499
g_signal_handler_disconnect (desktop_icon_view,
500
desktop_icon_view->details->delayed_init_signal);
502
desktop_icon_view->details->delayed_init_signal = 0;
506
font_changed_callback (gpointer callback_data)
508
g_return_if_fail (FM_IS_DESKTOP_ICON_VIEW (callback_data));
510
fm_desktop_icon_view_update_icon_container_fonts (FM_DESKTOP_ICON_VIEW (callback_data));
514
fm_desktop_icon_view_update_icon_container_fonts (FMDesktopIconView *icon_view)
516
CajaIconContainer *icon_container;
519
icon_container = get_icon_container (icon_view);
520
g_assert (icon_container != NULL);
522
font = g_settings_get_string (caja_desktop_preferences, CAJA_PREFERENCES_DESKTOP_FONT);
524
caja_icon_container_set_font (icon_container, font);
530
fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
532
CajaIconContainer *icon_container;
533
GtkAllocation allocation;
534
GtkAdjustment *hadj, *vadj;
536
desktop_icon_view->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_icon_view,
537
FM_TYPE_DESKTOP_ICON_VIEW,
538
FMDesktopIconViewDetails);
540
if (desktop_directory == NULL)
542
g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR,
543
G_CALLBACK(desktop_directory_changed_callback),
545
desktop_directory_changed_callback (NULL);
548
fm_icon_view_filter_by_screen (FM_ICON_VIEW (desktop_icon_view), TRUE);
549
icon_container = get_icon_container (desktop_icon_view);
550
caja_icon_container_set_use_drop_shadows (icon_container, TRUE);
551
fm_icon_container_set_sort_desktop (FM_ICON_CONTAINER (icon_container), TRUE);
553
/* Do a reload on the desktop if we don't have FAM, a smarter
554
* way to keep track of the items on the desktop.
556
if (!caja_monitor_active ())
558
desktop_icon_view->details->delayed_init_signal = g_signal_connect_object
559
(desktop_icon_view, "begin_loading",
560
G_CALLBACK (delayed_init), desktop_icon_view, 0);
563
caja_icon_container_set_is_fixed_size (icon_container, TRUE);
564
caja_icon_container_set_is_desktop (icon_container, TRUE);
565
caja_icon_container_set_store_layout_timestamps (icon_container, TRUE);
567
/* Set allocation to be at 0, 0 */
568
gtk_widget_get_allocation (GTK_WIDGET (icon_container), &allocation);
571
gtk_widget_set_allocation (GTK_WIDGET (icon_container), &allocation);
573
gtk_widget_queue_resize (GTK_WIDGET (icon_container));
575
hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (icon_container));
576
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (icon_container));
578
gtk_adjustment_set_value (hadj, 0);
579
gtk_adjustment_set_value (vadj, 0);
581
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (desktop_icon_view),
584
fm_directory_view_ignore_hidden_file_preferences
585
(FM_DIRECTORY_VIEW (desktop_icon_view));
587
fm_directory_view_set_show_foreign (FM_DIRECTORY_VIEW (desktop_icon_view),
590
/* Set our default layout mode */
591
caja_icon_container_set_layout_mode (icon_container,
592
gtk_widget_get_direction (GTK_WIDGET(icon_container)) == GTK_TEXT_DIR_RTL ?
593
CAJA_ICON_LAYOUT_T_B_R_L :
594
CAJA_ICON_LAYOUT_T_B_L_R);
596
g_signal_connect_object (icon_container, "middle_click",
597
G_CALLBACK (fm_desktop_icon_view_handle_middle_click), desktop_icon_view, 0);
598
g_signal_connect_object (desktop_icon_view, "realize",
599
G_CALLBACK (realized_callback), desktop_icon_view, 0);
600
g_signal_connect_object (desktop_icon_view, "unrealize",
601
G_CALLBACK (unrealized_callback), desktop_icon_view, 0);
603
g_signal_connect_swapped (caja_icon_view_preferences,
604
"changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
605
G_CALLBACK (default_zoom_level_changed),
608
g_signal_connect_swapped (caja_desktop_preferences,
609
"changed::" CAJA_PREFERENCES_DESKTOP_FONT,
610
G_CALLBACK (font_changed_callback),
613
default_zoom_level_changed (desktop_icon_view);
614
fm_desktop_icon_view_update_icon_container_fonts (desktop_icon_view);
616
g_signal_connect_swapped (mate_lockdown_preferences,
617
"changed::" CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE,
618
G_CALLBACK (fm_directory_view_update_menus),
624
action_new_launcher_callback (GtkAction *action, gpointer data)
626
char *desktop_directory;
628
g_assert (FM_DIRECTORY_VIEW (data));
630
desktop_directory = caja_get_desktop_directory ();
632
caja_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (data)),
633
"mate-desktop-item-edit",
634
"mate-desktop-item-edit",
636
"--create-new", desktop_directory, NULL);
637
g_free (desktop_directory);
642
action_change_background_callback (GtkAction *action,
645
g_assert (FM_DIRECTORY_VIEW (data));
647
caja_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (data)),
649
"mate-appearance-properties",
651
"--show-page=background", NULL);
655
action_empty_trash_conditional_callback (GtkAction *action,
658
g_assert (FM_IS_DIRECTORY_VIEW (data));
660
caja_file_operations_empty_trash (GTK_WIDGET (data));
664
trash_link_is_selection (FMDirectoryView *view)
667
CajaDesktopLink *link;
672
selection = fm_directory_view_get_selection (view);
674
if (eel_g_list_exactly_one_item (selection) &&
675
CAJA_IS_DESKTOP_ICON_FILE (selection->data))
677
link = caja_desktop_icon_file_get_link (CAJA_DESKTOP_ICON_FILE (selection->data));
678
/* link may be NULL if the link was recently removed (unmounted) */
680
caja_desktop_link_get_link_type (link) == CAJA_DESKTOP_LINK_TRASH)
686
g_object_unref (link);
690
caja_file_list_free (selection);
696
real_update_menus (FMDirectoryView *view)
698
FMDesktopIconView *desktop_view;
700
gboolean disable_command_line;
701
gboolean include_empty_trash;
704
g_assert (FM_IS_DESKTOP_ICON_VIEW (view));
706
FM_DIRECTORY_VIEW_CLASS (fm_desktop_icon_view_parent_class)->update_menus (view);
708
desktop_view = FM_DESKTOP_ICON_VIEW (view);
711
disable_command_line = g_settings_get_boolean (mate_lockdown_preferences, CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE);
712
action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
713
FM_ACTION_NEW_LAUNCHER_DESKTOP);
714
gtk_action_set_visible (action,
715
!disable_command_line);
718
include_empty_trash = trash_link_is_selection (view);
719
action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
720
FM_ACTION_EMPTY_TRASH_CONDITIONAL);
721
gtk_action_set_visible (action,
722
include_empty_trash);
723
if (include_empty_trash)
725
label = g_strdup (_("E_mpty Trash"));
726
g_object_set (action , "label", label, NULL);
727
gtk_action_set_sensitive (action,
728
!caja_trash_monitor_is_empty ());
733
static const GtkActionEntry desktop_view_entries[] =
737
"New Launcher Desktop", NULL,
738
/* label, accelerator */
739
N_("Create L_auncher..."), NULL,
741
N_("Create a new launcher"),
742
G_CALLBACK (action_new_launcher_callback)
746
"Change Background", NULL,
747
/* label, accelerator */
748
N_("Change Desktop _Background"), NULL,
750
N_("Show a window that lets you set your desktop background's pattern or color"),
751
G_CALLBACK (action_change_background_callback)
755
"Empty Trash Conditional", NULL,
756
/* label, accelerator */
757
N_("Empty Trash"), NULL,
759
N_("Delete all items in the Trash"),
760
G_CALLBACK (action_empty_trash_conditional_callback)
765
real_merge_menus (FMDirectoryView *view)
767
FMDesktopIconView *desktop_view;
768
GtkUIManager *ui_manager;
769
GtkActionGroup *action_group;
772
FM_DIRECTORY_VIEW_CLASS (fm_desktop_icon_view_parent_class)->merge_menus (view);
774
desktop_view = FM_DESKTOP_ICON_VIEW (view);
776
ui_manager = fm_directory_view_get_ui_manager (view);
778
action_group = gtk_action_group_new ("DesktopViewActions");
779
gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
780
desktop_view->details->desktop_action_group = action_group;
781
gtk_action_group_add_actions (action_group,
782
desktop_view_entries, G_N_ELEMENTS (desktop_view_entries),
785
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
786
g_object_unref (action_group); /* owned by ui manager */
788
ui = caja_ui_string_get ("caja-desktop-icon-view-ui.xml");
789
desktop_view->details->desktop_merge_id =
790
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
794
real_supports_auto_layout (FMIconView *view)
796
/* Can't use auto-layout on the desktop, because doing so
797
* would cause all sorts of complications involving the
804
real_supports_scaling (FMIconView *view)
810
real_supports_keep_aligned (FMIconView *view)
816
real_supports_labels_beside_icons (FMIconView *view)
822
real_supports_zooming (FMDirectoryView *view)
824
/* Can't zoom on the desktop, because doing so would cause all
825
* sorts of complications involving the fixed-size window.
831
fm_desktop_icon_view_create (CajaWindowSlotInfo *slot)
835
view = g_object_new (FM_TYPE_DESKTOP_ICON_VIEW,
838
return CAJA_VIEW (view);
842
fm_desktop_icon_view_supports_uri (const char *uri,
844
const char *mime_type)
846
if (g_str_has_prefix (uri, EEL_DESKTOP_URI))
854
static CajaViewInfo fm_desktop_icon_view =
856
FM_DESKTOP_ICON_VIEW_ID,
859
N_("The desktop view encountered an error."),
860
N_("The desktop view encountered an error while starting up."),
861
"Display this location with the desktop view.",
862
fm_desktop_icon_view_create,
863
fm_desktop_icon_view_supports_uri
867
fm_desktop_icon_view_register (void)
869
fm_desktop_icon_view.error_label = _(fm_desktop_icon_view.error_label);
870
fm_desktop_icon_view.startup_error_label = _(fm_desktop_icon_view.startup_error_label);
872
caja_view_factory_register (&fm_desktop_icon_view);