Updated Spanish translation
[evolution.git] / e-util / e-selectable.c
blob5e3267cf2ee9031f8d68939132ab5496b4bede9d
1 /*
2 * e-selectable.c
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
11 * for more details.
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)
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
25 #include "e-selectable.h"
27 G_DEFINE_INTERFACE (
28 ESelectable,
29 e_selectable,
30 GTK_TYPE_WIDGET)
32 static void
33 e_selectable_default_init (ESelectableInterface *iface)
35 g_object_interface_install_property (
36 iface,
37 g_param_spec_boxed (
38 "copy-target-list",
39 "Copy Target List",
40 NULL,
41 GTK_TYPE_TARGET_LIST,
42 G_PARAM_READABLE));
44 g_object_interface_install_property (
45 iface,
46 g_param_spec_boxed (
47 "paste-target-list",
48 "Paste Target List",
49 NULL,
50 GTK_TYPE_TARGET_LIST,
51 G_PARAM_READABLE));
54 void
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);
72 void
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);
85 void
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);
98 void
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);
111 void
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);
124 void
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);
137 void
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);
150 void
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);
163 GtkTargetList *
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);
176 return target_list;
179 GtkTargetList *
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);
192 return target_list;