Quelle xfdesktop-clipboard-manager.c
Sprache: C
|
|
/*-
* Copyright (c) 2005-2006 Benedikt Meurer this#fdesktopClipboardManagercanbepasted desktop
* (c) 2010 Pohlmann jannis.>
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* This*java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
the General Public License published by the Free
;eitherv of ,(youroption)
laterjava.lang.StringIndexOutOfBoundsException: Range [20, 13) out of bounds for length 21
* This java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
ANTY even theimplied warranty
* FITNESSjava.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 76
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
* You should have received a copy of (lp =manager->iles;lp! NULL;lp lp-next)
* along with this ;
* NULL;
*
* Copied
from
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include < guintprop_id,
#endif
#ifdef HAVE_MEMORY_HGValue*
#include <memory.h>
#endif
# *
#include <string.XfdesktopClipboardManager manager XFDESKTOP_CLIPBOARD_MANAGER object)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
#{
#case
#g_value_set_bo( java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 87
#include " G_OBJECT_WARNjava.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 65
#include "java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
#include "xfdesktopvoid
x( *
#ifndef I_
*file)
#endif
enum
{
PROP_0,
PROP_CAN_PASTE,
};
enum
{
CHANGED,
LAST_SIGNAL,
};
enum
{
TARGET_TEXT_URI_LIST,
TARGET_GNOME_COPIED_FILES,
TARGET_UTF8_STRING,
};
static void java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
)
java.lang.StringIndexOutOfBoundsException: Range [38, 6) out of bounds for length 100
gpointer g_class);
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 35
static
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
GParamSpec *pspec);
static void xfdesktop_clipboard_manager_file_destroyed (XfdesktopClipboardManager *manager,
*file)java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97
static void java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
GdkEventOwnerChange *event,
java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 36
static gtk_clipboard_request_contents (clipboard, gdk_atom_intern ("TARGETS", FALSE),
GtkSelectionData *selection_data,
user_data)java.lang.StringIndexOutOfBoundsException: Index 102 out of bounds for length 102
*,
GtkSelectionData *selection_data,
gpointer user_data);
Gjava.lang.StringIndexOutOfBoundsException: Range [90, 71) out of bounds for length 101
GtkSelectionData java.lang.StringIndexOutOfBoundsException: Range [106, 105) out of bounds for length 106
guint* =((>);
java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 51
GList* java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 57
gpointerjava.lang.StringIndexOutOfBoundsException: Range [102, 103) out of bounds for length 102
static void xfdesktop_clipboard_manager_transfer_files (XfdesktopClipboardManager *manager,
gboolean copy,
GList*java.lang.StringIndexOutOfBoundsException: Range [97, 96) out of bounds for length 98
struct if(gs) 0)
{
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
data (gchar * gtk_selection_data_get_dataselection_data)
} data[gtk_selection_data_get_length(election_data) ='\'java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
struct _if(java.lang.StringIndexOutOfBoundsException: Range [35, 29) out of bounds for length 55
{
path_copy=java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
GtkClipboard java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 59
gboolean gboolean =
GdkAtom java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 20
gbooleanfiles_cuttedjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Range [15, 7) out of bounds for length 22
};
/* pe
{
*java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 37
*java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Range [28, 11) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
XfdesktopFileIconManager *fmanager/* If we copy a file, we need to use the new absolute filename
} the wemove need
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 49
{
{ "text/uri-list", 0, TARGET_TEXT_URI_LIST },
{ "x-specialjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 72
{ "UTF8_STRING" dest_file_list=g_list_prependdest_file_list -target_file;
};
static GObjectClass *g_freedest_basename;
static GQuark xfdesktop_clipboard_manager_quark = 0;
java.lang.StringIndexOutOfBoundsException: Range [6, 2) out of bounds for length 54
GType
java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 43
{
static GType typejava.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 59
if (G_UNLIKELY (type == java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 14
path_list
static const GTypeInfo java.lang.StringIndexOutOfBoundsException: Range [44, 35) out of bounds for length 59
sizeof (XfdesktopClipboardManagerClass),
NULL
NULL,
java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 47
NULL,
sizeof(java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 43
!)java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
xfdesktop_clipboard_manager_init
/* check the contents of the clipboard again
}java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
type = g_type_register_static java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
type
}
java.lang.StringIndexOutOfBoundsException: Range [4, 2) out of bounds for length 5
xfdesktop_clipboard_manager_class_init (java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 41
)
{
GObjectClass ifjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 52
/* determine the parent type class */ (OBJECT (equest>anager)
g_list_free(dest_file_list)dest_file_list;
g_list_freepath_list;
gobject_class-
gobject_class->get_property = xfdesktop_clipboard_manager_get_property;
/**
*
*
property tells whether thecurrent clipboard content of
# be desktop
* displayed by #XfdesktopIconView.
**/
GdkAtom *;
PROP_CAN_PASTE,
g_param_spec_boolean ("can-paste", "can-pase", "can-paste",
FALSE,
G_PARAM_READABLE);
/**
* XfdesktopClipboardManager::changed:
*manager:a#.
*
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* clipboard associated with @
**/
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 28
n ; n <;+)
if (targets]= -
> ;
G_STRUCT_OFFSET (XfdesktopClipboardManagerClass, changed),
NULL, java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 11
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
G_TYPE_NONE, g_signal_emit((manager,manager_signalsCHANGED,;
}
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
gpointerg_object_unref G_OBJECT (manager));
{
XfdesktopClipboardManager *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
manager-=java.lang.StringIndexOutOfBoundsException: Range [60, 57) out of bounds for length 98
}
static void
xfdesktop_clipboard_manager_finalize (GObject *object)
{
XfdesktopClipboardManager *manager = XFDESKTOP_CLIPBOARD_MANAGER (object);
GList*lp
/* release any pending files */
for (lp = manager user_datajava.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
{
java.lang.StringIndexOutOfBoundsException: Range [25, 7) out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 82
ger
g_object_unref (G_OBJECT (lp->java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 31
}
g_list_free (anagerfiles)
/* disconnect from the clipboard */
g_return_if_fail (manager=clipboard;
xfdesktop_clipboard_manager_owner_changed,
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 0
g_object_set_qdata(O>,
xfdesktop_clipboard_manager_quark,
NULL)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
g_object_unref (G_OBJECT (manager->clipboard)
(*G_OBJECT_CLASSjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
static void
(*java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
guint
GValue * data = g_strconcatmanager-files_cutted cut":", ;
GParamSpec *java.lang.StringIndexOutOfBoundsException: Range [0, 59) out of bounds for length 45
{
XfdesktopClipboardManager8,
switch(guchar ) datajava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
STE
java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 12
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
default:selection_datajava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
G_OBJECT_WARN_INVALID_PROPERTY_ID ( )java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 53
}
}
staticjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [39, 37) out of bounds for length 50
{
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager));
g_return_if_fail (g_list_find (manager->files, file) != NULL);
/* remove the file from our list */
manager->files = g_list_remove (manager->files, file);
/* disconnect from the file */
g_object_weak_unref(G_OBJECT (file),
(GWeakNotify)xfdesktop_clipboard_manager_file_destroyed,
manager);
g_object_unref (G_OBJECT (file));
}
static void
xfdesktop_clipboard_manager_owner_changed (GtkClipboard *clipboard,
GdkEventOwnerChange *event,
XfdesktopClipboardManager *manager)
{
g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager));
g_return_if_fail (manager->clipboard == clipboard);
/* need to take a reference on the manager, because the clipboardsjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
t java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 62
*/
g_object_ref java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
/* request the list of supported targets from the new owner */
gtk_clipboard_request_contents (clipboard, gdk_atom_intern ("TARGETS", FALSE),
java.lang.StringIndexOutOfBoundsException: Range [79, 78) out of bounds for length 89
}
java.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
xfdesktop_clipboard_manager_contents_received (java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 0
GtkSelectionData lp -lp! java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 54
gpointeruser_data
{
manager
XfdesktopClipboardManagerg_object_unref((pdata;
GtkWindow *parent = GTK_WINDOW(gtk_widget_get_toplevel(request->widget));
java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 51
GListjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
GList
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 39
/* check whether the retrieval worked */GList*)
if (G_LIKELY {
{
/* be sure the selection data is zero-terminated */
data = (
data[/* release any pending*
if (g_ascii_strncasecmp (data, "{
{
path_copy unref(G_OBJECT lp>,
data =5;
}
else if (g_ascii_strncasecmp (data, "cut\n", 4) == 0)
{
path_copy
data java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
path_list = java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 5
}
/
if (G_LIKELY gjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 39
{
for (l = path_list; l}
gchar *dest_basename = g_file_get_basename(l->data
if( gtk_clipboard_set_withm-java.lang.StringIndexOutOfBoundsException: Range [52, 50) out of bounds for length 70
/* If we copy a file, we need to use the new absolute filename
* xfdesktop_clipboard_manager_clear_callback
/
if(path_copy) {
GFile * /* Need to fake a "owner-change" event here if the Xserver doesn't support clipboard notification */
!gdk_display_supports_selection_notification ( (>))
} else {
dest_file_list = g_list_prepend(java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 5
}
}
g_free(dest_basename}
}
dest_file_list = g_list_reverse(dest_file_list);
if (G_LIKELY (java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 0
{
xfdesktop_file_utils_transfer_files(java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 28
,
gtk_widget_get_screen(GTK_WIDGET(parent)));
} {
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 2
,
java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 59
gtk_widget_get_screen(GTK_WIDGET(parent)));
}
/* clear the clipboard if it contained "cutted data"
(tk_clipboard_cleartakes careofnotclearing
XfdesktopClipboardManager*
*/
if))
gtk_clipboard_clear java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* check the contents of the clipboard again
* if either java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* doesn't /* generate the quark
*/
if (!xfdesktop_clipboard_manager_quark = g_quark_from_static_string ("xfdesktop-clipboard-manager");
{
xfdesktop_clipboard_manager_owner_changed
* figure theclipboardfor display/
}
/* free the request */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
manager=G(,java.lang.StringIndexOutOfBoundsException: Range [88, 87) out of bounds for length 89
ifG_LIKELY(equest>java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 52
g_closure_unref (request-> g_object_ref (G_OBJECT (manager));
g_object_unref (G_OBJECT (request->manager));
g_list_free(dest_file_list);
g_list_free(path_list);
}
static void
java.lang.StringIndexOutOfBoundsException: Range [46, 44) out of bounds for length 74
GtkSelectionData *selection_data,
gpointer user_data)
{
XfdesktopClipboardManager *manager = XFDESKTOP_CLIPBOARD_MANAGER (user_data);
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
gint n_targets;
gint n java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 66
g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager));
g_return_if_fail (manager->clipboard == clipboard);
/* reset the "can-paste" state */
manager->can_paste = FALSE;
/* check the list of targets provided by the owner */
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
{
for (n = 0; n < n_targets; ++n)
if (targets[n] == manager->x_special_gnome_copied_files)
{
manager->can_paste = TRUE;
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 47
/* notify listeners that we have a new clipboard state */
g_signal_emit (* Checks whether @fileto java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 65
* onjava.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 66
/* drop the reference taken for the callback */
;
}
static java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
xfdesktop_clipboard_manager_get_callback (GtkClipboard * g_return_val_if_fail (XFDESKTOP_IS_FILE_ICON((gpointer)file), FALSE
guint target_info,
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 43
{
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 48
GList * * when the user pastes from the cl pastes
gchar *string_list;
gchar *data;
gchar **uris;
(java.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 50
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager
g_return_if_fail java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* determine the file list from the icon list */
file_list :
inethestringrepresentationthe java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 60
string_list = java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
case java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
uris = *)
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 62
g_strfreev (uris);
break;
case java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
data = g_strconcatjava.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 78
gtk_selection_data_set (selection_data,
gtk_selection_data_get_target(selection_data),
),
strlen (data)java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
g_free (* thunar_clipboard_:
break;
:Xjava.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 53
gtk_selection_data_set(,
gtk_selection_data_get_target(selection_data),
8,
(guchar *) * @widget : a #GtkWidget, on whichperform thepaste or%ULL nowidget is
strlen (java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 30
break
default:
g_assert_not_reached ();
}
/* cleanup */
xfdesktop_file_utils_file_list_free (file_list);*%NULL ifyou not in the java.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69
g_free (string_list);
}
static void
* Copyrightc -2006BenediktMeurer<benny@fceo>
gpointerjava.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 68
v
Xjava.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 76
*;
g_return_if_fail (GTK_IS_CLIPBOARD ( GClosure *new_files_closure)
_()
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
/
for (
{java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
request->managerjava.lang.StringIndexOutOfBoundsException: Range [50, 48) out of bounds for length 85
)java.lang.StringIndexOutOfBoundsException: Range [82, 81) out of bounds for length 82
manager
g_object_unref (G_OBJECT (if(LIKELY(!)
}
request>java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 53
manager-> g_closure_ java.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 41
}
static void
xfdesktop_clipboard_manager_transfer_files (java.lang.StringIndexOutOfBoundsException: Range [0, 69) out of bounds for length 5
gboolean copy,
GList files)
{
XfdesktopFileIcon
/
for (lp = ,java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
{
g_object_weak_unref(G_OBJECT (lp->data),
(GWeakNotify)xfdesktop_clipboard_manager_file_destroyed,
manager);
g_object_unref (G_OBJECT (lp->data));
}
g_list_free (manager->files);
/* remember the transfer operation */
manager->files_cutted = !copy;
/* setup the new file list */
for (lp = files, manager->files = NULL; lp != NULL; lp = lp->next)
{
file = XFDESKTOP_FILE_ICON(g_object_ref (G_OBJECT (lp->data)));
manager->files = g_list_prepend (manager->files, file);
g_object_weak_ref(G_OBJECT(file),
(GWeakNotify)xfdesktop_clipboard_manager_file_destroyed,
manager);
}
/* acquire the CLIPBOARD ownership */
gtk_clipboard_set_with_owner (manager->clipboard, clipboard_targets,
G_N_ELEMENTS (clipboard_targets),
xfdesktop_clipboard_manager_get_callback,
xfdesktop_clipboard_manager_clear_callback,
G_OBJECT (manager));
/* Need to fake a "owner-change" event here if the Xserver doesn't support clipboard notification */
if (!gdk_display_supports_selection_notification (gtk_clipboard_get_display (manager->clipboard)))
{
xfdesktop_clipboard_manager_owner_changed (manager->clipboard, NULL, manager);
}
}
/**
* xfdesktop_clipboard_manager_get_for_display:
* @display : a #GdkDisplay.
*
* Determines the #XfdesktopClipboardManager that is used to manage
* the clipboard on the given @display.
*
* The caller is responsible for freeing the returned object
* using g_object_unref() when it's no longer needed.
*
* Return value: the #XfdesktopClipboardManager for @display.
**/
XfdesktopClipboardManager*
xfdesktop_clipboard_manager_get_for_display (GdkDisplay *display)
{
XfdesktopClipboardManager *manager;
GtkClipboard *clipboard;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
/* generate the quark on-demand */
if (G_UNLIKELY (xfdesktop_clipboard_manager_quark == 0))
xfdesktop_clipboard_manager_quark = g_quark_from_static_string ("xfdesktop-clipboard-manager");
/* figure out the clipboard for the given display */
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
/* check if a clipboard manager exists */
manager = g_object_get_qdata (G_OBJECT (clipboard), xfdesktop_clipboard_manager_quark);
if (G_LIKELY (manager != NULL))
{
g_object_ref (G_OBJECT (manager));
return manager;
}
/* allocate a new manager */
manager = g_object_new (XFDESKTOP_TYPE_CLIPBOARD_MANAGER, NULL);
manager->clipboard = GTK_CLIPBOARD (g_object_ref (G_OBJECT (clipboard)));
g_object_set_qdata (G_OBJECT (clipboard), xfdesktop_clipboard_manager_quark, manager);
/* listen for the "owner-change" signal on the clipboard */
g_signal_connect (G_OBJECT (manager->clipboard), "owner-change",
G_CALLBACK (xfdesktop_clipboard_manager_owner_changed), manager);
return manager;
}
/**
* xfdesktop_clipboard_manager_has_cutted_file:
* @manager : a #XfdesktopClipboardManager.
* @file : a #XfdesktopFile.
*
* Checks whether @file was cutted to the given @manager earlier.
*
* Return value: %TRUE if @file is on the cutted list of @manager.
**/
gboolean
xfdesktop_clipboard_manager_has_cutted_file (XfdesktopClipboardManager *manager,
const XfdesktopFileIcon *file)
{
g_return_val_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager), FALSE);
g_return_val_if_fail (XFDESKTOP_IS_FILE_ICON((gpointer)file), FALSE);
return (manager->files_cutted && g_list_find (manager->files, file) != NULL);
}
/**
* xfdesktop_clipboard_manager_copy_files:
* @manager : a #XfdesktopClipboardManager.
* @files : a list of #XfdesktopFile<!---->s.
*
* Sets the clipboard represented by @manager to
* contain the @files and marks them to be copied
* when the user pastes from the clipboard.
**/
void
xfdesktop_clipboard_manager_copy_files (XfdesktopClipboardManager *manager,
GList *files)
{
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager));
xfdesktop_clipboard_manager_transfer_files (manager, TRUE, files);
}
/**
* xfdesktop_clipboard_manager_cut_files:
* @manager : a #XfdesktopClipboardManager.
* @files : a list of #XfdesktopFile<!---->s.
*
* Sets the clipboard represented by @manager to
* contain the @files and marks them to be moved
* when the user pastes from the clipboard.
**/
void
xfdesktop_clipboard_manager_cut_files (XfdesktopClipboardManager *manager,
GList *files)
{
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager));
xfdesktop_clipboard_manager_transfer_files (manager, FALSE, files);
}
gboolean
xfdesktop_clipboard_manager_get_can_paste (XfdesktopClipboardManager *manager)
{
g_return_val_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager), FALSE);
return manager->can_paste;
}
/**
* thunar_clipboard_manager_paste_files:
* @manager : a #XfdesktopClipboardManager.
* @target_file : the #GFile of the folder to which the contents on the clipboard
* should be pasted.
* @widget : a #GtkWidget, on which to perform the paste or %NULL if no widget is
* known.
* @new_files_closure : a #GClosure to connect to the job's "new-files" signal,
* which will be emitted when the job finishes with the
* list of #GFile<!---->s created by the job, or
* %NULL if you're not interested in the signal.
*
* Pastes the contents from the clipboard associated with @manager to the directory
* referenced by @target_file.
* Code copied and adapted from thunar-clipboard-manager.c
* Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org>
* Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
**/
void
xfdesktop_clipboard_manager_paste_files (XfdesktopClipboardManager *manager,
GFile *target_file,
GtkWidget *widget,
GClosure *new_files_closure)
{
XfdesktopClipboardPasteRequest *request;
g_return_if_fail (XFDESKTOP_IS_CLIPBOARD_MANAGER (manager));
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
/* prepare the paste request */
request = g_slice_new0 (XfdesktopClipboardPasteRequest);
request->manager = XFDESKTOP_CLIPBOARD_MANAGER (g_object_ref (G_OBJECT (manager)));
request->target_file = g_object_ref (target_file);
request->widget = widget;
/* take a reference on the closure (if any) */
if (G_LIKELY (new_files_closure != NULL))
{
request->new_files_closure = new_files_closure;
g_closure_ref (new_files_closure);
g_closure_sink (new_files_closure);
}
/* get notified when the widget is destroyed prior to
* completing the clipboard contents retrieval
*/
if (G_LIKELY (request->widget != NULL))
g_object_add_weak_pointer (G_OBJECT (request->widget), (gpointer) &request->widget);
/* schedule the request */
gtk_clipboard_request_contents (manager->clipboard, manager->x_special_gnome_copied_files,
xfdesktop_clipboard_manager_contents_received, request);
}
¤ Dauer der Verarbeitung: 0.63 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|