2014-08-07 18:55:15 +02:00
|
|
|
From fbdfce5abb17cae9a1b9b8df8f3c5f87af345789 Mon Sep 17 00:00:00 2001
|
2014-06-13 21:25:58 +02:00
|
|
|
From: Felix Zhang <fezhang@suse.com>
|
2014-08-07 18:55:15 +02:00
|
|
|
Date: Thu, 12 Jun 2014 20:17:05 +0800
|
2014-06-13 21:25:58 +02:00
|
|
|
Subject: [PATCH] allow extra tools in shell
|
|
|
|
|
|
|
|
---
|
|
|
|
shell/cc-panel-loader.c | 61 ++++++++++++++++++++++++++++++-------------------
|
|
|
|
shell/cc-window.c | 43 ++++++++++++++++++++++++++++++++++
|
|
|
|
2 files changed, 81 insertions(+), 23 deletions(-)
|
|
|
|
|
2014-06-23 11:12:20 +02:00
|
|
|
Index: gnome-control-center-3.12.1/shell/cc-panel-loader.c
|
|
|
|
===================================================================
|
|
|
|
--- gnome-control-center-3.12.1.orig/shell/cc-panel-loader.c
|
|
|
|
+++ gnome-control-center-3.12.1/shell/cc-panel-loader.c
|
2014-08-07 18:55:15 +02:00
|
|
|
@@ -73,35 +73,42 @@ static struct {
|
2014-06-13 21:25:58 +02:00
|
|
|
GType (*get_type)(void);
|
|
|
|
#endif
|
|
|
|
} all_panels[] = {
|
|
|
|
- PANEL_TYPE("background", cc_background_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("background", cc_background_panel_get_type ),
|
|
|
|
#ifdef BUILD_BLUETOOTH
|
|
|
|
- PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type ),
|
|
|
|
#endif
|
|
|
|
- PANEL_TYPE("color", cc_color_panel_get_type ),
|
|
|
|
- PANEL_TYPE("datetime", cc_date_time_panel_get_type ),
|
|
|
|
- PANEL_TYPE("display", cc_display_panel_get_type ),
|
|
|
|
- PANEL_TYPE("info", cc_info_panel_get_type ),
|
|
|
|
- PANEL_TYPE("keyboard", cc_keyboard_panel_get_type ),
|
|
|
|
- PANEL_TYPE("mouse", cc_mouse_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("color", cc_color_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("datetime", cc_date_time_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("display", cc_display_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("info", cc_info_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("keyboard", cc_keyboard_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("mouse", cc_mouse_panel_get_type ),
|
|
|
|
#ifdef BUILD_NETWORK
|
|
|
|
- PANEL_TYPE("network", cc_network_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("network", cc_network_panel_get_type ),
|
|
|
|
#endif
|
|
|
|
- PANEL_TYPE("notifications", cc_notifications_panel_get_type),
|
|
|
|
- PANEL_TYPE("online-accounts", cc_goa_panel_get_type ),
|
|
|
|
- PANEL_TYPE("power", cc_power_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("notifications", cc_notifications_panel_get_type),
|
2014-06-23 11:12:20 +02:00
|
|
|
+ PANEL_TYPE("online-accounts", cc_goa_panel_get_type ),
|
2014-06-13 21:25:58 +02:00
|
|
|
+ PANEL_TYPE("power", cc_power_panel_get_type ),
|
|
|
|
#ifdef BUILD_PRINTERS
|
|
|
|
- PANEL_TYPE("printers", cc_printers_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("printers", cc_printers_panel_get_type ),
|
|
|
|
#endif
|
|
|
|
- PANEL_TYPE("privacy", cc_privacy_panel_get_type ),
|
|
|
|
- PANEL_TYPE("region", cc_region_panel_get_type ),
|
|
|
|
- PANEL_TYPE("search", cc_search_panel_get_type ),
|
|
|
|
- PANEL_TYPE("sharing", cc_sharing_panel_get_type ),
|
|
|
|
- PANEL_TYPE("sound", cc_sound_panel_get_type ),
|
|
|
|
- PANEL_TYPE("universal-access", cc_ua_panel_get_type ),
|
|
|
|
- PANEL_TYPE("user-accounts", cc_user_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("privacy", cc_privacy_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("region", cc_region_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("search", cc_search_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("sharing", cc_sharing_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("sound", cc_sound_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("universal-access", cc_ua_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("user-accounts", cc_user_panel_get_type ),
|
|
|
|
#ifdef BUILD_WACOM
|
|
|
|
- PANEL_TYPE("wacom", cc_wacom_panel_get_type ),
|
|
|
|
+ PANEL_TYPE("wacom", cc_wacom_panel_get_type ),
|
|
|
|
#endif
|
|
|
|
+ PANEL_TYPE("dconf-editor", NULL ),
|
2014-08-07 18:55:15 +02:00
|
|
|
+ PANEL_TYPE("alacarte", NULL ),
|
2014-06-13 21:25:58 +02:00
|
|
|
+ PANEL_TYPE("gpk-prefs", NULL ),
|
|
|
|
+ PANEL_TYPE("tracker-preferences", NULL ),
|
2014-08-07 18:55:15 +02:00
|
|
|
+ PANEL_TYPE("itweb-settings", NULL ),
|
2014-06-13 21:25:58 +02:00
|
|
|
+ PANEL_TYPE("gnome-tweak-tool", NULL ),
|
|
|
|
+ PANEL_TYPE("YaST", NULL ),
|
|
|
|
};
|
|
|
|
|
|
|
|
GList *
|
2014-08-07 18:55:15 +02:00
|
|
|
@@ -158,10 +165,22 @@ cc_panel_loader_fill_model (CcShellModel
|
|
|
|
{
|
|
|
|
GDesktopAppInfo *app;
|
2014-06-13 21:25:58 +02:00
|
|
|
char *desktop_name;
|
2014-08-07 18:55:15 +02:00
|
|
|
+ char *name;
|
2014-06-13 21:25:58 +02:00
|
|
|
int category;
|
|
|
|
|
2014-08-07 18:55:15 +02:00
|
|
|
+#ifndef CC_PANEL_LOADER_NO_GTYPES
|
|
|
|
+ if (all_panels[i].get_type == NULL) {
|
2014-06-13 21:25:58 +02:00
|
|
|
+ desktop_name = g_strconcat (all_panels[i].name,
|
|
|
|
+ ".desktop", NULL);
|
2014-08-07 18:55:15 +02:00
|
|
|
+ name = g_strconcat ("suse-",all_panels[i].name, NULL);
|
|
|
|
+ }
|
2014-06-13 21:25:58 +02:00
|
|
|
+ else
|
2014-08-07 18:55:15 +02:00
|
|
|
+#endif
|
|
|
|
+ {
|
|
|
|
desktop_name = g_strconcat ("gnome-", all_panels[i].name,
|
|
|
|
"-panel.desktop", NULL);
|
|
|
|
+ name = g_strconcat (all_panels[i].name);
|
|
|
|
+ }
|
2014-06-13 21:25:58 +02:00
|
|
|
app = g_desktop_app_info_new (desktop_name);
|
|
|
|
g_free (desktop_name);
|
|
|
|
|
2014-08-07 18:55:15 +02:00
|
|
|
@@ -176,7 +195,7 @@ 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_object_unref (app);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -226,6 +245,8 @@ cc_panel_loader_add_option_groups (GOpti
|
2014-06-13 21:25:58 +02:00
|
|
|
{
|
|
|
|
GType (*get_type) (void);
|
|
|
|
get_type = all_panels[i].get_type;
|
|
|
|
+ if (get_type == NULL)
|
|
|
|
+ continue;
|
|
|
|
GOptionGroup *group = cc_panel_get_option_group (get_type(), builder);
|
|
|
|
if (group == NULL)
|
|
|
|
continue;
|
2014-06-23 11:12:20 +02:00
|
|
|
Index: gnome-control-center-3.12.1/shell/cc-window.c
|
|
|
|
===================================================================
|
|
|
|
--- gnome-control-center-3.12.1.orig/shell/cc-window.c
|
|
|
|
+++ gnome-control-center-3.12.1/shell/cc-window.c
|
2014-08-07 18:55:15 +02:00
|
|
|
@@ -139,6 +139,41 @@ get_icon_name_from_g_icon (GIcon *gicon)
|
2014-06-13 21:25:58 +02:00
|
|
|
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);
|
2014-08-07 18:55:15 +02:00
|
|
|
+ if (appinfo == NULL)
|
|
|
|
+ return;
|
2014-06-13 21:25:58 +02:00
|
|
|
+
|
|
|
|
+ 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,
|
2014-08-07 18:55:15 +02:00
|
|
|
@@ -152,6 +187,12 @@ activate_panel (CcWindow *self
|
|
|
|
|
2014-06-13 21:25:58 +02:00
|
|
|
if (!id)
|
|
|
|
return FALSE;
|
2014-08-07 18:55:15 +02:00
|
|
|
+ if (g_str_has_prefix(id, "suse-"))
|
2014-06-13 21:25:58 +02:00
|
|
|
+ {
|
2014-08-07 18:55:15 +02:00
|
|
|
+ /* we strip suse- prefix from the id we got to retrieve .desktop on disk */
|
|
|
|
+ suse_activate_desktop (id+strlen("suse-"));
|
2014-06-13 21:25:58 +02:00
|
|
|
+ return FALSE;
|
|
|
|
+ }
|
2014-08-07 18:55:15 +02:00
|
|
|
|
2014-06-13 21:25:58 +02:00
|
|
|
priv->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 (priv->current_panel));
|
2014-08-07 18:55:15 +02:00
|
|
|
@@ -1498,7 +1539,7 @@ create_header (CcWindow *self)
|
|
|
|
gtk_button_set_image (GTK_BUTTON (priv->search_button), image);
|
|
|
|
gtk_widget_set_valign (priv->search_button, GTK_ALIGN_CENTER);
|
|
|
|
gtk_style_context_add_class (gtk_widget_get_style_context (priv->search_button),
|
|
|
|
- "image-button");
|
|
|
|
+ "image-button");
|
|
|
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->header), priv->search_button);
|
|
|
|
|
|
|
|
priv->top_right_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|