[gnome-control-center] background: Added D'n'D support for adding wallpapers.
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Added D'n'D support for adding wallpapers.
- Date: Thu, 6 Oct 2011 08:48:36 +0000 (UTC)
commit cdfe63a3b252763a1ee6ddc29f9793cfbd03d379
Author: Ming Han Teh <teh_minghan hotmail com>
Date: Mon Oct 3 15:48:23 2011 -0400
background: Added D'n'D support for adding wallpapers.
https://bugzilla.gnome.org/show_bug.cgi?id=655375
panels/background/cc-background-panel.c | 34 +++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index d9977e4..1ec9188 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -1137,6 +1137,32 @@ scrolled_realize_cb (GtkWidget *scrolled,
}
static void
+cc_background_panel_drag_uris (GtkWidget *widget,
+ GdkDragContext *context, gint x, gint y,
+ GtkSelectionData *data, guint info, guint time,
+ CcBackgroundPanel *panel)
+{
+ gint i;
+ char *uri;
+ gchar **uris;
+
+ uris = gtk_selection_data_get_uris (data);
+ if (!uris)
+ return;
+
+ gtk_drag_finish (context, TRUE, FALSE, time);
+
+ for (i = 0; uris[i] != NULL; i++) {
+ uri = uris[i];
+ if (!bg_pictures_source_is_known (panel->priv->pictures_source, uri)) {
+ add_custom_wallpaper (panel, uri);
+ }
+ }
+
+ g_strfreev(uris);
+}
+
+static void
cc_background_panel_init (CcBackgroundPanel *self)
{
CcBackgroundPanelPrivate *priv;
@@ -1235,6 +1261,14 @@ cc_background_panel_init (CcBackgroundPanel *self)
g_signal_connect (WID ("remove_button"), "clicked",
G_CALLBACK (remove_button_clicked), self);
+ /* Add drag and drop support for bg images */
+ widget = WID ("scrolledwindow1");
+ gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
+ gtk_drag_dest_add_uri_targets (widget);
+ g_signal_connect (widget, "drag-data-received",
+ G_CALLBACK (cc_background_panel_drag_uris), self);
+
+
/* setup preview area */
gtk_label_set_ellipsize (GTK_LABEL (WID ("background-label")), PANGO_ELLIPSIZE_END);
widget = WID ("preview-area");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]