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

Proposed by dobey on 2012-11-14
Status: Merged
Approved by: dobey on 2012-11-27
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) 2012-11-14 Approve on 2012-11-19
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.
Roberto Alsina (ralsina) :
review: Approve
23. By dobey on 2012-11-27

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
1=== modified file 'configure.ac'
2--- configure.ac 2012-10-31 21:25:54 +0000
3+++ configure.ac 2012-11-27 21:44:20 +0000
4@@ -109,6 +109,17 @@
5 fi
6 AM_CONDITIONAL([HAVE_GSD_30], [test "x$have_gsd_30" = "xyes"])
7
8+# gnome-settings-daemon 3.5.91 changes REGISTER macro behavior again
9+# To compensate, we need an additional define to avoid defining the
10+# class_finalize method for the plug-in
11+PKG_CHECK_EXISTS([gnome-settings-daemon >= 3.5.91],
12+ [have_gsd_36=yes],
13+ [have_gsd_36=no])
14+if test "x$have_gsd_36" = "xyes"; then
15+ AC_DEFINE_UNQUOTED([HAVE_GSD_36], [1],
16+ [If using gnome-settings-daemon 3.5.91 or newer])
17+fi
18+
19 PKG_CHECK_MODULES(SETTINGS_PLUGIN,
20 gnome-settings-daemon
21 gio-2.0
22
23=== modified file 'gsd/gsd-ubuntuone.c'
24--- gsd/gsd-ubuntuone.c 2011-09-23 15:31:01 +0000
25+++ gsd/gsd-ubuntuone.c 2012-11-27 21:44:20 +0000
26@@ -201,11 +201,13 @@
27 }
28
29 #ifdef HAVE_GSD_30
30+#ifndef HAVE_GSD_36
31 static void
32 gsd_ubuntuone_class_finalize (GsdUbuntuOneClass *klass)
33 {
34 }
35 #endif
36+#endif
37
38 static void
39 gsd_ubuntuone_class_init (GsdUbuntuOneClass *klass)
40
41=== modified file 'nautilus/Makefile.am'
42--- nautilus/Makefile.am 2012-08-29 21:24:36 +0000
43+++ nautilus/Makefile.am 2012-11-27 21:44:20 +0000
44@@ -38,8 +38,6 @@
45 error-dialog.c \
46 file-watcher.c \
47 file-watcher.h \
48- share-dialog.c \
49- share-dialog.h \
50 ubuntuone-marshallers.c \
51 ubuntuone-marshallers.h \
52 ubuntuone-nautilus.c \
53
54=== modified file 'nautilus/context-menu.c'
55--- nautilus/context-menu.c 2012-02-20 16:45:35 +0000
56+++ nautilus/context-menu.c 2012-11-27 21:44:20 +0000
57@@ -26,7 +26,6 @@
58 #include <glib/gi18n-lib.h>
59 #include <libsyncdaemon/libsyncdaemon.h>
60 #include "context-menu.h"
61-#include "share-dialog.h"
62
63 typedef struct {
64 UbuntuOneNautilus *uon;
65@@ -141,55 +140,6 @@
66 file_watcher_update_path (data->uon->file_watcher, data->path);
67 }
68
69-static void
70-share_folder_cb (NautilusMenuItem *item, gpointer user_data)
71-{
72- MenuCallbackData * data = (MenuCallbackData *) user_data;
73- GtkWidget * dialog;
74-
75- dialog = share_dialog_new (data->parent, data->uon, data->path);
76- gtk_widget_show (dialog);
77-}
78-
79-static void
80-unshare_folder_cb (NautilusMenuItem *item, gpointer user_data)
81-{
82- MenuCallbackData * data = (MenuCallbackData *) user_data;
83- SyncdaemonSharesInterface *interface;
84-
85- interface = (SyncdaemonSharesInterface *) syncdaemon_daemon_get_shares_interface (data->uon->syncdaemon);
86- if (interface != NULL)
87- syncdaemon_shares_interface_delete (interface, data->path);
88-}
89-
90-gboolean
91-check_share_offer_pending (UbuntuOneNautilus *uon, const gchar *path)
92-{
93- GSList *shares, *l;
94- SyncdaemonInterface *interface;
95- gboolean is_share_offer_pending = FALSE;
96- const gchar *node_id;
97-
98- interface = syncdaemon_daemon_get_shares_interface (uon->syncdaemon);
99- if (SYNCDAEMON_IS_SHARES_INTERFACE (interface)) {
100- shares = syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface));
101- for (l = shares; l != NULL; l = l->next) {
102- SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (l->data);
103-
104- if (g_strcmp0 (syncdaemon_share_info_get_path (share_info), path) == 0) {
105- node_id = syncdaemon_share_info_get_node_id (share_info);
106- if (node_id == NULL)
107- is_share_offer_pending = TRUE;
108- break;
109- }
110- }
111-
112- g_slist_free (shares);
113- }
114-
115- return is_share_offer_pending;
116-}
117-
118 NautilusMenuItem *
119 context_menu_new (UbuntuOneNautilus *uon,
120 GtkWidget *window,
121@@ -201,12 +151,10 @@
122 gchar *path, *item, *homedir_path, *path_uri;
123 gboolean is_managed, is_root, is_udf, is_public, is_shared, is_pending;
124 gboolean is_shared_to_me, is_inhome, is_dir, is_regular, is_symlink;
125- gboolean is_share_offer_pending;
126 MenuCallbackData *cb_data;
127
128 is_managed = is_root = is_udf = is_public = is_shared = is_pending = FALSE;
129 is_shared_to_me = is_inhome = is_dir = is_regular = is_symlink = FALSE;
130- is_share_offer_pending = FALSE;
131
132 if (g_list_length (files) != 1)
133 return NULL;
134@@ -239,8 +187,6 @@
135
136 if (ubuntuone_is_folder_shared (uon, path)) {
137 is_shared = TRUE;
138- if (check_share_offer_pending (uon, path))
139- is_share_offer_pending = TRUE;
140 }
141
142 if (ubuntuone_is_inside_shares (uon, path))
143@@ -266,54 +212,6 @@
144
145 g_object_weak_ref (G_OBJECT (root_item), (GWeakNotify) free_menu_cb_data, cb_data);
146
147- /* Share/unshare */
148- if ((is_managed || is_udf) && !is_root && is_dir && !is_symlink) {
149-
150- menu_item = nautilus_menu_item_new ("ubuntuone-share",
151- _("_Share..."),
152- _("Share this folder on Ubuntu One"),
153- "ubuntuone");
154- if (is_pending)
155- g_object_set (menu_item, "sensitive", FALSE, NULL);
156-
157- g_signal_connect (menu_item, "activate",
158- G_CALLBACK (share_folder_cb), cb_data);
159- } else {
160- /* the different tooltips will probably do us no good */
161- if (is_root) {
162- menu_item = nautilus_menu_item_new ("ubuntuone-noshare-root",
163- _("_Share..."),
164- _("Sorry, you can't share the root of a Ubuntu One volume"),
165- "ubuntuone");
166- } else if (!(is_managed || is_udf)) {
167- menu_item = nautilus_menu_item_new ("ubuntuone-noshare-unmanaged",
168- _("_Share..."),
169- _("Sorry, you can't share folders not managed by Ubuntu One"),
170- "ubuntuone");
171- } else {
172- menu_item = nautilus_menu_item_new ("ubuntuone-noshare-unmanaged",
173- _("_Share..."),
174- _("Sorry, you can only share folders"),
175- "ubuntuone");
176- }
177- g_object_set (menu_item, "sensitive", FALSE, NULL);
178- }
179-
180- nautilus_menu_append_item (submenu, menu_item);
181-
182- if ((is_managed && is_shared) && !is_root && is_dir && !is_symlink) {
183- menu_item = nautilus_menu_item_new ("ubuntuone-unshare",
184- _("Stop _Sharing"),
185- _("Stop sharing this folder on Ubuntu One"),
186- "ubuntuone");
187- if (is_pending || is_share_offer_pending)
188- g_object_set (menu_item, "sensitive", FALSE, NULL);
189-
190- g_signal_connect (menu_item, "activate",
191- G_CALLBACK (unshare_folder_cb), cb_data);
192- nautilus_menu_append_item (submenu, menu_item);
193- }
194-
195 /* UDF logic
196 *
197 * XXX: clean this up and separate the logic out and reuse elsewhere
198
199=== removed file 'nautilus/share-dialog.c'
200--- nautilus/share-dialog.c 2012-08-30 18:27:39 +0000
201+++ nautilus/share-dialog.c 1970-01-01 00:00:00 +0000
202@@ -1,161 +0,0 @@
203-/*
204- * UbuntuOne Nautilus plugin
205- *
206- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
207- *
208- * Copyright 2009-2010 Canonical Ltd.
209- *
210- * This program is free software: you can redistribute it and/or modify it
211- * under the terms of the GNU General Public License version 3, as published
212- * by the Free Software Foundation.
213- *
214- * This program is distributed in the hope that it will be useful, but
215- * WITHOUT ANY WARRANTY; without even the implied warranties of
216- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
217- * PURPOSE. See the GNU General Public License for more details.
218- *
219- * You should have received a copy of the GNU General Public License along
220- * with this program. If not, see <http://www.gnu.org/licenses/>.
221- *
222- */
223-
224-#ifdef HAVE_CONFIG_H
225-#include <config.h>
226-#endif
227-
228-#include <glib/gi18n-lib.h>
229-#include <libsyncdaemon/libsyncdaemon.h>
230-#include "share-dialog.h"
231-
232-G_DEFINE_TYPE(ShareDialog, share_dialog, GTK_TYPE_DIALOG)
233-
234-static void
235-share_dialog_finalize (GObject *object)
236-{
237- ShareDialog *dialog = SHARE_DIALOG (object);
238-
239- if (dialog->path != NULL)
240- g_free (dialog->path);
241-
242- G_OBJECT_CLASS (share_dialog_parent_class)->finalize (object);
243-}
244-
245-static void
246-share_dialog_class_init (ShareDialogClass *klass)
247-{
248- GObjectClass *object_class = G_OBJECT_CLASS (klass);
249-
250- object_class->finalize = share_dialog_finalize;
251-}
252-
253-static void
254-dialog_response_cb (GtkDialog *gtk_dialog,
255- gint response,
256- gpointer user_data)
257-{
258- ShareDialog *dialog = SHARE_DIALOG (gtk_dialog);
259-
260- switch (response) {
261- case GTK_RESPONSE_ACCEPT: {
262- const gchar *entry_data;
263-
264- entry_data = gtk_entry_get_text (GTK_ENTRY (dialog->user_picker));
265- if (entry_data != NULL && strlen (entry_data) > 0) {
266- SyncdaemonSharesInterface *interface;
267- gchar **email_entries;
268- GSList *emails = NULL;
269- gboolean allow_mods = FALSE;
270- gint i;
271-
272- email_entries = g_strsplit (entry_data, ",", -1);
273- for (i = 0; email_entries[i] != NULL; i++) {
274- const gchar *email = g_strstrip (email_entries[i]);
275- emails = g_slist_prepend (emails, g_strdup (email));
276- }
277- g_strfreev (email_entries);
278-
279- if (emails != NULL && g_slist_length (emails) > 0) {
280- allow_mods = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->allow_mods));
281-
282- interface = SYNCDAEMON_SHARES_INTERFACE (syncdaemon_daemon_get_shares_interface (dialog->uon->syncdaemon));
283- if (interface != NULL) {
284- syncdaemon_shares_interface_create (interface,
285- dialog->path,
286- emails,
287- g_path_get_basename (dialog->path),
288- allow_mods);
289- }
290- }
291- }
292- }
293- default:
294- gtk_widget_destroy (GTK_WIDGET (dialog));
295- break;
296- }
297-}
298-
299-static void
300-share_dialog_init (ShareDialog *dialog)
301-{
302- GtkWidget *area, *table, *hbox, *label;
303-
304- gtk_window_set_title (GTK_WINDOW (dialog), _("Share on Ubuntu One"));
305- gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
306- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
307- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
308- (_("Share")), GTK_RESPONSE_ACCEPT,
309- NULL);
310- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
311- gtk_window_set_icon_name (GTK_WINDOW (dialog), "ubuntuone");
312- g_signal_connect (G_OBJECT (dialog), "response",
313- G_CALLBACK (dialog_response_cb), NULL);
314-
315- area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
316-
317- table = gtk_vbox_new (FALSE, 12);
318- gtk_container_set_border_width (GTK_CONTAINER (table), 7);
319- gtk_box_pack_start (GTK_BOX (area), table, TRUE, TRUE, 0);
320- gtk_widget_show (table);
321-
322- /* entry here maybe */
323- hbox = gtk_hbox_new (FALSE, 12);
324- gtk_box_pack_start (GTK_BOX (table), hbox, FALSE, FALSE, 0);
325- gtk_widget_show (hbox);
326-
327- label = gtk_label_new_with_mnemonic (_("_Email:"));
328- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
329- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
330- gtk_widget_show (label);
331-
332- dialog->user_picker = gtk_entry_new ();
333- gtk_widget_set_tooltip_text (dialog->user_picker,
334- _("Type an email address to share this "
335- "folder with. Use a comma to separate "
336- "multiple addresses."));
337- gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->user_picker);
338- gtk_entry_set_activates_default (GTK_ENTRY (dialog->user_picker), TRUE);
339- gtk_box_pack_start (GTK_BOX (hbox), dialog->user_picker, TRUE, TRUE, 0);
340- gtk_widget_show (dialog->user_picker);
341-
342- dialog->allow_mods = gtk_check_button_new_with_mnemonic (_("_Allow Modification"));
343- /* Default to RW */
344- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->allow_mods),
345- TRUE);
346- gtk_box_pack_end (GTK_BOX (table), dialog->allow_mods, FALSE, FALSE, 0);
347- gtk_widget_show (dialog->allow_mods);
348-
349- gtk_widget_set_size_request (GTK_WIDGET (dialog), 320, -1);
350-}
351-
352-GtkWidget *
353-share_dialog_new (GtkWidget *parent, UbuntuOneNautilus *uon, const gchar *path)
354-{
355- ShareDialog *dialog;
356-
357- dialog = (ShareDialog *) g_object_new (TYPE_SHARE_DIALOG, NULL);
358- dialog->uon = uon;
359- dialog->path = g_strdup (path);
360- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
361-
362- return (GtkWidget *) dialog;
363-}
364
365=== removed file 'nautilus/share-dialog.h'
366--- nautilus/share-dialog.h 2011-07-20 20:44:39 +0000
367+++ nautilus/share-dialog.h 1970-01-01 00:00:00 +0000
368@@ -1,51 +0,0 @@
369-/*
370- * UbuntuOne Nautilus plugin
371- *
372- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
373- *
374- * Copyright 2009-2010 Canonical Ltd.
375- *
376- * This program is free software: you can redistribute it and/or modify it
377- * under the terms of the GNU General Public License version 3, as published
378- * by the Free Software Foundation.
379- *
380- * This program is distributed in the hope that it will be useful, but
381- * WITHOUT ANY WARRANTY; without even the implied warranties of
382- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
383- * PURPOSE. See the GNU General Public License for more details.
384- *
385- * You should have received a copy of the GNU General Public License along
386- * with this program. If not, see <http://www.gnu.org/licenses/>.
387- *
388- */
389-
390-#ifndef __SHARE_DIALOG_H__
391-#define __SHARE_DIALOG_H__
392-
393-#include <gtk/gtk.h>
394-#include "ubuntuone-nautilus.h"
395-
396-#define TYPE_SHARE_DIALOG (share_dialog_get_type ())
397-#define SHARE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SHARE_DIALOG, ShareDialog))
398-#define IS_SHARE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SHARE_DIALOG))
399-#define SHARE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SHARE_DIALOG, ShareDialogClass))
400-#define IS_SHARE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SHARE_DIALOG))
401-#define SHARE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SHARE_DIALOG, ShareDialogClass))
402-
403-typedef struct {
404- GtkDialog parent;
405-
406- UbuntuOneNautilus *uon;
407- gchar *path;
408- GtkWidget *user_picker;
409- GtkWidget *allow_mods;
410-} ShareDialog;
411-
412-typedef struct {
413- GtkDialogClass parent_class;
414-} ShareDialogClass;
415-
416-GType share_dialog_get_type (void);
417-GtkWidget *share_dialog_new (GtkWidget *parent, UbuntuOneNautilus *uon, const gchar *path);
418-
419-#endif
420
421=== modified file 'po/POTFILES.in'
422--- po/POTFILES.in 2012-08-30 19:00:33 +0000
423+++ po/POTFILES.in 2012-11-27 21:44:20 +0000
424@@ -1,7 +1,6 @@
425 nautilus/ubuntuone-nautilus.c
426 nautilus/context-menu.c
427 nautilus/file-watcher.c
428-nautilus/share-dialog.c
429 nautilus/utils.c
430 gsd/gsd-ubuntuone.c
431 [type: gettext/ini]gsd/ubuntuone.gnome-settings-plugin.in

Subscribers

People subscribed via source and target branches

to all changes: