KatzeArray* array;
KatzeNet* net;
+ gboolean reversed;
};
struct _KatzeArrayActionClass
{
PROP_0,
- PROP_ARRAY
+ PROP_ARRAY,
+ PROP_REVERSED
};
enum
"The array the action represents",
KATZE_TYPE_ARRAY,
G_PARAM_READWRITE));
+
+ /**
+ * KatzeArrayAction:reversed:
+ *
+ * Whether the array should be walked backwards when building menus.
+ *
+ * Since: 0.2.2
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_REVERSED,
+ g_param_spec_boolean (
+ "reversed",
+ "Reversed",
+ "Whether the array should be walked backwards when building menus",
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
{
array_action->array = NULL;
array_action->net = katze_net_new ();
+ array_action->reversed = FALSE;
}
static void
case PROP_ARRAY:
katze_array_action_set_array (array_action, g_value_get_object (value));
break;
+ case PROP_REVERSED:
+ array_action->reversed = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_ARRAY:
g_value_set_object (value, array_action->array);
break;
+ case PROP_REVERSED:
+ g_value_set_boolean (value, array_action->reversed);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
GtkWidget* proxy)
{
guint i;
+ guint summand;
KatzeItem* item;
GtkWidget* menuitem;
const gchar* icon_name;
GtkWidget* image;
GtkWidget* submenu;
- i = 0;
- while ((item = katze_array_get_nth_item (array, i++)))
+ if (array_action->reversed)
+ {
+ i = katze_array_get_length (array);
+ summand = -1;
+ }
+ else
+ {
+ i = -1;
+ summand = +1;
+ }
+ while ((item = katze_array_get_nth_item (array, i += summand)))
{
/* FIXME: The menu item should reflect changes to the item */
if (!KATZE_IS_ARRAY (item) && !katze_item_get_uri (item))
if (history && ((recently_visited = katze_array_get_nth_item (history,
katze_array_get_length (KATZE_ARRAY (history)) - 1))))
g_object_set (_action_by_name (browser, "RecentlyVisited"),
- "array", recently_visited, NULL);
+ "array", recently_visited, "reversed", TRUE,
+ NULL);
else
g_object_set (_action_by_name (browser, "RecentlyVisited"),
- "array", NULL, NULL);
+ "array", NULL, "reversed", FALSE,
+ NULL);
if (!history)
return;
case PROP_TRASH:
/* FIXME: Disconnect handlers */
katze_object_assign (browser->trash, g_value_dup_object (value));
- g_object_set (_action_by_name (browser, "Trash"), "array",
- browser->trash, NULL);
+ g_object_set (_action_by_name (browser, "Trash"),
+ "array", browser->trash, "reversed", TRUE,
+ NULL);
/* FIXME: Connect to updates */
_midori_browser_update_actions (browser);
break;