[epiphany/wip/mcatanzaro/fedora-needs-upstreamed: 11/20] Display unescaped URIs in the history dialog



commit cf456306d6378fc7b6c0900fe32b3e6b947a8cbb
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Dec 11 19:10:58 2014 +0100

    Display unescaped URIs in the history dialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710004

 src/ephy-history-window.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 87c61d3..ea7bc51 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -52,6 +52,7 @@ struct _EphyHistoryWindowPrivate
        GtkTreeViewColumn *name_column;
        GtkTreeViewColumn *location_column;
        GtkWidget *date_renderer;
+       GtkWidget *location_renderer;
        GtkWidget *remove_button;
        GtkWidget *open_button;
        GtkWidget *clear_button;
@@ -720,6 +721,7 @@ ephy_history_window_class_init (EphyHistoryWindowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, name_column);
        gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, location_column);
        gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, date_renderer);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, location_renderer);
        gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, open_menuitem);
        gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, 
copy_location_menuitem);
        gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, bookmark_menuitem);
@@ -742,7 +744,7 @@ ephy_history_window_class_init (EphyHistoryWindowClass *klass)
 }
 
 static void
-convert_cell_data_func (GtkTreeViewColumn *column,
+convert_date_data_func (GtkTreeViewColumn *column,
                        GtkCellRenderer *renderer,
                        GtkTreeModel *model,
                        GtkTreeIter *iter,
@@ -765,6 +767,27 @@ convert_cell_data_func (GtkTreeViewColumn *column,
 }
 
 static void
+convert_location_data_func (GtkTreeViewColumn *column,
+                           GtkCellRenderer *renderer,
+                           GtkTreeModel *model,
+                           GtkTreeIter *iter,
+                           gpointer user_data)
+{
+       int col_id = GPOINTER_TO_INT (user_data);
+       const char *url;
+       char *unescaped_url;
+
+       gtk_tree_model_get (model, iter,
+                           col_id,
+                           &url,
+                           -1);
+       unescaped_url = g_uri_unescape_string (url, NULL);
+
+       g_object_set (renderer, "text", unescaped_url, NULL);
+       g_free (unescaped_url);
+}
+
+static void
 response_cb (GtkDialog *widget,
             int response,
             EphyHistoryWindow *self)
@@ -838,10 +861,16 @@ ephy_history_window_init (EphyHistoryWindow *self)
 
        gtk_tree_view_column_set_cell_data_func (GTK_TREE_VIEW_COLUMN (self->priv->date_column),
                                                 GTK_CELL_RENDERER (self->priv->date_renderer),
-                                                (GtkTreeCellDataFunc) convert_cell_data_func,
+                                                (GtkTreeCellDataFunc) convert_date_data_func,
                                                 GINT_TO_POINTER (COLUMN_DATE),
                                                 NULL);
 
+       gtk_tree_view_column_set_cell_data_func (GTK_TREE_VIEW_COLUMN (self->priv->location_column),
+                                                GTK_CELL_RENDERER (self->priv->location_renderer),
+                                                (GtkTreeCellDataFunc) convert_location_data_func,
+                                                GINT_TO_POINTER (COLUMN_LOCATION),
+                                                NULL);
+
        g_signal_connect (self, "response",
                          G_CALLBACK (response_cb), self);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]