After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 622126 - GSettingsList
GSettingsList
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gsettings
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
: 694800 (view as bug list)
Depends on: 765965
Blocks: 624856 642517 662759
 
 
Reported: 2010-06-19 20:19 UTC by Allison Karlitskaya (desrt)
Modified: 2018-05-24 12:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GSettingsList implementation (unfinished) (18.22 KB, patch)
2015-04-07 12:57 UTC, Marek Kašík
needs-work Details | Review
Sample schema + little demo of the API (831 bytes, application/x-compressed-tar)
2015-04-07 13:02 UTC, Marek Kašík
  Details

Description Allison Karlitskaya (desrt) 2010-06-19 20:19:52 UTC
it needs to be done before 2.26
Comment 1 Allison Karlitskaya (desrt) 2010-09-13 16:11:08 UTC
i've done enough work on this that i'm quite confident that it can be implemented without further incompatible changes to the API.

we'll punt this to 2.28 since it's coming so soon anyway (and that way we can avoid last-minute mistakes)
Comment 2 Matthias Clasen 2011-02-15 06:23:41 UTC
 didn't make 2.28 either :-(
Comment 3 Florent Thévenet 2011-03-16 22:13:36 UTC
Will it be implemented soon ?
Comment 4 Sébastien Wilmet 2011-08-06 17:19:03 UTC
I want to help on this. I have a lot of free time during the next 6 weeks.

I'm reading the code of GSettings, and it's not too hard to understand. I have a lot of things to learn, since I've never contributed to GLib/GIO. But I'm motivated!

The code I'm reading is the one in the master branch. I'll also read what has been done in the wip/gsettings-list branch, since I suppose it's a good base.

The last discussion I found is this thread:
http://www.mail-archive.com/gtk-devel-list@gnome.org/msg11753.html

Is there other discussions or other code that worth the reading?
Comment 5 Marek Kašík 2012-02-09 13:23:13 UTC
Hi,

is there any progress with this? Can I help somehow?

Regards

Marek
Comment 6 Sébastien Wilmet 2012-02-09 14:54:24 UTC
I made some really basic stuff here (to see how it works):

https://github.com/swilmet/glib
https://github.com/swilmet/dconf

I wanted to write a mail to the gtk-devel-list explaining my plans, and ask some questions, but I was busy with other projects.

Anyway, my idea was to create a subclass of GSettings called GSettingsList. The previous implementation added some functions directly in the GSettings class if I recall correctly.
Comment 7 Sébastien Wilmet 2012-02-09 18:15:18 UTC
I explain more in depth what was my ideas here:

http://mail.gnome.org/archives/gtk-devel-list/2012-February/msg00060.html
Comment 8 Allison Karlitskaya (desrt) 2013-10-29 20:44:17 UTC
*** Bug 694800 has been marked as a duplicate of this bug. ***
Comment 9 Rodrigo Silva 2015-02-04 22:13:08 UTC
2015, any news?

As a side note, I'm quite impressed Gnome made this huge effort to migrate all apps to gsettings when it still lacks a key value type from gconf.

Some apps that used List have migrated with downgraded features, such as Gnome Terminal that currently does not support multiple profiles anymore.
Comment 10 Matthias Clasen 2015-02-05 09:06:01 UTC
gnome-terminal supports multiple profiles just fine.

