static void
populate_model (GtkTreeStore *store)
{
	GtkTreeIter iter;
	GSList     *themes        = NULL;
	GSList     *l;

	gtk_tree_store_append (store, &iter, NULL);
	gtk_tree_store_set (store, &iter,
	                    NAME_COLUMN, _("Blank screen"),
	                    ID_COLUMN, "__blank-only",
	                    -1);

	gtk_tree_store_append (store, &iter, NULL);
	gtk_tree_store_set (store, &iter,
	                    NAME_COLUMN, _("Random"),
	                    ID_COLUMN, "__random",
	                    -1);

	gtk_tree_store_append (store, &iter, NULL);
	gtk_tree_store_set (store, &iter,
	                    NAME_COLUMN, NULL,
	                    ID_COLUMN, "__separator",
	                    -1);

	themes = get_theme_info_list ();

	if (themes == NULL)
	{
		return;
	}

	for (l = themes; l; l = l->next)
	{
		const char  *name;
		const char  *id;
		GSThemeInfo *info = l->data;

		if (info == NULL)
		{
			continue;
		}

		name = gs_theme_info_get_name (info);
		id = gs_theme_info_get_id (info);

		gtk_tree_store_append (store, &iter, NULL);
		gtk_tree_store_set (store, &iter,
		                    NAME_COLUMN, name,
		                    ID_COLUMN, id,
		                    -1);

		gs_theme_info_unref (info);
	}

	g_slist_free (themes);
}
Example #2
0
static void
manager_select_theme_for_job (GSManager *manager,
                              GSJob     *job)
{
	const char *theme;

	theme = select_theme (manager);

	if (theme != NULL)
	{
		GSThemeInfo    *info;
		const char     *command;

		command = NULL;

		info = gs_theme_manager_lookup_theme_info (manager->priv->theme_manager, theme);
		if (info != NULL)
		{
			command = gs_theme_info_get_exec (info);
		}
		else
		{
			gs_debug ("Could not find information for theme: %s",
			          theme);
		}

		gs_job_set_command (job, command);


		if (info != NULL)
		{
			gs_theme_info_unref (info);
		}
	}
	else
	{
		gs_job_set_command (job, NULL);
	}
}
static void
job_set_theme (GSJob      *job,
               const char *theme)
{
	GSThemeInfo *info;
	const char  *command;

	command = NULL;

	info = gs_theme_manager_lookup_theme_info (theme_manager, theme);
	if (info != NULL)
	{
		command = gs_theme_info_get_exec (info);
	}

	gs_job_set_command (job, command);

	if (info != NULL)
	{
		gs_theme_info_unref (info);
	}
}