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

85 lines
2.7 KiB
Diff
Raw Normal View History

Index: gnome-control-center-3.7.91/shell/cc-window.c
===================================================================
--- gnome-control-center-3.7.91.orig/shell/cc-window.c
+++ gnome-control-center-3.7.91/shell/cc-window.c
@@ -133,6 +133,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 (CcWindow *self,
const gchar *id,
@@ -147,6 +180,11 @@ activate_panel (CcWindow *self
if (!id)
return FALSE;
+ if (g_strcmp0 (id, "yast") == 0) {
+ suse_activate_desktop (shell, id, "YaST.desktop");
+ 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);
Index: gnome-control-center-3.7.91/shell/cc-panel-loader.c
===================================================================
--- gnome-control-center-3.7.91.orig/shell/cc-panel-loader.c
+++ gnome-control-center-3.7.91/shell/cc-panel-loader.c
@@ -178,6 +178,23 @@ cc_panel_loader_fill_model (CcShellModel
cc_shell_model_add_item (model, category, G_APP_INFO (app), all_panels[i].name);
g_object_unref (app);
}
+
+ do
+ {
+ GDesktopAppInfo *app;
+
+ app = g_desktop_app_info_new ("YaST.desktop");
+
+ if (app == NULL)
+ {
+ g_warning ("Missing desktop file for YaST");
+ continue;
+ }
+
+ cc_shell_model_add_item (model, CC_CATEGORY_SYSTEM, G_APP_INFO (app), "yast");
+ g_object_unref (app);
+ }
+ while (0);
}
#ifndef CC_PANEL_LOADER_NO_GTYPES