1
0
gnome-control-center/gnome-control-center-allow-yast-in-shell.patch

83 lines
2.8 KiB
Diff

Index: gnome-control-center-3.8.0/shell/cc-panel-loader.c
===================================================================
--- gnome-control-center-3.8.0.orig/shell/cc-panel-loader.c
+++ gnome-control-center-3.8.0/shell/cc-panel-loader.c
@@ -102,6 +102,7 @@ static struct {
#ifdef BUILD_WACOM
PANEL_TYPE("wacom", cc_wacom_panel_get_type ),
#endif
+ PANEL_TYPE("YaST", NULL ),
};
GList *
@@ -160,8 +161,11 @@ cc_panel_loader_fill_model (CcShellModel
char *desktop_name;
int category;
- desktop_name = g_strconcat ("gnome-", all_panels[i].name,
- "-panel.desktop", NULL);
+ if (g_strcmp0 (all_panels[i].name, "YaST") == 0)
+ desktop_name = g_strconcat (all_panels[i].name, ".desktop", NULL);
+ else
+ desktop_name = g_strconcat ("gnome-", all_panels[i].name,
+ "-panel.desktop", NULL);
app = g_desktop_app_info_new (desktop_name);
if (app == NULL)
Index: gnome-control-center-3.8.0/shell/cc-window.c
===================================================================
--- gnome-control-center-3.8.0.orig/shell/cc-window.c
+++ gnome-control-center-3.8.0/shell/cc-window.c
@@ -134,6 +134,38 @@ get_icon_name_from_g_icon (GIcon *gicon)
return NULL;
}
+static void
+suse_activate_desktop (const gchar *name)
+{
+ GDesktopAppInfo *appinfo;
+ const gchar *desktop_file;
+ GdkScreen *screen;
+ GdkDisplay *display;
+ GdkAppLaunchContext *context;
+ GError *error;
+
+ desktop_file = g_strconcat (name, ".desktop", NULL);
+ appinfo = g_desktop_app_info_new (desktop_file);
+
+ 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", name, error->message);
+ g_clear_error (&error);
+ }
+
+ g_object_unref (context);
+ g_object_unref (appinfo);
+}
+
static gboolean
activate_panel (CcWindow *self,
const gchar *id,
@@ -148,6 +180,12 @@ activate_panel (CcWindow *self
if (!id)
return FALSE;
+ if (g_strcmp0 (id, "YaST") == 0)
+ {
+ suse_activate_desktop (name);
+ return TRUE;
+ }
+
priv->current_panel = GTK_WIDGET (cc_panel_loader_load_by_name (CC_SHELL (self), id, argv));
cc_shell_set_active_panel (CC_SHELL (self), CC_PANEL (priv->current_panel));
gtk_widget_show (priv->current_panel);