* src/maemo/modest-maemo-utils.[ch]:
[modest] / src / maemo / modest-maemo-utils.c
index 518fbd1..5c36574 100644 (file)
@@ -203,6 +203,11 @@ modest_maemo_utils_get_device_name (void)
 gboolean 
 modest_maemo_utils_folder_writable (const gchar *filename)
 {
+       g_return_val_if_fail (filename, FALSE);
+
+       if (!filename)
+               return FALSE;
+       
        if (g_strncasecmp (filename, "obex", 4) != 0) {
                GnomeVFSFileInfo folder_info;
                gchar *folder;
@@ -525,7 +530,23 @@ modest_maemo_show_information_note_and_forget (GtkWindow *parent_window, const g
        gtk_widget_show (GTK_WIDGET (dialog));
 }
 
+#if 0
+static void
+on_hide (GtkDialog *dialog, gpointer user_data)
+{
+       /* Just destroy the dialog: */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+#endif
 
+void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *dialog)
+{
+       gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window);
+       
+       /* Destroy the dialog when it is closed: */
+       g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (on_response), NULL);
+       gtk_widget_show (GTK_WIDGET (dialog));
+}
 
 void
 modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable)
@@ -535,3 +556,26 @@ modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable
        hildon_helper_set_thumb_scrollbar (win, thumbable);
 #endif /* MODEST_HAVE_HILDON1_WIDGETS */
 }
+
+void
+modest_maemo_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value)
+{
+       GSList *proxies = NULL;
+
+       g_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
+
+       for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
+            proxies != NULL; proxies = g_slist_next (proxies)) {
+               GtkWidget *widget = (GtkWidget *) proxies->data;
+               gtk_action_block_activate_from (GTK_ACTION (action), widget);
+       }
+
+       gtk_toggle_action_set_active (action, value);
+
+       for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
+            proxies != NULL; proxies = g_slist_next (proxies)) {
+               GtkWidget *widget = (GtkWidget *) proxies->data;
+               gtk_action_unblock_activate_from (GTK_ACTION (action), widget);
+       }
+
+}