[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 386/473: Add customizable limit for recently used.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:59:16 CET 2015
This is an automated email from the git hooks/post-receive script.
gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit cbe603f95e04ee2aebeddcda1169c096b2dac5e9
Author: Marcel Dopita <m at rcel.cz>
Date: Sun Jun 1 21:20:27 2014 +0200
Add customizable limit for recently used.
---
panel-plugin/configuration-dialog.cpp | 22 ++++++++++++++++++++++
panel-plugin/configuration-dialog.h | 3 +++
panel-plugin/recent-page.cpp | 9 ++++-----
panel-plugin/settings.cpp | 14 ++++++++++----
panel-plugin/settings.h | 4 +++-
5 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/panel-plugin/configuration-dialog.cpp b/panel-plugin/configuration-dialog.cpp
index 6e8bc18..c886fa7 100644
--- a/panel-plugin/configuration-dialog.cpp
+++ b/panel-plugin/configuration-dialog.cpp
@@ -237,6 +237,14 @@ void ConfigurationDialog::toggle_position_categories_alternate(GtkToggleButton*
//-----------------------------------------------------------------------------
+void ConfigurationDialog::recent_items_max_changed(GtkSpinButton* button)
+{
+ wm_settings->recent_items_max = gtk_spin_button_get_value_as_int(button);
+ wm_settings->set_modified();
+}
+
+//-----------------------------------------------------------------------------
+
void ConfigurationDialog::toggle_remember_favorites(GtkToggleButton* button)
{
wm_settings->favorites_in_recent = gtk_toggle_button_get_active(button);
@@ -623,6 +631,20 @@ GtkWidget* ConfigurationDialog::init_behavior_tab()
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_hover_switch_category), wm_settings->category_hover_activate);
g_signal_connect_slot(m_hover_switch_category, "toggled", &ConfigurationDialog::toggle_hover_switch_category, this);
+ // Add value to change maximum number of recently used entries
+ GtkBox* hbox = GTK_BOX(gtk_hbox_new(false, 12));
+ gtk_box_pack_start(behavior_vbox, GTK_WIDGET(hbox), false, false, 0);
+
+ GtkWidget* label = gtk_label_new_with_mnemonic(_("_Maximum number of recently used entries:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(hbox, label, false, false, 0);
+
+ m_recent_items_max = gtk_spin_button_new_with_range(5, 100, 1);
+ gtk_box_pack_start(hbox, m_recent_items_max, false, false, 0);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_recent_items_max);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_recent_items_max), wm_settings->recent_items_max);
+ g_signal_connect_slot(m_recent_items_max, "value-changed", &ConfigurationDialog::recent_items_max_changed, this);
+
// Add option to remember favorites
m_remember_favorites = gtk_check_button_new_with_mnemonic(_("Include _favorites in recently used"));
gtk_box_pack_start(behavior_vbox, m_remember_favorites, true, true, 0);
diff --git a/panel-plugin/configuration-dialog.h b/panel-plugin/configuration-dialog.h
index 924758f..55fd3fb 100644
--- a/panel-plugin/configuration-dialog.h
+++ b/panel-plugin/configuration-dialog.h
@@ -56,6 +56,8 @@ private:
void toggle_button_single_row(GtkToggleButton* button);
void toggle_hover_switch_category(GtkToggleButton* button);
+
+ void recent_items_max_changed(GtkSpinButton* button);
void toggle_remember_favorites(GtkToggleButton* button);
void toggle_display_recent(GtkToggleButton* button);
@@ -95,6 +97,7 @@ private:
GtkWidget* m_hover_switch_category;
GtkWidget* m_remember_favorites;
GtkWidget* m_display_recent;
+ GtkWidget* m_recent_items_max;
std::vector<CommandEdit*> m_commands;
GtkTreeView* m_actions_view;
diff --git a/panel-plugin/recent-page.cpp b/panel-plugin/recent-page.cpp
index 48c6566..44e4ec0 100644
--- a/panel-plugin/recent-page.cpp
+++ b/panel-plugin/recent-page.cpp
@@ -29,13 +29,12 @@ using namespace WhiskerMenu;
//-----------------------------------------------------------------------------
RecentPage::RecentPage(Window* window) :
- ListPage(wm_settings->recent, window),
- m_max_items(10)
+ ListPage(wm_settings->recent, window)
{
// Prevent going over max
- if (wm_settings->recent.size() > m_max_items)
+ if (wm_settings->recent.size() > wm_settings->recent_items_max)
{
- wm_settings->recent.erase(wm_settings->recent.begin() + m_max_items, wm_settings->recent.end());
+ wm_settings->recent.erase(wm_settings->recent.begin() + wm_settings->recent_items_max, wm_settings->recent.end());
wm_settings->set_modified();
}
}
@@ -68,7 +67,7 @@ void RecentPage::add(Launcher* launcher)
-1);
// Prevent going over max
- while (wm_settings->recent.size() > m_max_items)
+ while (wm_settings->recent.size() > wm_settings->recent_items_max)
{
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, wm_settings->recent.size() - 1))
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index ba4c7bc..7eceb88 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -85,7 +85,7 @@ Settings::Settings() :
button_icon_name("xfce4-whiskermenu"),
button_title_visible(false),
button_icon_visible(true),
- button_single_row(false),
+ button_single_row(false),
launcher_show_name(true),
launcher_show_description(true),
@@ -95,9 +95,11 @@ Settings::Settings() :
category_icon_size(IconSize::Smaller),
load_hierarchy(false),
- favorites_in_recent(true),
+ recent_items_max(10),
+ favorites_in_recent(true),
display_recent(false),
+
position_search_alternate(false),
position_commands_alternate(false),
position_categories_alternate(false),
@@ -173,9 +175,11 @@ void Settings::load(char* file)
category_icon_size = xfce_rc_read_int_entry(rc, "category-icon-size", category_icon_size);
load_hierarchy = xfce_rc_read_bool_entry(rc, "load-hierarchy", load_hierarchy);
- favorites_in_recent = xfce_rc_read_bool_entry(rc, "favorites-in-recent", favorites_in_recent);
+ recent_items_max = std::max(5, xfce_rc_read_int_entry(rc, "recent-items-max", recent_items_max));
+ favorites_in_recent = xfce_rc_read_bool_entry(rc, "favorites-in-recent", favorites_in_recent);
display_recent = xfce_rc_read_bool_entry(rc, "display-recent-default", display_recent);
+
position_search_alternate = xfce_rc_read_bool_entry(rc, "position-search-alternate", position_search_alternate);
position_commands_alternate = xfce_rc_read_bool_entry(rc, "position-commands-alternate", position_commands_alternate) && position_search_alternate;
position_categories_alternate = xfce_rc_read_bool_entry(rc, "position-categories-alternate", position_categories_alternate);
@@ -266,9 +270,11 @@ void Settings::save(char* file)
xfce_rc_write_int_entry(rc, "category-icon-size", category_icon_size);
xfce_rc_write_bool_entry(rc, "load-hierarchy", load_hierarchy);
- xfce_rc_write_bool_entry(rc, "favorites-in-recent", favorites_in_recent);
+ xfce_rc_write_int_entry(rc, "recent-items-max", recent_items_max);
+ xfce_rc_write_bool_entry(rc, "favorites-in-recent", favorites_in_recent);
xfce_rc_write_bool_entry(rc, "display-recent-default", display_recent);
+
xfce_rc_write_bool_entry(rc, "position-search-alternate", position_search_alternate);
xfce_rc_write_bool_entry(rc, "position-commands-alternate", position_commands_alternate);
xfce_rc_write_bool_entry(rc, "position-categories-alternate", position_categories_alternate);
diff --git a/panel-plugin/settings.h b/panel-plugin/settings.h
index c291883..88f119d 100644
--- a/panel-plugin/settings.h
+++ b/panel-plugin/settings.h
@@ -73,9 +73,11 @@ public:
IconSize category_icon_size;
bool load_hierarchy;
- bool favorites_in_recent;
+ unsigned int recent_items_max;
+ bool favorites_in_recent;
bool display_recent;
+
bool position_search_alternate;
bool position_commands_alternate;
bool position_categories_alternate;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list