Merge lp:~alecu/ubuntuone-client/gsd-plugin into lp:ubuntuone-client

Proposed by Alejandro J. Cura on 2010-07-14
Status: Merged
Approved by: John Lenton on 2010-07-15
Approved revision: 568
Merged at revision: 578
Proposed branch: lp:~alecu/ubuntuone-client/gsd-plugin
Merge into: lp:ubuntuone-client
Diff against target: 614 lines (+499/-4)
12 files modified
.bzrignore (+2/-0)
Makefile.am (+1/-1)
configure.ac (+13/-0)
gsd-plugin/Makefile.am (+62/-0)
gsd-plugin/gsd-ubuntuone.c (+167/-0)
gsd-plugin/gsd-ubuntuone.h (+66/-0)
gsd-plugin/test-gsd-ubuntuone.c (+61/-0)
gsd-plugin/test-send-signal.py (+82/-0)
gsd-plugin/ubuntuone.gnome-settings-plugin.in (+8/-0)
libsyncdaemon/syncdaemon-daemon.c (+33/-3)
libsyncdaemon/syncdaemon-daemon.h (+2/-0)
po/POTFILES.in (+2/-0)
To merge this branch: bzr merge lp:~alecu/ubuntuone-client/gsd-plugin
Reviewer Review Type Date Requested Status
John Lenton Approve on 2010-07-15
Rodrigo Moya (community) 2010-07-14 Approve on 2010-07-15
Review via email: mp+29922@code.launchpad.net

Commit Message

A plugin for gnome-settings-daemon that listens for Ubuntu One out of space conditions, and shows a dialog with info

Description of the Change

A plugin for gnome-settings-daemon that listens for Ubuntu One out of space conditions, and shows a dialog with info.

To post a comment you must log in.
Rodrigo Moya (rodrigo-moya) wrote :

It looks ok, and seems to work. Only a few formatting issues:

* In Makefile.am some lines seem to use 8-spaces and others 4, so please use a TAB everywhere

* Also here:

583 + dbus_g_proxy_connect_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
584 + G_CALLBACK (quota_exceeded_cb), daemon, NULL);

Approving anyway, so just fix this please before merging the branch

review: Approve
568. By Alejandro J. Cura on 2010-07-15

tab/spaces fixes

John Lenton (chipaca) wrote :

I like it and I want it :)

review: Approve
dobey (dobey) wrote :

 +_Name=Ubuntu One

This shouldn't be marked for translation. Just remove the _ here. :)

114 +CLEANFILES = \
115 + $(plugin_DATA)
116 +
117 +DISTCLEANFILES = \
118 + $(plugin_DATA)

You don't need to add the same thing to multiple CLEANFILES variables. maintainer-clean depends on distclean depends on clean. :)

So you can just remove the DISTCLEANFILES here. You should add Makefile.in to MAINTAINERCLEANFILES though.

569. By Alejandro J. Cura on 2010-07-15

