[gtk+/save-popover: 2/2] Remove no longer needed in-tree editing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/save-popover: 2/2] Remove no longer needed in-tree editing
- Date: Fri, 10 Apr 2015 01:04:05 +0000 (UTC)
commit 86c97fd710a312b971449c094a7212f4d8e49e0d
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Apr 9 21:03:13 2015 -0400
Remove no longer needed in-tree editing
gtk/gtkfilechooserwidget.c | 115 ----------------------------------------
gtk/ui/gtkfilechooserwidget.ui | 2 -
2 files changed, 0 insertions(+), 117 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 3016d88..0ac1b60 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -305,9 +305,6 @@ struct _GtkFileChooserWidgetPrivate {
guint location_changed_id;
- GSource *edited_idle;
- char *edited_new_text;
-
gulong settings_signal_id;
int icon_size;
@@ -659,8 +656,6 @@ gtk_file_chooser_widget_finalize (GObject *object)
g_free (priv->preview_display_name);
- g_free (priv->edited_new_text);
-
impl->priv = NULL;
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->finalize (object);
@@ -1094,114 +1089,6 @@ new_folder_create_clicked (GtkButton *button,
error_creating_folder_dialog (impl, file, error);
}
-static GSource *
-add_idle_while_impl_is_alive (GtkFileChooserWidget *impl, GCallback callback)
-{
- GSource *source;
-
- source = g_idle_source_new ();
- g_source_set_closure (source,
- g_cclosure_new_object (callback, G_OBJECT (impl)));
- g_source_attach (source, NULL);
-
- return source;
-}
-
-/* Idle handler for creating a new folder after editing its name cell, or for
- * canceling the editing.
- */
-static gboolean
-edited_idle_cb (GtkFileChooserWidget *impl)
-{
- GtkFileChooserWidgetPrivate *priv = impl->priv;
-
- gdk_threads_enter ();
-
- g_source_destroy (priv->edited_idle);
- priv->edited_idle = NULL;
-
- _gtk_file_system_model_remove_editable (priv->browse_files_model);
- g_object_set (priv->list_name_renderer, "editable", FALSE, NULL);
-
- gtk_widget_set_sensitive (priv->browse_new_folder_button, TRUE);
-
- if (priv->edited_new_text /* not cancelled? */
- && (strlen (priv->edited_new_text) != 0)
- && (strcmp (priv->edited_new_text, DEFAULT_NEW_FOLDER_NAME) != 0)) /* Don't create folder if name is
empty or has not been edited */
- {
- GError *error = NULL;
- GFile *file;
-
- file = g_file_get_child_for_display_name (priv->current_folder,
- priv->edited_new_text,
- &error);
- if (file)
- {
- GError *error = NULL;
-
- if (g_file_make_directory (file, NULL, &error))
- change_folder_and_display_error (impl, file, FALSE);
- else
- error_creating_folder_dialog (impl, file, error);
-
- g_object_unref (file);
- }
- else
- error_creating_folder_dialog (impl, file, error);
-
- g_free (priv->edited_new_text);
- priv->edited_new_text = NULL;
- }
-
- gdk_threads_leave ();
-
- return FALSE;
-}
-
-static void
-queue_edited_idle (GtkFileChooserWidget *impl,
- const gchar *new_text)
-{
- GtkFileChooserWidgetPrivate *priv = impl->priv;
-
- /* We create the folder in an idle handler so that we don't modify the tree
- * just now.
- */
-
- if (!priv->edited_idle)
- priv->edited_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (edited_idle_cb));
-
- g_free (priv->edited_new_text);
- priv->edited_new_text = g_strdup (new_text);
-}
-
-/* Callback used from the text cell renderer when the new folder is named */
-static void
-renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
- const gchar *path,
- const gchar *new_text,
- GtkFileChooserWidget *impl)
-{
- /* work around bug #154921 */
- g_object_set (cell_renderer_text,
- "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
- queue_edited_idle (impl, new_text);
-}
-
-/* Callback used from the text cell renderer when the new folder edition gets
- * canceled.
- */
-static void
-renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
- GtkFileChooserWidget *impl)
-{
- /* work around bug #154921 */
- g_object_set (cell_renderer_text,
- "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
- queue_edited_idle (impl, NULL);
-}
-
-
struct selection_check_closure {
GtkFileChooserWidget *impl;
int num_selected;
@@ -7656,8 +7543,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_callback (widget_class, file_list_drag_motion_cb);
gtk_widget_class_bind_template_callback (widget_class, list_selection_changed);
gtk_widget_class_bind_template_callback (widget_class, list_cursor_changed);
- gtk_widget_class_bind_template_callback (widget_class, renderer_editing_canceled_cb);
- gtk_widget_class_bind_template_callback (widget_class, renderer_edited_cb);
gtk_widget_class_bind_template_callback (widget_class, filter_combo_changed);
gtk_widget_class_bind_template_callback (widget_class, new_folder_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, path_bar_clicked);
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index 40cfb3e..0337ba6 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -217,8 +217,6 @@
<child>
<object class="GtkCellRendererText" id="list_name_renderer">
<property name="ellipsize">end</property>
- <signal name="edited" handler="renderer_edited_cb" swapped="no"/>
- <signal name="editing-canceled" handler="renderer_editing_canceled_cb"
swapped="no"/>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]