4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
25 #include "e-selectable.h"
33 e_selectable_default_init (ESelectableInterface
*iface
)
35 g_object_interface_install_property (
44 g_object_interface_install_property (
55 e_selectable_update_actions (ESelectable
*selectable
,
56 EFocusTracker
*focus_tracker
,
57 GdkAtom
*clipboard_targets
,
58 gint n_clipboard_targets
)
60 ESelectableInterface
*iface
;
62 g_return_if_fail (E_IS_SELECTABLE (selectable
));
64 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
65 g_return_if_fail (iface
->update_actions
!= NULL
);
67 iface
->update_actions (
68 selectable
, focus_tracker
,
69 clipboard_targets
, n_clipboard_targets
);
73 e_selectable_cut_clipboard (ESelectable
*selectable
)
75 ESelectableInterface
*iface
;
77 g_return_if_fail (E_IS_SELECTABLE (selectable
));
79 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
81 if (iface
->cut_clipboard
!= NULL
)
82 iface
->cut_clipboard (selectable
);
86 e_selectable_copy_clipboard (ESelectable
*selectable
)
88 ESelectableInterface
*iface
;
90 g_return_if_fail (E_IS_SELECTABLE (selectable
));
92 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
94 if (iface
->copy_clipboard
!= NULL
)
95 iface
->copy_clipboard (selectable
);
99 e_selectable_paste_clipboard (ESelectable
*selectable
)
101 ESelectableInterface
*iface
;
103 g_return_if_fail (E_IS_SELECTABLE (selectable
));
105 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
107 if (iface
->paste_clipboard
!= NULL
)
108 iface
->paste_clipboard (selectable
);
112 e_selectable_delete_selection (ESelectable
*selectable
)
114 ESelectableInterface
*iface
;
116 g_return_if_fail (E_IS_SELECTABLE (selectable
));
118 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
120 if (iface
->delete_selection
!= NULL
)
121 iface
->delete_selection (selectable
);
125 e_selectable_select_all (ESelectable
*selectable
)
127 ESelectableInterface
*iface
;
129 g_return_if_fail (E_IS_SELECTABLE (selectable
));
131 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
133 if (iface
->select_all
!= NULL
)
134 iface
->select_all (selectable
);
138 e_selectable_undo (ESelectable
*selectable
)
140 ESelectableInterface
*iface
;
142 g_return_if_fail (E_IS_SELECTABLE (selectable
));
144 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
146 if (iface
->undo
!= NULL
)
147 iface
->undo (selectable
);
151 e_selectable_redo (ESelectable
*selectable
)
153 ESelectableInterface
*iface
;
155 g_return_if_fail (E_IS_SELECTABLE (selectable
));
157 iface
= E_SELECTABLE_GET_INTERFACE (selectable
);
159 if (iface
->redo
!= NULL
)
160 iface
->redo (selectable
);
164 e_selectable_get_copy_target_list (ESelectable
*selectable
)
166 GtkTargetList
*target_list
;
168 g_return_val_if_fail (E_IS_SELECTABLE (selectable
), NULL
);
170 g_object_get (selectable
, "copy-target-list", &target_list
, NULL
);
172 /* We want to return a borrowed reference to the target
173 * list, so undo the reference that g_object_get() added. */
174 gtk_target_list_unref (target_list
);
180 e_selectable_get_paste_target_list (ESelectable
*selectable
)
182 GtkTargetList
*target_list
;
184 g_return_val_if_fail (E_IS_SELECTABLE (selectable
), NULL
);
186 g_object_get (selectable
, "paste-target-list", &target_list
, NULL
);
188 /* We want to return a borrowed reference to the target
189 * list, so undo the reference that g_object_get() added. */
190 gtk_target_list_unref (target_list
);