1
0
gnome-control-center/gnome-control-center-allow-yast-in-shell.patch
Bjørn Lie 2ad1302fd6 Accepting request 203101 from home:dimstar:branches:GNOME:Factory
- Fix gnome-control-center-allow-yast-in-shell.patch: launching
  YaST should not give the feedback to the shell that we managed
  to switch panel (bnc#845643).

OBS-URL: https://build.opensuse.org/request/show/203101
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=222
2013-10-13 21:18:35 +00:00

92 lines
3.1 KiB
Diff

Index: gnome-control-center-3.10.0/shell/cc-panel-loader.c
===================================================================
--- gnome-control-center-3.10.0.orig/shell/cc-panel-loader.c
+++ gnome-control-center-3.10.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);
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;
Index: gnome-control-center-3.10.0/shell/cc-window.c
===================================================================
--- gnome-control-center-3.10.0.orig/shell/cc-window.c
+++ gnome-control-center-3.10.0/shell/cc-window.c
@@ -137,6 +137,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,
@@ -151,6 +183,12 @@ activate_panel (CcWindow *self
if (!id)
return FALSE;
+ if (g_strcmp0 (id, "YaST") == 0)
+ {
+ suse_activate_desktop (name);
+ return FALSE;
+ }
+
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);