d1915fdfb5c483b056c3b174ec67f9dff93476fe
[modest] / src / maemo / modest-maemo-utils.c
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  *   notice, this list of conditions and the following disclaimer in the
12  *   documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Nokia Corporation nor the names of its
14  *   contributors may be used to endorse or promote products derived from
15  *   this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef DBUS_API_SUBJECT_TO_CHANGE
31 #define DBUS_API_SUBJECT_TO_CHANGE
32 #endif /*DBUS_API_SUBJECT_TO_CHANGE*/
33
34 #include <dbus/dbus.h>
35 #include <dbus/dbus-glib-lowlevel.h>
36 #include <glib.h>
37 #include <modest-runtime.h>
38 #include <libgnomevfs/gnome-vfs.h>
39 #include <tny-fs-stream.h>
40 #include <tny-camel-account.h>
41 #include <tny-status.h>
42 #include <tny-camel-transport-account.h>
43 #include <tny-camel-imap-store-account.h>
44 #include <tny-camel-pop-store-account.h>
45 #include "modest-hildon-includes.h"
46
47 #include "modest-maemo-utils.h"
48 #include "modest-platform.h"
49
50 /*
51  * For getting and tracking the Bluetooth name
52  */
53 #define BTNAME_SERVICE                  "org.bluez"
54 #define BTNAME_REQUEST_IF               "org.bluez.Adapter"
55 #define BTNAME_SIGNAL_IF                "org.bluez.Adapter"
56 #define BTNAME_REQUEST_PATH             "/org/bluez/hci0"
57 #define BTNAME_SIGNAL_PATH              "/org/bluez/hci0"
58
59 #define BTNAME_REQ_GET                  "GetName"
60 #define BTNAME_SIG_CHANGED              "NameChanged"
61
62 #define BTNAME_MATCH_RULE "type='signal',interface='" BTNAME_SIGNAL_IF \
63                           "',member='" BTNAME_SIG_CHANGED "'"
64
65 GQuark modest_maemo_utils_get_supported_secure_authentication_error_quark (void)
66 {
67         return g_quark_from_static_string("modest-maemo-utils-get-supported-secure-authentication-error-quark");
68 }
69
70 GtkWidget*
71 modest_maemo_utils_menubar_to_menu (GtkUIManager *ui_manager)
72 {
73         GtkWidget *main_menu;
74         GtkWidget *menubar;
75         GList *iter;
76
77         g_return_val_if_fail (ui_manager, NULL);
78         
79         /* Create new main menu */
80         main_menu = gtk_menu_new();
81
82         /* Get the menubar from the UI manager */
83         menubar = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
84
85         iter = gtk_container_get_children (GTK_CONTAINER (menubar));
86         while (iter) {
87                 GtkWidget *menu;
88
89                 menu = GTK_WIDGET (iter->data);
90                 gtk_widget_reparent(menu, main_menu);
91
92                 iter = g_list_next (iter);
93         }
94         return main_menu;
95 }
96
97
98 static void
99 update_device_name_from_msg (DBusMessage *message)
100 {
101         DBusError error;
102         DBusMessageIter iter;
103
104         dbus_error_init (&error);
105
106         if (dbus_set_error_from_message (&error, message)) {
107                 g_printerr ("modest: failed to get bluetooth name: %s\n", error.message);
108                 dbus_error_free (&error);
109         } else {
110                 const gchar *device_name;
111                 if (!dbus_message_iter_init (message, &iter)) {
112                         g_printerr ("modest: message did not have argument\n");
113                         return;
114                 }
115                 dbus_message_iter_get_basic (&iter, &device_name);
116                 g_warning ("update device name: %s", device_name);
117                 modest_conf_set_string (modest_runtime_get_conf(),
118                                         MODEST_CONF_DEVICE_NAME, device_name,
119                                         NULL);
120         }
121 }
122
123
124 static void
125 on_device_name_received (DBusPendingCall *call, void *user_data)
126 {
127         DBusMessage *message;
128         
129         g_return_if_fail (dbus_pending_call_get_completed (call));
130         
131         message = dbus_pending_call_steal_reply (call);
132         if (!message) {
133                 g_printerr ("modest: no reply on device name query\n");
134                 return;
135         }
136
137         update_device_name_from_msg (message);
138         dbus_message_unref (message);
139 }
140
141
142 static DBusHandlerResult
143 handle_dbus_signal (DBusConnection *conn, DBusMessage *msg, gpointer data)
144 {
145         if (dbus_message_is_signal(msg, BTNAME_SIGNAL_IF, BTNAME_SIG_CHANGED))
146                 update_device_name_from_msg (msg);
147
148         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
149 }
150
151
152 static void
153 get_device_name_from_dbus ()
154 {
155         static DBusConnection *conn = NULL;
156         DBusMessage *request;
157         DBusError error;
158         DBusPendingCall *call = NULL;
159         
160         dbus_error_init (&error);
161         if (!conn) {
162                 conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
163                 if (!conn) {
164                         g_printerr ("modest: cannot get on the dbus: %s: %s\n",
165                                     error.name, error.message);
166                         dbus_error_free (&error);
167                         return;
168                 }
169         }
170         
171         request = dbus_message_new_method_call (BTNAME_SERVICE, BTNAME_REQUEST_PATH,
172                                                 BTNAME_REQUEST_IF, BTNAME_REQ_GET);
173         if (!request) {
174                 /* should we free the connection? */
175                 g_printerr ("modest: dbus_message_new_method_call failed\n");
176                 return;
177         }
178         dbus_message_set_auto_start (request, TRUE);
179         if (dbus_connection_send_with_reply (conn, request, &call, -1)) {
180                 dbus_pending_call_set_notify (call, on_device_name_received,
181                                               NULL, NULL);
182                 dbus_pending_call_unref (call);
183         }
184         dbus_message_unref (request);
185         
186         dbus_connection_setup_with_g_main (conn, NULL);
187         dbus_bus_add_match (conn, BTNAME_MATCH_RULE, &error);
188         if (dbus_error_is_set(&error)) {
189                 g_printerr ("modest: dbus_bus_add_match failed: %s\n", error.message);
190                 dbus_error_free (&error);
191         }
192
193         if (!dbus_connection_add_filter(conn, handle_dbus_signal, NULL, NULL))
194                 g_printerr ("modest: dbus_connection_add_filter failed\n");
195 }
196
197
198 void
199 modest_maemo_utils_get_device_name (void)
200 {
201         get_device_name_from_dbus ();
202 }
203
204 gboolean 
205 modest_maemo_utils_folder_writable (const gchar *filename)
206 {
207         g_return_val_if_fail (filename, FALSE);
208
209         if (!filename)
210                 return FALSE;
211         
212         if (g_strncasecmp (filename, "obex", 4) != 0) {
213                 GnomeVFSFileInfo folder_info;
214                 gchar *folder;
215                 folder = g_path_get_dirname (filename);
216                 gnome_vfs_get_file_info (folder, &folder_info,
217                                          GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS);
218                 g_free (folder);
219                 if (!((folder_info.permissions & GNOME_VFS_PERM_ACCESS_WRITABLE) ||
220                       (folder_info.permissions & GNOME_VFS_PERM_USER_WRITE))) {
221                         return FALSE;
222                 }
223         }
224         return TRUE;
225 }
226
227 gboolean 
228 modest_maemo_utils_file_exists (const gchar *filename)
229 {
230         GnomeVFSURI *uri = NULL;
231         gboolean result = FALSE;
232
233         uri = gnome_vfs_uri_new (filename);
234         if (uri) {
235                 result = gnome_vfs_uri_exists (uri);
236                 gnome_vfs_uri_unref (uri);
237         }
238         return result;
239 }
240
241 TnyFsStream *
242 modest_maemo_utils_create_temp_stream (const gchar *extension, gchar **path)
243 {
244         TnyStream *tmp_fs_stream = NULL;
245         gint fd;
246         gchar *filepath = NULL;
247         gchar *template = NULL;
248
249         if (extension != NULL)
250                 template = g_strdup_printf ("XXXXXX.%s", extension);
251
252         fd = g_file_open_tmp (template, &filepath, NULL);
253         g_free (template);
254         if (path != NULL)
255                 *path = filepath;
256         if (fd == -1) {
257                 g_message ("TODO BANNER: Error saving stream");
258                 return NULL;
259         }
260         tmp_fs_stream = tny_fs_stream_new (fd);
261         
262         return TNY_FS_STREAM (tmp_fs_stream);
263 }
264
265 typedef struct 
266 {
267         gboolean cancel;
268         GList *result;
269         GtkWidget* dialog;
270         GtkWidget* progress;
271         GError* error;
272 } ModestGetSupportedAuthInfo;
273
274 static void on_camel_account_get_supported_secure_authentication_status (
275         GObject *self, TnyStatus *status, gpointer user_data)
276 {
277         /*ModestGetSupportedAuthInfo* info = (ModestGetSupportedAuthInfo*) user_data;*/
278 }
279
280 static gboolean
281 on_idle_secure_auth_finished (gpointer user_data)
282 {
283         ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
284         /* Operation has finished, close the dialog. Control continues after
285          * gtk_dialog_run in modest_maemo_utils_get_supported_secure_authentication_methods() */
286         gdk_threads_enter();
287         gtk_dialog_response (GTK_DIALOG (info->dialog), GTK_RESPONSE_ACCEPT);
288         gdk_threads_leave();
289         return FALSE;
290 }
291
292 static void
293 on_camel_account_get_supported_secure_authentication (
294   TnyCamelAccount *self, gboolean cancelled,
295   TnyList *auth_types, GError **err, 
296   gpointer user_data)
297 {
298                 
299         ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
300         g_return_if_fail (info);
301
302         gdk_threads_enter();
303
304         /* Free everything if the actual action was canceled */
305         if (info->cancel)
306         {
307                 /* The operation was canceled and the ownership of the info given to us
308                  * so that we could still check the cancel flag. */
309                 g_slice_free (ModestGetSupportedAuthInfo, info);
310                 info = NULL;
311         }
312         else
313         {
314                 /* TODO: Why is this a pointer to a pointer? We are not supposed to
315                  * set it, are we? */
316                 if(err != NULL && *err != NULL)
317                 {
318                         if(info->error != NULL) g_error_free(info->error);
319                         info->error = g_error_copy(*err);
320                 }
321
322                 if (!auth_types) {
323                         printf ("DEBUG: %s: auth_types is NULL.\n", __FUNCTION__);
324                 }
325                 else
326                 {
327                         ModestPairList* pairs = modest_protocol_info_get_auth_protocol_pair_list ();
328   
329                         /* Get the enum value for the strings: */
330                         GList *result = NULL;
331                         TnyIterator* iter = tny_list_create_iterator(auth_types);
332                         while (!tny_iterator_is_done(iter)) {
333                                 TnyPair *pair = TNY_PAIR(tny_iterator_get_current(iter));
334                                 const gchar *auth_name = NULL;
335                                 if (pair) {
336                                         auth_name = tny_pair_get_name(pair);
337                                         g_object_unref (pair);
338                                         pair = NULL;
339                                 }
340
341                                 printf("DEBUG: %s: auth_name=%s\n", __FUNCTION__, auth_name);
342                                 ModestPair *matching = modest_pair_list_find_by_first_as_string (pairs, 
343                                         auth_name);
344                                 if (matching)
345                                 {
346                                         result = g_list_append (result, GINT_TO_POINTER((ModestConnectionProtocol)matching->first));
347                                 }
348                                 tny_iterator_next(iter);
349                         }
350         
351                         g_object_unref(auth_types);
352
353                         modest_pair_list_free (pairs);
354         
355                         info->result = result;
356                 }
357
358                 printf("DEBUG: finished\n");
359
360                 /* Close the dialog in a main thread */
361                 g_idle_add(on_idle_secure_auth_finished, info);
362         }
363
364         gdk_threads_leave();
365 }
366
367 static void on_secure_auth_cancel(GtkWidget* dialog, int response, gpointer user_data)
368 {
369         if(response == GTK_RESPONSE_REJECT || response == GTK_RESPONSE_DELETE_EVENT)
370         {
371                 ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
372                 g_return_if_fail(info);
373                 /* This gives the ownership of the info to the worker thread. */
374                 info->result = NULL;
375                 info->cancel = TRUE;
376         }
377 }
378
379 GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto, 
380         const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window, GError** error)
381 {
382         g_return_val_if_fail (proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN, NULL);
383         
384         /* We need a connection to get the capabilities; */
385         if (!modest_platform_connect_and_wait (GTK_WINDOW (parent_window), NULL))
386                 return NULL;
387          
388         /*
389         result = g_list_append (result, GINT_TO_POINTER (MODEST_PROTOCOL_AUTH_CRAMMD5));
390         */
391         
392         /* Create a TnyCamelAccount so we can use 
393          * tny_camel_account_get_supported_secure_authentication(): */
394         TnyAccount * tny_account = NULL;
395         switch (proto) {
396         case MODEST_PROTOCOL_TRANSPORT_SENDMAIL:
397         case MODEST_PROTOCOL_TRANSPORT_SMTP:
398                 tny_account = TNY_ACCOUNT(tny_camel_transport_account_new ()); break;
399         case MODEST_PROTOCOL_STORE_POP:
400                 tny_account = TNY_ACCOUNT(tny_camel_pop_store_account_new ()); break;
401         case MODEST_PROTOCOL_STORE_IMAP:
402                 tny_account = TNY_ACCOUNT(tny_camel_imap_store_account_new ()); break;
403         case MODEST_PROTOCOL_STORE_MAILDIR:
404         case MODEST_PROTOCOL_STORE_MBOX:
405                 tny_account = TNY_ACCOUNT(tny_camel_store_account_new()); break;
406         default:
407                 tny_account = NULL;
408         }
409
410         
411         if (!tny_account) {
412                 g_printerr ("%s could not create tny account.", __FUNCTION__);
413                 return NULL;
414         }
415         
416         /* Set proto, so that the prepare_func() vfunc will work when we call 
417          * set_session(): */
418          /* TODO: Why isn't this done in account_new()? */
419         tny_account_set_proto (tny_account,
420                                modest_protocol_info_get_transport_store_protocol_name(proto));
421
422         tny_account_set_hostname (tny_account, hostname);
423         /* Required for POP, at least */
424         tny_account_set_user (tny_account, username);
425                                
426         /* Set the session for the account, so we can use it: */
427         ModestTnyAccountStore *account_store = modest_runtime_get_account_store ();
428         TnySessionCamel *session = 
429                 modest_tny_account_store_get_session (TNY_ACCOUNT_STORE (account_store));
430         g_return_val_if_fail (session, NULL);
431         tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), session);
432         
433         if(port > 0)
434                 tny_account_set_port (tny_account, port);
435                 
436
437         /* Ask camel to ask the server, asynchronously: */
438         ModestGetSupportedAuthInfo *info = g_slice_new (ModestGetSupportedAuthInfo);
439         info->result = NULL;
440         info->cancel = FALSE;
441         info->error = NULL;
442         info->progress = gtk_progress_bar_new();
443         info->dialog = gtk_dialog_new_with_buttons(_("Authentication"),
444                                                    parent_window, GTK_DIALOG_MODAL,
445                                                    GTK_STOCK_CANCEL,
446                                                    GTK_RESPONSE_REJECT,
447                                                    NULL);
448         //gtk_window_set_default_size(GTK_WINDOW(info->dialog), 300, 100);
449         
450         g_signal_connect(G_OBJECT(info->dialog), "response", G_CALLBACK(on_secure_auth_cancel), info);
451         
452         gtk_container_add(GTK_CONTAINER(GTK_DIALOG(info->dialog)->vbox),
453                           gtk_label_new("Checking for supported authentication types..."));
454         gtk_container_add(GTK_CONTAINER(GTK_DIALOG(info->dialog)->vbox), info->progress);
455         gtk_widget_show_all(info->dialog);
456         gtk_progress_bar_pulse(GTK_PROGRESS_BAR(info->progress));
457         
458         printf ("DEBUG: %s: STARTING.\n", __FUNCTION__);
459         tny_camel_account_get_supported_secure_authentication (
460                 TNY_CAMEL_ACCOUNT (tny_account),
461                 on_camel_account_get_supported_secure_authentication,
462                 on_camel_account_get_supported_secure_authentication_status,
463                 info);
464
465         gtk_dialog_run (GTK_DIALOG (info->dialog));
466         
467         gtk_widget_destroy(info->dialog);
468                 
469         GList *result = info->result;
470         if (!info->cancel)
471         {
472                 if(info->error != NULL)
473                         g_propagate_error(error, info->error);
474
475                 g_slice_free (ModestGetSupportedAuthInfo, info);
476                 info = NULL;
477         }
478         else
479         {
480                 // Tell the caller that the operation was canceled so it can
481                 // make a difference
482                 g_set_error(error,
483                             modest_maemo_utils_get_supported_secure_authentication_error_quark(),
484                             MODEST_MAEMO_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED,
485                             "User has canceled query");
486         }
487
488         return result;
489 }
490
491 void
492 modest_maemo_utils_setup_images_filechooser (GtkFileChooser *chooser)
493 {
494         gchar *images_folder;
495         GtkFileFilter *file_filter;
496         GList *image_mimetypes_list;
497         GList *node;
498
499         g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
500
501         /* Set the default folder to images folder */
502         images_folder = g_build_filename (g_get_home_dir (), 
503                                           MODEST_MAEMO_UTILS_MYDOCS_FOLDER,
504                                           MODEST_MAEMO_UTILS_DEFAULT_IMAGE_FOLDER, NULL);
505         gtk_file_chooser_set_current_folder (chooser, images_folder);
506         g_free (images_folder);
507
508         /* Set the images mime filter */
509         file_filter = gtk_file_filter_new ();
510 #ifdef MODEST_HAVE_HILDON0_WIDGETS
511         image_mimetypes_list = osso_mime_get_mime_types_for_category (OSSO_MIME_CATEGORY_IMAGES);
512 #else
513         image_mimetypes_list = hildon_mime_get_mime_types_for_category (HILDON_MIME_CATEGORY_IMAGES);
514 #endif
515         for (node = image_mimetypes_list; node != NULL; node = g_list_next (node)) {
516                 gtk_file_filter_add_mime_type (file_filter, node->data);
517         }
518         gtk_file_chooser_set_filter (chooser, file_filter);
519 #ifdef MODEST_HAVE_HILDON0_WIDGETS
520         osso_mime_types_list_free (image_mimetypes_list);
521 #else
522         hildon_mime_types_list_free (image_mimetypes_list);
523 #endif
524
525 }
526
527 static void
528 on_response (GtkDialog *dialog, gint response, gpointer user_data)
529 {
530         /* Just destroy the dialog: */
531         gtk_widget_destroy (GTK_WIDGET (dialog));
532 }
533
534 void
535 modest_maemo_show_information_note_and_forget (GtkWindow *parent_window, const gchar* message)
536 {
537         GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_window, message));
538         
539         /* Destroy the dialog when it is closed: */
540         g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (on_response), NULL);
541         gtk_widget_show (GTK_WIDGET (dialog));
542 }
543
544 #if 0
545 static void
546 on_hide (GtkDialog *dialog, gpointer user_data)
547 {
548         /* Just destroy the dialog: */
549         gtk_widget_destroy (GTK_WIDGET (dialog));
550 }
551 #endif
552
553 #if 0 /* Not used now. */
554 /* user_data for the idle callback: */
555 typedef struct 
556 {
557         GtkWindow *parent_window;
558         gchar *message;
559 } ModestIdleNoteInfo;
560
561 static gboolean
562 on_idle_show_information(gpointer user_data)
563 {
564         ModestIdleNoteInfo *info = (ModestIdleNoteInfo*)user_data;
565         
566         modest_maemo_show_information_note_and_forget (info->parent_window, info->message);
567         
568         g_free (info->message);
569         g_slice_free (ModestIdleNoteInfo, info);
570         
571         return FALSE; /* Don't call this again. */
572 }
573
574 void modest_maemo_show_information_note_in_main_context_and_forget (GtkWindow *parent_window, const gchar* message)
575 {
576         ModestIdleNoteInfo *info = g_slice_new (ModestIdleNoteInfo);
577         info->parent_window = parent_window;
578         info->message = g_strdup (message);
579         
580         g_idle_add (on_idle_show_information, info);
581 }
582 #endif
583
584 void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *dialog)
585 {
586         gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window);
587         
588         /* Destroy the dialog when it is closed: */
589         g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (on_response), NULL);
590         gtk_widget_show (GTK_WIDGET (dialog));
591 }
592
593
594
595 void
596 modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable)
597 {
598         g_return_if_fail (GTK_IS_SCROLLED_WINDOW(win));
599 #ifdef MODEST_HAVE_HILDON1_WIDGETS              
600         hildon_helper_set_thumb_scrollbar (win, thumbable);
601 #endif /* MODEST_HAVE_HILDON1_WIDGETS */
602 }
603
604 void
605 modest_maemo_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value)
606 {
607         GSList *proxies = NULL;
608
609         g_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
610
611         for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
612              proxies != NULL; proxies = g_slist_next (proxies)) {
613                 GtkWidget *widget = (GtkWidget *) proxies->data;
614                 gtk_action_block_activate_from (GTK_ACTION (action), widget);
615         }
616
617         gtk_toggle_action_set_active (action, value);
618
619         for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
620              proxies != NULL; proxies = g_slist_next (proxies)) {
621                 GtkWidget *widget = (GtkWidget *) proxies->data;
622                 gtk_action_unblock_activate_from (GTK_ACTION (action), widget);
623         }
624
625 }