2005-10-05 Luc Pionchon <luc.pionchon@nokia.com>
+ N#20027 PDF Reader crashes on selecting read only option in the
+ details dialog box.
+
+ * hildon-widgets/hildon-file-details-dialog.c:
+ (change_state): Fixed assertion that was causing problems
+ (check_validity): New function: We now automatically close the
+ dialog if the displayed file is removed.
+ (handle_focus): Callback removed:
+ (init): Now using correct gtk way to bind container and adjustment
+ together. Not the previous callback.
+ (set_property): Connecting/disconnecting new handlers (for
+ change_state).
+ (finalize): disconnecting new handler.
+
+2005-10-05 Luc Pionchon <luc.pionchon@nokia.com>
+
N#17918 Volumebar widget background image doesn't change when
widget goes into mute state,
GtkTreeRowReference *active_file;
gboolean checkbox_original_state;
gulong toggle_handler;
+ gulong delete_handler;
/* Properties */
HildonFileSystemModel *model;
return result;
}
+/* When model deletes a file, we check if our reference is still valid.
+ If not, we emit response, which usually closes the dialog */
+static void check_validity(GtkTreeModel *model,
+ GtkTreePath *path, gpointer data)
+{
+ GtkTreeRowReference *ref;
+
+ g_return_if_fail(HILDON_IS_FILE_DETAILS_DIALOG(data));
+
+ ref = HILDON_FILE_DETAILS_DIALOG(data)->priv->active_file;
+
+ if (ref && !gtk_tree_row_reference_valid(ref))
+ gtk_dialog_response(GTK_DIALOG(data), GTK_RESPONSE_NONE);
+}
+
static void change_state(HildonFileDetailsDialog *self, gboolean readonly)
{
GtkTreeIter iter;
g_return_if_fail(HILDON_IS_FILE_DETAILS_DIALOG(self));
+ /* We fail to get the iterator in cases when the reference is
+ invalidated, for example when the file is removed. */
if (hildon_file_details_dialog_get_file_iter(self, &iter))
{
gchar *uri;
gnome_vfs_file_info_unref(info);
g_free(uri);
}
- else
- g_assert_not_reached();
}
/* Cancel changes if read-only is changed */
HILDON_TYPE_FILE_SYSTEM_MODEL, G_PARAM_READWRITE));
}
-/* This handler is needed to correctly position the scrollbar down.
- It doesn't happen automatically... */
-static gboolean
-handle_focus(GtkWidget *widget, GtkDirectionType *dir, gpointer data)
-{
- if (!GTK_WIDGET_HAS_FOCUS(widget))
- {
- GtkAdjustment *adj;
- adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(data));
- gtk_adjustment_set_value(adj, adj->upper - adj->page_size);
- }
-
- return FALSE;
-}
-
static void
hildon_file_details_dialog_init(HildonFileDetailsDialog *self)
{
GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(scroll))),
GTK_SHADOW_NONE);
+ gtk_container_set_focus_vadjustment(GTK_CONTAINER(vbox),
+ gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll)));
+
/* Populate dialog */
gtk_notebook_append_page(priv->notebook, scroll,
gtk_label_new(_("sfil_ti_notebook_common")));
priv->toggle_handler = g_signal_connect(priv->file_readonly, "toggled",
G_CALLBACK(hildon_file_details_dialog_read_only_toggled),
self);
- g_signal_connect(priv->file_readonly, "focus",
- G_CALLBACK(handle_focus), scroll);
}
static void
if (new_model != priv->model)
{
if (G_IS_OBJECT(priv->model))
+ {
+ g_signal_handler_disconnect(priv->model, priv->delete_handler);
g_object_unref(priv->model);
+ priv->delete_handler = 0;
+ }
priv->model = new_model;
if (new_model)
+ {
g_object_ref(new_model);
+ priv->delete_handler = g_signal_connect(priv->model, "row-deleted",
+ G_CALLBACK(check_validity), object);
+ }
}
break;
}
priv = HILDON_FILE_DETAILS_DIALOG(object)->priv;
if (G_IS_OBJECT(priv->model))
+ {
+ g_signal_handler_disconnect(priv->model, priv->delete_handler);
g_object_unref(priv->model);
+ }
if (G_IS_OBJECT(priv->tab_label))
g_object_unref(priv->tab_label);
if (priv->active_file)