Merge lp:~dobey/ubuntuone-client-gnome/kill-share-contacts into lp:ubuntuone-client-gnome

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 23
Merged at revision: 22
Proposed branch: lp:~dobey/ubuntuone-client-gnome/kill-share-contacts
Merge into: lp:ubuntuone-client-gnome
Diff against target: 431 lines (+13/-317)
7 files modified
configure.ac (+11/-0)
gsd/gsd-ubuntuone.c (+2/-0)
nautilus/Makefile.am (+0/-2)
nautilus/context-menu.c (+0/-102)
nautilus/share-dialog.c (+0/-161)
nautilus/share-dialog.h (+0/-51)
po/POTFILES.in (+0/-1)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client-gnome/kill-share-contacts
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+134296@code.launchpad.net

Commit message

Remove folder sharing UI and related code.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
23. By dobey

Need to special case newer versions of gnome-settings-daemon
Remove a removed file from POTFILES.in

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2012-10-31 21:25:54 +0000
+++ configure.ac 2012-11-27 21:44:20 +0000
@@ -109,6 +109,17 @@
109fi109fi
110AM_CONDITIONAL([HAVE_GSD_30], [test "x$have_gsd_30" = "xyes"])110AM_CONDITIONAL([HAVE_GSD_30], [test "x$have_gsd_30" = "xyes"])
111111
112# gnome-settings-daemon 3.5.91 changes REGISTER macro behavior again
113# To compensate, we need an additional define to avoid defining the
114# class_finalize method for the plug-in
115PKG_CHECK_EXISTS([gnome-settings-daemon >= 3.5.91],
116 [have_gsd_36=yes],
117 [have_gsd_36=no])
118if test "x$have_gsd_36" = "xyes"; then
119 AC_DEFINE_UNQUOTED([HAVE_GSD_36], [1],
120 [If using gnome-settings-daemon 3.5.91 or newer])
121fi
122
112PKG_CHECK_MODULES(SETTINGS_PLUGIN,123PKG_CHECK_MODULES(SETTINGS_PLUGIN,
113 gnome-settings-daemon124 gnome-settings-daemon
114 gio-2.0125 gio-2.0
115126
=== modified file 'gsd/gsd-ubuntuone.c'
--- gsd/gsd-ubuntuone.c 2011-09-23 15:31:01 +0000
+++ gsd/gsd-ubuntuone.c 2012-11-27 21:44:20 +0000
@@ -201,11 +201,13 @@
201}201}
202202
203#ifdef HAVE_GSD_30203#ifdef HAVE_GSD_30
204#ifndef HAVE_GSD_36
204static void205static void
205gsd_ubuntuone_class_finalize (GsdUbuntuOneClass *klass)206gsd_ubuntuone_class_finalize (GsdUbuntuOneClass *klass)
206{207{
207}208}
208#endif209#endif
210#endif
209211
210static void212static void
211gsd_ubuntuone_class_init (GsdUbuntuOneClass *klass)213gsd_ubuntuone_class_init (GsdUbuntuOneClass *klass)
212214
=== modified file 'nautilus/Makefile.am'
--- nautilus/Makefile.am 2012-08-29 21:24:36 +0000
+++ nautilus/Makefile.am 2012-11-27 21:44:20 +0000
@@ -38,8 +38,6 @@
38 error-dialog.c \38 error-dialog.c \
39 file-watcher.c \39 file-watcher.c \
40 file-watcher.h \40 file-watcher.h \
41 share-dialog.c \
42 share-dialog.h \
43 ubuntuone-marshallers.c \41 ubuntuone-marshallers.c \
44 ubuntuone-marshallers.h \42 ubuntuone-marshallers.h \
45 ubuntuone-nautilus.c \43 ubuntuone-nautilus.c \
4644
=== modified file 'nautilus/context-menu.c'
--- nautilus/context-menu.c 2012-02-20 16:45:35 +0000
+++ nautilus/context-menu.c 2012-11-27 21:44:20 +0000
@@ -26,7 +26,6 @@
26#include <glib/gi18n-lib.h>26#include <glib/gi18n-lib.h>
27#include <libsyncdaemon/libsyncdaemon.h>27#include <libsyncdaemon/libsyncdaemon.h>
28#include "context-menu.h"28#include "context-menu.h"
29#include "share-dialog.h"
3029
31typedef struct {30typedef struct {
32 UbuntuOneNautilus *uon;31 UbuntuOneNautilus *uon;
@@ -141,55 +140,6 @@
141 file_watcher_update_path (data->uon->file_watcher, data->path);140 file_watcher_update_path (data->uon->file_watcher, data->path);
142}141}
143142
144static void
145share_folder_cb (NautilusMenuItem *item, gpointer user_data)
146{
147 MenuCallbackData * data = (MenuCallbackData *) user_data;
148 GtkWidget * dialog;
149
150 dialog = share_dialog_new (data->parent, data->uon, data->path);
151 gtk_widget_show (dialog);
152}
153
154static void
155unshare_folder_cb (NautilusMenuItem *item, gpointer user_data)
156{
157 MenuCallbackData * data = (MenuCallbackData *) user_data;
158 SyncdaemonSharesInterface *interface;
159
160 interface = (SyncdaemonSharesInterface *) syncdaemon_daemon_get_shares_interface (data->uon->syncdaemon);
161 if (interface != NULL)
162 syncdaemon_shares_interface_delete (interface, data->path);
163}
164
165gboolean
166check_share_offer_pending (UbuntuOneNautilus *uon, const gchar *path)
167{
168 GSList *shares, *l;
169 SyncdaemonInterface *interface;
170 gboolean is_share_offer_pending = FALSE;
171 const gchar *node_id;
172
173 interface = syncdaemon_daemon_get_shares_interface (uon->syncdaemon);
174 if (SYNCDAEMON_IS_SHARES_INTERFACE (interface)) {
175 shares = syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface));
176 for (l = shares; l != NULL; l = l->next) {
177 SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (l->data);
178
179 if (g_strcmp0 (syncdaemon_share_info_get_path (share_info), path) == 0) {
180 node_id = syncdaemon_share_info_get_node_id (share_info);
181 if (node_id == NULL)
182 is_share_offer_pending = TRUE;
183 break;
184 }
185 }
186
187 g_slist_free (shares);
188 }
189
190 return is_share_offer_pending;
191}
192
193NautilusMenuItem *143NautilusMenuItem *
194context_menu_new (UbuntuOneNautilus *uon,144context_menu_new (UbuntuOneNautilus *uon,
195 GtkWidget *window,145 GtkWidget *window,
@@ -201,12 +151,10 @@
201 gchar *path, *item, *homedir_path, *path_uri;151 gchar *path, *item, *homedir_path, *path_uri;
202 gboolean is_managed, is_root, is_udf, is_public, is_shared, is_pending;152 gboolean is_managed, is_root, is_udf, is_public, is_shared, is_pending;
203 gboolean is_shared_to_me, is_inhome, is_dir, is_regular, is_symlink;153 gboolean is_shared_to_me, is_inhome, is_dir, is_regular, is_symlink;
204 gboolean is_share_offer_pending;
205 MenuCallbackData *cb_data;154 MenuCallbackData *cb_data;
206155
207 is_managed = is_root = is_udf = is_public = is_shared = is_pending = FALSE;156 is_managed = is_root = is_udf = is_public = is_shared = is_pending = FALSE;
208 is_shared_to_me = is_inhome = is_dir = is_regular = is_symlink = FALSE;157 is_shared_to_me = is_inhome = is_dir = is_regular = is_symlink = FALSE;
209 is_share_offer_pending = FALSE;
210158
211 if (g_list_length (files) != 1)159 if (g_list_length (files) != 1)
212 return NULL;160 return NULL;
@@ -239,8 +187,6 @@
239187
240 if (ubuntuone_is_folder_shared (uon, path)) {188 if (ubuntuone_is_folder_shared (uon, path)) {
241 is_shared = TRUE;189 is_shared = TRUE;
242 if (check_share_offer_pending (uon, path))
243 is_share_offer_pending = TRUE;
244 }190 }
245191
246 if (ubuntuone_is_inside_shares (uon, path))192 if (ubuntuone_is_inside_shares (uon, path))
@@ -266,54 +212,6 @@
266212
267 g_object_weak_ref (G_OBJECT (root_item), (GWeakNotify) free_menu_cb_data, cb_data);213 g_object_weak_ref (G_OBJECT (root_item), (GWeakNotify) free_menu_cb_data, cb_data);
268214
269 /* Share/unshare */
270 if ((is_managed || is_udf) && !is_root && is_dir && !is_symlink) {
271
272 menu_item = nautilus_menu_item_new ("ubuntuone-share",
273 _("_Share..."),
274 _("Share this folder on Ubuntu One"),
275 "ubuntuone");
276 if (is_pending)
277 g_object_set (menu_item, "sensitive", FALSE, NULL);
278
279 g_signal_connect (menu_item, "activate",
280 G_CALLBACK (share_folder_cb), cb_data);
281 } else {
282 /* the different tooltips will probably do us no good */
283 if (is_root) {
284 menu_item = nautilus_menu_item_new ("ubuntuone-noshare-root",
285 _("_Share..."),
286 _("Sorry, you can't share the root of a Ubuntu One volume"),
287 "ubuntuone");
288 } else if (!(is_managed || is_udf)) {
289 menu_item = nautilus_menu_item_new ("ubuntuone-noshare-unmanaged",
290 _("_Share..."),
291 _("Sorry, you can't share folders not managed by Ubuntu One"),
292 "ubuntuone");
293 } else {
294 menu_item = nautilus_menu_item_new ("ubuntuone-noshare-unmanaged",
295 _("_Share..."),
296 _("Sorry, you can only share folders"),
297 "ubuntuone");
298 }
299 g_object_set (menu_item, "sensitive", FALSE, NULL);
300 }
301
302 nautilus_menu_append_item (submenu, menu_item);
303
304 if ((is_managed && is_shared) && !is_root && is_dir && !is_symlink) {
305 menu_item = nautilus_menu_item_new ("ubuntuone-unshare",
306 _("Stop _Sharing"),
307 _("Stop sharing this folder on Ubuntu One"),
308 "ubuntuone");
309 if (is_pending || is_share_offer_pending)
310 g_object_set (menu_item, "sensitive", FALSE, NULL);
311
312 g_signal_connect (menu_item, "activate",
313 G_CALLBACK (unshare_folder_cb), cb_data);
314 nautilus_menu_append_item (submenu, menu_item);
315 }
316
317 /* UDF logic215 /* UDF logic
318 *216 *
319 * XXX: clean this up and separate the logic out and reuse elsewhere217 * XXX: clean this up and separate the logic out and reuse elsewhere
320218
=== removed file 'nautilus/share-dialog.c'
--- nautilus/share-dialog.c 2012-08-30 18:27:39 +0000
+++ nautilus/share-dialog.c 1970-01-01 00:00:00 +0000
@@ -1,161 +0,0 @@
1/*
2 * UbuntuOne Nautilus plugin
3 *
4 * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
5 *
6 * Copyright 2009-2010 Canonical Ltd.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifdef HAVE_CONFIG_H
23#include <config.h>
24#endif
25
26#include <glib/gi18n-lib.h>
27#include <libsyncdaemon/libsyncdaemon.h>
28#include "share-dialog.h"
29
30G_DEFINE_TYPE(ShareDialog, share_dialog, GTK_TYPE_DIALOG)
31
32static void
33share_dialog_finalize (GObject *object)
34{
35 ShareDialog *dialog = SHARE_DIALOG (object);
36
37 if (dialog->path != NULL)
38 g_free (dialog->path);
39
40 G_OBJECT_CLASS (share_dialog_parent_class)->finalize (object);
41}
42
43static void
44share_dialog_class_init (ShareDialogClass *klass)
45{
46 GObjectClass *object_class = G_OBJECT_CLASS (klass);
47
48 object_class->finalize = share_dialog_finalize;
49}
50
51static void
52dialog_response_cb (GtkDialog *gtk_dialog,
53 gint response,
54 gpointer user_data)
55{
56 ShareDialog *dialog = SHARE_DIALOG (gtk_dialog);
57
58 switch (response) {
59 case GTK_RESPONSE_ACCEPT: {
60 const gchar *entry_data;
61
62 entry_data = gtk_entry_get_text (GTK_ENTRY (dialog->user_picker));
63 if (entry_data != NULL && strlen (entry_data) > 0) {
64 SyncdaemonSharesInterface *interface;
65 gchar **email_entries;
66 GSList *emails = NULL;
67 gboolean allow_mods = FALSE;
68 gint i;
69
70 email_entries = g_strsplit (entry_data, ",", -1);
71 for (i = 0; email_entries[i] != NULL; i++) {
72 const gchar *email = g_strstrip (email_entries[i]);
73 emails = g_slist_prepend (emails, g_strdup (email));
74 }
75 g_strfreev (email_entries);
76
77 if (emails != NULL && g_slist_length (emails) > 0) {
78 allow_mods = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->allow_mods));
79
80 interface = SYNCDAEMON_SHARES_INTERFACE (syncdaemon_daemon_get_shares_interface (dialog->uon->syncdaemon));
81 if (interface != NULL) {
82 syncdaemon_shares_interface_create (interface,
83 dialog->path,
84 emails,
85 g_path_get_basename (dialog->path),
86 allow_mods);
87 }
88 }
89 }
90 }
91 default:
92 gtk_widget_destroy (GTK_WIDGET (dialog));
93 break;
94 }
95}
96
97static void
98share_dialog_init (ShareDialog *dialog)
99{
100 GtkWidget *area, *table, *hbox, *label;
101
102 gtk_window_set_title (GTK_WINDOW (dialog), _("Share on Ubuntu One"));
103 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
104 gtk_dialog_add_buttons (GTK_DIALOG (dialog),
105 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
106 (_("Share")), GTK_RESPONSE_ACCEPT,
107 NULL);
108 gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
109 gtk_window_set_icon_name (GTK_WINDOW (dialog), "ubuntuone");
110 g_signal_connect (G_OBJECT (dialog), "response",
111 G_CALLBACK (dialog_response_cb), NULL);
112
113 area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
114
115 table = gtk_vbox_new (FALSE, 12);
116 gtk_container_set_border_width (GTK_CONTAINER (table), 7);
117 gtk_box_pack_start (GTK_BOX (area), table, TRUE, TRUE, 0);
118 gtk_widget_show (table);
119
120 /* entry here maybe */
121 hbox = gtk_hbox_new (FALSE, 12);
122 gtk_box_pack_start (GTK_BOX (table), hbox, FALSE, FALSE, 0);
123 gtk_widget_show (hbox);
124
125 label = gtk_label_new_with_mnemonic (_("_Email:"));
126 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
127 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
128 gtk_widget_show (label);
129
130 dialog->user_picker = gtk_entry_new ();
131 gtk_widget_set_tooltip_text (dialog->user_picker,
132 _("Type an email address to share this "
133 "folder with. Use a comma to separate "
134 "multiple addresses."));
135 gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->user_picker);
136 gtk_entry_set_activates_default (GTK_ENTRY (dialog->user_picker), TRUE);
137 gtk_box_pack_start (GTK_BOX (hbox), dialog->user_picker, TRUE, TRUE, 0);
138 gtk_widget_show (dialog->user_picker);
139
140 dialog->allow_mods = gtk_check_button_new_with_mnemonic (_("_Allow Modification"));
141 /* Default to RW */
142 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->allow_mods),
143 TRUE);
144 gtk_box_pack_end (GTK_BOX (table), dialog->allow_mods, FALSE, FALSE, 0);
145 gtk_widget_show (dialog->allow_mods);
146
147 gtk_widget_set_size_request (GTK_WIDGET (dialog), 320, -1);
148}
149
150GtkWidget *
151share_dialog_new (GtkWidget *parent, UbuntuOneNautilus *uon, const gchar *path)
152{
153 ShareDialog *dialog;
154
155 dialog = (ShareDialog *) g_object_new (TYPE_SHARE_DIALOG, NULL);
156 dialog->uon = uon;
157 dialog->path = g_strdup (path);
158 gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
159
160 return (GtkWidget *) dialog;
161}
1620
=== removed file 'nautilus/share-dialog.h'
--- nautilus/share-dialog.h 2011-07-20 20:44:39 +0000
+++ nautilus/share-dialog.h 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
1/*
2 * UbuntuOne Nautilus plugin
3 *
4 * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
5 *
6 * Copyright 2009-2010 Canonical Ltd.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef __SHARE_DIALOG_H__
23#define __SHARE_DIALOG_H__
24
25#include <gtk/gtk.h>
26#include "ubuntuone-nautilus.h"
27
28#define TYPE_SHARE_DIALOG (share_dialog_get_type ())
29#define SHARE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SHARE_DIALOG, ShareDialog))
30#define IS_SHARE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SHARE_DIALOG))
31#define SHARE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SHARE_DIALOG, ShareDialogClass))
32#define IS_SHARE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SHARE_DIALOG))
33#define SHARE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SHARE_DIALOG, ShareDialogClass))
34
35typedef struct {
36 GtkDialog parent;
37
38 UbuntuOneNautilus *uon;
39 gchar *path;
40 GtkWidget *user_picker;
41 GtkWidget *allow_mods;
42} ShareDialog;
43
44typedef struct {
45 GtkDialogClass parent_class;
46} ShareDialogClass;
47
48GType share_dialog_get_type (void);
49GtkWidget *share_dialog_new (GtkWidget *parent, UbuntuOneNautilus *uon, const gchar *path);
50
51#endif
520
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2012-08-30 19:00:33 +0000
+++ po/POTFILES.in 2012-11-27 21:44:20 +0000
@@ -1,7 +1,6 @@
1nautilus/ubuntuone-nautilus.c1nautilus/ubuntuone-nautilus.c
2nautilus/context-menu.c2nautilus/context-menu.c
3nautilus/file-watcher.c3nautilus/file-watcher.c
4nautilus/share-dialog.c
5nautilus/utils.c4nautilus/utils.c
6gsd/gsd-ubuntuone.c5gsd/gsd-ubuntuone.c
7[type: gettext/ini]gsd/ubuntuone.gnome-settings-plugin.in6[type: gettext/ini]gsd/ubuntuone.gnome-settings-plugin.in

Subscribers

People subscribed via source and target branches

to all changes: