Dominique Leuenberger
c95887cb4a
Fixed patch tag line - it has been rebased OBS-URL: https://build.opensuse.org/request/show/425720 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=330
141 lines
5.0 KiB
Diff
141 lines
5.0 KiB
Diff
From 8469e4ac57f3b5d3efbf533ba23512612997ffff Mon Sep 17 00:00:00 2001
|
|
From: Felix Zhang <fezhang@suse.com>
|
|
Date: Fri, 2 Sep 2016 14:55:12 +0800
|
|
Subject: [PATCH] allow extra tools in shell
|
|
|
|
---
|
|
shell/cc-panel-loader.c | 28 ++++++++++++++++++++++++++--
|
|
shell/cc-window.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 67 insertions(+), 2 deletions(-)
|
|
|
|
Index: gnome-control-center-3.21.90/shell/cc-panel-loader.c
|
|
===================================================================
|
|
--- gnome-control-center-3.21.90.orig/shell/cc-panel-loader.c
|
|
+++ gnome-control-center-3.21.90/shell/cc-panel-loader.c
|
|
@@ -102,6 +102,12 @@ static struct {
|
|
#ifdef BUILD_WACOM
|
|
PANEL_TYPE("wacom", cc_wacom_panel_get_type ),
|
|
#endif
|
|
+ PANEL_TYPE("ca.desrt.dconf-editor", NULL ),
|
|
+ PANEL_TYPE("gnome-tweak-tool", NULL ),
|
|
+ PANEL_TYPE("gpk-prefs", NULL ),
|
|
+ PANEL_TYPE("itweb-settings", NULL ),
|
|
+ PANEL_TYPE("tracker-preferences", NULL ),
|
|
+ PANEL_TYPE("YaST", NULL ),
|
|
};
|
|
|
|
GList *
|
|
@@ -146,7 +152,8 @@ parse_categories (GDesktopAppInfo *app)
|
|
#else
|
|
if (g_strv_contains (const_strv (split), "HardwareSettings"))
|
|
retval = CC_CATEGORY_HARDWARE;
|
|
- else if (g_strv_contains (const_strv (split), "X-GNOME-PersonalSettings"))
|
|
+ else if (g_strv_contains (const_strv (split), "X-GNOME-PersonalSettings")
|
|
+ || g_strv_contains (const_strv (split), "X-GNOME-DesktopSettings"))
|
|
retval = CC_CATEGORY_PERSONAL;
|
|
else if (g_strv_contains (const_strv (split), "X-GNOME-SystemSettings"))
|
|
retval = CC_CATEGORY_SYSTEM;
|
|
@@ -173,17 +180,33 @@ cc_panel_loader_fill_model (CcShellModel
|
|
{
|
|
GDesktopAppInfo *app;
|
|
char *desktop_name;
|
|
+ char *name;
|
|
int category;
|
|
|
|
+#ifndef CC_PANEL_LOADER_NO_GTYPES
|
|
+ if (all_panels[i].get_type == NULL)
|
|
+ {
|
|
+ desktop_name = g_strconcat (all_panels[i].name,
|
|
+ ".desktop", NULL);
|
|
+ name = g_strconcat ("suse-",all_panels[i].name, NULL);
|
|
+ }
|
|
+ else
|
|
+#endif
|
|
+ {
|
|
desktop_name = g_strconcat ("gnome-", all_panels[i].name,
|
|
"-panel.desktop", NULL);
|
|
+ name = g_strconcat (all_panels[i].name, NULL);
|
|
+ }
|
|
app = g_desktop_app_info_new (desktop_name);
|
|
g_free (desktop_name);
|
|
|
|
if (app == NULL)
|
|
{
|
|
+ if (!g_str_has_prefix(name, "suse-"))
|
|
+ {
|
|
g_warning ("Ignoring broken panel %s (missing desktop file)",
|
|
all_panels[i].name);
|
|
+ }
|
|
continue;
|
|
}
|
|
|
|
@@ -191,7 +214,8 @@ cc_panel_loader_fill_model (CcShellModel
|
|
if (G_UNLIKELY (category < 0))
|
|
continue;
|
|
|
|
- cc_shell_model_add_item (model, category, G_APP_INFO (app), all_panels[i].name);
|
|
+ cc_shell_model_add_item (model, category, G_APP_INFO (app), name);
|
|
+ g_free (name);
|
|
g_object_unref (app);
|
|
}
|
|
}
|
|
Index: gnome-control-center-3.21.90/shell/cc-window.c
|
|
===================================================================
|
|
--- gnome-control-center-3.21.90.orig/shell/cc-window.c
|
|
+++ gnome-control-center-3.21.90/shell/cc-window.c
|
|
@@ -139,6 +139,41 @@ get_icon_name_from_g_icon (GIcon *gicon)
|
|
return NULL;
|
|
}
|
|
|
|
+static void
|
|
+suse_activate_desktop (const gchar *id)
|
|
+{
|
|
+ GDesktopAppInfo *appinfo;
|
|
+ const gchar *desktop_file;
|
|
+ GdkScreen *screen;
|
|
+ GdkDisplay *display;
|
|
+ GdkAppLaunchContext *context;
|
|
+ GError *error;
|
|
+
|
|
+ desktop_file = g_strconcat ("/usr/share/applications/", id,
|
|
+ ".desktop", NULL);
|
|
+ appinfo = g_desktop_app_info_new_from_filename (desktop_file);
|
|
+ if (appinfo == NULL)
|
|
+ return;
|
|
+
|
|
+ screen = gdk_screen_get_default();
|
|
+ display = gdk_screen_get_display (screen);
|
|
+ context = gdk_display_get_app_launch_context (display);
|
|
+ gdk_app_launch_context_set_screen (context, screen);
|
|
+ gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
|
|
+
|
|
+ error = NULL;
|
|
+ g_app_info_launch_uris (G_APP_INFO (appinfo), NULL,
|
|
+ (GAppLaunchContext *) context,
|
|
+ &error);
|
|
+ if (error) {
|
|
+ g_printerr ("Could not launch '%s': %s\n", id, error->message);
|
|
+ g_clear_error (&error);
|
|
+ }
|
|
+
|
|
+ g_object_unref (context);
|
|
+ g_object_unref (appinfo);
|
|
+}
|
|
+
|
|
static gboolean
|
|
activate_panel (CcWindow *self,
|
|
const gchar *id,
|
|
@@ -151,6 +186,12 @@ activate_panel (CcWindow *self
|
|
|
|
if (!id)
|
|
return FALSE;
|
|
+ if (g_str_has_prefix(id, "suse-"))
|
|
+ {
|
|
+ /* we strip suse- prefix from the id we got to retrieve .desktop on disk */
|
|
+ suse_activate_desktop (id+strlen("suse-"));
|
|
+ return FALSE;
|
|
+ }
|
|
|
|
self->current_panel = GTK_WIDGET (cc_panel_loader_load_by_name (CC_SHELL (self), id, parameters));
|
|
cc_shell_set_active_panel (CC_SHELL (self), CC_PANEL (self->current_panel));
|