accept drops from the nautilus patterns pallet. There's something broken
Thu May 16 02:25:03 2002 Jonathan Blandford <jrb@gnome.org> * background-properties-capplet.c (drag_data_received_cb): accept drops from the nautilus patterns pallet. There's something broken here, though.
This commit is contained in:
parent
0348d4f101
commit
0ff953e1e6
2 changed files with 61 additions and 26 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu May 16 02:25:03 2002 Jonathan Blandford <jrb@gnome.org>
|
||||||
|
|
||||||
|
* background-properties-capplet.c (drag_data_received_cb): accept
|
||||||
|
drops from the nautilus patterns pallet. There's something broken
|
||||||
|
here, though.
|
||||||
|
|
||||||
2002-05-10 Jody Goldberg <jody@gnome.org>
|
2002-05-10 Jody Goldberg <jody@gnome.org>
|
||||||
|
|
||||||
* background-properties.glade : merge in the missing atk patch.
|
* background-properties.glade : merge in the missing atk patch.
|
||||||
|
|
|
@ -42,12 +42,18 @@
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
TARGET_URI_LIST
|
TARGET_URI_LIST,
|
||||||
|
TARGET_COLOR,
|
||||||
|
TARGET_BGIMAGE,
|
||||||
|
/* TARGET_BACKGROUND_RESET*/
|
||||||
};
|
};
|
||||||
|
|
||||||
static GtkTargetEntry drop_types[] =
|
static GtkTargetEntry drop_types[] =
|
||||||
{
|
{
|
||||||
{"text/uri-list", 0, TARGET_URI_LIST}
|
{"text/uri-list", 0, TARGET_URI_LIST},
|
||||||
|
{ "application/x-color", 0, TARGET_COLOR },
|
||||||
|
{ "property/bgimage", 0, TARGET_BGIMAGE },
|
||||||
|
/* { "x-special/gnome-reset-background", 0, TARGET_BACKGROUND_RESET }*/
|
||||||
};
|
};
|
||||||
|
|
||||||
static gint n_drop_types = sizeof (drop_types) / sizeof (GtkTargetEntry);
|
static gint n_drop_types = sizeof (drop_types) / sizeof (GtkTargetEntry);
|
||||||
|
@ -486,40 +492,63 @@ drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint info, guint time, gpointer data)
|
guint info, guint time, gpointer data)
|
||||||
{
|
{
|
||||||
GList *list;
|
GConfClient *client = gconf_client_get_default ();
|
||||||
GList *uris;
|
|
||||||
ApplierSet *set = (ApplierSet*) data;
|
ApplierSet *set = (ApplierSet*) data;
|
||||||
|
|
||||||
if (info != TARGET_URI_LIST)
|
if (info == TARGET_URI_LIST ||
|
||||||
return;
|
info == TARGET_BGIMAGE)
|
||||||
|
|
||||||
uris = gnome_vfs_uri_list_parse ((gchar *) selection_data->
|
|
||||||
data);
|
|
||||||
for (list = uris; list; list = list->next)
|
|
||||||
{
|
{
|
||||||
GnomeVFSURI *uri = (GnomeVFSURI *) list->data;
|
GList *uris;
|
||||||
GConfEntry *entry;
|
|
||||||
GConfValue *value = gconf_value_new (GCONF_VALUE_STRING);
|
g_print ("got %s\n", selection_data->data);
|
||||||
GConfClient *client = gconf_client_get_default ();
|
uris = gnome_vfs_uri_list_parse ((gchar *) selection_data->data);
|
||||||
|
/* Arbitrarily pick the first item */
|
||||||
|
if (uris != NULL && uris->data != NULL)
|
||||||
|
{
|
||||||
|
GnomeVFSURI *uri = (GnomeVFSURI *) uris->data;
|
||||||
|
GConfEntry *entry;
|
||||||
|
GConfValue *value = gconf_value_new (GCONF_VALUE_STRING);
|
||||||
|
|
||||||
|
gconf_value_set_string (value, gnome_vfs_uri_get_path (uri));
|
||||||
|
|
||||||
|
/* Hmm, should we bother with changeset here? */
|
||||||
|
gconf_client_set (client, BG_PREFERENCES_PICTURE_FILENAME, value, NULL);
|
||||||
|
gconf_client_suggest_sync (client, NULL);
|
||||||
|
|
||||||
|
/* this isn't emitted by the peditors,
|
||||||
|
* so we have to manually update */
|
||||||
|
/* FIXME: this can't be right!!!! -jrb */
|
||||||
|
entry = gconf_entry_new (BG_PREFERENCES_PICTURE_FILENAME, value);
|
||||||
|
bg_preferences_merge_entry (set->prefs, entry);
|
||||||
|
gconf_entry_free (entry);
|
||||||
|
gconf_value_free (value);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, BG_PREFERENCES_PICTURE_OPTIONS, "wallpaper", NULL);
|
||||||
|
}
|
||||||
|
gnome_vfs_uri_list_free (uris);
|
||||||
|
} else if (info == TARGET_COLOR) {
|
||||||
|
guint16 *channels;
|
||||||
|
char *color_spec;
|
||||||
|
|
||||||
gconf_value_set_string (value, gnome_vfs_uri_get_path (uri));
|
if (selection_data->length != 8 || selection_data->format != 16) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
channels = (guint16 *) selection_data->data;
|
||||||
|
color_spec = g_strdup_printf ("#%02X%02X%02X", channels[0] >> 8, channels[1] >> 8, channels[2] >> 8);
|
||||||
|
gconf_client_set_string (client, BG_PREFERENCES_PICTURE_OPTIONS, "none", NULL);
|
||||||
|
gconf_client_set_string (client, BG_PREFERENCES_COLOR_SHADING_TYPE, "solid", NULL);
|
||||||
|
gconf_client_set_string (client, BG_PREFERENCES_PRIMARY_COLOR, color_spec, NULL);
|
||||||
|
g_free (color_spec);
|
||||||
|
} else if (info == TARGET_BGIMAGE) {
|
||||||
|
|
||||||
/* Hmm, should we bother with changeset here? */
|
} else if (info == TARGET_URI_LIST) {
|
||||||
gconf_client_set (client, BG_PREFERENCES_PICTURE_FILENAME, value, NULL);
|
|
||||||
gconf_client_suggest_sync (client, NULL);
|
|
||||||
|
|
||||||
/* this isn't emitted by the peditors,
|
|
||||||
* so we have to manually update */
|
|
||||||
entry = gconf_entry_new (BG_PREFERENCES_PICTURE_FILENAME, value);
|
|
||||||
bg_preferences_merge_entry (set->prefs, entry);
|
|
||||||
gconf_entry_free (entry);
|
|
||||||
gconf_value_free (value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (set->appliers[n_enum_vals - 1])))
|
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (set->appliers[n_enum_vals - 1])))
|
||||||
applier_set_redraw (set);
|
applier_set_redraw (set);
|
||||||
|
|
||||||
gnome_vfs_uri_list_free (uris);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue