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

90 lines
3.2 KiB
Diff

diff -Npur gnome-control-center-3.9.3-old/shell/cc-panel-loader.c gnome-control-center-3.9.3-new/shell/cc-panel-loader.c
--- gnome-control-center-3.9.3-old/shell/cc-panel-loader.c 2013-06-18 19:52:26.000000000 +0800
+++ gnome-control-center-3.9.3-new/shell/cc-panel-loader.c 2013-07-02 11:41:10.542975020 +0800
@@ -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);
g_free (desktop_name);
@@ -226,6 +230,8 @@ cc_panel_loader_add_option_groups (GOpti
{
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;
diff -Npur gnome-control-center-3.9.3-old/shell/cc-window.c gnome-control-center-3.9.3-new/shell/cc-window.c
--- gnome-control-center-3.9.3-old/shell/cc-window.c 2013-06-18 19:52:26.000000000 +0800
+++ gnome-control-center-3.9.3-new/shell/cc-window.c 2013-07-02 11:39:44.750963822 +0800
@@ -133,6 +133,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,
@@ -147,6 +179,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, parameters));
cc_shell_set_active_panel (CC_SHELL (self), CC_PANEL (priv->current_panel));
gtk_widget_show (priv->current_panel);