Merge lp:~robert-ancell/unity-control-center/xdg-current-desktop into lp:unity-control-center

Proposed by Robert Ancell
Status: Merged
Approved by: Iain Lane
Approved revision: 12871
Merged at revision: 12872
Proposed branch: lp:~robert-ancell/unity-control-center/xdg-current-desktop
Merge into: lp:unity-control-center
Diff against target: 297 lines (+21/-152)
5 files modified
panels/display/cc-display-panel.c (+15/-95)
panels/region/cc-region-panel.c (+2/-21)
panels/region/gnome-region-panel-input.c (+0/-9)
panels/universal-access/cc-ua-panel.c (+4/-26)
shell/control-center.c (+0/-1)
To merge this branch: bzr merge lp:~robert-ancell/unity-control-center/xdg-current-desktop
Reviewer Review Type Date Requested Status
Iain Lane Approve
Review via email: mp+307394@code.launchpad.net

Commit message

Don't check if we're running under Unity - we only support Unity

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

Makes sense.

unity-settings-daemon is used for Flashback (at least ATM), so I didn't do the same there.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'panels/display/cc-display-panel.c'
--- panels/display/cc-display-panel.c 2016-03-09 21:55:46 +0000
+++ panels/display/cc-display-panel.c 2016-10-03 03:56:43 +0000
@@ -271,12 +271,6 @@
271}271}
272272
273static gboolean273static gboolean
274is_unity_session (void)
275{
276 return (g_strcmp0 (g_getenv("XDG_CURRENT_DESKTOP"), "Unity") == 0);
277}
278
279static gboolean
280should_show_resolution (gint output_width,274should_show_resolution (gint output_width,
281 gint output_height,275 gint output_height,
282 gint width,276 gint width,
@@ -317,11 +311,8 @@
317311
318 select_current_output_from_dialog_position (self);312 select_current_output_from_dialog_position (self);
319313
320 if (is_unity_session ())314 refresh_unity_launcher_placement (self);
321 {315 refresh_unity_monitor_scale (self);
322 refresh_unity_launcher_placement (self);
323 refresh_unity_monitor_scale (self);
324 }
325}316}
326317
327static void318static void
@@ -2286,80 +2277,23 @@
2286 cairo_restore (cr);2277 cairo_restore (cr);
22872278
2288 /* Only display a launcher on all or primary monitor */2279 /* Only display a launcher on all or primary monitor */
2289 if (is_unity_session ())2280 if (gsd_rr_output_info_is_active (output) && (unity_launcher_on_all_monitors (self->priv->unity_settings) || gsd_rr_output_info_get_primary (output)))
2290 {2281 {
2291 if (gsd_rr_output_info_is_active (output) && (unity_launcher_on_all_monitors (self->priv->unity_settings) || gsd_rr_output_info_get_primary (output)))2282 cairo_rectangle (cr, x, y, 10, h * scale + 0.5);
2292 {
2293 cairo_rectangle (cr, x, y, 10, h * scale + 0.5);
2294 cairo_set_source_rgb (cr, 0, 0, 0);
2295 foo_scroll_area_add_input_from_fill (FOO_SCROLL_AREA (self->priv->area),
2296 cr,
2297 (FooScrollAreaEventFunc) on_top_bar_event,
2298 self);
2299 cairo_fill (cr);
2300
2301 cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
2302 cairo_rectangle (cr, x + 1, y + 6, 8, 8);
2303 cairo_rectangle (cr, x + 1, y + 16, 8, 8);
2304 cairo_rectangle (cr, x + 1, y + 26, 8, 8);
2305 cairo_rectangle (cr, x + 1, y + 36, 8, 8);
2306 cairo_rectangle (cr, x + 1, y + h * scale + 0.5 - 10, 8, 8);
2307 cairo_fill (cr);
2308 }
2309 }
2310
2311 if (gsd_rr_output_info_get_primary (output) && !is_unity_session ())
2312 {
2313 const char *clock_format;
2314 char *text;
2315 gboolean use_24;
2316 GDateTime *dt;
2317 GDesktopClockFormat value;
2318
2319 /* top bar */
2320 cairo_rectangle (cr, x, y, w * scale + 0.5, TOP_BAR_HEIGHT);
2321 cairo_set_source_rgb (cr, 0, 0, 0);2283 cairo_set_source_rgb (cr, 0, 0, 0);
2322 foo_scroll_area_add_input_from_fill (FOO_SCROLL_AREA (self->priv->area),2284 foo_scroll_area_add_input_from_fill (FOO_SCROLL_AREA (self->priv->area),
2323 cr,2285 cr,
2324 (FooScrollAreaEventFunc) on_top_bar_event,2286 (FooScrollAreaEventFunc) on_top_bar_event,
2325 self);2287 self);
23262288 cairo_fill (cr);
2327 cairo_fill (cr);2289
23282290 cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
2329 /* clock */2291 cairo_rectangle (cr, x + 1, y + 6, 8, 8);
2330 value = g_settings_get_enum (self->priv->clock_settings, CLOCK_FORMAT_KEY);2292 cairo_rectangle (cr, x + 1, y + 16, 8, 8);
2331 use_24 = value == G_DESKTOP_CLOCK_FORMAT_24H;2293 cairo_rectangle (cr, x + 1, y + 26, 8, 8);
2332 if (use_24)2294 cairo_rectangle (cr, x + 1, y + 36, 8, 8);
2333 clock_format = _("%a %R");2295 cairo_rectangle (cr, x + 1, y + h * scale + 0.5 - 10, 8, 8);
2334 else2296 cairo_fill (cr);
2335 clock_format = _("%a %l:%M %p");
2336
2337 dt = g_date_time_new_now_local ();
2338 text = g_date_time_format (dt, clock_format);
2339 g_date_time_unref (dt);
2340
2341 layout = gtk_widget_create_pango_layout (GTK_WIDGET (self->priv->area), text);
2342 g_free (text);
2343 pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
2344
2345 layout_set_font (layout, "Sans 4");
2346 pango_layout_get_pixel_extents (layout, &ink_extent, &log_extent);
2347
2348 if (available_w < ink_extent.width)
2349 factor = available_w / ink_extent.width;
2350 else
2351 factor = 1.0;
2352
2353 cairo_move_to (cr,
2354 x + ((w * scale + 0.5) - factor * log_extent.width) / 2,
2355 y + (TOP_BAR_HEIGHT - factor * log_extent.height) / 2);
2356
2357 cairo_scale (cr, factor, factor);
2358
2359 cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
2360
2361 pango_cairo_show_layout (cr, layout);
2362 g_object_unref (layout);
2363 }2297 }
23642298
2365 cairo_restore (cr);2299 cairo_restore (cr);
@@ -3255,21 +3189,7 @@
3255 "clicked", G_CALLBACK (apply), self);3189 "clicked", G_CALLBACK (apply), self);
32563190
3257 /* Unity settings */3191 /* Unity settings */
3258 if (is_unity_session ())3192 setup_unity_settings (self);
3259 setup_unity_settings (self);
3260 else
3261 {
3262 gtk_widget_hide (WID ("unity_launcher_placement_sep"));
3263 gtk_widget_hide (WID ("launcher_placement_label"));
3264 gtk_widget_hide (WID ("sticky_edge_label"));
3265 gtk_widget_hide (WID ("launcher_placement_combo"));
3266 gtk_widget_hide (WID ("stickyedge_switch"));
3267 gtk_widget_hide (WID ("ui_scale_separator"));
3268 gtk_widget_hide (WID ("ui_scale_label"));
3269 gtk_widget_hide (WID ("ui_scale"));
3270 gtk_widget_hide (WID ("ui_scale_monitor_label"));
3271 gtk_widget_hide (WID ("ui_scale_monitor_combo"));
3272 }
32733193
3274 gtk_widget_show (self->priv->panel);3194 gtk_widget_show (self->priv->panel);
3275 gtk_container_add (GTK_CONTAINER (self), self->priv->panel);3195 gtk_container_add (GTK_CONTAINER (self), self->priv->panel);
32763196
=== modified file 'panels/region/cc-region-panel.c'
--- panels/region/cc-region-panel.c 2016-03-09 21:55:46 +0000
+++ panels/region/cc-region-panel.c 2016-10-03 03:56:43 +0000
@@ -51,12 +51,6 @@
51#define INDICATOR_KEYBOARD_SCHEMA_ID "com.canonical.indicator.keyboard"51#define INDICATOR_KEYBOARD_SCHEMA_ID "com.canonical.indicator.keyboard"
5252
53static gboolean53static gboolean
54is_unity (void)
55{
56 return g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0;
57}
58
59static gboolean
60is_fcitx_active (void)54is_fcitx_active (void)
61{55{
62 return g_strcmp0 (g_getenv ("GTK_IM_MODULE"), "fcitx") == 0;56 return g_strcmp0 (g_getenv ("GTK_IM_MODULE"), "fcitx") == 0;
@@ -67,9 +61,6 @@
67{61{
68 GSettingsSchema *schema;62 GSettingsSchema *schema;
6963
70 if (!is_unity ())
71 return FALSE;
72
73 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_KEYBOARD_SCHEMA_ID, TRUE);64 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_KEYBOARD_SCHEMA_ID, TRUE);
74 if (schema) {65 if (schema) {
75 g_settings_schema_unref (schema);66 g_settings_schema_unref (schema);
@@ -196,24 +187,14 @@
196 return;187 return;
197 }188 }
198189
199 if (!is_unity ())190 prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
200 prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,191 "vbox5");
201 "region_notebook");
202 else
203 prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
204 "vbox5");
205192
206 gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);193 gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);
207194
208 gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));195 gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
209196
210 setup_input_tabs (priv->builder, self);197 setup_input_tabs (priv->builder, self);
211
212 if (!is_unity ()) {
213 setup_language (priv->builder);
214 setup_formats (priv->builder);
215 setup_system (priv->builder);
216 }
217}198}
218199
219void200void
220201
=== modified file 'panels/region/gnome-region-panel-input.c'
--- panels/region/gnome-region-panel-input.c 2015-09-02 13:30:14 +0000
+++ panels/region/gnome-region-panel-input.c 2016-10-03 03:56:43 +0000
@@ -144,19 +144,10 @@
144static GtkTreeModel *tree_view_get_actual_model (GtkTreeView *tv);144static GtkTreeModel *tree_view_get_actual_model (GtkTreeView *tv);
145145
146static gboolean146static gboolean
147is_unity (void)
148{
149 return g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0;
150}
151
152static gboolean
153has_indicator_keyboard (void)147has_indicator_keyboard (void)
154{148{
155 GSettingsSchema *schema;149 GSettingsSchema *schema;
156150
157 if (!is_unity ())
158 return FALSE;
159
160 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_KEYBOARD_SCHEMA_ID, TRUE);151 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_KEYBOARD_SCHEMA_ID, TRUE);
161 if (schema) {152 if (schema) {
162 g_settings_schema_unref (schema);153 g_settings_schema_unref (schema);
163154
=== modified file 'panels/universal-access/cc-ua-panel.c'
--- panels/universal-access/cc-ua-panel.c 2016-03-15 20:34:01 +0000
+++ panels/universal-access/cc-ua-panel.c 2016-10-03 03:56:43 +0000
@@ -91,12 +91,6 @@
91 }91 }
92}92}
9393
94static gboolean
95is_unity_session (void)
96{
97 return (g_strcmp0 (g_getenv("XDG_CURRENT_DESKTOP"), "Unity") == 0);
98}
99
100static void94static void
101cc_ua_panel_dispose (GObject *object)95cc_ua_panel_dispose (GObject *object)
102{96{
@@ -377,9 +371,7 @@
377 }371 }
378 else372 else
379 {373 {
380 const gchar *key = is_unity_session () ? KEY_UNITY_TEXT_SCALE_FACTOR :374 g_settings_reset (settings, KEY_UNITY_TEXT_SCALE_FACTOR);
381 KEY_TEXT_SCALING_FACTOR;
382 g_settings_reset (settings, key);
383 }375 }
384376
385 return ret;377 return ret;
@@ -467,20 +459,8 @@
467 WID (priv->builder, "seeing_toggle_keys_switch"), "active",459 WID (priv->builder, "seeing_toggle_keys_switch"), "active",
468 G_SETTINGS_BIND_DEFAULT);460 G_SETTINGS_BIND_DEFAULT);
469461
470 if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity")) 462 gtk_widget_hide (WID (priv->builder, "zoom_label_box"));
471 {463 gtk_widget_hide (WID (priv->builder, "zoom_value_box"));
472 priv->shell_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
473 "org.gnome.Shell",
474 G_BUS_NAME_WATCHER_FLAGS_NONE,
475 (GBusNameAppearedCallback) shell_appeared_cb,
476 (GBusNameVanishedCallback) shell_vanished_cb,
477 self,
478 NULL);
479 } else
480 {
481 gtk_widget_hide (WID (priv->builder, "zoom_label_box"));
482 gtk_widget_hide (WID (priv->builder, "zoom_value_box"));
483 }
484464
485 g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"),465 g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"),
486 "clicked",466 "clicked",
@@ -738,9 +718,7 @@
738 priv->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications");718 priv->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications");
739 priv->mediakeys_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");719 priv->mediakeys_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");
740 priv->a11y_profile_settings = g_settings_new ("org.gnome.desktop.a11y");720 priv->a11y_profile_settings = g_settings_new ("org.gnome.desktop.a11y");
741721 priv->unity_interface_settings = g_settings_new ("com.canonical.Unity.Interface");
742 if (is_unity_session ())
743 priv->unity_interface_settings = g_settings_new ("com.canonical.Unity.Interface");
744722
745 cc_ua_panel_init_keyboard (self);723 cc_ua_panel_init_keyboard (self);
746 cc_ua_panel_init_mouse (self);724 cc_ua_panel_init_mouse (self);
747725
=== modified file 'shell/control-center.c'
--- shell/control-center.c 2016-03-15 20:34:36 +0000
+++ shell/control-center.c 2016-10-03 03:56:43 +0000
@@ -303,7 +303,6 @@
303 gtk_icon_size_register ("cc-sidebar-list", 24, 24);303 gtk_icon_size_register ("cc-sidebar-list", 24, 24);
304304
305 notify_init ("gnome-control-center");305 notify_init ("gnome-control-center");
306 g_setenv ("XDG_CURRENT_DESKTOP", "Unity", FALSE);
307306
308 shell = gnome_control_center_new ();307 shell = gnome_control_center_new ();
309308

Subscribers

People subscribed via source and target branches