Merge lp:~robert-ancell/unity-control-center/screen-sharing into lp:unity-control-center

Proposed by Robert Ancell
Status: Merged
Merge reported by: Jeremy Bícha
Merged at revision: not available
Proposed branch: lp:~robert-ancell/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:~robert-ancell/unity-control-center/screen-sharing
Reviewer Review Type Date Requested Status
Matthew Paul Thomas (community) design Needs Fixing
Sebastien Bacher Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226771@code.launchpad.net

Commit message

Add screen sharing panel to replace vino-preferences which is not available in Vino >= 3.10

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Matthew - can you review for design? This adds a new panel "Screen Sharing" into the personal category.

Upsides:
- Feature is now more discoverable - previously you'd have to search in the dash for it

Downsides:
- Another panel
- Panel shows even if Vino is uninstalled - does this matter?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks Robert, is that code copied from vino or is that the one used in newer g-c-c for their privacy controls?

I've no reviewed the changeset yet, but having it listed even when vino is not installed seems suboptimal. We could make u-c-c depends on vino but it could be that some corporate installations want to uninstall vnc...

Revision history for this message
Robert Ancell (robert-ancell) wrote :

It's the code copied from Vino. The new g-c-c panel combines a number of sharing options that aren't applicable for us as well as the modern g-c-c style that doesn't really fit into u-c-c.

Agreed always showing is suboptimal. If Vino is not installed it just displays "Screen sharing support not installed". I tried to make it hide the panel if Vino is not available but that doesn't seem possible. I also considered adding an install button that would install the packages (first waiting to see if others think this direction is the right one).

The other option is to keep the panel in the Vino package as a big patch, but I think that will be more work over putting it in u-c-c.

Revision history for this message
Sebastien Bacher (seb128) wrote :

The code changes look fine to me, I'm unsure the feature is important enough to justify it's own settings panel like that though ... let's wait for mpt to comment on that before merging it in

review: Approve
Revision history for this message
Matthew Paul Thomas (mpt) wrote :

Is it possible to review this change on Ubuntu 14.04? autogen.sh gives me errors "No package 'gsettings-desktop-schemas' found | No package 'libnotify' found", although "gsettings-desktop-schemas is already the newest version" and "E: Unable to locate package libnotify".

