summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2018-07-07 18:09:49 +0200
committerCorentin Noël <corentin@elementary.io>2018-07-07 18:22:23 +0200
commit635b4bcc5db0629f30571d21214bfa513b88d536 (patch)
treefee141270567d6a4179986e10bb253e29c9ab17f
parentff7050da62a5e93d4b4bf31a33427d72d1a8ebe2 (diff)
downloadgnome-control-center-wip/tintou/settings-uri.tar.gz
common: Add Settings URI supportwip/tintou/settings-uri
As specified by https://docs.google.com/document/d/1N0uqNtVXEFn3cLgNMeN75mP_dpMpCco-7uw5PKow-_Q/edit Another implementation exists in Switchboard. This allows any application to open a specific pane without knowing the gnome-control-center binary name. This also enhances the cross-distribution support as this is a new distribution-agnostic way to open a setting pane.
-rw-r--r--panels/background/gnome-background-panel.desktop.in.in1
-rw-r--r--panels/bluetooth/gnome-bluetooth-panel.desktop.in.in1
-rw-r--r--panels/color/gnome-color-panel.desktop.in.in1
-rw-r--r--panels/datetime/gnome-datetime-panel.desktop.in.in1
-rw-r--r--panels/display/gnome-display-panel.desktop.in.in1
-rw-r--r--panels/info/gnome-default-apps-panel.desktop.in.in1
-rw-r--r--panels/keyboard/gnome-keyboard-panel.desktop.in.in1
-rw-r--r--panels/mouse/gnome-mouse-panel.desktop.in.in1
-rw-r--r--panels/network/gnome-network-panel.desktop.in.in1
-rw-r--r--panels/network/gnome-wifi-panel.desktop.in.in1
-rw-r--r--panels/notifications/gnome-notifications-panel.desktop.in.in1
-rw-r--r--panels/online-accounts/gnome-online-accounts-panel.desktop.in.in1
-rw-r--r--panels/power/gnome-power-panel.desktop.in.in1
-rw-r--r--panels/printers/gnome-printers-panel.desktop.in.in1
-rw-r--r--panels/privacy/gnome-privacy-panel.desktop.in.in1
-rw-r--r--panels/region/gnome-region-panel.desktop.in.in1
-rw-r--r--panels/search/gnome-search-panel.desktop.in.in1
-rw-r--r--panels/sharing/gnome-sharing-panel.desktop.in.in1
-rw-r--r--panels/sound/data/gnome-sound-panel.desktop.in.in1
-rw-r--r--panels/universal-access/gnome-universal-access-panel.desktop.in.in1
-rw-r--r--panels/user-accounts/data/gnome-user-accounts-panel.desktop.in.in1
-rw-r--r--panels/wacom/gnome-wacom-panel.desktop.in.in1
-rw-r--r--shell/cc-application.c56
-rw-r--r--shell/cc-shell-model.c23
-rw-r--r--shell/cc-shell-model.h1
-rw-r--r--shell/cc-shell.c34
-rw-r--r--shell/cc-shell.h42
-rw-r--r--shell/cc-window.c52
-rw-r--r--shell/gnome-control-center.desktop.in.in1
29 files changed, 188 insertions, 43 deletions
diff --git a/panels/background/gnome-background-panel.desktop.in.in b/panels/background/gnome-background-panel.desktop.in.in
index 76534b028..781d0931f 100644
--- a/panels/background/gnome-background-panel.desktop.in.in
+++ b/panels/background/gnome-background-panel.desktop.in.in
@@ -12,3 +12,4 @@ Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-Per
OnlyShowIn=GNOME;
# Translators: Search terms to find the Background panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Wallpaper;Screen;Desktop;
+X-GNOME-Settings-Schemas=desktop;desktop/wallpaper;desktop/dock;
diff --git a/panels/bluetooth/gnome-bluetooth-panel.desktop.in.in b/panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
index d460700d0..b51eeafb5 100644
--- a/panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
+++ b/panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-bluetooth
X-GNOME-Bugzilla-Component=properties
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=network/bluetooth;
# Translators: Search terms to find the Bluetooth panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=share;sharing;bluetooth;obex;
diff --git a/panels/color/gnome-color-panel.desktop.in.in b/panels/color/gnome-color-panel.desktop.in.in
index 30656828a..ec8f60a0d 100644
--- a/panels/color/gnome-color-panel.desktop.in.in
+++ b/panels/color/gnome-color-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=color
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=display/color;
# Translators: Search terms to find the Color panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Color;ICC;Profile;Calibrate;Printer;Display;
diff --git a/panels/datetime/gnome-datetime-panel.desktop.in.in b/panels/datetime/gnome-datetime-panel.desktop.in.in
index f7242f1ae..d5e095abd 100644
--- a/panels/datetime/gnome-datetime-panel.desktop.in.in
+++ b/panels/datetime/gnome-datetime-panel.desktop.in.in
@@ -10,5 +10,6 @@ NoDisplay=true
StartupNotify=true
Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-DetailsSettings;
OnlyShowIn=GNOME;
+X-GNOME-Settings-Schemas=time;date;
# Translators: Search terms to find the Date and Time panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Clock;Timezone;Location;
diff --git a/panels/display/gnome-display-panel.desktop.in.in b/panels/display/gnome-display-panel.desktop.in.in
index 9c4744d9d..5a2df297d 100644
--- a/panels/display/gnome-display-panel.desktop.in.in
+++ b/panels/display/gnome-display-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=Screen resolution
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=display;
# Translators: Search terms to find the Displays panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Panel;Projector;xrandr;Screen;Resolution;Refresh;Monitor;Night;Light;Blue;redshift;color;sunset;sunrise;
diff --git a/panels/info/gnome-default-apps-panel.desktop.in.in b/panels/info/gnome-default-apps-panel.desktop.in.in
index 328d6a611..613f60f47 100644
--- a/panels/info/gnome-default-apps-panel.desktop.in.in
+++ b/panels/info/gnome-default-apps-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=info
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=applications/defaults;
# Translators: Search terms to find the Default Applications panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=default;application;preferred;media;
diff --git a/panels/keyboard/gnome-keyboard-panel.desktop.in.in b/panels/keyboard/gnome-keyboard-panel.desktop.in.in
index b7b562716..332b885f2 100644
--- a/panels/keyboard/gnome-keyboard-panel.desktop.in.in
+++ b/panels/keyboard/gnome-keyboard-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=keyboard
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=input;input/keyboard;
# Translators: Search terms to find the Keyboard panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Shortcut;Workspace;Window;Resize;Zoom;Contrast;Input;Source;Lock;Volume;
diff --git a/panels/mouse/gnome-mouse-panel.desktop.in.in b/panels/mouse/gnome-mouse-panel.desktop.in.in
index 53d23ecdf..7d64fbbf8 100644
--- a/panels/mouse/gnome-mouse-panel.desktop.in.in
+++ b/panels/mouse/gnome-mouse-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=mouse
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=input/mouse;
# Translators: Search terms to find the Mouse and Touchpad panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Trackpad;Pointer;Click;Tap;Double;Button;Trackball;Scroll;
diff --git a/panels/network/gnome-network-panel.desktop.in.in b/panels/network/gnome-network-panel.desktop.in.in
index 5f6734f80..97dadb076 100644
--- a/panels/network/gnome-network-panel.desktop.in.in
+++ b/panels/network/gnome-network-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=network
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=network;
# Translators: Search terms to find the Network panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Network;Wireless;Wi-Fi;Wifi;IP;LAN;Proxy;WAN;Broadband;Modem;Bluetooth;vpn;DNS;
diff --git a/panels/network/gnome-wifi-panel.desktop.in.in b/panels/network/gnome-wifi-panel.desktop.in.in
index eca03c35e..a57663084 100644
--- a/panels/network/gnome-wifi-panel.desktop.in.in
+++ b/panels/network/gnome-wifi-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=network
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=network/wifi;
# Translators: Search terms to find the Wi-Fi panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Network;Wireless;Wi-Fi;Wifi;IP;LAN;Broadband;DNS;
diff --git a/panels/notifications/gnome-notifications-panel.desktop.in.in b/panels/notifications/gnome-notifications-panel.desktop.in.in
index 4b27b3fc3..5f2f4e8ae 100644
--- a/panels/notifications/gnome-notifications-panel.desktop.in.in
+++ b/panels/notifications/gnome-notifications-panel.desktop.in.in
@@ -15,5 +15,6 @@ X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=Notifications
X-GNOME-Bugzilla-Version=@VERSION@
X-GNOME-Settings-Panel=notifications
+X-GNOME-Settings-Schemas=notifications;
# Translators: Search terms to find the Notifications panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Notifications;Banner;Message;Tray;Popup;
diff --git a/panels/online-accounts/gnome-online-accounts-panel.desktop.in.in b/panels/online-accounts/gnome-online-accounts-panel.desktop.in.in
index f30aff524..6142e24fc 100644
--- a/panels/online-accounts/gnome-online-accounts-panel.desktop.in.in
+++ b/panels/online-accounts/gnome-online-accounts-panel.desktop.in.in
@@ -14,6 +14,7 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=Online Accounts
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=accounts/online;
# Translators: Search terms to find the Online Accounts panel.
# Do NOT translate or localize the semicolons!
# The list MUST also end with a semicolon!
diff --git a/panels/power/gnome-power-panel.desktop.in.in b/panels/power/gnome-power-panel.desktop.in.in
index 59ff8ab94..f393e114d 100644
--- a/panels/power/gnome-power-panel.desktop.in.in
+++ b/panels/power/gnome-power-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=power
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=power;
# Translators: Search terms to find the Power panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Power;Sleep;Suspend;Hibernate;Battery;Brightness;Dim;Blank;Monitor;DPMS;Idle;
diff --git a/panels/printers/gnome-printers-panel.desktop.in.in b/panels/printers/gnome-printers-panel.desktop.in.in
index ac93dcae9..91cb655a4 100644
--- a/panels/printers/gnome-printers-panel.desktop.in.in
+++ b/panels/printers/gnome-printers-panel.desktop.in.in
@@ -13,3 +13,4 @@ Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;X-GNOME-De
OnlyShowIn=GNOME;Unity;
# Translators: Search terms to find the Printers panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Printer;Queue;Print;Paper;Ink;Toner;
+X-GNOME-Settings-Schemas=printer;
diff --git a/panels/privacy/gnome-privacy-panel.desktop.in.in b/panels/privacy/gnome-privacy-panel.desktop.in.in
index 41ad29ce7..8ddb035f5 100644
--- a/panels/privacy/gnome-privacy-panel.desktop.in.in
+++ b/panels/privacy/gnome-privacy-panel.desktop.in.in
@@ -15,5 +15,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=privacy
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=security;security/privacy;
# Translators: Search terms to find the Privacy panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=screen;lock;diagnostics;crash;private;recent;temporary;tmp;index;name;network;identity;
diff --git a/panels/region/gnome-region-panel.desktop.in.in b/panels/region/gnome-region-panel.desktop.in.in
index 16c29bc25..9804a3757 100644
--- a/panels/region/gnome-region-panel.desktop.in.in
+++ b/panels/region/gnome-region-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=region
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=language;
# Translators: Search terms to find the Region and Language panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Language;Layout;Keyboard;Input;
diff --git a/panels/search/gnome-search-panel.desktop.in.in b/panels/search/gnome-search-panel.desktop.in.in
index c4ea2d067..00f0d6cf7 100644
--- a/panels/search/gnome-search-panel.desktop.in.in
+++ b/panels/search/gnome-search-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=search
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=security/search;
# Translators: Search terms to find the Search panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Search;Find;Index;Hide;Privacy;Results;
diff --git a/panels/sharing/gnome-sharing-panel.desktop.in.in b/panels/sharing/gnome-sharing-panel.desktop.in.in
index 32d0b0a09..faa085e0f 100644
--- a/panels/sharing/gnome-sharing-panel.desktop.in.in
+++ b/panels/sharing/gnome-sharing-panel.desktop.in.in
@@ -11,5 +11,6 @@ StartupNotify=true
Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-AccountSettings;
OnlyShowIn=GNOME;Unity;
X-GNOME-Settings-Panel=sharing
+X-GNOME-Settings-Schemas=network/share;
# Translators: Search terms to find the Sharing panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=share;sharing;ssh;host;name;remote;desktop;media;audio;video;pictures;photos;movies;server;renderer;
diff --git a/panels/sound/data/gnome-sound-panel.desktop.in.in b/panels/sound/data/gnome-sound-panel.desktop.in.in
index 1d782a171..f953c0913 100644
--- a/panels/sound/data/gnome-sound-panel.desktop.in.in
+++ b/panels/sound/data/gnome-sound-panel.desktop.in.in
@@ -15,5 +15,6 @@ X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=sound
X-GNOME-Bugzilla-Version=@VERSION@
X-GNOME-Settings-Panel=sound
+X-GNOME-Settings-Schemas=sound;
# Translators: Search terms to find the Sound panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Card;Microphone;Volume;Fade;Balance;Bluetooth;Headset;Audio;
diff --git a/panels/universal-access/gnome-universal-access-panel.desktop.in.in b/panels/universal-access/gnome-universal-access-panel.desktop.in.in
index 4b1c3ee0a..6c78dd7a0 100644
--- a/panels/universal-access/gnome-universal-access-panel.desktop.in.in
+++ b/panels/universal-access/gnome-universal-access-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=Universal Access
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=universal-access;
# Translators: Search terms to find the Universal Access panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Keyboard;Mouse;a11y;Accessibility;Contrast;Zoom;Screen;Reader;text;font;size;AccessX;Sticky;Keys;Slow;Bounce;Mouse;Double;click;Delay;Assist;Repeat;Blink;
diff --git a/panels/user-accounts/data/gnome-user-accounts-panel.desktop.in.in b/panels/user-accounts/data/gnome-user-accounts-panel.desktop.in.in
index 219921ad5..7fbfa5415 100644
--- a/panels/user-accounts/data/gnome-user-accounts-panel.desktop.in.in
+++ b/panels/user-accounts/data/gnome-user-accounts-panel.desktop.in.in
@@ -15,5 +15,6 @@ X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=user-accounts
X-GNOME-Bugzilla-Version=@VERSION@
X-GNOME-Settings-Panel=user-accounts
+X-GNOME-Settings-Schemas=accounts;
# Translators: Search terms to find the Users panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Login;Name;Fingerprint;Avatar;Logo;Face;Password;
diff --git a/panels/wacom/gnome-wacom-panel.desktop.in.in b/panels/wacom/gnome-wacom-panel.desktop.in.in
index c8358ee9e..e95b654e3 100644
--- a/panels/wacom/gnome-wacom-panel.desktop.in.in
+++ b/panels/wacom/gnome-wacom-panel.desktop.in.in
@@ -14,5 +14,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=wacom
X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Schemas=input/wacom;
# Translators: Search terms to find the Wacom Tablet panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Tablet;Wacom;Stylus;Eraser;Mouse;
diff --git a/shell/cc-application.c b/shell/cc-application.c
index 8ffb2bdbf..d48a445e0 100644
--- a/shell/cc-application.c
+++ b/shell/cc-application.c
@@ -173,31 +173,47 @@ cc_application_command_line (GApplication *application,
{
const char *start_id;
GError *err = NULL;
- GVariant *parameters;
- GVariantBuilder builder;
- int i;
g_return_val_if_fail (start_panels[0] != NULL, 1);
start_id = start_panels[0];
-
- if (start_panels[1])
- g_debug ("Extra argument: %s", start_panels[1]);
+ if (g_str_has_prefix (start_id, "settings://"))
+ {
+ g_autofree gchar *scheme = g_strdup(start_id + strlen("settings://"));
+ if (!cc_shell_set_active_panel_from_scheme (CC_SHELL (self->window), scheme, &err))
+ {
+ g_warning ("Could not load setting panel \"%s\": %s", start_id,
+ (err) ? err->message : "Unknown error");
+ retval = 1;
+
+ if (err)
+ g_clear_error (&err);
+ }
+ }
else
- g_debug ("No extra argument");
-
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
-
- for (i = 1; start_panels[i] != NULL; i++)
- g_variant_builder_add (&builder, "v", g_variant_new_string (start_panels[i]));
- parameters = g_variant_builder_end (&builder);
- if (!cc_shell_set_active_panel_from_id (CC_SHELL (self->window), start_id, parameters, &err))
{
- g_warning ("Could not load setting panel \"%s\": %s", start_id,
- (err) ? err->message : "Unknown error");
- retval = 1;
-
- if (err)
- g_clear_error (&err);
+ GVariant *parameters;
+ GVariantBuilder builder;
+ int i;
+
+ if (start_panels[1])
+ g_debug ("Extra argument: %s", start_panels[1]);
+ else
+ g_debug ("No extra argument");
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
+
+ for (i = 1; start_panels[i] != NULL; i++)
+ g_variant_builder_add (&builder, "v", g_variant_new_string (start_panels[i]));
+ parameters = g_variant_builder_end (&builder);
+ if (!cc_shell_set_active_panel_from_id (CC_SHELL (self->window), start_id, parameters, &err))
+ {
+ g_warning ("Could not load setting panel \"%s\": %s", start_id,
+ (err) ? err->message : "Unknown error");
+ retval = 1;
+
+ if (err)
+ g_clear_error (&err);
+ }
}
}
diff --git a/shell/cc-shell-model.c b/shell/cc-shell-model.c
index 2e209a7d0..c236a5e7f 100644
--- a/shell/cc-shell-model.c
+++ b/shell/cc-shell-model.c
@@ -27,6 +27,7 @@
#include <gio/gdesktopappinfo.h>
#define GNOME_SETTINGS_PANEL_ID_KEY "X-GNOME-Settings-Panel"
+#define GNOME_SETTINGS_SCHEMAS_KEY "X-GNOME-Settings-Schemas"
#define GNOME_SETTINGS_PANEL_CATEGORY GNOME_SETTINGS_PANEL_ID_KEY
#define GNOME_SETTINGS_PANEL_ID_KEYWORDS "Keywords"
@@ -255,7 +256,7 @@ static void
cc_shell_model_init (CcShellModel *self)
{
GType types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_APP_INFO, G_TYPE_STRING, G_TYPE_UINT,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ICON, G_TYPE_STRV, G_TYPE_UINT };
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ICON, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_STRV };
gtk_list_store_set_column_types (GTK_LIST_STORE (self),
N_COLS, types);
@@ -292,6 +293,22 @@ get_casefolded_keywords (GAppInfo *appinfo)
return casefolded_keywords;
}
+static gchar **
+get_schemes (GAppInfo *appinfo)
+{
+ char *schemes_str;
+ gchar **schemes;
+
+ schemes_str = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (appinfo), GNOME_SETTINGS_SCHEMAS_KEY);
+ if (!schemes_str)
+ return NULL;
+
+ schemes = g_strsplit (schemes_str, ";", -1);
+ g_free (schemes_str);
+
+ return schemes;
+}
+
void
cc_shell_model_add_item (CcShellModel *model,
CcPanelCategory category,
@@ -302,11 +319,13 @@ cc_shell_model_add_item (CcShellModel *model,
const gchar *name = g_app_info_get_name (appinfo);
const gchar *comment = g_app_info_get_description (appinfo);
char **keywords;
+ gchar **schemes;
char *casefolded_name, *casefolded_description;
casefolded_name = cc_util_normalize_casefold_and_unaccent (name);
casefolded_description = cc_util_normalize_casefold_and_unaccent (comment);
keywords = get_casefolded_keywords (appinfo);
+ schemes = get_schemes (appinfo);
gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, 0,
COL_NAME, name,
@@ -319,11 +338,13 @@ cc_shell_model_add_item (CcShellModel *model,
COL_GICON, icon,
COL_KEYWORDS, keywords,
COL_VISIBILITY, CC_PANEL_VISIBLE,
+ COL_SCHEMES, schemes,
-1);
g_free (casefolded_name);
g_free (casefolded_description);
g_strfreev (keywords);
+ g_strfreev (schemes);
}
gboolean
diff --git a/shell/cc-shell-model.h b/shell/cc-shell-model.h
index 397fc7d22..f925b0c24 100644
--- a/shell/cc-shell-model.h
+++ b/shell/cc-shell-model.h
@@ -53,6 +53,7 @@ enum
COL_GICON,
COL_KEYWORDS,
COL_VISIBILITY,
+ COL_SCHEMES,
N_COLS
};
diff --git a/shell/cc-shell.c b/shell/cc-shell.c
index 81de92a09..ee4a093d6 100644
--- a/shell/cc-shell.c
+++ b/shell/cc-shell.c
@@ -123,6 +123,40 @@ cc_shell_set_active_panel_from_id (CcShell *shell,
}
/**
+ * cc_shell_set_active_panel_from_scheme:
+ * @shell: A #CcShell
+ * @scheme: One scheme of the panel to set as active
+ * @error: A #GError
+ *
+ * Find a panel corresponding to the specified scheme and set it as active.
+ *
+ * Returns: #TRUE if the panel was found and set as the active panel
+ */
+gboolean
+cc_shell_set_active_panel_from_scheme (CcShell *shell,
+ const gchar *scheme,
+ GError **error)
+{
+ CcShellInterface *iface;
+
+ g_return_val_if_fail (CC_IS_SHELL (shell), FALSE);
+
+ iface = CC_SHELL_GET_IFACE (shell);
+
+ if (!iface->set_active_panel_from_scheme)
+ {
+ g_warning ("Object of type \"%s\" does not implement required interface"
+ " method \"set_active_panel_from_scheme\",",
+ G_OBJECT_TYPE_NAME (shell));
+ return FALSE;
+ }
+ else
+ {
+ return iface->set_active_panel_from_scheme (shell, scheme, error);
+ }
+}
+
+/**
* cc_shell_get_toplevel:
* @shell: A #CcShell
*
diff --git a/shell/cc-shell.h b/shell/cc-shell.h
index 1786aedb4..23c4aaf29 100644
--- a/shell/cc-shell.h
+++ b/shell/cc-shell.h
@@ -50,28 +50,34 @@ struct _CcShellInterface
GTypeInterface g_iface;
/* methods */
- gboolean (*set_active_panel_from_id) (CcShell *shell,
- const gchar *id,
- GVariant *parameters,
- GError **error);
- GtkWidget * (*get_toplevel) (CcShell *shell);
- void (*embed_widget_in_header) (CcShell *shell,
- GtkWidget *widget);
+ gboolean (*set_active_panel_from_id) (CcShell *shell,
+ const gchar *id,
+ GVariant *parameters,
+ GError **error);
+ gboolean (*set_active_panel_from_scheme) (CcShell *shell,
+ const gchar *scheme,
+ GError **error);
+ GtkWidget * (*get_toplevel) (CcShell *shell);
+ void (*embed_widget_in_header) (CcShell *shell,
+ GtkWidget *widget);
};
-GType cc_shell_get_type (void) G_GNUC_CONST;
+GType cc_shell_get_type (void) G_GNUC_CONST;
-CcPanel * cc_shell_get_active_panel (CcShell *shell);
-void cc_shell_set_active_panel (CcShell *shell,
- CcPanel *panel);
-gboolean cc_shell_set_active_panel_from_id (CcShell *shell,
- const gchar *id,
- GVariant *parameters,
- GError **error);
-GtkWidget * cc_shell_get_toplevel (CcShell *shell);
+CcPanel * cc_shell_get_active_panel (CcShell *shell);
+void cc_shell_set_active_panel (CcShell *shell,
+ CcPanel *panel);
+gboolean cc_shell_set_active_panel_from_id (CcShell *shell,
+ const gchar *id,
+ GVariant *parameters,
+ GError **error);
+gboolean cc_shell_set_active_panel_from_scheme (CcShell *shell,
+ const gchar *scheme,
+ GError **error);
+GtkWidget * cc_shell_get_toplevel (CcShell *shell);
-void cc_shell_embed_widget_in_header (CcShell *shell,
- GtkWidget *widget);
+void cc_shell_embed_widget_in_header (CcShell *shell,
+ GtkWidget *widget);
G_END_DECLS
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 382db54e1..21241fd73 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -328,7 +328,7 @@ setup_model (CcWindow *shell)
g_autofree gchar *description = NULL;
g_autofree gchar *id = NULL;
g_autofree gchar *icon_name = NULL;
- g_autofree GStrv keywords = NULL;
+ g_auto(GStrv) keywords = NULL;
CcPanelVisibility visibility;
gtk_tree_model_get (model, &iter,
@@ -537,7 +537,7 @@ gdk_window_set_cb (GObject *object,
CcWindow *self)
{
GdkWindow *window;
- gchar *str;
+ g_autofree gchar *str = NULL;
if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
return;
@@ -549,7 +549,6 @@ gdk_window_set_cb (GObject *object,
str = g_strdup_printf ("%u", (guint) GDK_WINDOW_XID (window));
g_setenv ("GNOME_CONTROL_CENTER_XID", str, TRUE);
- g_free (str);
}
static gboolean
@@ -641,7 +640,7 @@ split_decorations_cb (GtkSettings *settings,
g_autofree gchar *layout = NULL;
g_autofree gchar *layout_start = NULL;
g_autofree gchar *layout_end = NULL;
- g_autofree gchar **buttons;
+ g_auto(GStrv) buttons = NULL;
g_object_get (settings, "gtk-decoration-layout", &layout, NULL);
@@ -678,6 +677,50 @@ cc_window_set_active_panel_from_id (CcShell *shell,
return set_active_panel_from_id (shell, start_id, parameters, TRUE, error);
}
+static gboolean
+cc_window_set_active_panel_from_scheme (CcShell *shell,
+ const gchar *scheme,
+ GError **error)
+{
+ GtkTreeIter iter;
+ CcWindow *self;
+ gboolean iter_valid;
+
+ g_assert (CC_IS_WINDOW (shell));
+
+ self = CC_WINDOW (shell);
+ iter_valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
+
+ /* find the details for this item */
+ while (iter_valid)
+ {
+ g_autofree gchar *id = NULL;
+ g_auto(GStrv) schemes = NULL;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
+ COL_SCHEMES, &schemes,
+ COL_ID, &id,
+ -1);
+
+ for (int i = 0; schemes != NULL && schemes[i] != NULL; i++) {
+ if (g_strcmp0 (schemes[i], scheme) == 0)
+ {
+ GVariant *parameters;
+ GVariantBuilder builder;
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
+ parameters = g_variant_builder_end (&builder);
+ return cc_window_set_active_panel_from_id (shell, id, parameters, error);
+ }
+ }
+
+ iter_valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
+ }
+
+ g_warning ("Could not find settings panel matching scheme \"%s\"", scheme);
+ return TRUE;
+}
+
static void
cc_window_embed_widget_in_header (CcShell *shell,
GtkWidget *widget)
@@ -705,6 +748,7 @@ static void
cc_shell_iface_init (CcShellInterface *iface)
{
iface->set_active_panel_from_id = cc_window_set_active_panel_from_id;
+ iface->set_active_panel_from_scheme = cc_window_set_active_panel_from_scheme;
iface->embed_widget_in_header = cc_window_embed_widget_in_header;
iface->get_toplevel = cc_window_get_toplevel;
}
diff --git a/shell/gnome-control-center.desktop.in.in b/shell/gnome-control-center.desktop.in.in
index d6886a438..06bfff7de 100644
--- a/shell/gnome-control-center.desktop.in.in
+++ b/shell/gnome-control-center.desktop.in.in
@@ -8,6 +8,7 @@ Type=Application
StartupNotify=true
Categories=GNOME;GTK;System;
OnlyShowIn=GNOME;Unity;
+MimeType=x-scheme-handler/settings;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=shell