LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gnome-control-center-allow-yast-in-shell.patch of Package gnome-control-center (Project GNOME:Factory)

Index: gnome-control-center-3.5.90/shell/gnome-control-center.c
===================================================================
--- gnome-control-center-3.5.90.orig/shell/gnome-control-center.c
+++ gnome-control-center-3.5.90/shell/gnome-control-center.c
@@ -172,6 +172,39 @@ get_icon_name_from_g_icon (GIcon *gicon)
   return NULL;
 }
 
+static void
+suse_activate_desktop (GnomeControlCenter *shell,
+                       const gchar        *id,
+                       const gchar        *desktop_file)
+{
+  GDesktopAppInfo     *appinfo;
+  GdkAppLaunchContext *context;
+  GdkScreen           *screen;
+  GdkDisplay          *display;
+  GError              *error;
+
+  appinfo = g_desktop_app_info_new_from_filename (desktop_file);
+
+  screen = gtk_widget_get_screen (shell->priv->window);
+  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 (GnomeControlCenter *shell,
                 const gchar        *id,
@@ -195,6 +228,12 @@ activate_panel (GnomeControlCenter *shel
   if (!id)
     return FALSE;
 
+  if (g_strcmp0 (id, "YaST.desktop") == 0)
+    {
+       suse_activate_desktop (shell, id, desktop_file);
+       return TRUE;
+    }
+
   for (l = panels; l != NULL; l = l->next)
     {
       GIOExtension *extension;