Small adjustments to the History panel
Based on suggestions by Dale
This commit is contained in:
parent
6159e49018
commit
9e9365a221
1 changed files with 49 additions and 4 deletions
|
@ -2390,6 +2390,28 @@ midori_panel_history_row_activated_cb (GtkTreeView* treeview,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_panel_history_cursor_or_row_changed_cb (GtkTreeView* tree_view,
|
||||||
|
MidoriBrowser* browser)
|
||||||
|
{
|
||||||
|
GtkTreeModel* model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
KatzeItem* item;
|
||||||
|
gboolean is_page;
|
||||||
|
|
||||||
|
if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
|
||||||
|
{
|
||||||
|
gtk_tree_model_get (model, &iter, 0, &item, -1);
|
||||||
|
|
||||||
|
is_page = !KATZE_IS_ARRAY (item) && katze_item_get_uri (item);
|
||||||
|
_action_set_sensitive (browser, "HistoryAddBookmark", is_page);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_action_set_sensitive (browser, "HistoryAddBookmark", FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_midori_panel_history_popup (GtkWidget* widget,
|
_midori_panel_history_popup (GtkWidget* widget,
|
||||||
GdkEventButton* event,
|
GdkEventButton* event,
|
||||||
|
@ -2637,6 +2659,8 @@ midori_browser_history_render_text_cb (GtkTreeViewColumn* column,
|
||||||
GtkWidget* treeview)
|
GtkWidget* treeview)
|
||||||
{
|
{
|
||||||
KatzeItem* item;
|
KatzeItem* item;
|
||||||
|
time_t date;
|
||||||
|
gchar datebuf[50];
|
||||||
char* sdate;
|
char* sdate;
|
||||||
gint age;
|
gint age;
|
||||||
|
|
||||||
|
@ -2646,9 +2670,21 @@ midori_browser_history_render_text_cb (GtkTreeViewColumn* column,
|
||||||
|
|
||||||
if (KATZE_IS_ARRAY (item))
|
if (KATZE_IS_ARRAY (item))
|
||||||
{
|
{
|
||||||
g_return_if_fail (age >= 0);
|
g_assert (age >= 0);
|
||||||
|
|
||||||
if (age > 1)
|
if (age > 7)
|
||||||
|
{
|
||||||
|
date = (time_t)katze_item_get_added (item);
|
||||||
|
strftime (datebuf, sizeof (datebuf), "%Y-%m-%d", localtime (&date));
|
||||||
|
g_object_set (renderer, "text", datebuf, NULL);
|
||||||
|
}
|
||||||
|
else if (age > 6)
|
||||||
|
{
|
||||||
|
sdate = g_strdup_printf (_("A week ago"));
|
||||||
|
g_object_set (renderer, "text", sdate, NULL);
|
||||||
|
g_free (sdate);
|
||||||
|
}
|
||||||
|
else if (age > 1)
|
||||||
{
|
{
|
||||||
sdate = g_strdup_printf (_("%d days ago"), age);
|
sdate = g_strdup_printf (_("%d days ago"), age);
|
||||||
g_object_set (renderer, "text", sdate, NULL);
|
g_object_set (renderer, "text", sdate, NULL);
|
||||||
|
@ -2935,6 +2971,7 @@ _action_history_add_bookmark_activate (GtkAction* action,
|
||||||
if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
|
if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
|
||||||
{
|
{
|
||||||
gtk_tree_model_get (model, &iter, 0, &item, -1);
|
gtk_tree_model_get (model, &iter, 0, &item, -1);
|
||||||
|
if (!KATZE_IS_ARRAY (item))
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, item, TRUE);
|
midori_browser_edit_bookmark_dialog_new (browser, item, TRUE);
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
}
|
}
|
||||||
|
@ -3344,7 +3381,9 @@ static const gchar* ui_markup =
|
||||||
"<toolitem action='BookmarkDelete'/>"
|
"<toolitem action='BookmarkDelete'/>"
|
||||||
"</toolbar>"
|
"</toolbar>"
|
||||||
"<toolbar name='toolbar_history'>"
|
"<toolbar name='toolbar_history'>"
|
||||||
|
"<toolitem action='HistoryAddBookmark'/>"
|
||||||
"<toolitem action='HistoryDelete'/>"
|
"<toolitem action='HistoryDelete'/>"
|
||||||
|
"<separator expand='true' />"
|
||||||
"<toolitem action='HistoryClear' position='bottom' />"
|
"<toolitem action='HistoryClear' position='bottom' />"
|
||||||
"</toolbar>"
|
"</toolbar>"
|
||||||
"</ui>";
|
"</ui>";
|
||||||
|
@ -3715,6 +3754,10 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
g_object_connect (treeview,
|
g_object_connect (treeview,
|
||||||
"signal::row-activated",
|
"signal::row-activated",
|
||||||
midori_panel_history_row_activated_cb, browser,
|
midori_panel_history_row_activated_cb, browser,
|
||||||
|
"signal::cursor-changed",
|
||||||
|
midori_panel_history_cursor_or_row_changed_cb, browser,
|
||||||
|
"signal::columns-changed",
|
||||||
|
midori_panel_history_cursor_or_row_changed_cb, browser,
|
||||||
"signal::button-release-event",
|
"signal::button-release-event",
|
||||||
midori_panel_history_button_release_event_cb, browser,
|
midori_panel_history_button_release_event_cb, browser,
|
||||||
"signal::key-release-event",
|
"signal::key-release-event",
|
||||||
|
@ -3722,6 +3765,8 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
"signal::popup-menu",
|
"signal::popup-menu",
|
||||||
midori_panel_history_popup_menu_cb, browser,
|
midori_panel_history_popup_menu_cb, browser,
|
||||||
NULL);
|
NULL);
|
||||||
|
midori_panel_history_cursor_or_row_changed_cb (GTK_TREE_VIEW (treeview),
|
||||||
|
browser);
|
||||||
gtk_box_pack_start (GTK_BOX (box), treeview, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), treeview, TRUE, TRUE, 0);
|
||||||
browser->panel_history = treeview;
|
browser->panel_history = treeview;
|
||||||
gtk_widget_show_all (box);
|
gtk_widget_show_all (box);
|
||||||
|
|
Loading…
Reference in a new issue