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

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 932
Merged at revision: 949
Proposed branch: lp:~alecu/ubuntuone-client/gsd-plugin-remove-quota
Merge into: lp:ubuntuone-client
Diff against target: 189 lines (+0/-145)
2 files modified
gsd-plugin/gsd-ubuntuone.c (+0/-144)
gsd-plugin/gsd-ubuntuone.h (+0/-1)
To merge this branch: bzr merge lp:~alecu/ubuntuone-client/gsd-plugin-remove-quota
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
dobey (community) Approve
Review via email: mp+55934@code.launchpad.net

Commit message

Remove quota notification from the gsd-plugin, since it's being done from syncdaemon and on the control panel now. (LP: #747315)

Description of the change

Remove quota notification from the gsd-plugin, since it's being done from syncdaemon and on the control panel now. (LP: #747315)

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

We must first have a suitable replacement before removing this code.

review: Needs Fixing
932. By Alejandro J. Cura

merged with trunk

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Since the replacement out-of-quota UI for Unity has already landed we can safely remove this code now.

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Eric Casteleijn (thisfred) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gsd-plugin/gsd-ubuntuone.c'
--- gsd-plugin/gsd-ubuntuone.c 2011-04-05 18:48:08 +0000
+++ gsd-plugin/gsd-ubuntuone.c 2011-04-07 21:16:27 +0000
@@ -35,143 +35,8 @@
35G_DEFINE_TYPE (GsdUbuntuOne, gsd_ubuntuone, G_TYPE_OBJECT);35G_DEFINE_TYPE (GsdUbuntuOne, gsd_ubuntuone, G_TYPE_OBJECT);
36#endif36#endif
3737
38#define NO_SPACE _("Your Ubuntu One storage is full. Follow the link below to upgrade your subscription.")
39#define NO_SPACE_SHARE _("There is no available space on the folder:\n\"%s\" shared by %s")
40#define NO_SPACE_TITLE _("Out of space")
41#define UPGRADE_SUBSCRIPTION_TEXT _("Upgrade Subscription")
42#define UPGRADE_SUBSCRIPTION_URI "http://one.ubuntu.com/plans/"
43#define CHECKED_BOOKMARK_FILE_KEY "/apps/gnome_settings_daemon/plugins/ubuntuone/checked_bookmark_file"38#define CHECKED_BOOKMARK_FILE_KEY "/apps/gnome_settings_daemon/plugins/ubuntuone/checked_bookmark_file"
4439
45#define DAY_IN_SECONDS (60 * 60 * 24)
46
47/* For passing data into a GSourceFunc */
48typedef struct _GsdUbuntuOneData GsdUbuntuOneData;
49
50struct _GsdUbuntuOneData
51{
52 GtkWidget *dialog;
53 guint timeout_id;
54 guint last_shown;
55
56 gchar * message;
57 gboolean show_upgrade_link;
58};
59
60static void
61gsd_ubuntuone_data_free (GsdUbuntuOneData *data)
62{
63 if (data->dialog) {
64 gtk_widget_destroy (data->dialog);
65 data->dialog = NULL;
66 }
67
68 if (data->timeout_id) {
69 g_source_remove (data->timeout_id);
70 data->timeout_id = 0;
71 }
72
73 if (data->message)
74 g_free (data->message);
75
76 g_free (data);
77}
78
79
80static void
81dialog_closed_callback (GtkDialog *dialog,
82 gint response_id,
83 gpointer user_data)
84{
85 GsdUbuntuOneData *data = (GsdUbuntuOneData *) (user_data);
86
87 gtk_widget_destroy (GTK_WIDGET (data->dialog));
88 data->dialog = NULL;
89}
90
91static gboolean
92show_out_of_space_dialog (GsdUbuntuOneData *data)
93{
94 if ((time (NULL) - DAY_IN_SECONDS) < data->last_shown) {
95 return FALSE;
96 }
97
98 if (data->dialog != NULL) {
99 gtk_widget_show (GTK_WIDGET (data->dialog));
100 return FALSE;
101 }
102
103 data->dialog = gtk_message_dialog_new (NULL,
104 0,
105 GTK_MESSAGE_WARNING,
106 GTK_BUTTONS_CLOSE,
107 "%s",
108 data->message);
109
110 gtk_window_set_skip_taskbar_hint (GTK_WINDOW (data->dialog), FALSE);
111 gtk_window_set_title (GTK_WINDOW (data->dialog), NO_SPACE_TITLE);
112 gtk_window_set_icon_name (GTK_WINDOW (data->dialog), "ubuntuone");
113 gtk_window_set_position (GTK_WINDOW (data->dialog), GTK_WIN_POS_CENTER);
114
115 if (data->show_upgrade_link) {
116 GtkWidget *upgrade_link;
117
118 upgrade_link = gtk_link_button_new_with_label (UPGRADE_SUBSCRIPTION_URI,
119 UPGRADE_SUBSCRIPTION_TEXT);
120 gtk_widget_show (GTK_WIDGET (upgrade_link));
121 gtk_dialog_add_action_widget (GTK_DIALOG (data->dialog),
122 upgrade_link, 0);
123 }
124
125 g_signal_connect (G_OBJECT (data->dialog), "response",
126 G_CALLBACK (dialog_closed_callback), data);
127 gtk_widget_show (data->dialog);
128
129 data->last_shown = time (NULL);
130
131 return FALSE;
132}
133
134
135static void
136quota_exceeded_callback (SyncdaemonDaemon *daemon,
137 GHashTable *file_info,
138 gpointer user_data)
139{
140 gchar *volume_type, *owner_id;
141 GsdUbuntuOne *plugin = GSD_UBUNTUONE (user_data);
142 GsdUbuntuOneData *data;
143
144 volume_type = g_hash_table_lookup (file_info, "type");
145 owner_id = g_hash_table_lookup (file_info, "owner_id");
146 if (owner_id == NULL)
147 owner_id = g_hash_table_lookup (file_info, "volume_id");
148 data = g_hash_table_lookup (plugin->map_quota_dialogs, owner_id);
149
150 if (data == NULL) {
151 data = g_new0 (GsdUbuntuOneData, 1);
152
153 /* Set up the data to use in the dialog */
154 if (g_strcmp0 (volume_type, "Share") == 0) {
155 gchar * other_visible_name, * path;
156 other_visible_name = g_hash_table_lookup (file_info, "other_visible_name");
157 path = g_hash_table_lookup (file_info, "path");
158 data->message = g_strdup_printf (NO_SPACE_SHARE, path, other_visible_name);
159 data->show_upgrade_link = FALSE;
160 } else {
161 data->message = g_strdup (NO_SPACE);
162 data->show_upgrade_link = TRUE;
163 }
164 g_hash_table_replace (plugin->map_quota_dialogs, g_strdup (owner_id), data);
165 }
166
167 /* Set up the timeout for letting lots of signals queue */
168 if (data->timeout_id != 0) {
169 g_source_remove (data->timeout_id);
170 data->timeout_id = 0;
171 }
172 data->timeout_id = g_timeout_add_seconds (10, (GSourceFunc) show_out_of_space_dialog, data);
173}
174
175static void40static void
176bookmark_file_loaded (GObject *source, GAsyncResult *res, gpointer user_data)41bookmark_file_loaded (GObject *source, GAsyncResult *res, gpointer user_data)
177{42{
@@ -278,8 +143,6 @@
278 plugin = GSD_UBUNTUONE (data);143 plugin = GSD_UBUNTUONE (data);
279144
280 plugin->syncdaemon = syncdaemon_daemon_new ();145 plugin->syncdaemon = syncdaemon_daemon_new ();
281 g_signal_connect (G_OBJECT (plugin->syncdaemon), "quota_exceeded",
282 G_CALLBACK (quota_exceeded_callback), plugin);
283146
284 /* Check for authentication */147 /* Check for authentication */
285 auth = syncdaemon_daemon_get_authentication (plugin->syncdaemon);148 auth = syncdaemon_daemon_get_authentication (plugin->syncdaemon);
@@ -292,10 +155,6 @@
292static void155static void
293gsd_ubuntuone_init (GsdUbuntuOne *plugin)156gsd_ubuntuone_init (GsdUbuntuOne *plugin)
294{157{
295 plugin->map_quota_dialogs = g_hash_table_new_full (g_str_hash,
296 g_str_equal,
297 g_free,
298 (GDestroyNotify) gsd_ubuntuone_data_free);
299}158}
300159
301void160void
@@ -314,9 +173,6 @@
314 if (plugin->syncdaemon != NULL)173 if (plugin->syncdaemon != NULL)
315 g_object_unref (plugin->syncdaemon);174 g_object_unref (plugin->syncdaemon);
316175
317 if (plugin->map_quota_dialogs != NULL)
318 g_hash_table_destroy (plugin->map_quota_dialogs);
319
320 G_OBJECT_CLASS (gsd_ubuntuone_parent_class)->dispose (object);176 G_OBJECT_CLASS (gsd_ubuntuone_parent_class)->dispose (object);
321}177}
322178
323179
=== modified file 'gsd-plugin/gsd-ubuntuone.h'
--- gsd-plugin/gsd-ubuntuone.h 2011-01-07 20:42:48 +0000
+++ gsd-plugin/gsd-ubuntuone.h 2011-04-07 21:16:27 +0000
@@ -47,7 +47,6 @@
4747
48 /*< private >*/48 /*< private >*/
49 SyncdaemonDaemon *syncdaemon;49 SyncdaemonDaemon *syncdaemon;
50 GHashTable *map_quota_dialogs;
51};50};
5251
53struct _GsdUbuntuOneClass52struct _GsdUbuntuOneClass

Subscribers

People subscribed via source and target branches