[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 170/473: Add option to position search entry next to panel button. Closes #27.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:55:40 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 3b9e61cf4ddfb77f0b31167629fbede4c66739fa
Author: Graeme Gott <graeme at gottcode.org>
Date: Wed Oct 9 08:09:20 2013 -0400
Add option to position search entry next to panel button. Closes #27.
---
src/configuration_dialog.cpp | 14 ++++++++++++++
src/configuration_dialog.hpp | 30 ++++++++++++++++++++++--------
src/menu.cpp | 33 +++++++++++++++++++++++++++++++--
src/menu.hpp | 4 ++++
src/panel_plugin.cpp | 2 ++
5 files changed, 73 insertions(+), 10 deletions(-)
diff --git a/src/configuration_dialog.cpp b/src/configuration_dialog.cpp
index 1250765..0dea0ce 100644
--- a/src/configuration_dialog.cpp
+++ b/src/configuration_dialog.cpp
@@ -170,6 +170,14 @@ void ConfigurationDialog::toggle_show_description(GtkToggleButton* button)
//-----------------------------------------------------------------------------
+void ConfigurationDialog::toggle_position_search_alternate(GtkToggleButton* button)
+{
+ Menu::set_position_search_alternate(gtk_toggle_button_get_active(button));
+ m_plugin->reload();
+}
+
+//-----------------------------------------------------------------------------
+
void ConfigurationDialog::toggle_load_hierarchy(GtkToggleButton* button)
{
ApplicationsPage::set_load_hierarchy(gtk_toggle_button_get_active(button));
@@ -255,6 +263,12 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_show_descriptions), Launcher::get_show_description());
g_signal_connect(m_show_descriptions, "toggled", G_CALLBACK(ConfigurationDialog::toggle_show_description_slot), this);
+ // Add option to use alternate search entry position
+ m_position_search_alternate = gtk_check_button_new_with_mnemonic(_("Position _search entry next to panel button"));
+ gtk_box_pack_start(appearance_vbox, m_position_search_alternate, true, true, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_position_search_alternate), Menu::get_position_search_alternate());
+ g_signal_connect(m_position_search_alternate, "toggled", G_CALLBACK(ConfigurationDialog::toggle_position_search_alternate_slot), this);
+
// Add item icon size selector
GtkBox* hbox = GTK_BOX(gtk_hbox_new(false, 12));
gtk_box_pack_start(appearance_vbox, GTK_WIDGET(hbox), false, false, 0);
diff --git a/src/configuration_dialog.hpp b/src/configuration_dialog.hpp
index ccbcee5..5f4fe83 100644
--- a/src/configuration_dialog.hpp
+++ b/src/configuration_dialog.hpp
@@ -39,20 +39,25 @@ public:
}
private:
- void choose_icon();
+ void toggle_show_name(GtkToggleButton* button);
+ void toggle_show_description(GtkToggleButton* button);
+ void toggle_position_search_alternate(GtkToggleButton* button);
void category_icon_size_changed(GtkComboBox* combo);
void item_icon_size_changed(GtkComboBox* combo);
+
void style_changed(GtkComboBox* combo);
void title_changed();
+ void choose_icon();
+
void toggle_hover_switch_category(GtkToggleButton* button);
- void toggle_show_name(GtkToggleButton* button);
- void toggle_show_description(GtkToggleButton* button);
void toggle_load_hierarchy(GtkToggleButton* button);
void toggle_remember_favorites(GtkToggleButton* button);
void toggle_display_recent(GtkToggleButton* button);
+
void settings_command_changed();
void lockscreen_command_changed();
void logout_command_changed();
+
void response(int response_id);
GtkWidget* init_appearance_tab();
GtkWidget* init_panel_button_tab();
@@ -61,20 +66,24 @@ private:
private:
PanelPlugin* m_plugin;
-
GtkWidget* m_window;
+
+ GtkWidget* m_show_names;
+ GtkWidget* m_show_descriptions;
+ GtkWidget* m_position_search_alternate;
+ GtkWidget* m_category_icon_size;
+ GtkWidget* m_item_icon_size;
+
GtkWidget* m_button_style;
GtkWidget* m_title;
GtkWidget* m_icon;
GtkWidget* m_icon_button;
- GtkWidget* m_category_icon_size;
- GtkWidget* m_item_icon_size;
- GtkWidget* m_show_names;
- GtkWidget* m_show_descriptions;
+
GtkWidget* m_hover_switch_category;
GtkWidget* m_load_hierarchy;
GtkWidget* m_remember_favorites;
GtkWidget* m_display_recent;
+
GtkWidget* m_settings_command;
GtkWidget* m_lockscreen_command;
GtkWidget* m_logout_command;
@@ -121,6 +130,11 @@ private:
obj->toggle_show_description(button);
}
+ static void toggle_position_search_alternate_slot(GtkToggleButton* button, ConfigurationDialog* obj)
+ {
+ obj->toggle_position_search_alternate(button);
+ }
+
static void toggle_load_hierarchy_slot(GtkToggleButton* button, ConfigurationDialog* obj)
{
obj->toggle_load_hierarchy(button);
diff --git a/src/menu.cpp b/src/menu.cpp
index eabcc5a..11fbe32 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -53,6 +53,7 @@ std::string Menu::m_settings_command = "xfce4-settings-manager";
std::string Menu::m_lockscreen_command = "xflock4";
std::string Menu::m_logout_command = "xfce4-session-logout";
bool Menu::m_display_recent = false;
+bool Menu::m_position_search_alternate = false;
//-----------------------------------------------------------------------------
@@ -60,6 +61,7 @@ Menu::Menu(XfceRc* settings) :
m_window(NULL),
m_layout_left(true),
m_layout_bottom(true),
+ m_layout_search_alternate(false),
m_modified(false)
{
m_geometry.x = 0;
@@ -430,10 +432,23 @@ void Menu::show(GtkWidget* parent, bool horizontal)
}
}
- if (layout_bottom != m_layout_bottom)
+ if ((layout_bottom != m_layout_bottom) || (m_layout_search_alternate != m_position_search_alternate))
{
m_layout_bottom = layout_bottom;
- if (m_layout_bottom)
+ m_layout_search_alternate = m_position_search_alternate;
+ if (m_layout_bottom && m_layout_search_alternate)
+ {
+ gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_title_box), 0);
+ gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_contents_box), 1);
+ gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_search_entry), 2);
+ }
+ else if (m_layout_search_alternate)
+ {
+ gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_title_box), 2);
+ gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_contents_box), 1);
+ gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_search_entry), 0);
+ }
+ else if (m_layout_bottom)
{
gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_title_box), 0);
gtk_box_reorder_child(m_vbox, GTK_WIDGET(m_search_entry), 1);
@@ -564,6 +579,13 @@ bool Menu::get_display_recent()
//-----------------------------------------------------------------------------
+bool Menu::get_position_search_alternate()
+{
+ return m_position_search_alternate;
+}
+
+//-----------------------------------------------------------------------------
+
void Menu::set_settings_command(const std::string& command)
{
m_settings_command = command;
@@ -592,6 +614,13 @@ void Menu::set_display_recent(bool display)
//-----------------------------------------------------------------------------
+void Menu::set_position_search_alternate(bool alternate)
+{
+ m_position_search_alternate = alternate;
+}
+
+//-----------------------------------------------------------------------------
+
bool Menu::on_leave_notify_event(GdkEventCrossing* event)
{
if ( (event->detail == GDK_NOTIFY_INFERIOR)
diff --git a/src/menu.hpp b/src/menu.hpp
index 9b501dd..6244172 100644
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -87,10 +87,12 @@ public:
static std::string get_lockscreen_command();
static std::string get_logout_command();
static bool get_display_recent();
+ static bool get_position_search_alternate();
static void set_settings_command(const std::string& command);
static void set_lockscreen_command(const std::string& command);
static void set_logout_command(const std::string& command);
static void set_display_recent(bool display);
+ static void set_position_search_alternate(bool alternate);
private:
bool on_enter_notify_event(GdkEventCrossing* event);
@@ -142,12 +144,14 @@ private:
GdkRectangle m_geometry;
bool m_layout_left;
bool m_layout_bottom;
+ bool m_layout_search_alternate;
bool m_modified;
static std::string m_settings_command;
static std::string m_lockscreen_command;
static std::string m_logout_command;
static bool m_display_recent;
+ static bool m_position_search_alternate;
private:
diff --git a/src/panel_plugin.cpp b/src/panel_plugin.cpp
index 909684a..4879dd6 100644
--- a/src/panel_plugin.cpp
+++ b/src/panel_plugin.cpp
@@ -70,6 +70,7 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
ApplicationsPage::set_load_hierarchy(xfce_rc_read_bool_entry(settings, "load-hierarchy", ApplicationsPage::get_load_hierarchy()));
FavoritesPage::set_remember_favorites(xfce_rc_read_bool_entry(settings, "favorites-in-recent", FavoritesPage::get_remember_favorites()));
Menu::set_display_recent(xfce_rc_read_bool_entry(settings, "display-recent-default", Menu::get_display_recent()));
+ Menu::set_position_search_alternate(xfce_rc_read_bool_entry(settings, "position-search-alternate", Menu::get_position_search_alternate()));
Menu::set_settings_command(xfce_rc_read_entry(settings, "command-settings", Menu::get_settings_command().c_str()));
Menu::set_lockscreen_command(xfce_rc_read_entry(settings, "command-lockscreen", Menu::get_lockscreen_command().c_str()));
Menu::set_logout_command(xfce_rc_read_entry(settings, "command-logout", Menu::get_logout_command().c_str()));
@@ -320,6 +321,7 @@ void PanelPlugin::save()
xfce_rc_write_bool_entry(settings, "load-hierarchy", ApplicationsPage::get_load_hierarchy());
xfce_rc_write_bool_entry(settings, "favorites-in-recent", FavoritesPage::get_remember_favorites());
xfce_rc_write_bool_entry(settings, "display-recent-default", Menu::get_display_recent());
+ xfce_rc_write_bool_entry(settings, "position-search-alternate", Menu::get_position_search_alternate());
xfce_rc_write_entry(settings, "command-settings", Menu::get_settings_command().c_str());
xfce_rc_write_entry(settings, "command-lockscreen", Menu::get_lockscreen_command().c_str());
xfce_rc_write_entry(settings, "command-logout", Menu::get_logout_command().c_str());
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list