This is an automated email from the git hooks/post-receive script. o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r in repository panel-plugins/xfce4-clipman-plugin.
commit 4458c3939c782b4c2be9626917e026df1eacb90c Author: Simon Steinbeiss <simon.steinbe...@elfenbeinturm.at> Date: Tue Mar 24 22:07:37 2020 +0100 plugin: Wire up max-menu-items setting --- panel-plugin/menu.c | 22 +++++++++++++++++++++- panel-plugin/settings-dialog.ui | 6 ++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/panel-plugin/menu.c b/panel-plugin/menu.c index 1a6068a..8ce4e1e 100644 --- a/panel-plugin/menu.c +++ b/panel-plugin/menu.c @@ -54,6 +54,7 @@ struct _ClipmanMenuPrivate gboolean show_qr_code; #endif guint paste_on_activate; + guint max_menu_items; gboolean never_confirm_history_clear; }; @@ -65,6 +66,7 @@ enum #endif PASTE_ON_ACTIVATE, NEVER_CONFIRM_HISTORY_CLEAR, + MAX_MENU_ITEMS, }; static void clipman_menu_finalize (GObject *object); @@ -303,6 +305,7 @@ _clipman_menu_update_list (ClipmanMenu *menu) const ClipmanHistoryItem *item_to_restore; GSList *list, *l; gint pos = 0; + gint i = 0; /* Get the most recent item in the history */ item_to_restore = clipman_history_get_item_to_restore (menu->priv->history); @@ -317,8 +320,10 @@ _clipman_menu_update_list (ClipmanMenu *menu) list = clipman_history_get_list (menu->priv->history); if (menu->priv->reverse_order) list = g_slist_reverse (list); - for (l = list; l != NULL; l = l->next) + for (i = 0, l = list; i < menu->priv->max_menu_items; i++, l = l->next) { + if (l == NULL) + break; item = l->data; switch (item->type) @@ -475,6 +480,13 @@ clipman_menu_class_init (ClipmanMenuClass *klass) "Set to FALSE to clear the history list with confirmation", FALSE, G_PARAM_CONSTRUCT|G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, MAX_MENU_ITEMS, + g_param_spec_uint ("max-menu-items", + "MaxMenuItems", + "Maximum amount of items displayed in the plugin's menu", + 1, 100, 15, + G_PARAM_CONSTRUCT|G_PARAM_READWRITE)); } static void @@ -542,6 +554,10 @@ clipman_menu_set_property (GObject *object, priv->never_confirm_history_clear = g_value_get_boolean (value); break; + case MAX_MENU_ITEMS: + priv->max_menu_items = g_value_get_uint (value); + break; + default: break; } @@ -569,6 +585,10 @@ clipman_menu_get_property (GObject *object, g_value_set_boolean (value, priv->never_confirm_history_clear); break; + case MAX_MENU_ITEMS: + g_value_set_uint (value, priv->max_menu_items); + break; + default: break; } diff --git a/panel-plugin/settings-dialog.ui b/panel-plugin/settings-dialog.ui index 5c8134f..349502a 100644 --- a/panel-plugin/settings-dialog.ui +++ b/panel-plugin/settings-dialog.ui @@ -10,6 +10,11 @@ <property name="step_increment">5</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkImage" id="image5"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -254,6 +259,7 @@ <object class="GtkSpinButton" id="max-menu-items"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="adjustment">adjustment2</property> </object> <packing> <property name="expand">False</property> -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits