aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--data/glade/epiphany.glade12
-rwxr-xr-xsrc/history-dialog.c53
3 files changed, 73 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c8eac12e9..31959026b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-02-20 Xan Lopez <xan@masilla.org>
+
+ * data/glade/epiphany.glade:
+ * src/history-dialog.c: (history_view_selection_changed_cb),
+ (history_view_row_activated_cb), (history_dialog_setup_view),
+ (history_dialog_set_embedded),
+ (history_time_optionmenu_changed_cb),
+ (history_go_button_clicked_cb):
+
+ All hail the mighty "Go to" button.
+
2003-02-20 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/widgets/ephy-editable-toolbar.c: (drag_data_received_cb):
diff --git a/data/glade/epiphany.glade b/data/glade/epiphany.glade
index 160615ef5..8500522aa 100644
--- a/data/glade/epiphany.glade
+++ b/data/glade/epiphany.glade
@@ -26,6 +26,18 @@
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="history_go_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-jump-to</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="sensitive">False</property>
+ <signal name="clicked" handler="history_go_button_clicked_cb"/>
+ </widget>
+ </child>
+
<child>
<widget class="GtkButton" id="history_clear_button">
<property name="visible">True</property>
diff --git a/src/history-dialog.c b/src/history-dialog.c
index 4c32327a3..70710252a 100755
--- a/src/history-dialog.c
+++ b/src/history-dialog.c
@@ -55,6 +55,9 @@ void
history_entry_changed_cb (GtkWidget *widget,
HistoryDialog *dialog);
void
+history_go_button_clicked_cb (GtkWidget *button,
+ HistoryDialog *dialog);
+void
history_ok_button_clicked_cb (GtkWidget *button,
HistoryDialog *dialog);
void
@@ -75,6 +78,7 @@ struct HistoryDialogPrivate
EphyHistoryModel *nodemodel;
GtkTreeModel *filtermodel;
EphyTreeModelSort *sortmodel;
+ GtkWidget *go_button;
gboolean group;
gboolean embedded;
};
@@ -89,7 +93,8 @@ enum
{
PROP_TREEVIEW,
PROP_WORD,
- PROP_TIME
+ PROP_TIME,
+ PROP_GO_BUTTON
};
static const
@@ -98,6 +103,7 @@ EphyDialogProperty properties [] =
{ PROP_TREEVIEW, "history_treeview", NULL, PT_NORMAL, NULL },
{ PROP_WORD, "history_entry", CONF_HISTORY_SEARCH_TEXT, PT_NORMAL, NULL },
{ PROP_TIME, "history_time_optionmenu", CONF_HISTORY_SEARCH_TIME, PT_NORMAL, NULL },
+ { PROP_GO_BUTTON, "history_go_button", NULL, PT_NORMAL, NULL },
{ -1, NULL, NULL }
};
@@ -207,6 +213,16 @@ add_column (HistoryDialog *dialog,
}
static void
+history_view_selection_changed_cb (GtkTreeSelection *selection,
+ HistoryDialog *dialog)
+{
+ if (gtk_tree_selection_count_selected_rows (selection))
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->priv->go_button), TRUE);
+ else
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->priv->go_button), FALSE);
+}
+
+static void
history_view_row_activated_cb (GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *column,
@@ -226,7 +242,7 @@ history_view_row_activated_cb (GtkTreeView *treeview,
node = ephy_history_model_node_from_iter (dialog->priv->nodemodel, &iter);
location = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION);
g_return_if_fail (location != NULL);
- embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG(dialog));
+ embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
ephy_embed_load_url (embed, location);
}
@@ -277,6 +293,11 @@ history_dialog_setup_view (HistoryDialog *dialog)
"row_activated",
G_CALLBACK (history_view_row_activated_cb),
dialog);
+
+ g_signal_connect (gtk_tree_view_get_selection (dialog->priv->treeview),
+ "changed",
+ G_CALLBACK (history_view_selection_changed_cb),
+ dialog);
}
static GTime
@@ -383,12 +404,13 @@ history_dialog_set_embedded (HistoryDialog *dialog,
{
dialog->priv->embedded = embedded;
- ephy_dialog_construct (EPHY_DIALOG(dialog),
+ ephy_dialog_construct (EPHY_DIALOG (dialog),
properties,
"epiphany.glade",
embedded ?
"history_dock_box" :
"history_dialog");
+ dialog->priv->go_button = ephy_dialog_get_control (EPHY_DIALOG (dialog), PROP_GO_BUTTON);
dialog->priv->treeview = GTK_TREE_VIEW (
ephy_dialog_get_control (EPHY_DIALOG(dialog),
@@ -465,6 +487,31 @@ history_time_optionmenu_changed_cb (GtkWidget *widget,
}
void
+history_go_button_clicked_cb (GtkWidget *button,
+ HistoryDialog *dialog)
+{
+ GtkTreeSelection *selection;
+ GtkTreeIter iter, iter2;
+ EphyNode *node;
+ EphyEmbed *embed;
+ const char *location;
+
+ selection = gtk_tree_view_get_selection (dialog->priv->treeview);
+ g_return_if_fail (selection != NULL);
+ gtk_tree_selection_get_selected (selection, NULL, &iter);
+ gtk_tree_model_sort_convert_iter_to_child_iter
+ (GTK_TREE_MODEL_SORT (dialog->priv->sortmodel), &iter2, &iter);
+ egg_tree_model_filter_convert_iter_to_child_iter
+ (EGG_TREE_MODEL_FILTER (dialog->priv->filtermodel), &iter, &iter2);
+
+ node = ephy_history_model_node_from_iter (dialog->priv->nodemodel, &iter);
+ location = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION);
+ g_return_if_fail (location != NULL);
+ embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
+ ephy_embed_load_url (embed, location);
+}
+
+void
history_ok_button_clicked_cb (GtkWidget *button,
HistoryDialog *dialog)
{