If anybody is still blocking a gsettings port for lack of this feature, it is time to move on. I don't expect GSettingsList will ever happen.
Comment 11 Rodrigo Silva 2015-02-07 13:23:01 UTC
(In reply to comment #10)
> gnome-terminal supports multiple profiles just fine.

It didn't according to https://bugzilla.gnome.org/show_bug.cgi?id=624856 .Perhaps they found out a way to implement profiles without List? Speaking of that...

> If anybody is still blocking a gsettings port for lack of this feature, it is
> time to move on. I don't expect GSettingsList will ever happen.

What would be recommended GSettings way of creating a list? If not as a native type, is there any equivalent idiom?
Comment 12 Allison Karlitskaya (desrt) 2015-02-08 15:00:34 UTC
(In reply to comment #11)
> What would be recommended GSettings way of creating a list? If not as a native
> type, is there any equivalent idiom?

This bug has never been about storing list types in GSettings, but rather having a list of GSettings objects.

You can store any valid GVariant type in GSettings and that includes lists (lists of strings, lists of ints, etc.)  You can even store lists of lists and lists of lists of lists or lists of tuples containing lists (...and so on).  It's fully recursive.

See https://developer.gnome.org/glib/stable/glib-GVariantType.html for a full (*cough*) list of the possible types.
Comment 13 Marek Kašík 2015-04-07 12:57:21 UTC
Created attachment 301064 [details] [review]
GSettingsList implementation (unfinished)

Hi,

I walked through the Ryan's post about GSettingsList (https://mail.gnome.org/archives/gtk-devel-list/2010-May/msg00065.html) and tried to implement something working.
Attached is a patch which implements the basic API of GSettingsList mentioned there:

gchar *g_settings_list_add_item (GSettings *settings)
void g_settings_list_remove_item (GSettings *settings, const gchar *name)
GSettings *g_settings_list_get_item (GSettings *settings, const gchar *name)
gchar **g_settings_list_get_items (GSettings *settings)

All those functions are part of gsettings.h.

The implementation uses the '.exists' key to store list of items of the gsettings list. It also uses existence of the '.anti-Default' key to specify that the list in '.exists' contains all items of the list.

I used the 'list-of' attribute to specify which schema is used for items of the list.

I haven't found another way to specify default items than using 'override' element together with 'extends' attribute without changing the DTD file.
Getting of the default items lists all schemas and finds all extending schemas of the schema used as schema of the list items. This is very inefficient. An improvement here would probably need a change in the DTD file (an <instance> element with <override>s in it?).

It doesn't emit signals (added, removed, changed?) or lock anything yet.

This is just a proposal to start with. Please let me know if there is anything I got wrong about the ideas (e.g. I wasn't sure about whether to add new DTD elements or try to use just the existing ones).

I'll attach a small example of such a schema soon.
Comment 14 Marek Kašík 2015-04-07 13:02:41 UTC
Created attachment 301066 [details]
Sample schema + little demo of the API

Here is a small schema which contains gsettings list schema 'org.test.data.profiles', schema 'org.test.data.profile' for its items and 2 schemas used as default items of the list: {org.test.data.profile-1, org.test.data.profile-2}.
Comment 15 Takao Fujiwara 2015-04-29 13:08:27 UTC
(In reply to Matthias Clasen from comment #10)
> gnome-terminal supports multiple profiles just fine.
> 
> If anybody is still blocking a gsettings port for lack of this feature, it
> is time to move on. I don't expect GSettingsList will ever happen.

My understanding is gnome-terminal drops the multiple profiles?
I cannot find profiles on gnome-terminal menus in 3.16.
The profiles had worked with dconf.
Comment 16 Sébastien Wilmet 2015-04-29 13:45:29 UTC
'File -> New Profile' exists here in gnome-terminal, on Fedora 22.

For some apps, a profile feature is/would be useful IMO. And GSettingsList would simplify the implementation. For example it would be nice to have profiles in gedit: one profile for the C language, one profile for Python, or even different profiles for different C projects (with different indentation settings, for example).

We can even imagine creating profiles from the desktop, for several apps at once, so that we can clearly separate _tasks_. Coming back to a task would be just a matter of launching a certain profile.
Comment 17 Takao Fujiwara 2015-04-29 13:57:08 UTC
(In reply to Sébastien Wilmet from comment #16)
> 'File -> New Profile' exists here in gnome-terminal, on Fedora 22.

You're right. I looked at a different terminal by mistake.
I will look at the implementation.
Comment 18 Takao Fujiwara 2015-05-01 08:00:53 UTC
When I see the code of gnome-terminal, my understanding is gnome-terminal still uses dconf APIs for the new profiles.
I guess gnome-terminal/src/terminal-settings-list.c:clone_child() generates the profile and it runs dconf_client_new().
It means both dconf and gsettings is used.
Should we migrate dconf to gsettings?
Comment 19 GNOME Infrastructure Team 2018-05-24 12:22:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/312.