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

Proposed by Robert Ancell on 2016-10-03
Status: Merged
Approved by: Iain Lane on 2016-10-03
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 2016-10-03 Approve on 2016-10-03
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.
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
1=== modified file 'panels/display/cc-display-panel.c'
2--- panels/display/cc-display-panel.c 2016-03-09 21:55:46 +0000
3+++ panels/display/cc-display-panel.c 2016-10-03 03:56:43 +0000
4@@ -271,12 +271,6 @@
5 }
6
7 static gboolean
8-is_unity_session (void)
9-{
10- return (g_strcmp0 (g_getenv("XDG_CURRENT_DESKTOP"), "Unity") == 0);
11-}
12-
13-static gboolean
14 should_show_resolution (gint output_width,
15 gint output_height,
16 gint width,
17@@ -317,11 +311,8 @@
18
19 select_current_output_from_dialog_position (self);
20
21- if (is_unity_session ())
22- {
23- refresh_unity_launcher_placement (self);
24- refresh_unity_monitor_scale (self);
25- }
26+ refresh_unity_launcher_placement (self);
27+ refresh_unity_monitor_scale (self);
28 }
29
30 static void
31@@ -2286,80 +2277,23 @@
32 cairo_restore (cr);
33
34 /* Only display a launcher on all or primary monitor */
35- if (is_unity_session ())
36- {
37- if (gsd_rr_output_info_is_active (output) && (unity_launcher_on_all_monitors (self->priv->unity_settings) || gsd_rr_output_info_get_primary (output)))
38- {
39- cairo_rectangle (cr, x, y, 10, h * scale + 0.5);
40- cairo_set_source_rgb (cr, 0, 0, 0);
41- foo_scroll_area_add_input_from_fill (FOO_SCROLL_AREA (self->priv->area),
42- cr,
43- (FooScrollAreaEventFunc) on_top_bar_event,
44- self);
45- cairo_fill (cr);
46-
47- cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
48- cairo_rectangle (cr, x + 1, y + 6, 8, 8);
49- cairo_rectangle (cr, x + 1, y + 16, 8, 8);
50- cairo_rectangle (cr, x + 1, y + 26, 8, 8);
51- cairo_rectangle (cr, x + 1, y + 36, 8, 8);
52- cairo_rectangle (cr, x + 1, y + h * scale + 0.5 - 10, 8, 8);
53- cairo_fill (cr);
54- }
55- }
56-
57- if (gsd_rr_output_info_get_primary (output) && !is_unity_session ())
58- {
59- const char *clock_format;
60- char *text;
61- gboolean use_24;
62- GDateTime *dt;
63- GDesktopClockFormat value;
64-
65- /* top bar */
66- cairo_rectangle (cr, x, y, w * scale + 0.5, TOP_BAR_HEIGHT);
67+ if (gsd_rr_output_info_is_active (output) && (unity_launcher_on_all_monitors (self->priv->unity_settings) || gsd_rr_output_info_get_primary (output)))
68+ {
69+ cairo_rectangle (cr, x, y, 10, h * scale + 0.5);
70 cairo_set_source_rgb (cr, 0, 0, 0);
71 foo_scroll_area_add_input_from_fill (FOO_SCROLL_AREA (self->priv->area),
72 cr,
73 (FooScrollAreaEventFunc) on_top_bar_event,
74 self);
75-
76- cairo_fill (cr);
77-
78- /* clock */
79- value = g_settings_get_enum (self->priv->clock_settings, CLOCK_FORMAT_KEY);
80- use_24 = value == G_DESKTOP_CLOCK_FORMAT_24H;
81- if (use_24)
82- clock_format = _("%a %R");
83- else
84- clock_format = _("%a %l:%M %p");
85-
86- dt = g_date_time_new_now_local ();
87- text = g_date_time_format (dt, clock_format);
88- g_date_time_unref (dt);
89-
90- layout = gtk_widget_create_pango_layout (GTK_WIDGET (self->priv->area), text);
91- g_free (text);
92- pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
93-
94- layout_set_font (layout, "Sans 4");
95- pango_layout_get_pixel_extents (layout, &ink_extent, &log_extent);
96-
97- if (available_w < ink_extent.width)
98- factor = available_w / ink_extent.width;
99- else
100- factor = 1.0;
101-
102- cairo_move_to (cr,
103- x + ((w * scale + 0.5) - factor * log_extent.width) / 2,
104- y + (TOP_BAR_HEIGHT - factor * log_extent.height) / 2);
105-
106- cairo_scale (cr, factor, factor);
107-
108- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
109-
110- pango_cairo_show_layout (cr, layout);
111- g_object_unref (layout);
112+ cairo_fill (cr);
113+
114+ cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
115+ cairo_rectangle (cr, x + 1, y + 6, 8, 8);
116+ cairo_rectangle (cr, x + 1, y + 16, 8, 8);
117+ cairo_rectangle (cr, x + 1, y + 26, 8, 8);
118+ cairo_rectangle (cr, x + 1, y + 36, 8, 8);
119+ cairo_rectangle (cr, x + 1, y + h * scale + 0.5 - 10, 8, 8);
120+ cairo_fill (cr);
121 }
122
123 cairo_restore (cr);
124@@ -3255,21 +3189,7 @@
125 "clicked", G_CALLBACK (apply), self);
126
127 /* Unity settings */
128- if (is_unity_session ())
129- setup_unity_settings (self);
130- else
131- {
132- gtk_widget_hide (WID ("unity_launcher_placement_sep"));
133- gtk_widget_hide (WID ("launcher_placement_label"));
134- gtk_widget_hide (WID ("sticky_edge_label"));
135- gtk_widget_hide (WID ("launcher_placement_combo"));
136- gtk_widget_hide (WID ("stickyedge_switch"));
137- gtk_widget_hide (WID ("ui_scale_separator"));
138- gtk_widget_hide (WID ("ui_scale_label"));
139- gtk_widget_hide (WID ("ui_scale"));
140- gtk_widget_hide (WID ("ui_scale_monitor_label"));
141- gtk_widget_hide (WID ("ui_scale_monitor_combo"));
142- }
143+ setup_unity_settings (self);
144
145 gtk_widget_show (self->priv->panel);
146 gtk_container_add (GTK_CONTAINER (self), self->priv->panel);
147
148=== modified file 'panels/region/cc-region-panel.c'
149--- panels/region/cc-region-panel.c 2016-03-09 21:55:46 +0000
150+++ panels/region/cc-region-panel.c 2016-10-03 03:56:43 +0000
151@@ -51,12 +51,6 @@
152 #define INDICATOR_KEYBOARD_SCHEMA_ID "com.canonical.indicator.keyboard"
153
154 static gboolean
155-is_unity (void)
156-{
157- return g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0;
158-}
159-
160-static gboolean
161 is_fcitx_active (void)
162 {
163 return g_strcmp0 (g_getenv ("GTK_IM_MODULE"), "fcitx") == 0;
164@@ -67,9 +61,6 @@
165 {
166 GSettingsSchema *schema;
167
168- if (!is_unity ())
169- return FALSE;
170-
171 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_KEYBOARD_SCHEMA_ID, TRUE);
172 if (schema) {
173 g_settings_schema_unref (schema);
174@@ -196,24 +187,14 @@
175 return;
176 }
177
178- if (!is_unity ())
179- prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
180- "region_notebook");
181- else
182- prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
183- "vbox5");
184+ prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
185+ "vbox5");
186
187 gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);
188
189 gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
190
191 setup_input_tabs (priv->builder, self);
192-
193- if (!is_unity ()) {
194- setup_language (priv->builder);
195- setup_formats (priv->builder);
196- setup_system (priv->builder);
197- }
198 }
199
200 void
201
202=== modified file 'panels/region/gnome-region-panel-input.c'
203--- panels/region/gnome-region-panel-input.c 2015-09-02 13:30:14 +0000
204+++ panels/region/gnome-region-panel-input.c 2016-10-03 03:56:43 +0000
205@@ -144,19 +144,10 @@
206 static GtkTreeModel *tree_view_get_actual_model (GtkTreeView *tv);
207
208 static gboolean
209-is_unity (void)
210-{
211- return g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0;
212-}
213-
214-static gboolean
215 has_indicator_keyboard (void)
216 {
217 GSettingsSchema *schema;
218
219- if (!is_unity ())
220- return FALSE;
221-
222 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_KEYBOARD_SCHEMA_ID, TRUE);
223 if (schema) {
224 g_settings_schema_unref (schema);
225
226=== modified file 'panels/universal-access/cc-ua-panel.c'
227--- panels/universal-access/cc-ua-panel.c 2016-03-15 20:34:01 +0000
228+++ panels/universal-access/cc-ua-panel.c 2016-10-03 03:56:43 +0000
229@@ -91,12 +91,6 @@
230 }
231 }
232
233-static gboolean
234-is_unity_session (void)
235-{
236- return (g_strcmp0 (g_getenv("XDG_CURRENT_DESKTOP"), "Unity") == 0);
237-}
238-
239 static void
240 cc_ua_panel_dispose (GObject *object)
241 {
242@@ -377,9 +371,7 @@
243 }
244 else
245 {
246- const gchar *key = is_unity_session () ? KEY_UNITY_TEXT_SCALE_FACTOR :
247- KEY_TEXT_SCALING_FACTOR;
248- g_settings_reset (settings, key);
249+ g_settings_reset (settings, KEY_UNITY_TEXT_SCALE_FACTOR);
250 }
251
252 return ret;
253@@ -467,20 +459,8 @@
254 WID (priv->builder, "seeing_toggle_keys_switch"), "active",
255 G_SETTINGS_BIND_DEFAULT);
256
257- if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity"))
258- {
259- priv->shell_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
260- "org.gnome.Shell",
261- G_BUS_NAME_WATCHER_FLAGS_NONE,
262- (GBusNameAppearedCallback) shell_appeared_cb,
263- (GBusNameVanishedCallback) shell_vanished_cb,
264- self,
265- NULL);
266- } else
267- {
268- gtk_widget_hide (WID (priv->builder, "zoom_label_box"));
269- gtk_widget_hide (WID (priv->builder, "zoom_value_box"));
270- }
271+ gtk_widget_hide (WID (priv->builder, "zoom_label_box"));
272+ gtk_widget_hide (WID (priv->builder, "zoom_value_box"));
273
274 g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"),
275 "clicked",
276@@ -738,9 +718,7 @@
277 priv->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications");
278 priv->mediakeys_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");
279 priv->a11y_profile_settings = g_settings_new ("org.gnome.desktop.a11y");
280-
281- if (is_unity_session ())
282- priv->unity_interface_settings = g_settings_new ("com.canonical.Unity.Interface");
283+ priv->unity_interface_settings = g_settings_new ("com.canonical.Unity.Interface");
284
285 cc_ua_panel_init_keyboard (self);
286 cc_ua_panel_init_mouse (self);
287
288=== modified file 'shell/control-center.c'
289--- shell/control-center.c 2016-03-15 20:34:36 +0000
290+++ shell/control-center.c 2016-10-03 03:56:43 +0000
291@@ -303,7 +303,6 @@
292 gtk_icon_size_register ("cc-sidebar-list", 24, 24);
293
294 notify_init ("gnome-control-center");
295- g_setenv ("XDG_CURRENT_DESKTOP", "Unity", FALSE);
296
297 shell = gnome_control_center_new ();
298

Subscribers

People subscribed via source and target branches