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

Subscribers

People subscribed via source and target branches