autoconf fixes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-07-01 11:06:12 +0000
3+++ .bzrignore 2010-07-15 20:33:42 +0000
4@@ -53,3 +53,5 @@
5 libsyncdaemon/syncdaemon-marshal.[ch]
6 libsyncdaemon/test-libsyncdaemon
7 libsyncdaemon/libsyncdaemon-1.0.pc
8+ubuntuone.gnome-settings-plugin
9+test-gsd-ubuntuone
10
11=== modified file 'Makefile.am'
12--- Makefile.am 2010-07-15 17:28:51 +0000
13+++ Makefile.am 2010-07-15 20:33:42 +0000
14@@ -1,6 +1,6 @@
15 DISTCHECK_CONFIGURE_FLAGS = --disable-rendering --enable-pycentral
16
17-SUBDIRS = data libsyncdaemon nautilus po
18+SUBDIRS = data libsyncdaemon nautilus po gsd-plugin
19
20 # Shut libtoolize up
21 ACLOCAL_AMFLAGS = -I m4
22
23=== modified file 'configure.ac'
24--- configure.ac 2010-07-15 17:28:51 +0000
25+++ configure.ac 2010-07-15 20:33:42 +0000
26@@ -144,6 +144,18 @@
27 AC_SUBST(LIBSYNCDAEMON_REVISION)
28 AC_SUBST(LIBSYNCDAEMON_AGE)
29
30+# Dependencies for the gnome-settings-daemon plugin
31+PKG_CHECK_MODULES(SETTINGS_PLUGIN,
32+ gtk+-2.0
33+ gnome-settings-daemon
34+)
35+
36+AC_SUBST(SETTINGS_PLUGIN_CFLAGS)
37+AC_SUBST(SETTINGS_PLUGIN_LIBS)
38+
39+GSD_INTLTOOL_PLUGIN_RULE='%.gnome-settings-plugin: %.gnome-settings-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
40+AC_SUBST([GSD_INTLTOOL_PLUGIN_RULE])
41+
42 dnl ---------------------------------------------------------------------------
43 dnl - Are we specifying a different dbus root ?
44 dnl ---------------------------------------------------------------------------
45@@ -165,6 +177,7 @@
46 libsyncdaemon/libsyncdaemon-1.0.pc
47 nautilus/Makefile
48 po/Makefile.in
49+gsd-plugin/Makefile
50 ])
51
52 AC_OUTPUT
53
54=== added directory 'gsd-plugin'
55=== added file 'gsd-plugin/Makefile.am'
56--- gsd-plugin/Makefile.am 1970-01-01 00:00:00 +0000
57+++ gsd-plugin/Makefile.am 2010-07-15 20:33:42 +0000
58@@ -0,0 +1,62 @@
59+noinst_PROGRAMS = \
60+ test-gsd-ubuntuone
61+
62+test_gsd_ubuntuone_SOURCES = \
63+ test-gsd-ubuntuone.c \
64+ gsd-ubuntuone.h \
65+ gsd-ubuntuone.c
66+
67+test_gsd_ubuntuone_CPPFLAGS = \
68+ -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
69+ -DDELAYED_START_TIMEOUT=1000
70+
71+test_gsd_ubuntuone_CFLAGS = \
72+ $(SETTINGS_PLUGIN_CFLAGS) \
73+ -I$(top_srcdir)
74+
75+test_gsd_ubuntuone_LDADD = \
76+ $(SETTINGS_PLUGIN_LIBS) \
77+ $(top_builddir)/libsyncdaemon/libsyncdaemon-1.0.la
78+
79+plugindir = $(libdir)/gnome-settings-daemon-2.0
80+
81+plugin_LTLIBRARIES = \
82+ libubuntuone.la
83+
84+libubuntuone_la_SOURCES = \
85+ gsd-ubuntuone.h \
86+ gsd-ubuntuone.c
87+
88+libubuntuone_la_CPPFLAGS = \
89+ -I$(top_srcdir)/gnome-settings-daemon \
90+ -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
91+ -DREGISTER_PLUGIN \
92+ -DDELAYED_START_TIMEOUT=3000
93+
94+libubuntuone_la_CFLAGS = \
95+ $(SETTINGS_PLUGIN_CFLAGS) \
96+ -I$(top_srcdir)
97+
98+libubuntuone_la_LDFLAGS = \
99+ -export_dynamic -module -avoid-version -no-undefined \
100+ $(GSD_PLUGIN_LDFLAGS)
101+
102+libubuntuone_la_LIBADD = \
103+ $(SETTINGS_PLUGIN_LIBS) \
104+ $(top_builddir)/libsyncdaemon/libsyncdaemon-1.0.la
105+
106+plugin_in_files = \
107+ ubuntuone.gnome-settings-plugin.in
108+
109+plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
110+
111+EXTRA_DIST = \
112+ $(plugin_in_files)
113+
114+CLEANFILES = \
115+ $(plugin_DATA)
116+
117+MAINTAINERCLEANFILES = \
118+ Makefile.in
119+
120+@GSD_INTLTOOL_PLUGIN_RULE@
121
122=== added file 'gsd-plugin/gsd-ubuntuone.c'
123--- gsd-plugin/gsd-ubuntuone.c 1970-01-01 00:00:00 +0000
124+++ gsd-plugin/gsd-ubuntuone.c 2010-07-15 20:33:42 +0000
125@@ -0,0 +1,167 @@
126+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
127+ *
128+ * Authors: Alejandro J. Cura <alecu@canonical.com>
129+ *
130+ * Copyright (C) 2010 Canonical Ltd.
131+ *
132+ * This program is free software; you can redistribute it and/or modify
133+ * it under the terms of the GNU General Public License version 3,
134+ * as published by the Free Software Foundation.
135+ *
136+ * This program is distributed in the hope that it will be useful,
137+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
138+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
139+ * GNU General Public License for more details.
140+ *
141+ * You should have received a copy of the GNU General Public License
142+ * along with this program; if not, write to the Free Software
143+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
144+ *
145+ */
146+
147+#include "config.h"
148+
149+#include <glib/gi18n-lib.h>
150+#include <gmodule.h>
151+#include <gtk/gtk.h>
152+
153+#include "gnome-settings-daemon/gnome-settings-plugin.h"
154+#include "gsd-ubuntuone.h"
155+
156+#ifdef REGISTER_PLUGIN
157+GNOME_SETTINGS_PLUGIN_REGISTER (GsdUbuntuOne, gsd_ubuntuone)
158+#else
159+G_DEFINE_TYPE (GsdUbuntuOne, gsd_ubuntuone, G_TYPE_OBJECT);
160+#endif
161+
162+#define NO_SPACE _("Your Ubuntu One storage is full. Follow the link below to upgrade your subscription.")
163+#define NO_SPACE_SHARE _("There is no available space on the folder:\n\"%s\" shared by %s")
164+#define NO_SPACE_TITLE _("Out of space")
165+#define UPGRADE_SUBSCRIPTION_TEXT _("Upgrade Subscription")
166+#define UPGRADE_SUBSCRIPTION_URI _("http://one.ubuntu.com/plans/")
167+
168+static void dialog_closed_callback (GtkDialog *dialog,
169+ gint response_id,
170+ gpointer user_data)
171+{
172+ GsdUbuntuOne *plugin = GSD_UBUNTUONE (user_data);
173+ g_debug ("dialog closed %d", response_id);
174+ gtk_widget_destroy (GTK_WIDGET (plugin->out_of_space_dialog));
175+ plugin->out_of_space_dialog = NULL;
176+}
177+
178+static void
179+show_out_of_space_dialog (GsdUbuntuOne *plugin,
180+ const gchar *title,
181+ const gchar *body,
182+ gboolean show_upgrade_link)
183+{
184+ GError *error = NULL;
185+ GtkWidget *upgrade_link;
186+ GtkResponseType result;
187+
188+ if (plugin->out_of_space_dialog != NULL) {
189+ gtk_widget_destroy (GTK_WIDGET (plugin->out_of_space_dialog));
190+ plugin->out_of_space_dialog = NULL;
191+ }
192+
193+ g_debug ("notification: %s - %s", title, body);
194+
195+ plugin->out_of_space_dialog = gtk_message_dialog_new (NULL,
196+ GTK_DIALOG_NO_SEPARATOR,
197+ GTK_MESSAGE_WARNING,
198+ GTK_BUTTONS_CLOSE,
199+ "%s",
200+ body);
201+
202+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW (plugin->out_of_space_dialog), FALSE);
203+ gtk_window_set_title (GTK_WINDOW (plugin->out_of_space_dialog), title);
204+ gtk_window_set_icon_name (GTK_WINDOW (plugin->out_of_space_dialog), "ubuntuone");
205+ gtk_window_set_position (GTK_WINDOW (plugin->out_of_space_dialog), GTK_WIN_POS_CENTER);
206+
207+
208+ upgrade_link = gtk_link_button_new_with_label (UPGRADE_SUBSCRIPTION_URI,
209+ UPGRADE_SUBSCRIPTION_TEXT);
210+
211+ gtk_dialog_add_action_widget (GTK_DIALOG (plugin->out_of_space_dialog),
212+ upgrade_link, 0);
213+
214+
215+ if (show_upgrade_link) {
216+ gtk_widget_show (GTK_WIDGET (upgrade_link));
217+ }
218+
219+ g_signal_connect (G_OBJECT (plugin->out_of_space_dialog), "response",
220+ G_CALLBACK (dialog_closed_callback), plugin);
221+ gtk_widget_show (plugin->out_of_space_dialog);
222+}
223+
224+
225+static void
226+quota_exceeded_callback (SyncdaemonDaemon *daemon,
227+ GHashTable *file_info,
228+ gpointer user_data)
229+{
230+ gchar * volume_type;
231+ GsdUbuntuOne *plugin = GSD_UBUNTUONE (user_data);
232+ volume_type = g_hash_table_lookup (file_info, "type");
233+ if (volume_type != NULL && strcmp (volume_type, "Share") == 0) {
234+ gchar * other_visible_name, * path, * message;
235+ other_visible_name = g_hash_table_lookup (file_info, "other_visible_name");
236+ path = g_hash_table_lookup (file_info, "path");
237+ message = g_strdup_printf (NO_SPACE_SHARE, path, other_visible_name);
238+ show_out_of_space_dialog (plugin, NO_SPACE_TITLE, message, FALSE);
239+ g_free (message);
240+ } else {
241+ show_out_of_space_dialog (plugin, NO_SPACE_TITLE, NO_SPACE, TRUE);
242+ }
243+}
244+
245+static gboolean
246+delayed_syncdaemon_start (gpointer data)
247+{
248+ GsdUbuntuOne *plugin;
249+ plugin = GSD_UBUNTUONE (data);
250+ g_debug ("Performing delayed syncdaemon init");
251+
252+ plugin->syncdaemon = syncdaemon_daemon_new ();
253+ plugin->out_of_space_dialog = NULL;
254+ g_signal_connect (G_OBJECT (plugin->syncdaemon), "quota_exceeded",
255+ G_CALLBACK (quota_exceeded_callback), plugin);
256+ return FALSE;
257+}
258+
259+static void
260+gsd_ubuntuone_init (GsdUbuntuOne *plugin)
261+{
262+}
263+
264+void
265+gsd_ubuntuone_activate (GnomeSettingsPlugin *gsp_object)
266+{
267+ GsdUbuntuOne *plugin = GSD_UBUNTUONE (gsp_object);
268+ g_timeout_add (DELAYED_START_TIMEOUT, delayed_syncdaemon_start, plugin);
269+}
270+
271+static void
272+gsd_ubuntuone_dispose (GObject *object)
273+{
274+ GsdUbuntuOne *plugin = GSD_UBUNTUONE (object);
275+ GsdUbuntuOneClass *klass = GSD_UBUNTUONE_GET_CLASS (object);
276+ GObjectClass *parent_class = G_OBJECT_CLASS (klass);
277+
278+ if (plugin->syncdaemon)
279+ g_object_unref (plugin->syncdaemon);
280+
281+ parent_class->dispose (object);
282+}
283+
284+static void
285+gsd_ubuntuone_class_init (GsdUbuntuOneClass *klass)
286+{
287+ GObjectClass *g_class = G_OBJECT_CLASS (klass);
288+ GnomeSettingsPluginClass *gsp_class = (GnomeSettingsPluginClass *) klass;
289+
290+ g_class->dispose = gsd_ubuntuone_dispose;
291+ gsp_class->activate = gsd_ubuntuone_activate;
292+}
293
294=== added file 'gsd-plugin/gsd-ubuntuone.h'
295--- gsd-plugin/gsd-ubuntuone.h 1970-01-01 00:00:00 +0000
296+++ gsd-plugin/gsd-ubuntuone.h 2010-07-15 20:33:42 +0000
297@@ -0,0 +1,66 @@
298+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
299+ *
300+ * Authors: Alejandro J. Cura <alecu@canonical.com>
301+ *
302+ * Copyright (C) 2010 Canonical Ltd.
303+ *
304+ * This program is free software; you can redistribute it and/or modify
305+ * it under the terms of the GNU General Public License version 3,
306+ * as published by the Free Software Foundation.
307+ *
308+ * This program is distributed in the hope that it will be useful,
309+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
310+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
311+ * GNU General Public License for more details.
312+ *
313+ * You should have received a copy of the GNU General Public License
314+ * along with this program; if not, write to the Free Software
315+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
316+ *
317+ */
318+
319+#ifndef __GSD_UBUNTUONE_H__
320+#define __GSD_UBUNTUONE_H__
321+
322+#include <glib.h>
323+#include <glib-object.h>
324+#include <gmodule.h>
325+
326+#include "gnome-settings-daemon/gnome-settings-plugin.h"
327+
328+#include <libsyncdaemon/syncdaemon-publicfiles-interface.h>
329+
330+G_BEGIN_DECLS
331+
332+#define GSD_TYPE_UBUNTUONE (gsd_ubuntuone_get_type ())
333+#define GSD_UBUNTUONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_UBUNTUONE, GsdUbuntuOne))
334+#define GSD_UBUNTUONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GSD_TYPE_UBUNTUONE, GsdUbuntuOneClass))
335+#define GSD_IS_UBUNTUONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_UBUNTUONE))
336+#define GSD_IS_UBUNTUONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_UBUNTUONE))
337+#define GSD_UBUNTUONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_UBUNTUONE, GsdUbuntuOneClass))
338+
339+typedef struct _GsdUbuntuOne GsdUbuntuOne;
340+typedef struct _GsdUbuntuOneClass GsdUbuntuOneClass;
341+
342+struct _GsdUbuntuOne
343+{
344+ GnomeSettingsPlugin parent_instance;
345+
346+ /*< private >*/
347+ SyncdaemonDaemon *syncdaemon;
348+ GtkWidget *out_of_space_dialog;
349+};
350+
351+struct _GsdUbuntuOneClass
352+{
353+ GnomeSettingsPluginClass parent_class;
354+};
355+
356+GType gsd_ubuntuone_get_type (void);
357+G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module);
358+
359+void gsd_ubuntuone_activate (GnomeSettingsPlugin *gsp_object);
360+
361+G_END_DECLS
362+
363+#endif
364
365=== added file 'gsd-plugin/test-gsd-ubuntuone.c'
366--- gsd-plugin/test-gsd-ubuntuone.c 1970-01-01 00:00:00 +0000
367+++ gsd-plugin/test-gsd-ubuntuone.c 2010-07-15 20:33:42 +0000
368@@ -0,0 +1,61 @@
369+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
370+ *
371+ * Authors: Alejandro J. Cura <alecu@canonical.com>
372+ *
373+ * Copyright (C) 2010 Canonical Ltd.
374+ *
375+ * This program is free software; you can redistribute it and/or modify
376+ * it under the terms of the GNU General Public License version 3,
377+ * as published by the Free Software Foundation.
378+ *
379+ * This program is distributed in the hope that it will be useful,
380+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
381+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
382+ * GNU General Public License for more details.
383+ *
384+ * You should have received a copy of the GNU General Public License
385+ * along with this program; if not, write to the Free Software
386+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
387+ *
388+ */
389+
390+#include "config.h"
391+
392+#include <stdlib.h>
393+#include <libintl.h>
394+#include <locale.h>
395+#include <string.h>
396+#include <unistd.h>
397+
398+#include <glib/gi18n.h>
399+#include <gtk/gtk.h>
400+
401+#include "gsd-ubuntuone.h"
402+
403+static gboolean
404+idle (GsdUbuntuOne *plugin)
405+{
406+ gsd_ubuntuone_activate ((GnomeSettingsPlugin *) plugin);
407+ return FALSE;
408+}
409+
410+int
411+main (int argc, char *argv[])
412+{
413+ GsdUbuntuOne *plugin;
414+
415+ bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
416+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
417+ textdomain (GETTEXT_PACKAGE);
418+
419+ setlocale (LC_ALL, "");
420+
421+ gtk_init (&argc, &argv);
422+
423+ plugin = g_object_new (GSD_TYPE_UBUNTUONE, NULL);
424+ g_idle_add ((GSourceFunc)idle, plugin);
425+
426+ gtk_main ();
427+
428+ return 0;
429+}
430
431=== added file 'gsd-plugin/test-send-signal.py'
432--- gsd-plugin/test-send-signal.py 1970-01-01 00:00:00 +0000
433+++ gsd-plugin/test-send-signal.py 2010-07-15 20:33:42 +0000
434@@ -0,0 +1,82 @@
435+#!/usr/bin/env python
436+# -*- encoding: utf-8 -*-
437+#
438+# Authors: Alejandro J. Cura <alecu@canonical.com>
439+#
440+# Copyright (C) 2010 Canonical Ltd.
441+#
442+# This program is free software; you can redistribute it and/or modify
443+# it under the terms of the GNU General Public License version 3,
444+# as published by the Free Software Foundation.
445+#
446+# This program is distributed in the hope that it will be useful,
447+# but WITHOUT ANY WARRANTY; without even the implied warranty of
448+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
449+# GNU General Public License for more details.
450+#
451+# You should have received a copy of the GNU General Public License
452+# along with this program; if not, write to the Free Software
453+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
454+#
455+
456+
457+import gobject
458+
459+import dbus
460+import dbus.service
461+import dbus.mainloop.glib
462+
463+import sys
464+
465+OBJECT_PATH = "/"
466+OBJECT_NAME = "com.ubuntuone.SyncDaemon"
467+OBJECT_INTERFACE = "com.ubuntuone.SyncDaemon.SyncDaemon"
468+SAMPLE_VOLUME_INFO = {
469+ "volume_id": "sample_volume_id",
470+ "owner_id": "sample_owner_id",
471+ "volume_name": "sample_volume_name",
472+ "type": "UDF",
473+}
474+SAMPLE_SHARE_INFO = {
475+ "volume_id": "sample_volume_id",
476+ "owner_id": "sample_owner_id",
477+ "volume_name": "sample_volume_name",
478+ "type": "Share",
479+ "other_visible_name": "Some Body",
480+ "path": "~/A shared folder",
481+}
482+
483+class SyncDaemonMocker(dbus.service.Object):
484+ def __init__(self, conn, object_path=OBJECT_PATH):
485+ dbus.service.Object.__init__(self, conn, object_path)
486+
487+ @dbus.service.signal(OBJECT_INTERFACE)
488+ def QuotaExceeded(self, volume_info):
489+ pass
490+
491+ @dbus.service.method(OBJECT_INTERFACE)
492+ def emitQuotaExceeded(self):
493+ self.QuotaExceeded(SAMPLE_VOLUME_INFO)
494+ return 'Signal emitted'
495+
496+ @dbus.service.method(OBJECT_INTERFACE, in_signature='', out_signature='')
497+ def Quit(self):
498+ main_loop.quit()
499+
500+if __name__ == '__main__':
501+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
502+
503+ bus = dbus.SessionBus()
504+ name = dbus.service.BusName(OBJECT_NAME, bus)
505+ object = SyncDaemonMocker(bus)
506+
507+ main_loop = gobject.MainLoop()
508+
509+ if "-d" not in sys.argv:
510+ if "-3" in sys.argv:
511+ gobject.timeout_add(10, object.QuotaExceeded, SAMPLE_SHARE_INFO)
512+ else:
513+ gobject.timeout_add(10, object.QuotaExceeded, SAMPLE_VOLUME_INFO)
514+ gobject.timeout_add(200, main_loop.quit)
515+
516+ main_loop.run()
517
518=== added file 'gsd-plugin/ubuntuone.gnome-settings-plugin.in'
519--- gsd-plugin/ubuntuone.gnome-settings-plugin.in 1970-01-01 00:00:00 +0000
520+++ gsd-plugin/ubuntuone.gnome-settings-plugin.in 2010-07-15 20:33:42 +0000
521@@ -0,0 +1,8 @@
522+[GNOME Settings Plugin]
523+Module=ubuntuone
524+IAge=0
525+Name=Ubuntu One
526+_Description=Shows a warning when the Ubuntu One account runs out of space
527+Authors=Alejandro J. Cura <alecu@canonical.com>
528+Copyright=Copyright © 2010 Canonical Ltd.
529+Website=http://one.ubuntu.com/
530
531=== modified file 'libsyncdaemon/syncdaemon-daemon.c'
532--- libsyncdaemon/syncdaemon-daemon.c 2010-06-24 10:43:48 +0000
533+++ libsyncdaemon/syncdaemon-daemon.c 2010-07-15 20:33:42 +0000
534@@ -76,6 +76,7 @@
535 UPLOAD_STARTED_SIGNAL,
536 UPLOAD_FILE_PROGRESS_SIGNAL,
537 UPLOAD_FINISHED_SIGNAL,
538+ QUOTA_EXCEEDED_SIGNAL,
539 LAST_SIGNAL
540 };
541
542@@ -273,17 +274,46 @@
543 _syncdaemon_marshal_VOID__STRING_OBJECT,
544 G_TYPE_NONE, 2,
545 G_TYPE_STRING, G_TYPE_OBJECT);
546+ daemon_signals[QUOTA_EXCEEDED_SIGNAL] = g_signal_new ("quota_exceeded",
547+ G_TYPE_FROM_CLASS (klass),
548+ (GSignalFlags) G_SIGNAL_RUN_LAST,
549+ G_STRUCT_OFFSET (SyncdaemonDaemonClass, quota_exceeded),
550+ NULL, NULL,
551+ g_cclosure_marshal_VOID__POINTER,
552+ G_TYPE_NONE, 1,
553+ G_TYPE_POINTER);
554+}
555+
556+static void
557+quota_exceeded_cb (DBusGProxy *proxy, GHashTable *volume_info, gpointer user_data)
558+{
559+ SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
560+
561+ if (daemon != NULL)
562+ g_signal_emit_by_name (daemon, "quota_exceeded", volume_info);
563 }
564
565 static void
566 setup_daemon_interface (SyncdaemonDaemon *daemon)
567 {
568+ GObject *proxy = NULL;
569 daemon->priv->daemon_interface = g_object_new (SYNCDAEMON_TYPE_INTERFACE,
570 "daemon", daemon,
571 NULL);
572- syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface),
573- "com.ubuntuone.SyncDaemon", "/",
574- "com.ubuntuone.SyncDaemon.SyncDaemon");
575+ proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface),
576+ "com.ubuntuone.SyncDaemon", "/",
577+ "com.ubuntuone.SyncDaemon.SyncDaemon");
578+ if (proxy != NULL) {
579+ dbus_g_proxy_add_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
580+ dbus_g_type_get_map ("GHashTable",
581+ G_TYPE_STRING,
582+ G_TYPE_STRING),
583+ G_TYPE_INVALID);
584+ dbus_g_proxy_connect_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
585+ G_CALLBACK (quota_exceeded_cb),
586+ daemon, NULL);
587+ }
588+
589 }
590
591 static void
592
593=== modified file 'libsyncdaemon/syncdaemon-daemon.h'
594--- libsyncdaemon/syncdaemon-daemon.h 2010-06-24 10:43:48 +0000
595+++ libsyncdaemon/syncdaemon-daemon.h 2010-07-15 20:33:42 +0000
596@@ -72,6 +72,8 @@
597 void (* upload_started) (SyncdaemonDaemon *daemon, const gchar *path);
598 void (* upload_file_progress) (SyncdaemonDaemon *daemon, const gchar *path, SyncdaemonTransferInfo *tinfo);
599 void (* upload_finished) (SyncdaemonDaemon *daemon, const gchar *path, SyncdaemonTransferInfo *tinfo);
600+
601+ void (* quota_exceeded) (SyncdaemonDaemon *daemon, GHashTable *volume_info);
602 } SyncdaemonDaemonClass;
603
604 GType syncdaemon_daemon_get_type (void);
605
606=== modified file 'po/POTFILES.in'
607--- po/POTFILES.in 2010-06-17 13:49:37 +0000
608+++ po/POTFILES.in 2010-07-15 20:33:42 +0000
609@@ -8,3 +8,5 @@
610 nautilus/contacts-view.c
611 nautilus/u1-contacts-picker.c
612 nautilus/location-widget.c
613+gsd-plugin/gsd-ubuntuone.c
614+[type: gettext/ini]gsd-plugin/ubuntuone.gnome-settings-plugin.in

Subscribers

People subscribed via source and target branches