Merge lp:~khurshid-alam/unity-control-center/screen-sharing into lp:unity-control-center
- screen-sharing
- Merge into trunk
Proposed by
Khurshid Alam
Status: | Merged |
---|---|
Merged at revision: | 12908 |
Proposed branch: | lp:~khurshid-alam/unity-control-center/screen-sharing |
Merge into: | lp:unity-control-center |
Diff against target: |
1362 lines (+1271/-1) 13 files modified
configure.ac (+3/-0) panels/Makefile.am (+2/-1) panels/screen-sharing/Makefile.am (+39/-0) panels/screen-sharing/cc-screen-sharing-panel.c (+315/-0) panels/screen-sharing/cc-screen-sharing-panel.h (+29/-0) panels/screen-sharing/screen-sharing-module.c (+41/-0) panels/screen-sharing/screen-sharing-panel.ui (+400/-0) panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in (+13/-0) panels/screen-sharing/vino-message-box.c (+156/-0) panels/screen-sharing/vino-message-box.h (+59/-0) panels/screen-sharing/vino-radio-button.c (+181/-0) panels/screen-sharing/vino-radio-button.h (+29/-0) po/POTFILES.in (+4/-0) |
To merge this branch: | bzr merge lp:~khurshid-alam/unity-control-center/screen-sharing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeremy Bícha | Approve | ||
Sebastien Bacher | Pending | ||
Review via email: mp+335211@code.launchpad.net |
Commit message
Description of the change
Vino 3.8 provided the Desktop Sharing preferences dialog to allow remote desktop access to the local computer. But Vino 3.10 replaced the Desktop Sharing dialog with an integrated Sharing panel in g-c-c, but Unity’s System Settings panel never had a Sharing panel because it is a fork of GNOME’s 3.6 version.
This will merge ~robert-
PPA: https:/
See thread here: https:/
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2017-04-04 09:08:13 +0000 |
3 | +++ configure.ac 2017-12-14 13:03:07 +0000 |
4 | @@ -160,6 +160,7 @@ |
5 | $FCITX_MODULE |
6 | x11) |
7 | PKG_CHECK_MODULES(SCREEN_PANEL, $COMMON_MODULES) |
8 | +PKG_CHECK_MODULES(SCREEN_SHARING_PANEL, $COMMON_MODULES) |
9 | PKG_CHECK_MODULES(SOUND_PANEL, $COMMON_MODULES libxml-2.0 |
10 | libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION |
11 | libpulse >= $PA_REQUIRED_VERSION |
12 | @@ -461,6 +462,8 @@ |
13 | panels/sound/data/icons/scalable/devices/Makefile |
14 | panels/screen/Makefile |
15 | panels/screen/unity-screen-panel.desktop.in |
16 | +panels/screen-sharing/Makefile |
17 | +panels/screen-sharing/unity-screen-sharing-panel.desktop.in |
18 | panels/info/Makefile |
19 | panels/info/unity-info-panel.desktop.in |
20 | panels/power/Makefile |
21 | |
22 | === modified file 'panels/Makefile.am' |
23 | --- panels/Makefile.am 2015-03-03 11:08:17 +0000 |
24 | +++ panels/Makefile.am 2017-12-14 13:03:07 +0000 |
25 | @@ -13,7 +13,8 @@ |
26 | keyboard \ |
27 | universal-access \ |
28 | user-accounts \ |
29 | - bluetooth |
30 | + bluetooth \ |
31 | + screen-sharing |
32 | |
33 | if BUILD_WACOM |
34 | SUBDIRS += wacom |
35 | |
36 | === added directory 'panels/screen-sharing' |
37 | === added file 'panels/screen-sharing/Makefile.am' |
38 | --- panels/screen-sharing/Makefile.am 1970-01-01 00:00:00 +0000 |
39 | +++ panels/screen-sharing/Makefile.am 2017-12-14 13:03:07 +0000 |
40 | @@ -0,0 +1,39 @@ |
41 | +# This is used in PANEL_CFLAGS |
42 | +cappletname = screen-sharing |
43 | + |
44 | +uidir = $(pkgdatadir)/ui/screen-sharing |
45 | +dist_ui_DATA = \ |
46 | + screen-sharing-panel.ui |
47 | + |
48 | +INCLUDES = \ |
49 | + $(PANEL_CFLAGS) \ |
50 | + $(SCREEN_SHARING_PANEL_CFLAGS) \ |
51 | + -DG_LOG_DOMAIN="\"$(PACKAGE)\"" \ |
52 | + -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
53 | + -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
54 | + $(NULL) |
55 | + |
56 | +ccpanelsdir = $(PANELS_DIR) |
57 | +ccpanels_LTLIBRARIES = libscreen-sharing.la |
58 | + |
59 | +libscreen_sharing_la_SOURCES = \ |
60 | + screen-sharing-module.c \ |
61 | + vino-message-box.c \ |
62 | + vino-message-box.h \ |
63 | + cc-screen-sharing-panel.c \ |
64 | + cc-screen-sharing-panel.h \ |
65 | + vino-radio-button.c \ |
66 | + vino-radio-button.h |
67 | + |
68 | +libscreen_sharing_la_LIBADD = $(PANEL_LIBS) $(SCREEN_SHARING_PANEL_LIBS) |
69 | +libscreen_sharing_la_LDFLAGS = $(PANEL_LDFLAGS) |
70 | + |
71 | +@INTLTOOL_DESKTOP_RULE@ |
72 | + |
73 | +desktopdir = $(datadir)/applications |
74 | +desktop_in_files = unity-screen-sharing-panel.desktop.in |
75 | +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) |
76 | + |
77 | +CLEANFILES = $(desktop_in_files) $(desktop_DATA) |
78 | + |
79 | +-include $(top_srcdir)/git.mk |
80 | |
81 | === added file 'panels/screen-sharing/cc-screen-sharing-panel.c' |
82 | --- panels/screen-sharing/cc-screen-sharing-panel.c 1970-01-01 00:00:00 +0000 |
83 | +++ panels/screen-sharing/cc-screen-sharing-panel.c 2017-12-14 13:03:07 +0000 |
84 | @@ -0,0 +1,315 @@ |
85 | +/* |
86 | + * Copyright (C) 2003 Sun Microsystems, Inc. |
87 | + * Copyright (C) 2006 Jonh Wendell <wendell@bani.com.br> |
88 | + * Copyright © 2010 Codethink Limited |
89 | + * |
90 | + * This program is free software; you can redistribute it and/or |
91 | + * modify it under the terms of the GNU General Public License as |
92 | + * published by the Free Software Foundation; either version 2 of the |
93 | + * License, or (at your option) any later version. |
94 | + * |
95 | + * This program is distributed in the hope that it will be useful, but |
96 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
97 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
98 | + * General Public License for more details. |
99 | + * |
100 | + * You should have received a copy of the GNU General Public License |
101 | + * along with this program; if not, write to the Free Software |
102 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
103 | + * 02111-1307, USA. |
104 | + * |
105 | + * Authors: |
106 | + * Mark McLoughlin <mark@skynet.ie> |
107 | + * Jonh Wendell <wendell@bani.com.br> |
108 | + * Ryan Lortie <desrt@desrt.ca> |
109 | + */ |
110 | + |
111 | +#include "config.h" |
112 | + |
113 | +#include "cc-screen-sharing-panel.h" |
114 | +#include "vino-radio-button.h" |
115 | +#include "vino-message-box.h" |
116 | + |
117 | +#include <glib/gi18n.h> |
118 | +#include <gtk/gtk.h> |
119 | +#include <shell/cc-panel.h> |
120 | + |
121 | +typedef struct |
122 | +{ |
123 | + CcPanel parent; |
124 | +} CcScreenSharingPanel; |
125 | + |
126 | +typedef struct |
127 | +{ |
128 | + CcPanelClass parent_class; |
129 | +} CcScreenSharingPanelClass; |
130 | + |
131 | +static GType cc_screen_sharing_panel_get_type (void); |
132 | + |
133 | +CC_PANEL_REGISTER (CcScreenSharingPanel, cc_screen_sharing_panel) |
134 | + |
135 | +#define VINO_SCHEMA_ID "org.gnome.Vino" |
136 | + |
137 | +/* We define three GSettings mappings here: |
138 | + * |
139 | + * First, a relatively boring boolean inversion mapping. |
140 | + */ |
141 | +static gboolean |
142 | +get_inverted (GValue *value, |
143 | + GVariant *variant, |
144 | + gpointer user_data) |
145 | +{ |
146 | + g_value_set_boolean (value, !g_variant_get_boolean (variant)); |
147 | + return TRUE; |
148 | +} |
149 | + |
150 | +static GVariant * |
151 | +set_inverted (const GValue *value, |
152 | + const GVariantType *type, |
153 | + gpointer user_data) |
154 | +{ |
155 | + return g_variant_new_boolean (!g_value_get_boolean (value)); |
156 | +} |
157 | + |
158 | +/* Next, one that maps between the array-of-strings list of |
159 | + * authentication mechanisms and a boolean that is FALSE if the 'none' |
160 | + * and TRUE otherwise (ie: for 'vnc' in the list). |
161 | + */ |
162 | +static gboolean |
163 | +get_authtype (GValue *value, |
164 | + GVariant *variant, |
165 | + gpointer user_data) |
166 | +{ |
167 | + GVariantIter iter; |
168 | + const gchar *type; |
169 | + |
170 | + g_variant_iter_init (&iter, variant); |
171 | + g_value_set_boolean (value, TRUE); |
172 | + |
173 | + while (g_variant_iter_next (&iter, "s", &type)) |
174 | + if (strcmp (type, "none") == 0) |
175 | + g_value_set_boolean (value, FALSE); |
176 | + |
177 | + return TRUE; |
178 | +} |
179 | + |
180 | +static GVariant * |
181 | +set_authtype (const GValue *value, |
182 | + const GVariantType *type, |
183 | + gpointer user_data) |
184 | +{ |
185 | + const gchar *authtype; |
186 | + |
187 | + if (g_value_get_boolean (value)) |
188 | + authtype = "vnc"; |
189 | + else |
190 | + authtype = "none"; |
191 | + |
192 | + return g_variant_new_strv (&authtype, 1); |
193 | +} |
194 | + |
195 | + |
196 | +/* Finally, a somewhat evil mapping for the password setting: |
197 | + * |
198 | + * If the setting is 'keyring' then we load the password from the |
199 | + * keyring. Else, it is assumed to be a base64-encoded string which is |
200 | + * the actual password. |
201 | + * |
202 | + * On setting the password, we always first try to use the keyring. If |
203 | + * that is successful we write 'keyring' to the settings. If it fails |
204 | + * then we base64-encode the password and write it to the settings. |
205 | + * |
206 | + * Doing it this way ensures that there is no ambiguity about what the |
207 | + * password is in the event that gnome-keyring becomes available then |
208 | + * unavailable again. |
209 | + */ |
210 | +static gboolean |
211 | +get_password (GValue *value, |
212 | + GVariant *variant, |
213 | + gpointer user_data) |
214 | +{ |
215 | + const gchar *setting; |
216 | + |
217 | + setting = g_variant_get_string (variant, NULL); |
218 | + |
219 | + if (strcmp (setting, "keyring") == 0) |
220 | + { |
221 | + /* "keyring" is the default value, even though vino doesn't support it at the moment */ |
222 | + g_value_set_static_string (value, ""); |
223 | + return TRUE; |
224 | + } |
225 | + else |
226 | + { |
227 | + gchar *decoded; |
228 | + gsize length; |
229 | + gboolean ok; |
230 | + |
231 | + decoded = (gchar *) g_base64_decode (setting, &length); |
232 | + |
233 | + if ((ok = g_utf8_validate (decoded, length, NULL))) |
234 | + g_value_take_string (value, g_strndup (decoded, length)); |
235 | + |
236 | + return ok; |
237 | + } |
238 | +} |
239 | + |
240 | +static GVariant * |
241 | +set_password (const GValue *value, |
242 | + const GVariantType *type, |
243 | + gpointer user_data) |
244 | +{ |
245 | + const gchar *string; |
246 | + gchar *base64; |
247 | + |
248 | + string = g_value_get_string (value); |
249 | + |
250 | + /* if that failed, store it in GSettings, base64 */ |
251 | + base64 = g_base64_encode ((guchar *) string, strlen (string)); |
252 | + return g_variant_new_from_data (G_VARIANT_TYPE_STRING, |
253 | + base64, strlen (base64) + 1, |
254 | + TRUE, g_free, base64); |
255 | +} |
256 | + |
257 | +typedef enum |
258 | +{ |
259 | + VINO_ICON_VISIBILITY_NEVER, |
260 | + VINO_ICON_VISIBILITY_ALWAYS, |
261 | + VINO_ICON_VISIBILITY_CLIENT |
262 | +} VinoIconVisibility; |
263 | + |
264 | +static gboolean |
265 | +get_icon_visibility (GValue *value, |
266 | + GVariant *variant, |
267 | + gpointer user_data) |
268 | +{ |
269 | + const char *setting; |
270 | + char *name; |
271 | + |
272 | + setting = g_variant_get_string (variant, NULL); |
273 | + |
274 | + g_object_get (user_data, "name", &name, NULL); |
275 | + |
276 | + /* If the button name matches the setting, it should be active. */ |
277 | + if (g_strcmp0 (name, setting) == 0) |
278 | + g_value_set_boolean (value, TRUE); |
279 | + |
280 | + g_free (name); |
281 | + |
282 | + return TRUE; |
283 | +} |
284 | + |
285 | +static GVariant * |
286 | +set_icon_visibility (const GValue *value, |
287 | + const GVariantType *type, |
288 | + gpointer user_data) |
289 | +{ |
290 | + GVariant *variant = NULL; |
291 | + char *name; |
292 | + |
293 | + /* Don't act unless the button has been activated (turned ON). */ |
294 | + if (!g_value_get_boolean (value)) |
295 | + return NULL; |
296 | + |
297 | + /* GtkToggleButton *button = GTK_TOGGLE_BUTTON(user_data); */ |
298 | + g_object_get (user_data, "name", &name, NULL); |
299 | + variant = g_variant_new_string (name); |
300 | + |
301 | + g_free (name); |
302 | + |
303 | + return variant; |
304 | +} |
305 | + |
306 | +static void |
307 | +cc_screen_sharing_panel_init (CcScreenSharingPanel *panel) |
308 | +{ |
309 | + struct { |
310 | + const gchar *setting; |
311 | + const gchar *name; |
312 | + const gchar *property; |
313 | + GSettingsBindFlags flags; |
314 | + GSettingsBindGetMapping get_mapping; |
315 | + GSettingsBindSetMapping set_mapping; |
316 | + } bindings[] = { |
317 | + { "enabled", "allowed_toggle", "active", G_SETTINGS_BIND_DEFAULT, NULL, NULL }, |
318 | + |
319 | + { "enabled", "control_settings", "sensitive", G_SETTINGS_BIND_GET, NULL, NULL }, |
320 | + { "view-only", "view_only_toggle", "active", G_SETTINGS_BIND_DEFAULT, get_inverted, set_inverted }, |
321 | + |
322 | + { "enabled", "security_settings", "sensitive", G_SETTINGS_BIND_GET, NULL, NULL }, |
323 | + { "prompt-enabled", "prompt_enabled_toggle", "active", G_SETTINGS_BIND_DEFAULT, NULL, NULL }, |
324 | + { "authentication-methods", "password_toggle", "active", G_SETTINGS_BIND_DEFAULT, get_authtype, set_authtype }, |
325 | + { "authentication-methods", "password_box", "sensitive", G_SETTINGS_BIND_GET, get_authtype, NULL }, |
326 | + { "vnc-password", "password_entry", "text", G_SETTINGS_BIND_DEFAULT, get_password, set_password }, |
327 | + { "use-upnp", "use_upnp_toggle", "active", G_SETTINGS_BIND_DEFAULT, NULL, NULL }, |
328 | + |
329 | + { "enabled", "notification_settings", "sensitive", G_SETTINGS_BIND_GET, NULL, NULL }, |
330 | + |
331 | + { "icon-visibility", "icon_always_radio", "active", G_SETTINGS_BIND_DEFAULT, get_icon_visibility, set_icon_visibility }, |
332 | + { "icon-visibility", "icon_client_radio", "active", G_SETTINGS_BIND_DEFAULT, get_icon_visibility, set_icon_visibility }, |
333 | + { "icon-visibility", "icon_never_radio", "active", G_SETTINGS_BIND_DEFAULT, get_icon_visibility, set_icon_visibility } |
334 | + }; |
335 | + GSettingsSchemaSource *source; |
336 | + |
337 | + source = g_settings_schema_source_get_default (); |
338 | + if (source && g_settings_schema_source_lookup (source, VINO_SCHEMA_ID, TRUE)) |
339 | + { |
340 | + GError *error = NULL; |
341 | + GtkBuilder *builder; |
342 | + GSettings *settings; |
343 | + gint i; |
344 | + |
345 | + vino_radio_button_get_type (); |
346 | + vino_message_box_get_type (); |
347 | + |
348 | + builder = gtk_builder_new (); |
349 | + if (!gtk_builder_add_from_file (builder, GNOMECC_UI_DIR "/screen-sharing-panel.ui", &error)) |
350 | + { |
351 | + g_warning ("Unable to load interface file: %s", error->message); |
352 | + g_error_free (error); |
353 | + } |
354 | + gtk_widget_reparent (GTK_WIDGET (gtk_builder_get_object (builder, "screen_sharing_vbox")), GTK_WIDGET (panel)); |
355 | + |
356 | + settings = g_settings_new (VINO_SCHEMA_ID); |
357 | + |
358 | + for (i = 0; i < G_N_ELEMENTS (bindings); i++) |
359 | + { |
360 | + GObject *object = gtk_builder_get_object (builder, bindings[i].name); |
361 | + g_settings_bind_with_mapping (settings, bindings[i].setting, |
362 | + object, |
363 | + bindings[i].property, |
364 | + bindings[i].flags, |
365 | + bindings[i].get_mapping, |
366 | + bindings[i].set_mapping, |
367 | + object, NULL); |
368 | + } |
369 | + |
370 | + g_object_unref (settings); |
371 | + g_object_unref (builder); |
372 | + } |
373 | + else |
374 | + { |
375 | + GtkWidget *label; |
376 | + gchar *text; |
377 | + |
378 | + label = gtk_label_new (NULL); |
379 | + text = g_strdup_printf ("<big>%s</big>", _("Desktop sharing support not installed")); |
380 | + gtk_label_set_markup (GTK_LABEL (label), text); |
381 | + g_free (text); |
382 | + gtk_widget_show (label); |
383 | + gtk_container_add (GTK_CONTAINER (panel), label); |
384 | + } |
385 | +} |
386 | + |
387 | +static void |
388 | +cc_screen_sharing_panel_class_init (CcScreenSharingPanelClass *class) |
389 | +{ |
390 | +} |
391 | + |
392 | +void |
393 | +cc_screen_sharing_panel_register (GIOModule *module) |
394 | +{ |
395 | + cc_screen_sharing_panel_register_type (G_TYPE_MODULE (module)); |
396 | + g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT, |
397 | + cc_screen_sharing_panel_get_type (), |
398 | + "screen-sharing", 0); |
399 | +} |
400 | |
401 | === added file 'panels/screen-sharing/cc-screen-sharing-panel.h' |
402 | --- panels/screen-sharing/cc-screen-sharing-panel.h 1970-01-01 00:00:00 +0000 |
403 | +++ panels/screen-sharing/cc-screen-sharing-panel.h 2017-12-14 13:03:07 +0000 |
404 | @@ -0,0 +1,29 @@ |
405 | +/* |
406 | + * Copyright © 2010 Codethink Limited |
407 | + * |
408 | + * This program is free software; you can redistribute it and/or |
409 | + * modify it under the terms of the GNU General Public License as |
410 | + * published by the Free Software Foundation; either version 2 of the |
411 | + * License, or (at your option) any later version. |
412 | + * |
413 | + * This program is distributed in the hope that it will be useful, but |
414 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
415 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
416 | + * General Public License for more details. |
417 | + * |
418 | + * You should have received a copy of the GNU General Public License |
419 | + * along with this program; if not, write to the Free Software |
420 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
421 | + * 02111-1307, USA. |
422 | + * |
423 | + * Author: Ryan Lortie <desrt@desrt.ca> |
424 | + */ |
425 | + |
426 | +#ifndef __vino_preferences_h__ |
427 | +#define __vino_preferences_h__ |
428 | + |
429 | +#include <shell/cc-panel.h> |
430 | + |
431 | +void cc_screen_sharing_panel_register (GIOModule *module); |
432 | + |
433 | +#endif /* __vino_preferences_h__ */ |
434 | |
435 | === added file 'panels/screen-sharing/screen-sharing-module.c' |
436 | --- panels/screen-sharing/screen-sharing-module.c 1970-01-01 00:00:00 +0000 |
437 | +++ panels/screen-sharing/screen-sharing-module.c 2017-12-14 13:03:07 +0000 |
438 | @@ -0,0 +1,41 @@ |
439 | +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- |
440 | + * |
441 | + * Copyright (C) 2010 Red Hat, Inc |
442 | + * |
443 | + * This program is free software; you can redistribute it and/or modify |
444 | + * it under the terms of the GNU General Public License as published by |
445 | + * the Free Software Foundation; either version 2 of the License, or |
446 | + * (at your option) any later version. |
447 | + * |
448 | + * This program is distributed in the hope that it will be useful, |
449 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
450 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
451 | + * GNU General Public License for more details. |
452 | + * |
453 | + * You should have received a copy of the GNU General Public License |
454 | + * along with this program; if not, write to the Free Software |
455 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
456 | + * |
457 | + * |
458 | + */ |
459 | + |
460 | +#include <config.h> |
461 | + |
462 | +#include "cc-screen-sharing-panel.h" |
463 | + |
464 | +#include <glib/gi18n-lib.h> |
465 | + |
466 | +void |
467 | +g_io_module_load (GIOModule *module) |
468 | +{ |
469 | + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); |
470 | + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
471 | + |
472 | + /* register the panel */ |
473 | + cc_screen_sharing_panel_register (module); |
474 | +} |
475 | + |
476 | +void |
477 | +g_io_module_unload (GIOModule *module) |
478 | +{ |
479 | +} |
480 | |
481 | === added file 'panels/screen-sharing/screen-sharing-panel.ui' |
482 | --- panels/screen-sharing/screen-sharing-panel.ui 1970-01-01 00:00:00 +0000 |
483 | +++ panels/screen-sharing/screen-sharing-panel.ui 2017-12-14 13:03:07 +0000 |
484 | @@ -0,0 +1,400 @@ |
485 | +<?xml version="1.0"?> |
486 | +<interface> |
487 | + <requires lib="gtk+" version="2.16"/> |
488 | + <!-- interface-naming-policy toplevel-contextual --> |
489 | + <object class="GtkWindow" id="window1"> |
490 | + <child> |
491 | + <object class="GtkBox" id="screen_sharing_vbox"> |
492 | + <property name="visible">True</property> |
493 | + <property name="orientation">vertical</property> |
494 | + <property name="spacing">6</property> |
495 | + <child> |
496 | + <object class="GtkBox" id="vbox1"> |
497 | + <property name="visible">True</property> |
498 | + <property name="orientation">vertical</property> |
499 | + <property name="border_width">6</property> |
500 | + <property name="spacing">18</property> |
501 | + <child> |
502 | + <object class="GtkBox" id="sharing_box"> |
503 | + <property name="visible">True</property> |
504 | + <property name="orientation">vertical</property> |
505 | + <property name="spacing">6</property> |
506 | + <child> |
507 | + <object class="GtkLabel" id="label1"> |
508 | + <property name="visible">True</property> |
509 | + <property name="xalign">0</property> |
510 | + <property name="label" translatable="yes">Sharing</property> |
511 | + <attributes> |
512 | + <attribute name="weight" value="bold"/> |
513 | + </attributes> |
514 | + </object> |
515 | + <packing> |
516 | + <property name="position">0</property> |
517 | + </packing> |
518 | + </child> |
519 | + <child> |
520 | + <object class="GtkBox" id="writability_warning"> |
521 | + <property name="orientation">horizontal</property> |
522 | + <property name="no_show_all">True</property> |
523 | + <property name="border_width">3</property> |
524 | + <property name="spacing">6</property> |
525 | + <child> |
526 | + <object class="GtkLabel" id="label6"> |
527 | + <property name="visible">True</property> |
528 | + <property name="label"> </property> |
529 | + </object> |
530 | + <packing> |
531 | + <property name="expand">False</property> |
532 | + <property name="fill">False</property> |
533 | + <property name="position">0</property> |
534 | + </packing> |
535 | + </child> |
536 | + <child> |
537 | + <object class="GtkImage" id="image1"> |
538 | + <property name="visible">True</property> |
539 | + <property name="stock">gtk-dialog-warning</property> |
540 | + </object> |
541 | + <packing> |
542 | + <property name="expand">False</property> |
543 | + <property name="position">1</property> |
544 | + </packing> |
545 | + </child> |
546 | + <child> |
547 | + <object class="GtkLabel" id="label8"> |
548 | + <property name="visible">True</property> |
549 | + <property name="label" translatable="yes">Some of these preferences are locked down</property> |
550 | + <attributes> |
551 | + <attribute name="style" value="italic"/> |
552 | + </attributes> |
553 | + </object> |
554 | + <packing> |
555 | + <property name="expand">False</property> |
556 | + <property name="fill">False</property> |
557 | + <property name="position">2</property> |
558 | + </packing> |
559 | + </child> |
560 | + </object> |
561 | + <packing> |
562 | + <property name="position">1</property> |
563 | + </packing> |
564 | + </child> |
565 | + <child> |
566 | + <object class="GtkBox" id="hbox1"> |
567 | + <property name="visible">True</property> |
568 | + <property name="orientation">horizontal</property> |
569 | + <child> |
570 | + <object class="GtkLabel" id="label2"> |
571 | + <property name="visible">True</property> |
572 | + <property name="label"> </property> |
573 | + </object> |
574 | + <packing> |
575 | + <property name="expand">False</property> |
576 | + <property name="fill">False</property> |
577 | + <property name="position">0</property> |
578 | + </packing> |
579 | + </child> |
580 | + <child> |
581 | + <object class="GtkCheckButton" id="allowed_toggle"> |
582 | + <property name="label" translatable="yes">Allow other users to _view your desktop</property> |
583 | + <property name="visible">True</property> |
584 | + <property name="can_focus">True</property> |
585 | + <property name="receives_default">False</property> |
586 | + <property name="has_tooltip">True</property> |
587 | + <property name="tooltip_text" translatable="yes">Your desktop will be shared</property> |
588 | + <property name="use_underline">True</property> |
589 | + <property name="draw_indicator">True</property> |
590 | + </object> |
591 | + <packing> |
592 | + <property name="position">1</property> |
593 | + </packing> |
594 | + </child> |
595 | + </object> |
596 | + <packing> |
597 | + <property name="position">2</property> |
598 | + </packing> |
599 | + </child> |
600 | + <child> |
601 | + <object class="GtkBox" id="control_settings"> |
602 | + <property name="visible">True</property> |
603 | + <property name="orientation">horizontal</property> |
604 | + <child> |
605 | + <object class="GtkLabel" id="label3"> |
606 | + <property name="visible">True</property> |
607 | + <property name="label"> </property> |
608 | + </object> |
609 | + <packing> |
610 | + <property name="expand">False</property> |
611 | + <property name="fill">False</property> |
612 | + <property name="position">0</property> |
613 | + </packing> |
614 | + </child> |
615 | + <child> |
616 | + <object class="GtkCheckButton" id="view_only_toggle"> |
617 | + <property name="label" translatable="yes">_Allow other users to control your desktop</property> |
618 | + <property name="visible">True</property> |
619 | + <property name="can_focus">True</property> |
620 | + <property name="receives_default">False</property> |
621 | + <property name="has_tooltip">True</property> |
622 | + <property name="tooltip_text" translatable="yes">Remote users are able to control your mouse and keyboard</property> |
623 | + <property name="use_underline">True</property> |
624 | + <property name="draw_indicator">True</property> |
625 | + </object> |
626 | + <packing> |
627 | + <property name="position">1</property> |
628 | + </packing> |
629 | + </child> |
630 | + </object> |
631 | + <packing> |
632 | + <property name="position">3</property> |
633 | + </packing> |
634 | + </child> |
635 | + <!-- |
636 | + <child> |
637 | + <object class="GtkBox" id="message_box"> |
638 | + <property name="visible">True</property> |
639 | + <property name="orientation">horizontal</property> |
640 | + <child> |
641 | + <object class="GtkLabel" id="label14"> |
642 | + <property name="visible">True</property> |
643 | + <property name="label"> </property> |
644 | + </object> |
645 | + <packing> |
646 | + <property name="expand">False</property> |
647 | + <property name="fill">False</property> |
648 | + <property name="position">0</property> |
649 | + </packing> |
650 | + </child> |
651 | + <child> |
652 | + <object class="VinoMessageBox" id="message"> |
653 | + <property name="visible">True</property> |
654 | + </object> |
655 | + <packing> |
656 | + <property name="position">1</property> |
657 | + </packing> |
658 | + </child> |
659 | + </object> |
660 | + <packing> |
661 | + <property name="position">4</property> |
662 | + </packing> |
663 | + </child> |
664 | + --> |
665 | + </object> |
666 | + <packing> |
667 | + <property name="position">0</property> |
668 | + </packing> |
669 | + </child> |
670 | + <child> |
671 | + <object class="GtkBox" id="security_box"> |
672 | + <property name="visible">True</property> |
673 | + <property name="orientation">vertical</property> |
674 | + <property name="spacing">6</property> |
675 | + <child> |
676 | + <object class="GtkLabel" id="label4"> |
677 | + <property name="visible">True</property> |
678 | + <property name="xalign">0</property> |
679 | + <property name="label" translatable="yes">Security</property> |
680 | + <attributes> |
681 | + <attribute name="weight" value="bold"/> |
682 | + </attributes> |
683 | + </object> |
684 | + <packing> |
685 | + <property name="position">0</property> |
686 | + </packing> |
687 | + </child> |
688 | + <child> |
689 | + <object class="GtkBox" id="hbox3"> |
690 | + <property name="visible">True</property> |
691 | + <property name="orientation">horizontal</property> |
692 | + <child> |
693 | + <object class="GtkBox" id="security_settings"> |
694 | + <property name="visible">True</property> |
695 | + <property name="orientation">vertical</property> |
696 | + <property name="spacing">6</property> |
697 | + <child> |
698 | + <object class="GtkCheckButton" id="prompt_enabled_toggle"> |
699 | + <property name="label" translatable="yes">_You must confirm each access to this machine</property> |
700 | + <property name="visible">True</property> |
701 | + <property name="can_focus">True</property> |
702 | + <property name="receives_default">False</property> |
703 | + <property name="use_underline">True</property> |
704 | + <property name="draw_indicator">True</property> |
705 | + </object> |
706 | + <packing> |
707 | + <property name="position">0</property> |
708 | + </packing> |
709 | + </child> |
710 | + <child> |
711 | + <object class="GtkBox" id="hbox4"> |
712 | + <property name="visible">True</property> |
713 | + <property name="orientation">horizontal</property> |
714 | + <property name="spacing">12</property> |
715 | + <child> |
716 | + <object class="GtkCheckButton" id="password_toggle"> |
717 | + <property name="label" translatable="yes">_Require the user to enter this password:</property> |
718 | + <property name="visible">True</property> |
719 | + <property name="can_focus">True</property> |
720 | + <property name="receives_default">False</property> |
721 | + <property name="use_underline">True</property> |
722 | + <property name="draw_indicator">True</property> |
723 | + </object> |
724 | + <packing> |
725 | + <property name="expand">False</property> |
726 | + <property name="position">0</property> |
727 | + </packing> |
728 | + </child> |
729 | + <child> |
730 | + <object class="GtkBox" id="password_box"> |
731 | + <property name="visible">True</property> |
732 | + <property name="orientation">horizontal</property> |
733 | + <child> |
734 | + <object class="GtkEntry" id="password_entry"> |
735 | + <property name="visible">True</property> |
736 | + <property name="can_focus">True</property> |
737 | + <property name="max_length">8</property> |
738 | + <property name="visibility">False</property> |
739 | + <property name="invisible_char">●</property> |
740 | + </object> |
741 | + <packing> |
742 | + <property name="position">1</property> |
743 | + </packing> |
744 | + </child> |
745 | + </object> |
746 | + <packing> |
747 | + <property name="position">1</property> |
748 | + </packing> |
749 | + </child> |
750 | + </object> |
751 | + <packing> |
752 | + <property name="position">1</property> |
753 | + </packing> |
754 | + </child> |
755 | + <child> |
756 | + <object class="GtkCheckButton" id="use_upnp_toggle"> |
757 | + <property name="label" translatable="yes">Automatically _configure UPnP router to open and forward ports</property> |
758 | + <property name="visible">True</property> |
759 | + <property name="can_focus">True</property> |
760 | + <property name="receives_default">False</property> |
761 | + <property name="has_tooltip">True</property> |
762 | + <property name="tooltip_text" translatable="yes">The router must have the UPnP feature enabled</property> |
763 | + <property name="use_underline">True</property> |
764 | + <property name="draw_indicator">True</property> |
765 | + </object> |
766 | + <packing> |
767 | + <property name="position">2</property> |
768 | + </packing> |
769 | + </child> |
770 | + </object> |
771 | + <packing> |
772 | + <property name="padding">12</property> |
773 | + <property name="position">0</property> |
774 | + </packing> |
775 | + </child> |
776 | + </object> |
777 | + <packing> |
778 | + <property name="position">1</property> |
779 | + </packing> |
780 | + </child> |
781 | + </object> |
782 | + <packing> |
783 | + <property name="position">1</property> |
784 | + </packing> |
785 | + </child> |
786 | + <child> |
787 | + <object class="GtkBox" id="notification_box"> |
788 | + <property name="visible">True</property> |
789 | + <property name="orientation">vertical</property> |
790 | + <property name="spacing">6</property> |
791 | + <child> |
792 | + <object class="GtkLabel" id="label12"> |
793 | + <property name="visible">True</property> |
794 | + <property name="xalign">0</property> |
795 | + <property name="label" translatable="yes">Show Notification Area Icon</property> |
796 | + <attributes> |
797 | + <attribute name="weight" value="bold"/> |
798 | + </attributes> |
799 | + </object> |
800 | + <packing> |
801 | + <property name="position">0</property> |
802 | + </packing> |
803 | + </child> |
804 | + <child> |
805 | + <object class="GtkBox" id="hbox8"> |
806 | + <property name="visible">True</property> |
807 | + <property name="orientation">horizontal</property> |
808 | + <child> |
809 | + <object class="GtkBox" id="notification_settings"> |
810 | + <property name="visible">True</property> |
811 | + <property name="orientation">vertical</property> |
812 | + <property name="spacing">3</property> |
813 | + <child> |
814 | + <object class="VinoRadioButton" id="icon_always_radio"> |
815 | + <property name='name'>always</property> |
816 | + <property name="label" translatable="yes">Al_ways</property> |
817 | + <property name="visible">True</property> |
818 | + <property name="can_focus">True</property> |
819 | + <property name="receives_default">False</property> |
820 | + <property name="use_underline">True</property> |
821 | + <property name="active">True</property> |
822 | + <property name="draw_indicator">True</property> |
823 | + </object> |
824 | + <packing> |
825 | + <property name="position">0</property> |
826 | + </packing> |
827 | + </child> |
828 | + <child> |
829 | + <object class="VinoRadioButton" id="icon_client_radio"> |
830 | + <property name='name'>client</property> |
831 | + <property name="label" translatable="yes">_Only when someone is connected</property> |
832 | + <property name="visible">True</property> |
833 | + <property name="can_focus">True</property> |
834 | + <property name="receives_default">False</property> |
835 | + <property name="use_underline">True</property> |
836 | + <property name="active">True</property> |
837 | + <property name="draw_indicator">True</property> |
838 | + <property name="group">icon_always_radio</property> |
839 | + </object> |
840 | + <packing> |
841 | + <property name="position">1</property> |
842 | + </packing> |
843 | + </child> |
844 | + <child> |
845 | + <object class="VinoRadioButton" id="icon_never_radio"> |
846 | + <property name='name'>never</property> |
847 | + <property name="label" translatable="yes">_Never</property> |
848 | + <property name="visible">True</property> |
849 | + <property name="can_focus">True</property> |
850 | + <property name="receives_default">False</property> |
851 | + <property name="use_underline">True</property> |
852 | + <property name="active">True</property> |
853 | + <property name="draw_indicator">True</property> |
854 | + <property name="group">icon_always_radio</property> |
855 | + </object> |
856 | + <packing> |
857 | + <property name="position">2</property> |
858 | + </packing> |
859 | + </child> |
860 | + </object> |
861 | + <packing> |
862 | + <property name="padding">12</property> |
863 | + <property name="position">0</property> |
864 | + </packing> |
865 | + </child> |
866 | + </object> |
867 | + <packing> |
868 | + <property name="position">1</property> |
869 | + </packing> |
870 | + </child> |
871 | + </object> |
872 | + <packing> |
873 | + <property name="position">2</property> |
874 | + </packing> |
875 | + </child> |
876 | + </object> |
877 | + <packing> |
878 | + <property name="position">1</property> |
879 | + </packing> |
880 | + </child> |
881 | + </object> |
882 | + </child> |
883 | + </object> |
884 | +</interface> |
885 | |
886 | === added file 'panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in' |
887 | --- panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in 1970-01-01 00:00:00 +0000 |
888 | +++ panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in 2017-12-14 13:03:07 +0000 |
889 | @@ -0,0 +1,13 @@ |
890 | +[Desktop Entry] |
891 | +_Name=Desktop Sharing |
892 | +_Comment=Choose how other users can remotely view your desktop |
893 | +Exec=unity-control-center screen-sharing |
894 | +Icon=preferences-desktop-remote-desktop |
895 | +Terminal=false |
896 | +Type=Application |
897 | +StartupNotify=true |
898 | +Categories=GNOME;GTK;Settings;DesktopSettings;X-Unity-Settings-Panel;X-GNOME-PersonalSettings |
899 | +OnlyShowIn=Unity; |
900 | +X-Unity-Settings-Panel=screen-sharing |
901 | +# Translators: those are keywords for the screen sharing control-center panel |
902 | +_Keywords=Screen;Sharing;Remote;Desktop;VNC |
903 | |
904 | === added file 'panels/screen-sharing/vino-message-box.c' |
905 | --- panels/screen-sharing/vino-message-box.c 1970-01-01 00:00:00 +0000 |
906 | +++ panels/screen-sharing/vino-message-box.c 2017-12-14 13:03:07 +0000 |
907 | @@ -0,0 +1,156 @@ |
908 | +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ |
909 | +/* |
910 | + * vino-message-box.c |
911 | + * Copyright (C) Jonh Wendell 2009 <wendell@bani.com.br> |
912 | + * |
913 | + * vino-message-box.c is free software: you can redistribute it and/or modify it |
914 | + * under the terms of the GNU General Public License as published by the |
915 | + * Free Software Foundation, either version 2 of the License, or |
916 | + * (at your option) any later version. |
917 | + * |
918 | + * vino-message-box.c is distributed in the hope that it will be useful, but |
919 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
920 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
921 | + * See the GNU General Public License for more details. |
922 | + * |
923 | + * You should have received a copy of the GNU General Public License along |
924 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
925 | + */ |
926 | + |
927 | +#include <config.h> |
928 | +#include <glib/gi18n.h> |
929 | +#include "vino-message-box.h" |
930 | + |
931 | +struct _VinoMessageBoxPrivate |
932 | +{ |
933 | + GtkWidget *main_hbox; |
934 | + GtkWidget *label; |
935 | + GtkWidget *image; |
936 | +}; |
937 | + |
938 | +G_DEFINE_TYPE (VinoMessageBox, vino_message_box, GTK_TYPE_INFO_BAR); |
939 | + |
940 | +static void |
941 | +url_activated_cb(GtkWidget *url_label, const gchar *url) |
942 | +{ |
943 | + GError *error; |
944 | + GdkScreen *screen; |
945 | + gchar *mailto; |
946 | + |
947 | + error = NULL; |
948 | + screen = gtk_widget_get_screen (url_label); |
949 | + mailto = g_strdup_printf ("mailto:?Body=%s", url); |
950 | + |
951 | + if (!gtk_show_uri (screen, mailto, GDK_CURRENT_TIME, &error)) |
952 | + { |
953 | + GtkWidget *message_dialog, *parent; |
954 | + |
955 | + parent = gtk_widget_get_toplevel (GTK_WIDGET (url_label)); |
956 | + if (!GTK_IS_WINDOW (parent)) |
957 | + parent = NULL; |
958 | + message_dialog = gtk_message_dialog_new (GTK_WINDOW (parent), |
959 | + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, |
960 | + GTK_MESSAGE_ERROR, |
961 | + GTK_BUTTONS_CLOSE, |
962 | + _("There was an error showing the URL \"%s\""), |
963 | + url); |
964 | + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog), |
965 | + "%s", |
966 | + error->message); |
967 | + |
968 | + gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE); |
969 | + |
970 | + g_signal_connect (message_dialog, "response", |
971 | + G_CALLBACK (gtk_widget_destroy), |
972 | + NULL); |
973 | + |
974 | + gtk_widget_show (message_dialog); |
975 | + g_error_free (error); |
976 | + } |
977 | + |
978 | + g_free (mailto); |
979 | +} |
980 | + |
981 | +static void |
982 | +vino_message_box_init (VinoMessageBox *box) |
983 | +{ |
984 | + box->priv = G_TYPE_INSTANCE_GET_PRIVATE (box, VINO_TYPE_MESSAGE_BOX, VinoMessageBoxPrivate); |
985 | + |
986 | + box->priv->main_hbox = gtk_info_bar_get_content_area (GTK_INFO_BAR (box)); |
987 | + box->priv->image = NULL; |
988 | + |
989 | + box->priv->label = gtk_label_new (NULL); |
990 | + gtk_misc_set_alignment (GTK_MISC (box->priv->label), 0.0, 0.0); |
991 | + gtk_label_set_line_wrap (GTK_LABEL (box->priv->label), TRUE); |
992 | + gtk_label_set_selectable (GTK_LABEL (box->priv->label), TRUE); |
993 | + g_signal_connect (box->priv->label, |
994 | + "activate-link", |
995 | + G_CALLBACK (url_activated_cb), |
996 | + NULL); |
997 | + |
998 | + gtk_widget_show (box->priv->label); |
999 | + gtk_info_bar_set_message_type (GTK_INFO_BAR (box), GTK_MESSAGE_INFO); |
1000 | + gtk_container_add (GTK_CONTAINER (box->priv->main_hbox), box->priv->label); |
1001 | +} |
1002 | + |
1003 | +static void |
1004 | +vino_message_box_finalize (GObject *object) |
1005 | +{ |
1006 | + /* TODO: Add deinitalization code here */ |
1007 | + |
1008 | + G_OBJECT_CLASS (vino_message_box_parent_class)->finalize (object); |
1009 | +} |
1010 | + |
1011 | +static void |
1012 | +vino_message_box_class_init (VinoMessageBoxClass *klass) |
1013 | +{ |
1014 | + GObjectClass* object_class = G_OBJECT_CLASS (klass); |
1015 | + |
1016 | + object_class->finalize = vino_message_box_finalize; |
1017 | + g_type_class_add_private (object_class, sizeof(VinoMessageBoxPrivate)); |
1018 | +} |
1019 | + |
1020 | +GtkWidget * |
1021 | +vino_message_box_new (void) |
1022 | +{ |
1023 | + return GTK_WIDGET (g_object_new (VINO_TYPE_MESSAGE_BOX, NULL)); |
1024 | +} |
1025 | + |
1026 | +void |
1027 | +vino_message_box_set_label (VinoMessageBox *box, const gchar *label) |
1028 | +{ |
1029 | + g_return_if_fail (VINO_IS_MESSAGE_BOX (box)); |
1030 | + |
1031 | + gtk_label_set_markup (GTK_LABEL (box->priv->label), label); |
1032 | +} |
1033 | + |
1034 | +void |
1035 | +vino_message_box_show_image (VinoMessageBox *box) |
1036 | +{ |
1037 | + g_return_if_fail (VINO_IS_MESSAGE_BOX (box)); |
1038 | + |
1039 | + if (box->priv->image) |
1040 | + { |
1041 | + gtk_widget_destroy (box->priv->image); |
1042 | + box->priv->image = NULL; |
1043 | + } |
1044 | + |
1045 | + |
1046 | + box->priv->image = gtk_spinner_new (); |
1047 | + gtk_spinner_start (GTK_SPINNER (box->priv->image)); |
1048 | + |
1049 | + gtk_box_pack_start (GTK_BOX (box->priv->main_hbox), box->priv->image, FALSE, FALSE, 2); |
1050 | + gtk_box_reorder_child (GTK_BOX (box->priv->main_hbox), box->priv->image, 0); |
1051 | + gtk_widget_show (box->priv->image); |
1052 | +} |
1053 | + |
1054 | +void |
1055 | +vino_message_box_hide_image (VinoMessageBox *box) |
1056 | +{ |
1057 | + g_return_if_fail (VINO_IS_MESSAGE_BOX (box)); |
1058 | + |
1059 | + if (box->priv->image) |
1060 | + gtk_widget_destroy (box->priv->image); |
1061 | + box->priv->image = NULL; |
1062 | +} |
1063 | + |
1064 | |
1065 | === added file 'panels/screen-sharing/vino-message-box.h' |
1066 | --- panels/screen-sharing/vino-message-box.h 1970-01-01 00:00:00 +0000 |
1067 | +++ panels/screen-sharing/vino-message-box.h 2017-12-14 13:03:07 +0000 |
1068 | @@ -0,0 +1,59 @@ |
1069 | +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ |
1070 | +/* |
1071 | + * vino-message-box.c |
1072 | + * Copyright (C) Jonh Wendell 2009 <wendell@bani.com.br> |
1073 | + * |
1074 | + * vino-message-box.c is free software: you can redistribute it and/or modify it |
1075 | + * under the terms of the GNU General Public License as published by the |
1076 | + * Free Software Foundation, either version 2 of the License, or |
1077 | + * (at your option) any later version. |
1078 | + * |
1079 | + * vino-message-box.c is distributed in the hope that it will be useful, but |
1080 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
1081 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
1082 | + * See the GNU General Public License for more details. |
1083 | + * |
1084 | + * You should have received a copy of the GNU General Public License along |
1085 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
1086 | + */ |
1087 | + |
1088 | +#ifndef _VINO_MESSAGE_BOX_H_ |
1089 | +#define _VINO_MESSAGE_BOX_H_ |
1090 | + |
1091 | +#include <gtk/gtk.h> |
1092 | + |
1093 | +G_BEGIN_DECLS |
1094 | + |
1095 | +#define VINO_TYPE_MESSAGE_BOX (vino_message_box_get_type ()) |
1096 | +#define VINO_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VINO_TYPE_MESSAGE_BOX, VinoMessageBox)) |
1097 | +#define VINO_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VINO_TYPE_MESSAGE_BOX, VinoMessageBoxClass)) |
1098 | +#define VINO_IS_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VINO_TYPE_MESSAGE_BOX)) |
1099 | +#define VINO_IS_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VINO_TYPE_MESSAGE_BOX)) |
1100 | +#define VINO_MESSAGE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VINO_TYPE_MESSAGE_BOX, VinoMessageBoxClass)) |
1101 | + |
1102 | +typedef struct _VinoMessageBoxClass VinoMessageBoxClass; |
1103 | +typedef struct _VinoMessageBox VinoMessageBox; |
1104 | +typedef struct _VinoMessageBoxPrivate VinoMessageBoxPrivate; |
1105 | + |
1106 | +struct _VinoMessageBoxClass |
1107 | +{ |
1108 | + GtkInfoBarClass parent_class; |
1109 | +}; |
1110 | + |
1111 | +struct _VinoMessageBox |
1112 | +{ |
1113 | + GtkInfoBar parent_instance; |
1114 | + VinoMessageBoxPrivate *priv; |
1115 | +}; |
1116 | + |
1117 | +GType vino_message_box_get_type (void); |
1118 | + |
1119 | +GtkWidget *vino_message_box_new (void); |
1120 | + |
1121 | +void vino_message_box_set_label (VinoMessageBox *box, const gchar *label); |
1122 | +void vino_message_box_show_image (VinoMessageBox *box); |
1123 | +void vino_message_box_hide_image (VinoMessageBox *box); |
1124 | + |
1125 | +G_END_DECLS |
1126 | + |
1127 | +#endif /* _VINO_MESSAGE_BOX_H_ */ |
1128 | |
1129 | === added file 'panels/screen-sharing/vino-radio-button.c' |
1130 | --- panels/screen-sharing/vino-radio-button.c 1970-01-01 00:00:00 +0000 |
1131 | +++ panels/screen-sharing/vino-radio-button.c 2017-12-14 13:03:07 +0000 |
1132 | @@ -0,0 +1,181 @@ |
1133 | +/* |
1134 | + * Copyright © 2010 Codethink Limited |
1135 | + * |
1136 | + * This program is free software; you can redistribute it and/or |
1137 | + * modify it under the terms of the GNU General Public License as |
1138 | + * published by the Free Software Foundation; either version 2 of the |
1139 | + * License, or (at your option) any later version. |
1140 | + * |
1141 | + * This program is distributed in the hope that it will be useful, but |
1142 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
1143 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1144 | + * General Public License for more details. |
1145 | + * |
1146 | + * You should have received a copy of the GNU General Public License |
1147 | + * along with this program; if not, write to the Free Software |
1148 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
1149 | + * 02111-1307, USA. |
1150 | + * |
1151 | + * Author: Ryan Lortie <desrt@desrt.ca> |
1152 | + */ |
1153 | + |
1154 | +#include "vino-radio-button.h" |
1155 | + |
1156 | +#include <gtk/gtk.h> |
1157 | + |
1158 | +typedef struct |
1159 | +{ |
1160 | + GtkRadioButton parent_instance; |
1161 | + gchar *name; |
1162 | +} VinoRadioButton; |
1163 | + |
1164 | +typedef GtkRadioButtonClass VinoRadioButtonClass; |
1165 | + |
1166 | +G_DEFINE_TYPE (VinoRadioButton, vino_radio_button, GTK_TYPE_RADIO_BUTTON) |
1167 | + |
1168 | +enum |
1169 | +{ |
1170 | + PROP_0, |
1171 | + PROP_SETTINGS_NAME, |
1172 | + PROP_SETTINGS_ACTIVE |
1173 | +}; |
1174 | + |
1175 | +static void |
1176 | +vino_radio_button_get_property (GObject *object, guint prop_id, |
1177 | + GValue *value, GParamSpec *pspec) |
1178 | +{ |
1179 | + VinoRadioButton *vrb = (VinoRadioButton *) object; |
1180 | + |
1181 | + switch (prop_id) |
1182 | + { |
1183 | + case PROP_SETTINGS_ACTIVE: |
1184 | + { |
1185 | + const GSList *list; |
1186 | + |
1187 | + list = gtk_radio_button_get_group (&vrb->parent_instance); |
1188 | + while (list) |
1189 | + { |
1190 | + VinoRadioButton *this = list->data; |
1191 | + |
1192 | + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this))) |
1193 | + { |
1194 | + g_value_set_string (value, this->name); |
1195 | + return; |
1196 | + } |
1197 | + |
1198 | + list = list->next; |
1199 | + } |
1200 | + } |
1201 | + |
1202 | + g_warning ("No active radio buttons"); |
1203 | + g_value_set_string (value, ""); |
1204 | + return; |
1205 | + |
1206 | + default: |
1207 | + g_assert_not_reached (); |
1208 | + } |
1209 | +} |
1210 | + |
1211 | +static void |
1212 | +vino_radio_button_set_property (GObject *object, guint prop_id, |
1213 | + const GValue *value, GParamSpec *pspec) |
1214 | +{ |
1215 | + VinoRadioButton *vrb = (VinoRadioButton *) object; |
1216 | + |
1217 | + switch (prop_id) |
1218 | + { |
1219 | + case PROP_SETTINGS_NAME: |
1220 | + g_assert (vrb->name == NULL); |
1221 | + vrb->name = g_value_dup_string (value); |
1222 | + return; |
1223 | + |
1224 | + case PROP_SETTINGS_ACTIVE: |
1225 | + { |
1226 | + const GSList *list; |
1227 | + const gchar *name; |
1228 | + |
1229 | + list = gtk_radio_button_get_group (&vrb->parent_instance); |
1230 | + name = g_value_get_string (value); |
1231 | + |
1232 | + while (list) |
1233 | + { |
1234 | + VinoRadioButton *this = list->data; |
1235 | + |
1236 | + if (g_strcmp0 (this->name, name)) |
1237 | + { |
1238 | + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (this), |
1239 | + TRUE); |
1240 | + return; |
1241 | + } |
1242 | + |
1243 | + list = list->next; |
1244 | + } |
1245 | + |
1246 | + g_warning ("No such radio button named `%s'", name); |
1247 | + } |
1248 | + return; |
1249 | + |
1250 | + default: |
1251 | + g_assert_not_reached (); |
1252 | + } |
1253 | +} |
1254 | + |
1255 | +static void |
1256 | +vino_radio_button_toggled (GtkToggleButton *button) |
1257 | +{ |
1258 | + VinoRadioButton *vrb = (VinoRadioButton *) button; |
1259 | + |
1260 | + /* As it is, we get the notification of the old button becoming inactivity |
1261 | + * followed by the notification of the new button becoming active. Only run |
1262 | + * when the new button becomes active in order to avoid unnecessary |
1263 | + * notifications. |
1264 | + */ |
1265 | + if (gtk_toggle_button_get_active (button)) |
1266 | + { |
1267 | + const GSList *list; |
1268 | + |
1269 | + list = gtk_radio_button_get_group (&vrb->parent_instance); |
1270 | + while (list) |
1271 | + { |
1272 | + g_object_notify (list->data, "settings-active"); |
1273 | + list = list->next; |
1274 | + } |
1275 | + } |
1276 | +} |
1277 | + |
1278 | +static void |
1279 | +vino_radio_button_finalize (GObject *object) |
1280 | +{ |
1281 | + VinoRadioButton *vrb = (VinoRadioButton *) object; |
1282 | + |
1283 | + g_free (vrb->name); |
1284 | + |
1285 | + G_OBJECT_CLASS (vino_radio_button_parent_class) |
1286 | + ->finalize (object); |
1287 | +} |
1288 | + |
1289 | +static void |
1290 | +vino_radio_button_init (VinoRadioButton *button) |
1291 | +{ |
1292 | +} |
1293 | + |
1294 | +static void |
1295 | +vino_radio_button_class_init (GtkRadioButtonClass *class) |
1296 | +{ |
1297 | + GtkToggleButtonClass *tb_class = GTK_TOGGLE_BUTTON_CLASS (class); |
1298 | + GObjectClass *object_class = G_OBJECT_CLASS (class); |
1299 | + |
1300 | + tb_class->toggled = vino_radio_button_toggled; |
1301 | + object_class->get_property = vino_radio_button_get_property; |
1302 | + object_class->set_property = vino_radio_button_set_property; |
1303 | + object_class->finalize = vino_radio_button_finalize; |
1304 | + |
1305 | + g_object_class_install_property (object_class, PROP_SETTINGS_NAME, |
1306 | + g_param_spec_string ("settings-name", "name", "name", NULL, |
1307 | + G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | |
1308 | + G_PARAM_STATIC_STRINGS)); |
1309 | + |
1310 | + g_object_class_install_property (object_class, PROP_SETTINGS_ACTIVE, |
1311 | + g_param_spec_string ("settings-active", "active", "active", NULL, |
1312 | + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1313 | +} |
1314 | |
1315 | === added file 'panels/screen-sharing/vino-radio-button.h' |
1316 | --- panels/screen-sharing/vino-radio-button.h 1970-01-01 00:00:00 +0000 |
1317 | +++ panels/screen-sharing/vino-radio-button.h 2017-12-14 13:03:07 +0000 |
1318 | @@ -0,0 +1,29 @@ |
1319 | +/* |
1320 | + * Copyright © 2010 Codethink Limited |
1321 | + * |
1322 | + * This program is free software; you can redistribute it and/or |
1323 | + * modify it under the terms of the GNU General Public License as |
1324 | + * published by the Free Software Foundation; either version 2 of the |
1325 | + * License, or (at your option) any later version. |
1326 | + * |
1327 | + * This program is distributed in the hope that it will be useful, but |
1328 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
1329 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1330 | + * General Public License for more details. |
1331 | + * |
1332 | + * You should have received a copy of the GNU General Public License |
1333 | + * along with this program; if not, write to the Free Software |
1334 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
1335 | + * 02111-1307, USA. |
1336 | + * |
1337 | + * Author: Ryan Lortie <desrt@desrt.ca> |
1338 | + */ |
1339 | + |
1340 | +#ifndef __vino_radio_button_h__ |
1341 | +#define __vino_radio_button_h__ |
1342 | + |
1343 | +#include <glib-object.h> |
1344 | + |
1345 | +GType vino_radio_button_get_type (void); |
1346 | + |
1347 | +#endif /* __vino_radio_button_h__ */ |
1348 | |
1349 | === modified file 'po/POTFILES.in' |
1350 | --- po/POTFILES.in 2016-11-07 01:05:30 +0000 |
1351 | +++ po/POTFILES.in 2017-12-14 13:03:07 +0000 |
1352 | @@ -89,6 +89,10 @@ |
1353 | panels/region/gtkentryaccel.c |
1354 | panels/screen/unity-screen-panel.desktop.in.in |
1355 | [type: gettext/glade]panels/screen/screen.ui |
1356 | +panels/screen-sharing/vino-message-box.c |
1357 | +panels/screen-sharing/cc-screen-sharing-panel.c |
1358 | +panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in |
1359 | +[type: gettext/glade]panels/screen-sharing/cc-screen-sharing-panel.ui |
1360 | panels/sound/cc-sound-panel.c |
1361 | panels/sound/gvc-balance-bar.c |
1362 | panels/sound/gvc-channel-bar.c |
Thank you! Uploading…