(If you link screenshots, please show the variations for when Vino both is and isn't installed.)

review: Needs Information (design)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Currently the system settings does not show any desktop sharing options [1]. Instead, you need to run the settings application [2] from the dash [3].

The proposal is to add a new panel to the system settings [4] [5]. If vino is no installed then this panel describes that [6].

[1] https://launchpadlibrarian.net/181103095/u-c-c-original.png
[2] https://launchpadlibrarian.net/181103152/vino-preferences.png
[3] https://launchpadlibrarian.net/181103119/dash-original.png
[4] https://launchpadlibrarian.net/181103180/u-c-c-sharing.png
[5] https://launchpadlibrarian.net/181103194/u-c-c-sharing-panel.png
[6] https://launchpadlibrarian.net/181103203/u-c-c-sharing-panel-uninstalled.png

Revision history for this message
Robert Ancell (robert-ancell) wrote :

We really should land this to unblock the vino update.

Revision history for this message
Sebastien Bacher (seb128) wrote :

is there anything in the vino update that makes us want to update? when I looked previously it was basically bringing nothing more that the simplifcation

Revision history for this message
Robert Ancell (robert-ancell) wrote :

It's a version that's supported upstream.
It has build fixes and removes old API usages which are likely to get harder to build against in the future.
It means we can drop a lot of patches we are carrying.
It means we are in sync with Debian.
It means it is easier to update when newer versions come out.
It means we're not blocking other users of Vino (e.g. Ubuntu GNOME).

What reason do we have not to update?

Revision history for this message
Iain Lane (laney) wrote :

The work's done, this MP is approved - why don't you get it in?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Well, the main motivation to not update is that we don't need to atm, the current version builds&works fine and there is no much work/cool new features we/GNOME remix are missing, and that the panel feels like a regression compared to the standalone preferences

I guess we could decide the advantages you listed outweight the cost of the user experience regression though, if that's how you feel I can you can go ahead and land the changes

I would still appreciate a review from mpt there before we land it, having a "sharing" panel the way GNOME has it would be ok since it wouldn't be as specific, having a panel only for "screen sharing" feels like putting that feature a bit much in front to me...

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

The Gnome System Settings designers seem to be in a period of confusion about whether to copy OS X or to copy iOS. The "Sharing" settings panel is the worst of both: combining settings for sharing wildly unrelated things in a single panel apparently because OS X does, and presenting them using a needlessly modal navigation list apparently because iOS does. I think it would be an extremely poor design to introduce to Ubuntu.

Sebastien is right that having a "Desktop Sharing" panel would be making that feature unusually prominent. Ideally I think it would be a tab of the "Displays" panel. But if the choice is between "Desktop Sharing" and the Gnome "Sharing" panel, I would strongly prefer the "Desktop Sharing" panel, renamed to "Screen Sharing" since it will eventually work on phones and tablets too.

"Desktop sharing support not installed" is an unhelpful message. I suggest instead something like "You need to install extra software to share your screen.", followed by a centered "Install Software…" button that invokes SessionInstaller to actually install it.

review: Needs Fixing (design)
12787. By Robert Ancell

Merge with trunk

Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Is this done for xenial?

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2015-02-12 14:09:23 +0000
+++ configure.ac 2015-07-05 22:39:29 +0000
@@ -160,6 +160,7 @@
160 $FCITX_MODULE160 $FCITX_MODULE
161 x11)161 x11)
162PKG_CHECK_MODULES(SCREEN_PANEL, $COMMON_MODULES)162PKG_CHECK_MODULES(SCREEN_PANEL, $COMMON_MODULES)
163PKG_CHECK_MODULES(SCREEN_SHARING_PANEL, $COMMON_MODULES)
163PKG_CHECK_MODULES(SOUND_PANEL, $COMMON_MODULES libxml-2.0164PKG_CHECK_MODULES(SOUND_PANEL, $COMMON_MODULES libxml-2.0
164 libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION165 libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION
165 libpulse >= $PA_REQUIRED_VERSION166 libpulse >= $PA_REQUIRED_VERSION
@@ -460,6 +461,8 @@
460panels/sound/data/icons/scalable/devices/Makefile461panels/sound/data/icons/scalable/devices/Makefile
461panels/screen/Makefile462panels/screen/Makefile
462panels/screen/unity-screen-panel.desktop.in463panels/screen/unity-screen-panel.desktop.in
464panels/screen-sharing/Makefile
465panels/screen-sharing/unity-screen-sharing-panel.desktop.in
463panels/info/Makefile466panels/info/Makefile
464panels/info/unity-info-panel.desktop.in467panels/info/unity-info-panel.desktop.in
465panels/power/Makefile468panels/power/Makefile
466469
=== modified file 'panels/Makefile.am'
--- panels/Makefile.am 2014-02-10 22:19:33 +0000
+++ panels/Makefile.am 2015-07-05 22:39:29 +0000
@@ -12,7 +12,8 @@
12 sound \12 sound \
13 keyboard \13 keyboard \
14 universal-access \14 universal-access \
15 user-accounts15 user-accounts \
16 screen-sharing
1617
17if BUILD_WACOM18if BUILD_WACOM
18SUBDIRS += wacom19SUBDIRS += wacom
1920
=== added directory 'panels/screen-sharing'
=== added file 'panels/screen-sharing/Makefile.am'
--- panels/screen-sharing/Makefile.am 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/Makefile.am 2015-07-05 22:39:29 +0000
@@ -0,0 +1,39 @@
1# This is used in PANEL_CFLAGS
2cappletname = screen-sharing
3
4uidir = $(pkgdatadir)/ui/screen-sharing
5dist_ui_DATA = \
6 screen-sharing-panel.ui
7
8INCLUDES = \
9 $(PANEL_CFLAGS) \
10 $(SCREEN_SHARING_PANEL_CFLAGS) \
11 -DG_LOG_DOMAIN="\"$(PACKAGE)\"" \
12 -DGNOMECC_UI_DIR="\"$(uidir)\"" \
13 -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
14 $(NULL)
15
16ccpanelsdir = $(PANELS_DIR)
17ccpanels_LTLIBRARIES = libscreen-sharing.la
18
19libscreen_sharing_la_SOURCES = \
20 screen-sharing-module.c \
21 vino-message-box.c \
22 vino-message-box.h \
23 cc-screen-sharing-panel.c \
24 cc-screen-sharing-panel.h \
25 vino-radio-button.c \
26 vino-radio-button.h
27
28libscreen_sharing_la_LIBADD = $(PANEL_LIBS) $(SCREEN_SHARING_PANEL_LIBS)
29libscreen_sharing_la_LDFLAGS = $(PANEL_LDFLAGS)
30
31@INTLTOOL_DESKTOP_RULE@
32
33desktopdir = $(datadir)/applications
34desktop_in_files = unity-screen-sharing-panel.desktop.in
35desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
36
37CLEANFILES = $(desktop_in_files) $(desktop_DATA)
38
39-include $(top_srcdir)/git.mk
040
=== added file 'panels/screen-sharing/cc-screen-sharing-panel.c'
--- panels/screen-sharing/cc-screen-sharing-panel.c 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/cc-screen-sharing-panel.c 2015-07-05 22:39:29 +0000
@@ -0,0 +1,315 @@
1/*
2 * Copyright (C) 2003 Sun Microsystems, Inc.
3 * Copyright (C) 2006 Jonh Wendell <wendell@bani.com.br>
4 * Copyright © 2010 Codethink Limited
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
20 *
21 * Authors:
22 * Mark McLoughlin <mark@skynet.ie>
23 * Jonh Wendell <wendell@bani.com.br>
24 * Ryan Lortie <desrt@desrt.ca>
25 */
26
27#include "config.h"
28
29#include "cc-screen-sharing-panel.h"
30#include "vino-radio-button.h"
31#include "vino-message-box.h"
32
33#include <glib/gi18n.h>
34#include <gtk/gtk.h>
35#include <shell/cc-panel.h>
36
37typedef struct
38{
39 CcPanel parent;
40} CcScreenSharingPanel;
41
42typedef struct
43{
44 CcPanelClass parent_class;
45} CcScreenSharingPanelClass;
46
47static GType cc_screen_sharing_panel_get_type (void);
48
49CC_PANEL_REGISTER (CcScreenSharingPanel, cc_screen_sharing_panel)
50
51#define VINO_SCHEMA_ID "org.gnome.Vino"
52
53/* We define three GSettings mappings here:
54 *
55 * First, a relatively boring boolean inversion mapping.
56 */
57static gboolean
58get_inverted (GValue *value,
59 GVariant *variant,
60 gpointer user_data)
61{
62 g_value_set_boolean (value, !g_variant_get_boolean (variant));
63 return TRUE;
64}
65
66static GVariant *
67set_inverted (const GValue *value,
68 const GVariantType *type,
69 gpointer user_data)
70{
71 return g_variant_new_boolean (!g_value_get_boolean (value));
72}
73
74/* Next, one that maps between the array-of-strings list of
75 * authentication mechanisms and a boolean that is FALSE if the 'none'
76 * and TRUE otherwise (ie: for 'vnc' in the list).
77 */
78static gboolean
79get_authtype (GValue *value,
80 GVariant *variant,
81 gpointer user_data)
82{
83 GVariantIter iter;
84 const gchar *type;
85
86 g_variant_iter_init (&iter, variant);
87 g_value_set_boolean (value, TRUE);
88
89 while (g_variant_iter_next (&iter, "s", &type))
90 if (strcmp (type, "none") == 0)
91 g_value_set_boolean (value, FALSE);
92
93 return TRUE;
94}
95
96static GVariant *
97set_authtype (const GValue *value,
98 const GVariantType *type,
99 gpointer user_data)
100{
101 const gchar *authtype;
102
103 if (g_value_get_boolean (value))
104 authtype = "vnc";
105 else
106 authtype = "none";
107
108 return g_variant_new_strv (&authtype, 1);
109}
110
111
112/* Finally, a somewhat evil mapping for the password setting:
113 *
114 * If the setting is 'keyring' then we load the password from the
115 * keyring. Else, it is assumed to be a base64-encoded string which is
116 * the actual password.
117 *
118 * On setting the password, we always first try to use the keyring. If
119 * that is successful we write 'keyring' to the settings. If it fails
120 * then we base64-encode the password and write it to the settings.
121 *
122 * Doing it this way ensures that there is no ambiguity about what the
123 * password is in the event that gnome-keyring becomes available then
124 * unavailable again.
125 */
126static gboolean
127get_password (GValue *value,
128 GVariant *variant,
129 gpointer user_data)
130{
131 const gchar *setting;
132
133 setting = g_variant_get_string (variant, NULL);
134
135 if (strcmp (setting, "keyring") == 0)
136 {
137 /* "keyring" is the default value, even though vino doesn't support it at the moment */
138 g_value_set_static_string (value, "");
139 return TRUE;
140 }
141 else
142 {
143 gchar *decoded;
144 gsize length;
145 gboolean ok;
146
147 decoded = (gchar *) g_base64_decode (setting, &length);
148
149 if ((ok = g_utf8_validate (decoded, length, NULL)))
150 g_value_take_string (value, g_strndup (decoded, length));
151
152 return ok;
153 }
154}
155
156static GVariant *
157set_password (const GValue *value,
158 const GVariantType *type,
159 gpointer user_data)
160{
161 const gchar *string;
162 gchar *base64;
163
164 string = g_value_get_string (value);
165
166 /* if that failed, store it in GSettings, base64 */
167 base64 = g_base64_encode ((guchar *) string, strlen (string));
168 return g_variant_new_from_data (G_VARIANT_TYPE_STRING,
169 base64, strlen (base64) + 1,
170 TRUE, g_free, base64);
171}
172
173typedef enum
174{
175 VINO_ICON_VISIBILITY_NEVER,
176 VINO_ICON_VISIBILITY_ALWAYS,
177 VINO_ICON_VISIBILITY_CLIENT
178} VinoIconVisibility;
179
180static gboolean
181get_icon_visibility (GValue *value,
182 GVariant *variant,
183 gpointer user_data)
184{
185 const char *setting;
186 char *name;
187
188 setting = g_variant_get_string (variant, NULL);
189
190 g_object_get (user_data, "name", &name, NULL);
191
192 /* If the button name matches the setting, it should be active. */
193 if (g_strcmp0 (name, setting) == 0)
194 g_value_set_boolean (value, TRUE);
195
196 g_free (name);
197
198 return TRUE;
199}
200
201static GVariant *
202set_icon_visibility (const GValue *value,
203 const GVariantType *type,
204 gpointer user_data)
205{
206 GVariant *variant = NULL;
207 char *name;
208
209 /* Don't act unless the button has been activated (turned ON). */
210 if (!g_value_get_boolean (value))
211 return NULL;
212
213 /* GtkToggleButton *button = GTK_TOGGLE_BUTTON(user_data); */
214 g_object_get (user_data, "name", &name, NULL);
215 variant = g_variant_new_string (name);
216
217 g_free (name);
218
219 return variant;
220}
221
222static void
223cc_screen_sharing_panel_init (CcScreenSharingPanel *panel)
224{
225 struct {
226 const gchar *setting;
227 const gchar *name;
228 const gchar *property;
229 GSettingsBindFlags flags;
230 GSettingsBindGetMapping get_mapping;
231 GSettingsBindSetMapping set_mapping;
232 } bindings[] = {
233 { "enabled", "allowed_toggle", "active", G_SETTINGS_BIND_DEFAULT, NULL, NULL },
234
235 { "enabled", "control_settings", "sensitive", G_SETTINGS_BIND_GET, NULL, NULL },
236 { "view-only", "view_only_toggle", "active", G_SETTINGS_BIND_DEFAULT, get_inverted, set_inverted },
237
238 { "enabled", "security_settings", "sensitive", G_SETTINGS_BIND_GET, NULL, NULL },
239 { "prompt-enabled", "prompt_enabled_toggle", "active", G_SETTINGS_BIND_DEFAULT, NULL, NULL },
240 { "authentication-methods", "password_toggle", "active", G_SETTINGS_BIND_DEFAULT, get_authtype, set_authtype },
241 { "authentication-methods", "password_box", "sensitive", G_SETTINGS_BIND_GET, get_authtype, NULL },
242 { "vnc-password", "password_entry", "text", G_SETTINGS_BIND_DEFAULT, get_password, set_password },
243 { "use-upnp", "use_upnp_toggle", "active", G_SETTINGS_BIND_DEFAULT, NULL, NULL },
244
245 { "enabled", "notification_settings", "sensitive", G_SETTINGS_BIND_GET, NULL, NULL },
246
247 { "icon-visibility", "icon_always_radio", "active", G_SETTINGS_BIND_DEFAULT, get_icon_visibility, set_icon_visibility },
248 { "icon-visibility", "icon_client_radio", "active", G_SETTINGS_BIND_DEFAULT, get_icon_visibility, set_icon_visibility },
249 { "icon-visibility", "icon_never_radio", "active", G_SETTINGS_BIND_DEFAULT, get_icon_visibility, set_icon_visibility }
250 };
251 GSettingsSchemaSource *source;
252
253 source = g_settings_schema_source_get_default ();
254 if (source && g_settings_schema_source_lookup (source, VINO_SCHEMA_ID, TRUE))
255 {
256 GError *error = NULL;
257 GtkBuilder *builder;
258 GSettings *settings;
259 gint i;
260
261 vino_radio_button_get_type ();
262 vino_message_box_get_type ();
263
264 builder = gtk_builder_new ();
265 if (!gtk_builder_add_from_file (builder, GNOMECC_UI_DIR "/screen-sharing-panel.ui", &error))
266 {
267 g_warning ("Unable to load interface file: %s", error->message);
268 g_error_free (error);
269 }
270 gtk_widget_reparent (GTK_WIDGET (gtk_builder_get_object (builder, "screen_sharing_vbox")), GTK_WIDGET (panel));
271
272 settings = g_settings_new (VINO_SCHEMA_ID);
273
274 for (i = 0; i < G_N_ELEMENTS (bindings); i++)
275 {
276 GObject *object = gtk_builder_get_object (builder, bindings[i].name);
277 g_settings_bind_with_mapping (settings, bindings[i].setting,
278 object,
279 bindings[i].property,
280 bindings[i].flags,
281 bindings[i].get_mapping,
282 bindings[i].set_mapping,
283 object, NULL);
284 }
285
286 g_object_unref (settings);
287 g_object_unref (builder);
288 }
289 else
290 {
291 GtkWidget *label;
292 gchar *text;
293
294 label = gtk_label_new (NULL);
295 text = g_strdup_printf ("<big>%s</big>", _("Desktop sharing support not installed"));
296 gtk_label_set_markup (GTK_LABEL (label), text);
297 g_free (text);
298 gtk_widget_show (label);
299 gtk_container_add (GTK_CONTAINER (panel), label);
300 }
301}
302
303static void
304cc_screen_sharing_panel_class_init (CcScreenSharingPanelClass *class)
305{
306}
307
308void
309cc_screen_sharing_panel_register (GIOModule *module)
310{
311 cc_screen_sharing_panel_register_type (G_TYPE_MODULE (module));
312 g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
313 cc_screen_sharing_panel_get_type (),
314 "screen-sharing", 0);
315}
0316
=== added file 'panels/screen-sharing/cc-screen-sharing-panel.h'
--- panels/screen-sharing/cc-screen-sharing-panel.h 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/cc-screen-sharing-panel.h 2015-07-05 22:39:29 +0000
@@ -0,0 +1,29 @@
1/*
2 * Copyright © 2010 Codethink Limited
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 * 02111-1307, USA.
18 *
19 * Author: Ryan Lortie <desrt@desrt.ca>
20 */
21
22#ifndef __vino_preferences_h__
23#define __vino_preferences_h__
24
25#include <shell/cc-panel.h>
26
27void cc_screen_sharing_panel_register (GIOModule *module);
28
29#endif /* __vino_preferences_h__ */
030
=== added file 'panels/screen-sharing/screen-sharing-module.c'
--- panels/screen-sharing/screen-sharing-module.c 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/screen-sharing-module.c 2015-07-05 22:39:29 +0000
@@ -0,0 +1,41 @@
1/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 *
3 * Copyright (C) 2010 Red Hat, Inc
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 *
20 */
21
22#include <config.h>
23
24#include "cc-screen-sharing-panel.h"
25
26#include <glib/gi18n-lib.h>
27
28void
29g_io_module_load (GIOModule *module)
30{
31 bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
32 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
33
34 /* register the panel */
35 cc_screen_sharing_panel_register (module);
36}
37
38void
39g_io_module_unload (GIOModule *module)
40{
41}
042
=== added file 'panels/screen-sharing/screen-sharing-panel.ui'
--- panels/screen-sharing/screen-sharing-panel.ui 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/screen-sharing-panel.ui 2015-07-05 22:39:29 +0000
@@ -0,0 +1,400 @@
1<?xml version="1.0"?>
2<interface>
3 <requires lib="gtk+" version="2.16"/>
4 <!-- interface-naming-policy toplevel-contextual -->
5 <object class="GtkWindow" id="window1">
6 <child>
7 <object class="GtkBox" id="screen_sharing_vbox">
8 <property name="visible">True</property>
9 <property name="orientation">vertical</property>
10 <property name="spacing">6</property>
11 <child>
12 <object class="GtkBox" id="vbox1">
13 <property name="visible">True</property>
14 <property name="orientation">vertical</property>
15 <property name="border_width">6</property>
16 <property name="spacing">18</property>
17 <child>
18 <object class="GtkBox" id="sharing_box">
19 <property name="visible">True</property>
20 <property name="orientation">vertical</property>
21 <property name="spacing">6</property>
22 <child>
23 <object class="GtkLabel" id="label1">
24 <property name="visible">True</property>
25 <property name="xalign">0</property>
26 <property name="label" translatable="yes">Sharing</property>
27 <attributes>
28 <attribute name="weight" value="bold"/>
29 </attributes>
30 </object>
31 <packing>
32 <property name="position">0</property>
33 </packing>
34 </child>
35 <child>
36 <object class="GtkBox" id="writability_warning">
37 <property name="orientation">horizontal</property>
38 <property name="no_show_all">True</property>
39 <property name="border_width">3</property>
40 <property name="spacing">6</property>
41 <child>
42 <object class="GtkLabel" id="label6">
43 <property name="visible">True</property>
44 <property name="label"> </property>
45 </object>
46 <packing>
47 <property name="expand">False</property>
48 <property name="fill">False</property>
49 <property name="position">0</property>
50 </packing>
51 </child>
52 <child>
53 <object class="GtkImage" id="image1">
54 <property name="visible">True</property>
55 <property name="stock">gtk-dialog-warning</property>
56 </object>
57 <packing>
58 <property name="expand">False</property>
59 <property name="position">1</property>
60 </packing>
61 </child>
62 <child>
63 <object class="GtkLabel" id="label8">
64 <property name="visible">True</property>
65 <property name="label" translatable="yes">Some of these preferences are locked down</property>
66 <attributes>
67 <attribute name="style" value="italic"/>
68 </attributes>
69 </object>
70 <packing>
71 <property name="expand">False</property>
72 <property name="fill">False</property>
73 <property name="position">2</property>
74 </packing>
75 </child>
76 </object>
77 <packing>
78 <property name="position">1</property>
79 </packing>
80 </child>
81 <child>
82 <object class="GtkBox" id="hbox1">
83 <property name="visible">True</property>
84 <property name="orientation">horizontal</property>
85 <child>
86 <object class="GtkLabel" id="label2">
87 <property name="visible">True</property>
88 <property name="label"> </property>
89 </object>
90 <packing>
91 <property name="expand">False</property>
92 <property name="fill">False</property>
93 <property name="position">0</property>
94 </packing>
95 </child>
96 <child>
97 <object class="GtkCheckButton" id="allowed_toggle">
98 <property name="label" translatable="yes">Allow other users to _view your desktop</property>
99 <property name="visible">True</property>
100 <property name="can_focus">True</property>
101 <property name="receives_default">False</property>
102 <property name="has_tooltip">True</property>
103 <property name="tooltip_text" translatable="yes">Your desktop will be shared</property>
104 <property name="use_underline">True</property>
105 <property name="draw_indicator">True</property>
106 </object>
107 <packing>
108 <property name="position">1</property>
109 </packing>
110 </child>
111 </object>
112 <packing>
113 <property name="position">2</property>
114 </packing>
115 </child>
116 <child>
117 <object class="GtkBox" id="control_settings">
118 <property name="visible">True</property>
119 <property name="orientation">horizontal</property>
120 <child>
121 <object class="GtkLabel" id="label3">
122 <property name="visible">True</property>
123 <property name="label"> </property>
124 </object>
125 <packing>
126 <property name="expand">False</property>
127 <property name="fill">False</property>
128 <property name="position">0</property>
129 </packing>
130 </child>
131 <child>
132 <object class="GtkCheckButton" id="view_only_toggle">
133 <property name="label" translatable="yes">_Allow other users to control your desktop</property>
134 <property name="visible">True</property>
135 <property name="can_focus">True</property>
136 <property name="receives_default">False</property>
137 <property name="has_tooltip">True</property>
138 <property name="tooltip_text" translatable="yes">Remote users are able to control your mouse and keyboard</property>
139 <property name="use_underline">True</property>
140 <property name="draw_indicator">True</property>
141 </object>
142 <packing>
143 <property name="position">1</property>
144 </packing>
145 </child>
146 </object>
147 <packing>
148 <property name="position">3</property>
149 </packing>
150 </child>
151 <!--
152 <child>
153 <object class="GtkBox" id="message_box">
154 <property name="visible">True</property>
155 <property name="orientation">horizontal</property>
156 <child>
157 <object class="GtkLabel" id="label14">
158 <property name="visible">True</property>
159 <property name="label"> </property>
160 </object>
161 <packing>
162 <property name="expand">False</property>
163 <property name="fill">False</property>
164 <property name="position">0</property>
165 </packing>
166 </child>
167 <child>
168 <object class="VinoMessageBox" id="message">
169 <property name="visible">True</property>
170 </object>
171 <packing>
172 <property name="position">1</property>
173 </packing>
174 </child>
175 </object>
176 <packing>
177 <property name="position">4</property>
178 </packing>
179 </child>
180 -->
181 </object>
182 <packing>
183 <property name="position">0</property>
184 </packing>
185 </child>
186 <child>
187 <object class="GtkBox" id="security_box">
188 <property name="visible">True</property>
189 <property name="orientation">vertical</property>
190 <property name="spacing">6</property>
191 <child>
192 <object class="GtkLabel" id="label4">
193 <property name="visible">True</property>
194 <property name="xalign">0</property>
195 <property name="label" translatable="yes">Security</property>
196 <attributes>
197 <attribute name="weight" value="bold"/>
198 </attributes>
199 </object>
200 <packing>
201 <property name="position">0</property>
202 </packing>
203 </child>
204 <child>
205 <object class="GtkBox" id="hbox3">
206 <property name="visible">True</property>
207 <property name="orientation">horizontal</property>
208 <child>
209 <object class="GtkBox" id="security_settings">
210 <property name="visible">True</property>
211 <property name="orientation">vertical</property>
212 <property name="spacing">6</property>
213 <child>
214 <object class="GtkCheckButton" id="prompt_enabled_toggle">
215 <property name="label" translatable="yes">_You must confirm each access to this machine</property>
216 <property name="visible">True</property>
217 <property name="can_focus">True</property>
218 <property name="receives_default">False</property>
219 <property name="use_underline">True</property>
220 <property name="draw_indicator">True</property>
221 </object>
222 <packing>
223 <property name="position">0</property>
224 </packing>
225 </child>
226 <child>
227 <object class="GtkBox" id="hbox4">
228 <property name="visible">True</property>
229 <property name="orientation">horizontal</property>
230 <property name="spacing">12</property>
231 <child>
232 <object class="GtkCheckButton" id="password_toggle">
233 <property name="label" translatable="yes">_Require the user to enter this password:</property>
234 <property name="visible">True</property>
235 <property name="can_focus">True</property>
236 <property name="receives_default">False</property>
237 <property name="use_underline">True</property>
238 <property name="draw_indicator">True</property>
239 </object>
240 <packing>
241 <property name="expand">False</property>
242 <property name="position">0</property>
243 </packing>
244 </child>
245 <child>
246 <object class="GtkBox" id="password_box">
247 <property name="visible">True</property>
248 <property name="orientation">horizontal</property>
249 <child>
250 <object class="GtkEntry" id="password_entry">
251 <property name="visible">True</property>
252 <property name="can_focus">True</property>
253 <property name="max_length">8</property>
254 <property name="visibility">False</property>
255 <property name="invisible_char">&#x25CF;</property>
256 </object>
257 <packing>
258 <property name="position">1</property>
259 </packing>
260 </child>
261 </object>
262 <packing>
263 <property name="position">1</property>
264 </packing>
265 </child>
266 </object>
267 <packing>
268 <property name="position">1</property>
269 </packing>
270 </child>
271 <child>
272 <object class="GtkCheckButton" id="use_upnp_toggle">
273 <property name="label" translatable="yes">Automatically _configure UPnP router to open and forward ports</property>
274 <property name="visible">True</property>
275 <property name="can_focus">True</property>
276 <property name="receives_default">False</property>
277 <property name="has_tooltip">True</property>
278 <property name="tooltip_text" translatable="yes">The router must have the UPnP feature enabled</property>
279 <property name="use_underline">True</property>
280 <property name="draw_indicator">True</property>
281 </object>
282 <packing>
283 <property name="position">2</property>
284 </packing>
285 </child>
286 </object>
287 <packing>
288 <property name="padding">12</property>
289 <property name="position">0</property>
290 </packing>
291 </child>
292 </object>
293 <packing>
294 <property name="position">1</property>
295 </packing>
296 </child>
297 </object>
298 <packing>
299 <property name="position">1</property>
300 </packing>
301 </child>
302 <child>
303 <object class="GtkBox" id="notification_box">
304 <property name="visible">True</property>
305 <property name="orientation">vertical</property>
306 <property name="spacing">6</property>
307 <child>
308 <object class="GtkLabel" id="label12">
309 <property name="visible">True</property>
310 <property name="xalign">0</property>
311 <property name="label" translatable="yes">Show Notification Area Icon</property>
312 <attributes>
313 <attribute name="weight" value="bold"/>
314 </attributes>
315 </object>
316 <packing>
317 <property name="position">0</property>
318 </packing>
319 </child>
320 <child>
321 <object class="GtkBox" id="hbox8">
322 <property name="visible">True</property>
323 <property name="orientation">horizontal</property>
324 <child>
325 <object class="GtkBox" id="notification_settings">
326 <property name="visible">True</property>
327 <property name="orientation">vertical</property>
328 <property name="spacing">3</property>
329 <child>
330 <object class="VinoRadioButton" id="icon_always_radio">
331 <property name='name'>always</property>
332 <property name="label" translatable="yes">Al_ways</property>
333 <property name="visible">True</property>
334 <property name="can_focus">True</property>
335 <property name="receives_default">False</property>
336 <property name="use_underline">True</property>
337 <property name="active">True</property>
338 <property name="draw_indicator">True</property>
339 </object>
340 <packing>
341 <property name="position">0</property>
342 </packing>
343 </child>
344 <child>
345 <object class="VinoRadioButton" id="icon_client_radio">
346 <property name='name'>client</property>
347 <property name="label" translatable="yes">_Only when someone is connected</property>
348 <property name="visible">True</property>
349 <property name="can_focus">True</property>
350 <property name="receives_default">False</property>
351 <property name="use_underline">True</property>
352 <property name="active">True</property>
353 <property name="draw_indicator">True</property>
354 <property name="group">icon_always_radio</property>
355 </object>
356 <packing>
357 <property name="position">1</property>
358 </packing>
359 </child>
360 <child>
361 <object class="VinoRadioButton" id="icon_never_radio">
362 <property name='name'>never</property>
363 <property name="label" translatable="yes">_Never</property>
364 <property name="visible">True</property>
365 <property name="can_focus">True</property>
366 <property name="receives_default">False</property>
367 <property name="use_underline">True</property>
368 <property name="active">True</property>
369 <property name="draw_indicator">True</property>
370 <property name="group">icon_always_radio</property>
371 </object>
372 <packing>
373 <property name="position">2</property>
374 </packing>
375 </child>
376 </object>
377 <packing>
378 <property name="padding">12</property>
379 <property name="position">0</property>
380 </packing>
381 </child>
382 </object>
383 <packing>
384 <property name="position">1</property>
385 </packing>
386 </child>
387 </object>
388 <packing>
389 <property name="position">2</property>
390 </packing>
391 </child>
392 </object>
393 <packing>
394 <property name="position">1</property>
395 </packing>
396 </child>
397 </object>
398 </child>
399 </object>
400</interface>
0401
=== added file 'panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in'
--- panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in 2015-07-05 22:39:29 +0000
@@ -0,0 +1,13 @@
1[Desktop Entry]
2_Name=Desktop Sharing
3_Comment=Choose how other users can remotely view your desktop
4Exec=unity-control-center screen-sharing
5Icon=preferences-desktop-remote-desktop
6Terminal=false
7Type=Application
8StartupNotify=true
9Categories=GNOME;GTK;Settings;DesktopSettings;X-Unity-Settings-Panel;X-GNOME-PersonalSettings
10OnlyShowIn=Unity;
11X-Unity-Settings-Panel=screen-sharing
12# Translators: those are keywords for the screen sharing control-center panel
13_Keywords=Screen;Sharing;Remote;Desktop;VNC
014
=== added file 'panels/screen-sharing/vino-message-box.c'
--- panels/screen-sharing/vino-message-box.c 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/vino-message-box.c 2015-07-05 22:39:29 +0000
@@ -0,0 +1,156 @@
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2/*
3 * vino-message-box.c
4 * Copyright (C) Jonh Wendell 2009 <wendell@bani.com.br>
5 *
6 * vino-message-box.c is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * vino-message-box.c is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <config.h>
21#include <glib/gi18n.h>
22#include "vino-message-box.h"
23
24struct _VinoMessageBoxPrivate
25{
26 GtkWidget *main_hbox;
27 GtkWidget *label;
28 GtkWidget *image;
29};
30
31G_DEFINE_TYPE (VinoMessageBox, vino_message_box, GTK_TYPE_INFO_BAR);
32
33static void
34url_activated_cb(GtkWidget *url_label, const gchar *url)
35{
36 GError *error;
37 GdkScreen *screen;
38 gchar *mailto;
39
40 error = NULL;
41 screen = gtk_widget_get_screen (url_label);
42 mailto = g_strdup_printf ("mailto:?Body=%s", url);
43
44 if (!gtk_show_uri (screen, mailto, GDK_CURRENT_TIME, &error))
45 {
46 GtkWidget *message_dialog, *parent;
47
48 parent = gtk_widget_get_toplevel (GTK_WIDGET (url_label));
49 if (!GTK_IS_WINDOW (parent))
50 parent = NULL;
51 message_dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
52 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
53 GTK_MESSAGE_ERROR,
54 GTK_BUTTONS_CLOSE,
55 _("There was an error showing the URL \"%s\""),
56 url);
57 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
58 "%s",
59 error->message);
60
61 gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
62
63 g_signal_connect (message_dialog, "response",
64 G_CALLBACK (gtk_widget_destroy),
65 NULL);
66
67 gtk_widget_show (message_dialog);
68 g_error_free (error);
69 }
70
71 g_free (mailto);
72}
73
74static void
75vino_message_box_init (VinoMessageBox *box)
76{
77 box->priv = G_TYPE_INSTANCE_GET_PRIVATE (box, VINO_TYPE_MESSAGE_BOX, VinoMessageBoxPrivate);
78
79 box->priv->main_hbox = gtk_info_bar_get_content_area (GTK_INFO_BAR (box));
80 box->priv->image = NULL;
81
82 box->priv->label = gtk_label_new (NULL);
83 gtk_misc_set_alignment (GTK_MISC (box->priv->label), 0.0, 0.0);
84 gtk_label_set_line_wrap (GTK_LABEL (box->priv->label), TRUE);
85 gtk_label_set_selectable (GTK_LABEL (box->priv->label), TRUE);
86 g_signal_connect (box->priv->label,
87 "activate-link",
88 G_CALLBACK (url_activated_cb),
89 NULL);
90
91 gtk_widget_show (box->priv->label);
92 gtk_info_bar_set_message_type (GTK_INFO_BAR (box), GTK_MESSAGE_INFO);
93 gtk_container_add (GTK_CONTAINER (box->priv->main_hbox), box->priv->label);
94}
95
96static void
97vino_message_box_finalize (GObject *object)
98{
99 /* TODO: Add deinitalization code here */
100
101 G_OBJECT_CLASS (vino_message_box_parent_class)->finalize (object);
102}
103
104static void
105vino_message_box_class_init (VinoMessageBoxClass *klass)
106{
107 GObjectClass* object_class = G_OBJECT_CLASS (klass);
108
109 object_class->finalize = vino_message_box_finalize;
110 g_type_class_add_private (object_class, sizeof(VinoMessageBoxPrivate));
111}
112
113GtkWidget *
114vino_message_box_new (void)
115{
116 return GTK_WIDGET (g_object_new (VINO_TYPE_MESSAGE_BOX, NULL));
117}
118
119void
120vino_message_box_set_label (VinoMessageBox *box, const gchar *label)
121{
122 g_return_if_fail (VINO_IS_MESSAGE_BOX (box));
123
124 gtk_label_set_markup (GTK_LABEL (box->priv->label), label);
125}
126
127void
128vino_message_box_show_image (VinoMessageBox *box)
129{
130 g_return_if_fail (VINO_IS_MESSAGE_BOX (box));
131
132 if (box->priv->image)
133 {
134 gtk_widget_destroy (box->priv->image);
135 box->priv->image = NULL;
136 }
137
138
139 box->priv->image = gtk_spinner_new ();
140 gtk_spinner_start (GTK_SPINNER (box->priv->image));
141
142 gtk_box_pack_start (GTK_BOX (box->priv->main_hbox), box->priv->image, FALSE, FALSE, 2);
143 gtk_box_reorder_child (GTK_BOX (box->priv->main_hbox), box->priv->image, 0);
144 gtk_widget_show (box->priv->image);
145}
146
147void
148vino_message_box_hide_image (VinoMessageBox *box)
149{
150 g_return_if_fail (VINO_IS_MESSAGE_BOX (box));
151
152 if (box->priv->image)
153 gtk_widget_destroy (box->priv->image);
154 box->priv->image = NULL;
155}
156
0157
=== added file 'panels/screen-sharing/vino-message-box.h'
--- panels/screen-sharing/vino-message-box.h 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/vino-message-box.h 2015-07-05 22:39:29 +0000
@@ -0,0 +1,59 @@
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2/*
3 * vino-message-box.c
4 * Copyright (C) Jonh Wendell 2009 <wendell@bani.com.br>
5 *
6 * vino-message-box.c is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * vino-message-box.c is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _VINO_MESSAGE_BOX_H_
21#define _VINO_MESSAGE_BOX_H_
22
23#include <gtk/gtk.h>
24
25G_BEGIN_DECLS
26
27#define VINO_TYPE_MESSAGE_BOX (vino_message_box_get_type ())
28#define VINO_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VINO_TYPE_MESSAGE_BOX, VinoMessageBox))
29#define VINO_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VINO_TYPE_MESSAGE_BOX, VinoMessageBoxClass))
30#define VINO_IS_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VINO_TYPE_MESSAGE_BOX))
31#define VINO_IS_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VINO_TYPE_MESSAGE_BOX))
32#define VINO_MESSAGE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VINO_TYPE_MESSAGE_BOX, VinoMessageBoxClass))
33
34typedef struct _VinoMessageBoxClass VinoMessageBoxClass;
35typedef struct _VinoMessageBox VinoMessageBox;
36typedef struct _VinoMessageBoxPrivate VinoMessageBoxPrivate;
37
38struct _VinoMessageBoxClass
39{
40 GtkInfoBarClass parent_class;
41};
42
43struct _VinoMessageBox
44{
45 GtkInfoBar parent_instance;
46 VinoMessageBoxPrivate *priv;
47};
48
49GType vino_message_box_get_type (void);
50
51GtkWidget *vino_message_box_new (void);
52
53void vino_message_box_set_label (VinoMessageBox *box, const gchar *label);
54void vino_message_box_show_image (VinoMessageBox *box);
55void vino_message_box_hide_image (VinoMessageBox *box);
56
57G_END_DECLS
58
59#endif /* _VINO_MESSAGE_BOX_H_ */
060
=== added file 'panels/screen-sharing/vino-radio-button.c'
--- panels/screen-sharing/vino-radio-button.c 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/vino-radio-button.c 2015-07-05 22:39:29 +0000
@@ -0,0 +1,181 @@
1/*
2 * Copyright © 2010 Codethink Limited
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 * 02111-1307, USA.
18 *
19 * Author: Ryan Lortie <desrt@desrt.ca>
20 */
21
22#include "vino-radio-button.h"
23
24#include <gtk/gtk.h>
25
26typedef struct
27{
28 GtkRadioButton parent_instance;
29 gchar *name;
30} VinoRadioButton;
31
32typedef GtkRadioButtonClass VinoRadioButtonClass;
33
34G_DEFINE_TYPE (VinoRadioButton, vino_radio_button, GTK_TYPE_RADIO_BUTTON)
35
36enum
37{
38 PROP_0,
39 PROP_SETTINGS_NAME,
40 PROP_SETTINGS_ACTIVE
41};
42
43static void
44vino_radio_button_get_property (GObject *object, guint prop_id,
45 GValue *value, GParamSpec *pspec)
46{
47 VinoRadioButton *vrb = (VinoRadioButton *) object;
48
49 switch (prop_id)
50 {
51 case PROP_SETTINGS_ACTIVE:
52 {
53 const GSList *list;
54
55 list = gtk_radio_button_get_group (&vrb->parent_instance);
56 while (list)
57 {
58 VinoRadioButton *this = list->data;
59
60 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this)))
61 {
62 g_value_set_string (value, this->name);
63 return;
64 }
65
66 list = list->next;
67 }
68 }
69
70 g_warning ("No active radio buttons");
71 g_value_set_string (value, "");
72 return;
73
74 default:
75 g_assert_not_reached ();
76 }
77}
78
79static void
80vino_radio_button_set_property (GObject *object, guint prop_id,
81 const GValue *value, GParamSpec *pspec)
82{
83 VinoRadioButton *vrb = (VinoRadioButton *) object;
84
85 switch (prop_id)
86 {
87 case PROP_SETTINGS_NAME:
88 g_assert (vrb->name == NULL);
89 vrb->name = g_value_dup_string (value);
90 return;
91
92 case PROP_SETTINGS_ACTIVE:
93 {
94 const GSList *list;
95 const gchar *name;
96
97 list = gtk_radio_button_get_group (&vrb->parent_instance);
98 name = g_value_get_string (value);
99
100 while (list)
101 {
102 VinoRadioButton *this = list->data;
103
104 if (g_strcmp0 (this->name, name))
105 {
106 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (this),
107 TRUE);
108 return;
109 }
110
111 list = list->next;
112 }
113
114 g_warning ("No such radio button named `%s'", name);
115 }
116 return;
117
118 default:
119 g_assert_not_reached ();
120 }
121}
122
123static void
124vino_radio_button_toggled (GtkToggleButton *button)
125{
126 VinoRadioButton *vrb = (VinoRadioButton *) button;
127
128 /* As it is, we get the notification of the old button becoming inactivity
129 * followed by the notification of the new button becoming active. Only run
130 * when the new button becomes active in order to avoid unnecessary
131 * notifications.
132 */
133 if (gtk_toggle_button_get_active (button))
134 {
135 const GSList *list;
136
137 list = gtk_radio_button_get_group (&vrb->parent_instance);
138 while (list)
139 {
140 g_object_notify (list->data, "settings-active");
141 list = list->next;
142 }
143 }
144}
145
146static void
147vino_radio_button_finalize (GObject *object)
148{
149 VinoRadioButton *vrb = (VinoRadioButton *) object;
150
151 g_free (vrb->name);
152
153 G_OBJECT_CLASS (vino_radio_button_parent_class)
154 ->finalize (object);
155}
156
157static void
158vino_radio_button_init (VinoRadioButton *button)
159{
160}
161
162static void
163vino_radio_button_class_init (GtkRadioButtonClass *class)
164{
165 GtkToggleButtonClass *tb_class = GTK_TOGGLE_BUTTON_CLASS (class);
166 GObjectClass *object_class = G_OBJECT_CLASS (class);
167
168 tb_class->toggled = vino_radio_button_toggled;
169 object_class->get_property = vino_radio_button_get_property;
170 object_class->set_property = vino_radio_button_set_property;
171 object_class->finalize = vino_radio_button_finalize;
172
173 g_object_class_install_property (object_class, PROP_SETTINGS_NAME,
174 g_param_spec_string ("settings-name", "name", "name", NULL,
175 G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE |
176 G_PARAM_STATIC_STRINGS));
177
178 g_object_class_install_property (object_class, PROP_SETTINGS_ACTIVE,
179 g_param_spec_string ("settings-active", "active", "active", NULL,
180 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
181}
0182
=== added file 'panels/screen-sharing/vino-radio-button.h'
--- panels/screen-sharing/vino-radio-button.h 1970-01-01 00:00:00 +0000
+++ panels/screen-sharing/vino-radio-button.h 2015-07-05 22:39:29 +0000
@@ -0,0 +1,29 @@
1/*
2 * Copyright © 2010 Codethink Limited
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 * 02111-1307, USA.
18 *
19 * Author: Ryan Lortie <desrt@desrt.ca>
20 */
21
22#ifndef __vino_radio_button_h__
23#define __vino_radio_button_h__
24
25#include <glib-object.h>
26
27GType vino_radio_button_get_type (void);
28
29#endif /* __vino_radio_button_h__ */
030
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2014-09-15 21:09:13 +0000
+++ po/POTFILES.in 2015-07-05 22:39:29 +0000
@@ -84,6 +84,10 @@
84panels/region/gtkentryaccel.c84panels/region/gtkentryaccel.c
85panels/screen/unity-screen-panel.desktop.in.in85panels/screen/unity-screen-panel.desktop.in.in
86[type: gettext/glade]panels/screen/screen.ui86[type: gettext/glade]panels/screen/screen.ui
87panels/screen-sharing/vino-message-box.c
88panels/screen-sharing/cc-screen-sharing-panel.c
89panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in
90[type: gettext/glade]panels/screen-sharing/cc-screen-sharing-panel.ui
87panels/sound/cc-sound-panel.c91panels/sound/cc-sound-panel.c
88panels/sound/gvc-balance-bar.c92panels/sound/gvc-balance-bar.c
89panels/sound/gvc-channel-bar.c93panels/sound/gvc-channel-bar.c

Subscribers

People subscribed via source and target branches