Add %F to Exec command line

2005-01-08  Rodney Dawes  <dobey@novell.com>

	* background.desktop.in.in: Add %F to Exec command line

	* gnome-wp-capplet.[ch] (gnome_wp_remove_wp): Check that the tree path
	is not NULL before removing items from the list store
	(gnome_wp_load_stuffs): Don't duplicate the code from
	gnome_wp_add_image/gnome_wp_capplet_scroll_to_item  here
	Load any images we were passed on the command line, and free the
	GSList that they were stored in after doing so
	(gnome_wp_file_changed): Clean up to just call gnome_wp_add_image and
	gnome_wp_capplet_scroll_to_item rather than duplicating the code
	(wallpaper_properties_init): Take a poptContext argument now
	Parse the poptContext into a GSList for loading the images from
	(main): Use a clearer variable name for the GnomeProgram object
	Get the poptContext from the GnomeProgram object and pass it through
	to wallpaper_properties_init

	Fixes #120720
This commit is contained in:
Rodney Dawes 2005-01-09 03:53:35 +00:00 committed by Rodney Dawes
parent 35037d76ec
commit bdd4d0142e
5 changed files with 64 additions and 33 deletions

View file

@ -1,3 +1,23 @@
2005-01-08 Rodney Dawes <dobey@novell.com>
* background.desktop.in.in: Add %F to Exec command line
* gnome-wp-capplet.[ch] (gnome_wp_remove_wp): Check that the tree path
is not NULL before removing items from the list store
(gnome_wp_load_stuffs): Don't duplicate the code from
gnome_wp_add_image/gnome_wp_capplet_scroll_to_item here
Load any images we were passed on the command line, and free the
GSList that they were stored in after doing so
(gnome_wp_file_changed): Clean up to just call gnome_wp_add_image and
gnome_wp_capplet_scroll_to_item rather than duplicating the code
(wallpaper_properties_init): Take a poptContext argument now
Parse the poptContext into a GSList for loading the images from
(main): Use a clearer variable name for the GnomeProgram object
Get the poptContext from the GnomeProgram object and pass it through
to wallpaper_properties_init
Fixes #120720
2005-01-08 Thomas Wood <thos@gnome.org>
* gnome-wp-xml.c (gnome_wp_xml_load_xml): Load translated XML

View file

@ -2,7 +2,7 @@
Encoding=UTF-8
_Name=Desktop Background
_Comment=Change your Desktop Background settings
Exec=gnome-background-properties
Exec=gnome-background-properties %F
Icon=gnome-settings-background
Terminal=false
Type=Application

View file

@ -351,11 +351,13 @@ static void gnome_wp_remove_wp (gchar * key, GnomeWPItem * item,
if (item->rowref != NULL && item->deleted == FALSE) {
path = gtk_tree_row_reference_get_path (item->rowref);
if (path != NULL) {
gtk_tree_model_get_iter (capplet->model, &iter, path);
gtk_tree_path_free (path);
gtk_list_store_remove (GTK_LIST_STORE (capplet->model), &iter);
}
}
}
void gnome_wp_main_quit (GnomeWPCapplet * capplet) {
@ -627,24 +629,8 @@ static gboolean gnome_wp_load_stuffs (void * data) {
item->scolor->green,
item->scolor->blue, 65535);
} else if (strcmp (style, "none") != 0) {
item = gnome_wp_item_new (imagepath, capplet->wphash, capplet->thumbs);
if (item != NULL) {
wp_props_load_wallpaper (item->filename, item, capplet);
item = gnome_wp_add_image (capplet, imagepath);
gnome_wp_capplet_scroll_to_item (capplet, item);
gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (capplet->pc_picker),
item->pcolor->red,
item->pcolor->green,
item->pcolor->blue, 65535);
gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (capplet->sc_picker),
item->scolor->red,
item->scolor->green,
item->scolor->blue, 65535);
gnome_wp_option_menu_set (capplet, item->options, FALSE);
gnome_wp_option_menu_set (capplet, item->shade_type, TRUE);
}
}
item = g_hash_table_lookup (capplet->wphash, "(none)");
@ -666,6 +652,11 @@ static gboolean gnome_wp_load_stuffs (void * data) {
g_free (imagepath);
g_free (style);
if (capplet->uri_list) {
gnome_wp_add_images (capplet, capplet->uri_list);
g_slist_free (capplet->uri_list);
}
return FALSE;
}
@ -714,14 +705,10 @@ static void gnome_wp_file_changed (GConfClient * client, guint id,
if (item != NULL) {
gnome_wp_capplet_scroll_to_item (capplet, item);
} else {
item = gnome_wp_item_new (wpfile, capplet->wphash, capplet->thumbs);
if (item != NULL) {
wp_props_load_wallpaper (item->filename, item, capplet);
item = gnome_wp_add_image (capplet, wpfile);
gnome_wp_capplet_scroll_to_item (capplet, item);
}
}
}
g_free (wpfile);
g_free (selected);
}
@ -910,7 +897,7 @@ static void set_accessible_name (GtkWidget *widget, const gchar *name) {
atk_object_set_name (obj, name);
}
static void wallpaper_properties_init (void) {
static void wallpaper_properties_init (poptContext ctx) {
GnomeWPCapplet * capplet;
GladeXML * dialog;
GtkWidget * menu, * label;
@ -922,6 +909,7 @@ static void wallpaper_properties_init (void) {
GdkPixbuf * pixbuf;
GdkCursor * cursor;
gchar * icofile;
const gchar ** args;
gtk_rc_parse_string ("style \"wp-tree-defaults\" {\n"
" GtkTreeView::horizontal-separator = 6\n"
@ -1226,6 +1214,17 @@ static void wallpaper_properties_init (void) {
gdk_window_set_cursor (capplet->window->window, cursor);
gdk_cursor_unref (cursor);
args = poptGetArgs (ctx);
if (args != NULL) {
const gchar ** p;
for (p = args; *p != NULL; p++) {
capplet->uri_list = g_slist_append (capplet->uri_list, (gchar *) *p);
}
}
poptFreeContext (ctx);
g_idle_add (gnome_wp_load_stuffs, capplet);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
@ -1246,7 +1245,9 @@ static void wallpaper_properties_init (void) {
}
gint main (gint argc, gchar *argv[]) {
GnomeProgram * proggie;
GnomeProgram * program;
GValue context = { 0 };
poptContext ctx;
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@ -1254,11 +1255,16 @@ gint main (gint argc, gchar *argv[]) {
textdomain (GETTEXT_PACKAGE);
#endif
proggie = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
argc, argv, GNOME_PARAM_POPT_TABLE,
NULL, NULL);
wallpaper_properties_init ();
g_object_get_property (G_OBJECT (program), GNOME_PARAM_POPT_CONTEXT,
g_value_init (&context, G_TYPE_POINTER));
ctx = g_value_get_pointer (&context);
wallpaper_properties_init (ctx);
gtk_main ();
return 0;

View file

@ -42,6 +42,9 @@ typedef struct _GnomeWPCapplet GnomeWPCapplet;
struct _GnomeWPCapplet {
GtkWidget * window;
/* List of files passed to command line */
GSList * uri_list;
/* The Tree View */
GtkWidget * treeview;
GtkTreeModel * model;

View file

@ -61,7 +61,7 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
item->options = gconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
if (!strcmp (item->options, "none")) {
item->options = g_strdup ("wallpaper");
item->options = g_strdup ("scaled");
}
gnome_wp_item_update_description (item);
@ -71,6 +71,8 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
item = NULL;
}
g_object_unref (client);
return item;
}