[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 258/473: Replace slot class functions with templates.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:57:08 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 f0fb4bda3b6efd8184ea5089d2c2c1e1dd63f832
Author: Graeme Gott <graeme at gottcode.org>
Date: Sun Nov 24 08:59:10 2013 -0500
Replace slot class functions with templates.
---
panel-plugin/CMakeLists.txt | 1 +
panel-plugin/applications-page.cpp | 15 ++-
panel-plugin/applications-page.h | 32 ++----
panel-plugin/command-edit.cpp | 7 +-
panel-plugin/command-edit.h | 17 ----
panel-plugin/command.cpp | 5 +-
panel-plugin/command.h | 14 +--
panel-plugin/configuration-dialog.cpp | 37 +++----
panel-plugin/configuration-dialog.h | 76 +--------------
panel-plugin/favorites-page.cpp | 5 +-
panel-plugin/favorites-page.h | 12 ---
panel-plugin/launcher-view.cpp | 9 +-
panel-plugin/launcher-view.h | 16 +--
panel-plugin/list-page.cpp | 9 +-
panel-plugin/list-page.h | 19 +---
panel-plugin/page.cpp | 23 ++---
panel-plugin/page.h | 48 +--------
panel-plugin/plugin.cpp | 50 ++++++----
panel-plugin/plugin.h | 56 ++---------
panel-plugin/recent-page.cpp | 3 +-
panel-plugin/recent-page.h | 7 --
panel-plugin/resizer-widget.cpp | 18 ++--
panel-plugin/resizer-widget.h | 30 +-----
panel-plugin/search-page.cpp | 9 +-
panel-plugin/search-page.h | 16 +--
panel-plugin/slot.h | 172 +++++++++++++++++++++++++++++++++
panel-plugin/window.cpp | 45 ++++-----
panel-plugin/window.h | 88 ++---------------
28 files changed, 341 insertions(+), 498 deletions(-)
diff --git a/panel-plugin/CMakeLists.txt b/panel-plugin/CMakeLists.txt
index c6af58b..7a771ef 100644
--- a/panel-plugin/CMakeLists.txt
+++ b/panel-plugin/CMakeLists.txt
@@ -87,6 +87,7 @@ add_library(whiskermenu MODULE
search-page.cpp
section-button.cpp
settings.cpp
+ slot.h
window.cpp)
target_link_libraries(whiskermenu
diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index 36ea47e..ed01a01 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -22,6 +22,7 @@
#include "launcher-view.h"
#include "section-button.h"
#include "settings.h"
+#include "slot.h"
#include "window.h"
#include <algorithm>
@@ -206,7 +207,7 @@ void ApplicationsPage::load_garcon_menu()
//-----------------------------------------------------------------------------
-bool ApplicationsPage::load_contents()
+void ApplicationsPage::load_contents()
{
if (!m_garcon_menu)
{
@@ -215,11 +216,11 @@ bool ApplicationsPage::load_contents()
m_load_status = STATUS_INVALID;
m_load_thread = NULL;
- return false;
+ return;
}
// Populate map of menu data
- g_signal_connect_swapped(m_garcon_menu, "reload-required", G_CALLBACK(ApplicationsPage::invalidate_applications_slot), this);
+ g_signal_connect_slot(m_garcon_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
load_menu(m_garcon_menu, NULL);
// Sort items and categories
@@ -250,7 +251,7 @@ bool ApplicationsPage::load_contents()
for (std::vector<Category*>::const_iterator i = m_categories.begin(), end = m_categories.end(); i != end; ++i)
{
SectionButton* category_button = (*i)->get_button();
- g_signal_connect(category_button->get_button(), "toggled", G_CALLBACK(ApplicationsPage::apply_filter_slot), this);
+ g_signal_connect_slot(category_button->get_button(), "toggled", &ApplicationsPage::apply_filter, this);
category_buttons.push_back(category_button);
}
@@ -263,8 +264,6 @@ bool ApplicationsPage::load_contents()
m_load_status = STATUS_LOADED;
m_load_thread = NULL;
-
- return false;
}
//-----------------------------------------------------------------------------
@@ -327,7 +326,7 @@ void ApplicationsPage::load_menu(GarconMenu* menu, Category* parent_category)
}
// Listen for menu changes
- g_signal_connect_swapped(menu, "directory-changed", G_CALLBACK(ApplicationsPage::invalidate_applications_slot), this);
+ g_signal_connect_slot(menu, "directory-changed", &ApplicationsPage::invalidate_applications, this);
}
//-----------------------------------------------------------------------------
@@ -355,7 +354,7 @@ void ApplicationsPage::load_menu_item(GarconMenuItem* menu_item, Category* categ
}
// Listen for menu changes
- g_signal_connect_swapped(menu_item, "changed", G_CALLBACK(ApplicationsPage::invalidate_applications_slot), this);
+ g_signal_connect_slot(menu_item, "changed", &ApplicationsPage::invalidate_applications, this);
}
//-----------------------------------------------------------------------------
diff --git a/panel-plugin/applications-page.h b/panel-plugin/applications-page.h
index 62462f2..c3511f9 100644
--- a/panel-plugin/applications-page.h
+++ b/panel-plugin/applications-page.h
@@ -47,32 +47,12 @@ public:
private:
void apply_filter(GtkToggleButton* togglebutton);
- bool on_filter(GtkTreeModel* model, GtkTreeIter* iter);
void clear_applications();
void load_garcon_menu();
- bool load_contents();
+ void load_contents();
void load_menu(GarconMenu* menu, Category* parent_category);
void load_menu_item(GarconMenuItem* menu_item, Category* category);
-private:
- GarconMenu* m_garcon_menu;
- std::vector<Category*> m_categories;
- std::map<std::string, Launcher*> m_items;
- GThread* m_load_thread;
- gint m_load_status;
-
-
-private:
- static void invalidate_applications_slot(ApplicationsPage* obj)
- {
- obj->invalidate_applications();
- }
-
- static void apply_filter_slot(GtkToggleButton* togglebutton, ApplicationsPage* obj)
- {
- obj->apply_filter(togglebutton);
- }
-
static gpointer load_garcon_menu_slot(ApplicationsPage *obj)
{
obj->load_garcon_menu();
@@ -81,8 +61,16 @@ private:
static gboolean load_contents_slot(ApplicationsPage* obj)
{
- return obj->load_contents();
+ obj->load_contents();
+ return false;
}
+
+private:
+ GarconMenu* m_garcon_menu;
+ std::vector<Category*> m_categories;
+ std::map<std::string, Launcher*> m_items;
+ GThread* m_load_thread;
+ int m_load_status;
};
}
diff --git a/panel-plugin/command-edit.cpp b/panel-plugin/command-edit.cpp
index e06a824..414deb3 100644
--- a/panel-plugin/command-edit.cpp
+++ b/panel-plugin/command-edit.cpp
@@ -18,6 +18,7 @@
#include "command-edit.h"
#include "command.h"
+#include "slot.h"
#include <glib/gi18n-lib.h>
@@ -34,12 +35,12 @@ CommandEdit::CommandEdit(Command* command, GtkSizeGroup* label_size_group) :
gtk_toggle_button_set_active(m_shown, m_command->get_shown());
gtk_box_pack_start(GTK_BOX(m_widget), GTK_WIDGET(m_shown), false, false, 0);
gtk_size_group_add_widget(label_size_group, GTK_WIDGET(m_shown));
- g_signal_connect(m_shown, "toggled", G_CALLBACK(CommandEdit::shown_toggled_slot), this);
+ g_signal_connect_slot(m_shown, "toggled", &CommandEdit::shown_toggled, this);
m_entry = GTK_ENTRY(gtk_entry_new());
gtk_entry_set_text(m_entry, m_command->get());
gtk_box_pack_start(GTK_BOX(m_widget), GTK_WIDGET(m_entry), true, true, 0);
- g_signal_connect(m_entry, "changed", G_CALLBACK(CommandEdit::command_changed_slot), this);
+ g_signal_connect_slot(m_entry, "changed", &CommandEdit::command_changed, this);
m_browse_button = gtk_button_new();
gtk_widget_set_tooltip_text(m_browse_button, _("Browse the file system to choose a custom command."));
@@ -49,7 +50,7 @@ CommandEdit::CommandEdit(Command* command, GtkSizeGroup* label_size_group) :
GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
gtk_container_add(GTK_CONTAINER(m_browse_button), image);
gtk_widget_show(image);
- g_signal_connect(m_browse_button, "clicked", G_CALLBACK(CommandEdit::browse_clicked_slot), this);
+ g_signal_connect_slot(m_browse_button, "clicked", &CommandEdit::browse_clicked, this);
}
//-----------------------------------------------------------------------------
diff --git a/panel-plugin/command-edit.h b/panel-plugin/command-edit.h
index 3a39034..243acb5 100644
--- a/panel-plugin/command-edit.h
+++ b/panel-plugin/command-edit.h
@@ -47,23 +47,6 @@ private:
GtkToggleButton* m_shown;
GtkEntry* m_entry;
GtkWidget* m_browse_button;
-
-
-private:
- static void browse_clicked_slot(GtkWidget*, CommandEdit* obj)
- {
- obj->browse_clicked();
- }
-
- static void command_changed_slot(GtkEditable*, CommandEdit* obj)
- {
- obj->command_changed();
- }
-
- static void shown_toggled_slot(GtkToggleButton*, CommandEdit* obj)
- {
- obj->shown_toggled();
- }
};
}
diff --git a/panel-plugin/command.cpp b/panel-plugin/command.cpp
index 9fca424..4ee246b 100644
--- a/panel-plugin/command.cpp
+++ b/panel-plugin/command.cpp
@@ -18,6 +18,7 @@
#include "command.h"
#include "settings.h"
+#include "slot.h"
#include <string>
@@ -91,7 +92,7 @@ GtkWidget* Command::get_button()
m_button = gtk_button_new();
gtk_button_set_relief(GTK_BUTTON(m_button), GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text(m_button, tooltip.c_str());
- g_signal_connect(m_button, "clicked", G_CALLBACK(Command::clicked_slot), this);
+ g_signal_connect_slot(m_button, "clicked", &Command::activated, this);
GtkWidget* image = gtk_image_new_from_icon_name(m_icon, GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_container_add(GTK_CONTAINER(m_button), GTK_WIDGET(image));
@@ -116,7 +117,7 @@ GtkWidget* Command::get_menuitem()
m_menuitem = gtk_image_menu_item_new_with_mnemonic(m_text);
GtkWidget* image = gtk_image_new_from_icon_name(m_icon, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m_menuitem), image);
- g_signal_connect(m_menuitem, "activate", G_CALLBACK(Command::activated_slot), this);
+ g_signal_connect_slot(m_menuitem, "activate", &Command::activated, this);
gtk_widget_set_visible(m_menuitem, m_shown);
gtk_widget_set_sensitive(m_menuitem, m_status == WHISKERMENU_COMMAND_VALID);
diff --git a/panel-plugin/command.h b/panel-plugin/command.h
index a5f73de..d97be08 100644
--- a/panel-plugin/command.h
+++ b/panel-plugin/command.h
@@ -63,20 +63,8 @@ private:
gchar* m_text;
gchar* m_command;
gchar* m_error_text;
- gint m_status;
+ int m_status;
bool m_shown;
-
-
-private:
- static void clicked_slot(GtkButton*, Command* obj)
- {
- obj->activated();
- }
-
- static void activated_slot(GtkMenuItem*, Command* obj)
- {
- obj->activated();
- }
};
}
diff --git a/panel-plugin/configuration-dialog.cpp b/panel-plugin/configuration-dialog.cpp
index 638c46c..1bbb99a 100644
--- a/panel-plugin/configuration-dialog.cpp
+++ b/panel-plugin/configuration-dialog.cpp
@@ -22,6 +22,7 @@
#include "icon-size.h"
#include "plugin.h"
#include "settings.h"
+#include "slot.h"
#include <exo/exo.h>
#include <libxfce4panel/libxfce4panel.h>
@@ -52,7 +53,7 @@ ConfigurationDialog::ConfigurationDialog(Plugin* plugin) :
m_window = xfce_titled_dialog_new_with_buttons(_("Whisker Menu"), window, GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
gtk_window_set_icon_name(GTK_WINDOW(m_window), GTK_STOCK_PROPERTIES);
gtk_window_set_position(GTK_WINDOW(m_window), GTK_WIN_POS_CENTER);
- g_signal_connect(m_window, "response", G_CALLBACK(ConfigurationDialog::response_slot), this);
+ g_signal_connect_slot(m_window, "response", &ConfigurationDialog::response, this);
g_signal_connect_swapped(m_window, "destroy", G_CALLBACK(whiskermenu_config_dialog_delete), this);
// Create tabs
@@ -137,9 +138,9 @@ void ConfigurationDialog::style_changed(GtkComboBox* combo)
//-----------------------------------------------------------------------------
-void ConfigurationDialog::title_changed()
+void ConfigurationDialog::title_changed(GtkEditable* editable)
{
- const gchar* text = gtk_entry_get_text(GTK_ENTRY(m_title));
+ const gchar* text = gtk_entry_get_text(GTK_ENTRY(editable));
m_plugin->set_button_title(text ? text : "");
}
@@ -214,7 +215,7 @@ void ConfigurationDialog::toggle_display_recent(GtkToggleButton* button)
//-----------------------------------------------------------------------------
-void ConfigurationDialog::response(int response_id)
+void ConfigurationDialog::response(GtkDialog*, int response_id)
{
if ((m_plugin->get_button_style() == Plugin::ShowText) && m_plugin->get_button_title().empty())
{
@@ -264,7 +265,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
gtk_combo_box_set_active(GTK_COMBO_BOX(m_button_style), static_cast<int>(m_plugin->get_button_style()) - 1);
gtk_box_pack_start(hbox, m_button_style, false, false, 0);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_button_style);
- g_signal_connect(m_button_style, "changed", G_CALLBACK(ConfigurationDialog::style_changed_slot), this);
+ g_signal_connect_slot(m_button_style, "changed", &ConfigurationDialog::style_changed, this);
// Add title selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -279,7 +280,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
gtk_entry_set_text(GTK_ENTRY(m_title), m_plugin->get_button_title().c_str());
gtk_box_pack_start(hbox, m_title, true, true, 0);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_title);
- g_signal_connect(m_title, "changed", G_CALLBACK(ConfigurationDialog::title_changed_slot), this);
+ g_signal_connect_slot(m_title, "changed", &ConfigurationDialog::title_changed, this);
// Add icon selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -293,7 +294,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
m_icon_button = gtk_button_new();
gtk_box_pack_start(hbox, m_icon_button, false, false, 0);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_icon_button);
- g_signal_connect(m_icon_button, "clicked", G_CALLBACK(ConfigurationDialog::choose_icon_slot), this);
+ g_signal_connect_slot(m_icon_button, "clicked", &ConfigurationDialog::choose_icon, this);
m_icon = xfce_panel_image_new_from_source(m_plugin->get_button_icon_name().c_str());
xfce_panel_image_set_size(XFCE_PANEL_IMAGE(m_icon), 48);
@@ -310,32 +311,32 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
m_show_generic_names = gtk_check_button_new_with_mnemonic(_("Show generic application _names"));
gtk_box_pack_start(appearance_vbox, m_show_generic_names, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_show_generic_names), !wm_settings->launcher_show_name);
- g_signal_connect(m_show_generic_names, "toggled", G_CALLBACK(ConfigurationDialog::toggle_show_generic_name_slot), this);
+ g_signal_connect_slot(m_show_generic_names, "toggled", &ConfigurationDialog::toggle_show_generic_name, this);
// Add option to hide descriptions
m_show_descriptions = gtk_check_button_new_with_mnemonic(_("Show application _descriptions"));
gtk_box_pack_start(appearance_vbox, m_show_descriptions, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_show_descriptions), wm_settings->launcher_show_description);
- g_signal_connect(m_show_descriptions, "toggled", G_CALLBACK(ConfigurationDialog::toggle_show_description_slot), this);
+ g_signal_connect_slot(m_show_descriptions, "toggled", &ConfigurationDialog::toggle_show_description, this);
// Add option to show menu hierarchy
m_show_hierarchy = gtk_check_button_new_with_mnemonic(_("Show menu hie_rarchy"));
gtk_box_pack_start(appearance_vbox, m_show_hierarchy, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_show_hierarchy), wm_settings->load_hierarchy);
- g_signal_connect(m_show_hierarchy, "toggled", G_CALLBACK(ConfigurationDialog::toggle_show_hierarchy_slot), this);
+ g_signal_connect_slot(m_show_hierarchy, "toggled", &ConfigurationDialog::toggle_show_hierarchy, 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), wm_settings->position_search_alternate);
- g_signal_connect(m_position_search_alternate, "toggled", G_CALLBACK(ConfigurationDialog::toggle_position_search_alternate_slot), this);
+ g_signal_connect_slot(m_position_search_alternate, "toggled", &ConfigurationDialog::toggle_position_search_alternate, this);
// Add option to use alternate commands position
m_position_commands_alternate = gtk_check_button_new_with_mnemonic(_("Position commands next to search _entry"));
gtk_box_pack_start(appearance_vbox, m_position_commands_alternate, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_position_commands_alternate), wm_settings->position_commands_alternate);
- gtk_widget_set_sensitive(GTK_WIDGET(m_position_commands_alternate), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_position_search_alternate)));
- g_signal_connect(m_position_commands_alternate, "toggled", G_CALLBACK(ConfigurationDialog::toggle_position_commands_alternate_slot), this);
+ gtk_widget_set_sensitive(GTK_WIDGET(m_position_commands_alternate), wm_settings->position_commands_alternate);
+ g_signal_connect_slot(m_position_commands_alternate, "toggled", &ConfigurationDialog::toggle_position_commands_alternate, this);
// Add item icon size selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -355,7 +356,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
gtk_combo_box_set_active(GTK_COMBO_BOX(m_item_icon_size), wm_settings->launcher_icon_size + 1);
gtk_box_pack_start(hbox, m_item_icon_size, false, false, 0);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_item_icon_size);
- g_signal_connect(m_item_icon_size, "changed", G_CALLBACK(ConfigurationDialog::item_icon_size_changed_slot), this);
+ g_signal_connect_slot(m_item_icon_size, "changed", &ConfigurationDialog::item_icon_size_changed, this);
// Add category icon size selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -374,7 +375,7 @@ GtkWidget* ConfigurationDialog::init_appearance_tab()
gtk_combo_box_set_active(GTK_COMBO_BOX(m_category_icon_size), wm_settings->category_icon_size + 1);
gtk_box_pack_start(hbox, m_category_icon_size, false, false, 0);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_category_icon_size);
- g_signal_connect(m_category_icon_size, "changed", G_CALLBACK(ConfigurationDialog::category_icon_size_changed_slot), this);
+ g_signal_connect_slot(m_category_icon_size, "changed", &ConfigurationDialog::category_icon_size_changed, this);
return page;
}
@@ -393,19 +394,19 @@ GtkWidget* ConfigurationDialog::init_behavior_tab()
m_hover_switch_category = gtk_check_button_new_with_mnemonic(_("Switch categories by _hovering"));
gtk_box_pack_start(behavior_vbox, m_hover_switch_category, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_hover_switch_category), wm_settings->category_hover_activate);
- g_signal_connect(m_hover_switch_category, "toggled", G_CALLBACK(ConfigurationDialog::toggle_hover_switch_category_slot), this);
+ g_signal_connect_slot(m_hover_switch_category, "toggled", &ConfigurationDialog::toggle_hover_switch_category, 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);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_remember_favorites), wm_settings->favorites_in_recent);
- g_signal_connect(m_remember_favorites, "toggled", G_CALLBACK(ConfigurationDialog::toggle_remember_favorites_slot), this);
+ g_signal_connect_slot(m_remember_favorites, "toggled", &ConfigurationDialog::toggle_remember_favorites, this);
// Add option to display recently used
m_display_recent = gtk_check_button_new_with_mnemonic(_("Display recently _used by default"));
gtk_box_pack_start(behavior_vbox, m_display_recent, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_display_recent), wm_settings->display_recent);
- g_signal_connect(m_display_recent, "toggled", G_CALLBACK(ConfigurationDialog::toggle_display_recent_slot), this);
+ g_signal_connect_slot(m_display_recent, "toggled", &ConfigurationDialog::toggle_display_recent, this);
// Create commands section
GtkSizeGroup* label_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
diff --git a/panel-plugin/configuration-dialog.h b/panel-plugin/configuration-dialog.h
index 30282a7..fee52a6 100644
--- a/panel-plugin/configuration-dialog.h
+++ b/panel-plugin/configuration-dialog.h
@@ -49,14 +49,14 @@ private:
void item_icon_size_changed(GtkComboBox* combo);
void style_changed(GtkComboBox* combo);
- void title_changed();
+ void title_changed(GtkEditable* editable);
void choose_icon();
void toggle_hover_switch_category(GtkToggleButton* button);
void toggle_remember_favorites(GtkToggleButton* button);
void toggle_display_recent(GtkToggleButton* button);
- void response(int response_id);
+ void response(GtkDialog*, int response_id);
GtkWidget* init_appearance_tab();
GtkWidget* init_behavior_tab();
@@ -81,78 +81,6 @@ private:
GtkWidget* m_remember_favorites;
GtkWidget* m_display_recent;
std::vector<CommandEdit*> m_commands;
-
-
-private:
- static void choose_icon_slot(GtkButton*, ConfigurationDialog* obj)
- {
- obj->choose_icon();
- }
-
- static void category_icon_size_changed_slot(GtkComboBox* combo, ConfigurationDialog* obj)
- {
- obj->category_icon_size_changed(combo);
- }
-
- static void item_icon_size_changed_slot(GtkComboBox* combo, ConfigurationDialog* obj)
- {
- obj->item_icon_size_changed(combo);
- }
-
- static void style_changed_slot(GtkComboBox* combo, ConfigurationDialog* obj)
- {
- obj->style_changed(combo);
- }
-
- static void title_changed_slot(GtkEditable*, ConfigurationDialog* obj)
- {
- obj->title_changed();
- }
-
- static void toggle_hover_switch_category_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_hover_switch_category(button);
- }
-
- static void toggle_show_generic_name_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_show_generic_name(button);
- }
-
- static void toggle_show_description_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_show_description(button);
- }
-
- static void toggle_show_hierarchy_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_show_hierarchy(button);
- }
-
- static void toggle_position_search_alternate_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_position_search_alternate(button);
- }
-
- static void toggle_position_commands_alternate_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_position_commands_alternate(button);
- }
-
- static void toggle_remember_favorites_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_remember_favorites(button);
- }
-
- static void toggle_display_recent_slot(GtkToggleButton* button, ConfigurationDialog* obj)
- {
- obj->toggle_display_recent(button);
- }
-
- static void response_slot(GtkDialog*, gint response_id, ConfigurationDialog* obj)
- {
- obj->response(response_id);
- }
};
}
diff --git a/panel-plugin/favorites-page.cpp b/panel-plugin/favorites-page.cpp
index 375c34a..b72e5fc 100644
--- a/panel-plugin/favorites-page.cpp
+++ b/panel-plugin/favorites-page.cpp
@@ -21,6 +21,7 @@
#include "launcher.h"
#include "launcher-view.h"
#include "settings.h"
+#include "slot.h"
#include "window.h"
#include <algorithm>
@@ -66,13 +67,13 @@ void FavoritesPage::extend_context_menu(GtkWidget* menu)
menuitem = gtk_image_menu_item_new_with_label(_("Sort Alphabetically A-Z"));
GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_SORT_ASCENDING, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
- g_signal_connect(menuitem, "activate", G_CALLBACK(FavoritesPage::sort_ascending_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &FavoritesPage::sort_ascending, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_image_menu_item_new_with_label(_("Sort Alphabetically Z-A"));
image = gtk_image_new_from_stock(GTK_STOCK_SORT_DESCENDING, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
- g_signal_connect(menuitem, "activate", G_CALLBACK(FavoritesPage::sort_descending_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &FavoritesPage::sort_descending, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
diff --git a/panel-plugin/favorites-page.h b/panel-plugin/favorites-page.h
index 0598ca1..91a3e41 100644
--- a/panel-plugin/favorites-page.h
+++ b/panel-plugin/favorites-page.h
@@ -36,18 +36,6 @@ private:
void sort(std::vector<Launcher*>& items) const;
void sort_ascending();
void sort_descending();
-
-
-private:
- static void sort_ascending_slot(GtkMenuItem*, FavoritesPage* obj)
- {
- obj->sort_ascending();
- }
-
- static void sort_descending_slot(GtkMenuItem*, FavoritesPage* obj)
- {
- obj->sort_descending();
- }
};
}
diff --git a/panel-plugin/launcher-view.cpp b/panel-plugin/launcher-view.cpp
index 951198f..b024cb8 100644
--- a/panel-plugin/launcher-view.cpp
+++ b/panel-plugin/launcher-view.cpp
@@ -18,6 +18,7 @@
#include "launcher-view.h"
#include "settings.h"
+#include "slot.h"
#include <algorithm>
@@ -51,8 +52,8 @@ LauncherView::LauncherView() :
gtk_tree_view_set_fixed_height_mode(m_view, true);
gtk_tree_view_set_row_separator_func(m_view, &is_separator, NULL, NULL);
create_column();
- g_signal_connect(m_view, "key-press-event", G_CALLBACK(LauncherView::on_key_press_event_slot), this);
- g_signal_connect(m_view, "key-release-event", G_CALLBACK(LauncherView::on_key_release_event_slot), this);
+ g_signal_connect_slot(m_view, "key-press-event", &LauncherView::on_key_press_event, this);
+ g_signal_connect_slot(m_view, "key-release-event", &LauncherView::on_key_release_event, this);
// Use single clicks to activate items
exo_tree_view_set_single_click(EXO_TREE_VIEW(m_view), true);
@@ -213,7 +214,7 @@ void LauncherView::create_column()
//-----------------------------------------------------------------------------
-bool LauncherView::on_key_press_event(GdkEventKey* event)
+gboolean LauncherView::on_key_press_event(GtkWidget*, GdkEventKey* event)
{
if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
{
@@ -224,7 +225,7 @@ bool LauncherView::on_key_press_event(GdkEventKey* event)
//-----------------------------------------------------------------------------
-bool LauncherView::on_key_release_event(GdkEventKey* event)
+gboolean LauncherView::on_key_release_event(GtkWidget*, GdkEventKey* event)
{
if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
{
diff --git a/panel-plugin/launcher-view.h b/panel-plugin/launcher-view.h
index 767863b..37ecd28 100644
--- a/panel-plugin/launcher-view.h
+++ b/panel-plugin/launcher-view.h
@@ -69,26 +69,14 @@ public:
private:
void create_column();
- bool on_key_press_event(GdkEventKey* event);
- bool on_key_release_event(GdkEventKey* event);
+ gboolean on_key_press_event(GtkWidget*, GdkEventKey* event);
+ gboolean on_key_release_event(GtkWidget*, GdkEventKey* event);
private:
GtkTreeModel* m_model;
GtkTreeView* m_view;
GtkTreeViewColumn* m_column;
int m_icon_size;
-
-
-private:
- static gboolean on_key_press_event_slot(GtkWidget*, GdkEventKey* event, LauncherView* obj)
- {
- return obj->on_key_press_event(event);
- }
-
- static gboolean on_key_release_event_slot(GtkWidget*, GdkEventKey* event, LauncherView* obj)
- {
- return obj->on_key_release_event(event);
- }
};
}
diff --git a/panel-plugin/list-page.cpp b/panel-plugin/list-page.cpp
index 4684f60..d6ecb3f 100644
--- a/panel-plugin/list-page.cpp
+++ b/panel-plugin/list-page.cpp
@@ -21,6 +21,7 @@
#include "launcher.h"
#include "launcher-view.h"
#include "settings.h"
+#include "slot.h"
#include "window.h"
#include <algorithm>
@@ -116,9 +117,9 @@ void ListPage::set_menu_items()
// Replace treeview contents
GtkTreeModel* model = GTK_TREE_MODEL(store);
get_view()->set_model(model);
- g_signal_connect(model, "row-changed", G_CALLBACK(ListPage::on_row_changed_slot), this);
- g_signal_connect(model, "row-inserted", G_CALLBACK(ListPage::on_row_inserted_slot), this);
- g_signal_connect(model, "row-deleted", G_CALLBACK(ListPage::on_row_deleted_slot), this);
+ g_signal_connect_slot(model, "row-changed", &ListPage::on_row_changed, this);
+ g_signal_connect_slot(model, "row-inserted", &ListPage::on_row_inserted, this);
+ g_signal_connect_slot(model, "row-deleted", &ListPage::on_row_deleted, this);
g_object_unref(model);
}
@@ -188,7 +189,7 @@ void ListPage::on_row_inserted(GtkTreeModel* model, GtkTreePath* path, GtkTreeIt
//-----------------------------------------------------------------------------
-void ListPage::on_row_deleted(GtkTreePath* path)
+void ListPage::on_row_deleted(GtkTreeModel*, GtkTreePath* path)
{
size_t pos = gtk_tree_path_get_indices(path)[0];
if (pos < m_desktop_ids.size())
diff --git a/panel-plugin/list-page.h b/panel-plugin/list-page.h
index 54b112f..6346fd7 100644
--- a/panel-plugin/list-page.h
+++ b/panel-plugin/list-page.h
@@ -45,27 +45,10 @@ protected:
private:
void on_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter);
void on_row_inserted(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter);
- void on_row_deleted(GtkTreePath*);
+ void on_row_deleted(GtkTreeModel*, GtkTreePath* path);
private:
std::vector<std::string>& m_desktop_ids;
-
-
-private:
- static void on_row_changed_slot(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, ListPage* obj)
- {
- obj->on_row_changed(model, path, iter);
- }
-
- static void on_row_inserted_slot(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, ListPage* obj)
- {
- obj->on_row_inserted(model, path, iter);
- }
-
- static void on_row_deleted_slot(GtkTreeModel*, GtkTreePath* path, ListPage* obj)
- {
- obj->on_row_deleted(path);
- }
};
}
diff --git a/panel-plugin/page.cpp b/panel-plugin/page.cpp
index 23f6c6d..a1d68f6 100644
--- a/panel-plugin/page.cpp
+++ b/panel-plugin/page.cpp
@@ -21,6 +21,7 @@
#include "launcher.h"
#include "launcher-view.h"
#include "recent-page.h"
+#include "slot.h"
#include "window.h"
#include <libxfce4ui/libxfce4ui.h>
@@ -35,9 +36,9 @@ Page::Page(Window* window) :
{
// Create view
m_view = new LauncherView;
- g_signal_connect(m_view->get_widget(), "button-press-event", G_CALLBACK(Page::view_button_press_event_slot), this);
- g_signal_connect(m_view->get_widget(), "popup-menu", G_CALLBACK(Page::view_popup_menu_event_slot), this);
- g_signal_connect(m_view->get_widget(), "row-activated", G_CALLBACK(Page::launcher_activated_slot), this);
+ g_signal_connect_slot(m_view->get_widget(), "button-press-event", &Page::view_button_press_event, this);
+ g_signal_connect_slot(m_view->get_widget(), "popup-menu", &Page::view_popup_menu_event, this);
+ g_signal_connect_slot(m_view->get_widget(), "row-activated", &Page::launcher_activated, this);
g_signal_connect_swapped(m_view->get_widget(), "start-interactive-search", G_CALLBACK(gtk_widget_grab_focus), m_window->get_search_entry());
// Add scrolling to view
@@ -104,7 +105,7 @@ bool Page::remember_launcher(Launcher*)
//-----------------------------------------------------------------------------
-void Page::launcher_activated(GtkTreeView* view, GtkTreePath* path)
+void Page::launcher_activated(GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn*)
{
GtkTreeIter iter;
GtkTreeModel* model = gtk_tree_view_get_model(view);
@@ -133,7 +134,7 @@ void Page::launcher_activated(GtkTreeView* view, GtkTreePath* path)
//-----------------------------------------------------------------------------
-bool Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
+gboolean Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
{
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
GtkTreeIter iter;
@@ -150,7 +151,7 @@ bool Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
//-----------------------------------------------------------------------------
-bool Page::view_popup_menu_event(GtkWidget* view)
+gboolean Page::view_popup_menu_event(GtkWidget* view)
{
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
GtkTreeIter iter;
@@ -176,7 +177,7 @@ void Page::create_context_menu(GtkTreeIter* iter, GdkEventButton* event)
// Create context menu
GtkWidget* menu = gtk_menu_new();
- g_signal_connect(menu, "selection-done", G_CALLBACK(Page::destroy_context_menu_slot), this);
+ g_signal_connect_slot(menu, "selection-done", &Page::destroy_context_menu, this);
// Add menu items
GtkWidget* menuitem = gtk_menu_item_new_with_label(launcher->get_display_name());
@@ -191,7 +192,7 @@ void Page::create_context_menu(GtkTreeIter* iter, GdkEventButton* event)
menuitem = gtk_image_menu_item_new_with_label(_("Add to Favorites"));
GtkWidget* image = gtk_image_new_from_icon_name("stock_add-bookmark", GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
- g_signal_connect(menuitem, "activate", G_CALLBACK(Page::add_selected_to_favorites_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &Page::add_selected_to_favorites, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
else
@@ -199,16 +200,16 @@ void Page::create_context_menu(GtkTreeIter* iter, GdkEventButton* event)
menuitem = gtk_image_menu_item_new_with_label(_("Remove From Favorites"));
GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
- g_signal_connect(menuitem, "activate", G_CALLBACK(Page::remove_selected_from_favorites_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &Page::remove_selected_from_favorites, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
menuitem = gtk_menu_item_new_with_label(_("Add to Desktop"));
- g_signal_connect(menuitem, "activate", G_CALLBACK(Page::add_selected_to_desktop_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &Page::add_selected_to_desktop, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label(_("Add to Panel"));
- g_signal_connect(menuitem, "activate", G_CALLBACK(Page::add_selected_to_panel_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &Page::add_selected_to_panel, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
extend_context_menu(menu);
diff --git a/panel-plugin/page.h b/panel-plugin/page.h
index 3ca1890..d398d7e 100644
--- a/panel-plugin/page.h
+++ b/panel-plugin/page.h
@@ -53,9 +53,9 @@ protected:
private:
virtual bool remember_launcher(Launcher* launcher);
- void launcher_activated(GtkTreeView* view, GtkTreePath* path);
- bool view_button_press_event(GtkWidget* view, GdkEventButton* event);
- bool view_popup_menu_event(GtkWidget* view);
+ void launcher_activated(GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn*);
+ gboolean view_button_press_event(GtkWidget* view, GdkEventButton* event);
+ gboolean view_popup_menu_event(GtkWidget* view);
void on_unmap();
void destroy_context_menu(GtkMenuShell* menu);
void add_selected_to_desktop();
@@ -72,48 +72,6 @@ private:
GtkWidget* m_widget;
LauncherView* m_view;
GtkTreePath* m_selected_path;
-
-
-private:
- static void launcher_activated_slot(GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn*, Page* obj)
- {
- obj->launcher_activated(view, path);
- }
-
- static gboolean view_button_press_event_slot(GtkWidget* view, GdkEventButton* event, Page* obj)
- {
- return obj->view_button_press_event(view, event);
- }
-
- static gboolean view_popup_menu_event_slot(GtkWidget* view, Page* obj)
- {
- return obj->view_popup_menu_event(view);
- }
-
- static void destroy_context_menu_slot(GtkMenuShell* menu, Page* obj)
- {
- obj->destroy_context_menu(menu);
- }
-
- static void add_selected_to_desktop_slot(GtkMenuItem*, Page* obj)
- {
- obj->add_selected_to_desktop();
- }
-
- static void add_selected_to_panel_slot(GtkMenuItem*, Page* obj)
- {
- obj->add_selected_to_panel();
- }
-
- static void add_selected_to_favorites_slot(GtkMenuItem*, Page* obj)
- {
- obj->add_selected_to_favorites();
- }
-
- static void remove_selected_from_favorites_slot(GtkMenuItem*, Page* obj)
- {
- obj->remove_selected_from_favorites();
- }
};
}
diff --git a/panel-plugin/plugin.cpp b/panel-plugin/plugin.cpp
index a6256dd..da588c2 100644
--- a/panel-plugin/plugin.cpp
+++ b/panel-plugin/plugin.cpp
@@ -21,6 +21,7 @@
#include "command.h"
#include "configuration-dialog.h"
#include "settings.h"
+#include "slot.h"
#include "window.h"
extern "C"
@@ -71,12 +72,12 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
// Create menu window
m_window = new Window;
- g_signal_connect(m_window->get_widget(), "unmap", G_CALLBACK(Plugin::menu_hidden_slot), this);
+ g_signal_connect_slot(m_window->get_widget(), "unmap", &Plugin::menu_hidden, this);
// Create toggle button
m_button = xfce_create_panel_toggle_button();
gtk_button_set_relief(GTK_BUTTON(m_button), GTK_RELIEF_NONE);
- g_signal_connect(m_button, "button-press-event", G_CALLBACK(Plugin::button_clicked_slot), this);
+ g_signal_connect_slot(m_button, "button-press-event", &Plugin::button_clicked, this);
gtk_widget_show(m_button);
m_button_box = GTK_BOX(gtk_hbox_new(false, 1));
@@ -104,23 +105,23 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
// Connect plugin signals to functions
g_signal_connect(plugin, "free-data", G_CALLBACK(whiskermenu_free), this);
- g_signal_connect(plugin, "configure-plugin", G_CALLBACK(Plugin::configure_slot), this);
+ g_signal_connect_slot(plugin, "configure-plugin", &Plugin::configure, this);
#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
- g_signal_connect(plugin, "mode-changed", G_CALLBACK(Plugin::mode_changed_slot), this);
+ g_signal_connect_slot(plugin, "mode-changed", &Plugin::mode_changed, this);
#else
- g_signal_connect(plugin, "orientation-changed", G_CALLBACK(Plugin::orientation_changed_slot), this);
+ g_signal_connect_slot(plugin, "orientation-changed", &Plugin::orientation_changed, this);
#endif
- g_signal_connect(plugin, "remote-event", G_CALLBACK(Plugin::remote_event_slot), this);
- g_signal_connect_swapped(plugin, "save", G_CALLBACK(Plugin::save_slot), this);
- g_signal_connect(plugin, "size-changed", G_CALLBACK(Plugin::size_changed_slot), this);
+ g_signal_connect_slot(plugin, "remote-event", &Plugin::remote_event, this);
+ g_signal_connect_slot(plugin, "save", &Plugin::save, this);
+ g_signal_connect_slot(plugin, "size-changed", &Plugin::size_changed, this);
xfce_panel_plugin_menu_show_configure(plugin);
xfce_panel_plugin_menu_insert_item(plugin, GTK_MENU_ITEM(wm_settings->command[Settings::CommandMenuEditor]->get_menuitem()));
#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
- mode_changed_slot(m_plugin, xfce_panel_plugin_get_mode(m_plugin), this);
+ mode_changed(m_plugin, xfce_panel_plugin_get_mode(m_plugin));
#else
- orientation_changed_slot(m_plugin, xfce_panel_plugin_get_orientation(m_plugin), this);
+ orientation_changed(m_plugin, xfce_panel_plugin_get_orientation(m_plugin));
#endif
}
@@ -201,7 +202,7 @@ void Plugin::set_button_style(ButtonStyle style)
wm_settings->set_modified();
- size_changed(xfce_panel_plugin_get_size(m_plugin));
+ size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
@@ -211,7 +212,7 @@ void Plugin::set_button_title(const std::string& title)
wm_settings->button_title = title;
wm_settings->set_modified();
gtk_label_set_markup(m_button_label, wm_settings->button_title.c_str());
- size_changed(xfce_panel_plugin_get_size(m_plugin));
+ size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
@@ -221,7 +222,7 @@ void Plugin::set_button_icon_name(const std::string& icon)
wm_settings->button_icon_name = icon;
wm_settings->set_modified();
xfce_panel_image_set_from_source(m_button_icon, icon.c_str());
- size_changed(xfce_panel_plugin_get_size(m_plugin));
+ size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
@@ -240,7 +241,7 @@ void Plugin::set_configure_enabled(bool enabled)
//-----------------------------------------------------------------------------
-bool Plugin::button_clicked(GdkEventButton* event)
+gboolean Plugin::button_clicked(GtkWidget*, GdkEventButton* event)
{
if (event->button != 1 || event->state & GDK_CONTROL_MASK)
{
@@ -273,21 +274,28 @@ void Plugin::menu_hidden()
void Plugin::configure()
{
ConfigurationDialog* dialog = new ConfigurationDialog(this);
- g_signal_connect_swapped(dialog->get_widget(), "destroy", G_CALLBACK(Plugin::save_slot), this);
+ g_signal_connect_slot(dialog->get_widget(), "destroy", &Plugin::save, this);
}
//-----------------------------------------------------------------------------
-void Plugin::orientation_changed(bool vertical)
+#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
+void Plugin::mode_changed(XfcePanelPlugin*, XfcePanelPluginMode mode)
{
- gtk_label_set_angle(m_button_label, vertical ? 270: 0);
-
- size_changed(xfce_panel_plugin_get_size(m_plugin));
+ gtk_label_set_angle(m_button_label, (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? 270: 0);
+ size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+}
+#else
+void Plugin::orientation_changed(XfcePanelPlugin*, GtkOrientation orientation)
+{
+ gtk_label_set_angle(m_button_label, (orientation == GTK_ORIENTATION_VERTICAL) ? 270: 0);
+ size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
}
+#endif
//-----------------------------------------------------------------------------
-bool Plugin::remote_event(gchar* name, GValue* value)
+gboolean Plugin::remote_event(XfcePanelPlugin*, gchar* name, GValue* value)
{
if (strcmp(name, "popup"))
{
@@ -320,7 +328,7 @@ void Plugin::save()
//-----------------------------------------------------------------------------
-bool Plugin::size_changed(int size)
+gboolean Plugin::size_changed(XfcePanelPlugin*, gint size)
{
#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
gint row_size = size / xfce_panel_plugin_get_nrows(m_plugin);
diff --git a/panel-plugin/plugin.h b/panel-plugin/plugin.h
index 2e3e55a..54f5d38 100644
--- a/panel-plugin/plugin.h
+++ b/panel-plugin/plugin.h
@@ -58,13 +58,17 @@ public:
void set_configure_enabled(bool enabled);
private:
- bool button_clicked(GdkEventButton* event);
+ gboolean button_clicked(GtkWidget*, GdkEventButton* event);
void menu_hidden();
void configure();
- bool remote_event(gchar* name, GValue* value);
+#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
+ void mode_changed(XfcePanelPlugin*, XfcePanelPluginMode mode);
+#else
+ void orientation_changed(XfcePanelPlugin*, GtkOrientation orientation);
+#endif
+ gboolean remote_event(XfcePanelPlugin*, gchar* name, GValue* value);
void save();
- bool size_changed(int size);
- void orientation_changed(bool vertical);
+ gboolean size_changed(XfcePanelPlugin*, gint size);
void popup_menu(bool at_cursor);
private:
@@ -75,50 +79,6 @@ private:
GtkBox* m_button_box;
GtkLabel* m_button_label;
XfcePanelImage* m_button_icon;
-
-
-private:
- static gboolean button_clicked_slot(GtkWidget*, GdkEventButton* event, Plugin* obj)
- {
- return obj->button_clicked(event);
- }
-
- static void menu_hidden_slot(GtkWidget*, Plugin* obj)
- {
- obj->menu_hidden();
- }
-
- static void configure_slot(XfcePanelPlugin*, Plugin* obj)
- {
- obj->configure();
- }
-
- static gboolean remote_event_slot(XfcePanelPlugin*, gchar* name, GValue* value, Plugin* obj)
- {
- return obj->remote_event(name, value);
- }
-
- static void save_slot(Plugin* obj)
- {
- obj->save();
- }
-
- static gboolean size_changed_slot(XfcePanelPlugin*, gint size, Plugin* obj)
- {
- return obj->size_changed(size);
- }
-
-#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
- static void mode_changed_slot(XfcePanelPlugin*, XfcePanelPluginMode mode, Plugin* obj)
- {
- obj->orientation_changed(mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL);
- }
-#else
- static void orientation_changed_slot(XfcePanelPlugin*, GtkOrientation orientation, Plugin* obj)
- {
- obj->orientation_changed(orientation == GTK_ORIENTATION_VERTICAL);
- }
-#endif
};
}
diff --git a/panel-plugin/recent-page.cpp b/panel-plugin/recent-page.cpp
index 6d29e94..a4af3b6 100644
--- a/panel-plugin/recent-page.cpp
+++ b/panel-plugin/recent-page.cpp
@@ -20,6 +20,7 @@
#include "launcher.h"
#include "launcher-view.h"
#include "settings.h"
+#include "slot.h"
#include <glib/gi18n-lib.h>
@@ -87,7 +88,7 @@ void RecentPage::extend_context_menu(GtkWidget* menu)
menuitem = gtk_image_menu_item_new_with_label(_("Clear Recently Used"));
GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
- g_signal_connect(menuitem, "activate", G_CALLBACK(RecentPage::clear_menu_slot), this);
+ g_signal_connect_slot(menuitem, "activate", &RecentPage::clear_menu, this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
diff --git a/panel-plugin/recent-page.h b/panel-plugin/recent-page.h
index 1dae170..fd48904 100644
--- a/panel-plugin/recent-page.h
+++ b/panel-plugin/recent-page.h
@@ -36,13 +36,6 @@ private:
private:
size_t m_max_items;
-
-
-private:
- static void clear_menu_slot(GtkMenuItem*, RecentPage* obj)
- {
- obj->clear_menu();
- }
};
}
diff --git a/panel-plugin/resizer-widget.cpp b/panel-plugin/resizer-widget.cpp
index ea78f86..afe3f36 100644
--- a/panel-plugin/resizer-widget.cpp
+++ b/panel-plugin/resizer-widget.cpp
@@ -17,6 +17,8 @@
#include "resizer-widget.h"
+#include "slot.h"
+
using namespace WhiskerMenu;
//-----------------------------------------------------------------------------
@@ -33,10 +35,10 @@ ResizerWidget::ResizerWidget(GtkWindow* window) :
gtk_widget_add_events(m_drawing, GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_container_add(GTK_CONTAINER(m_alignment), m_drawing);
- g_signal_connect(m_drawing, "button-press-event", G_CALLBACK(ResizerWidget::on_button_press_event_slot), this);
- g_signal_connect(m_drawing, "enter-notify-event", G_CALLBACK(ResizerWidget::on_enter_notify_event_slot), this);
- g_signal_connect(m_drawing, "leave-notify-event", G_CALLBACK(ResizerWidget::on_leave_notify_event_slot), this);
- g_signal_connect(m_drawing, "expose-event", G_CALLBACK(ResizerWidget::on_expose_event_slot), this);
+ g_signal_connect_slot(m_drawing, "button-press-event", &ResizerWidget::on_button_press_event, this);
+ g_signal_connect_slot(m_drawing, "enter-notify-event", &ResizerWidget::on_enter_notify_event, this);
+ g_signal_connect_slot(m_drawing, "leave-notify-event", &ResizerWidget::on_leave_notify_event, this);
+ g_signal_connect_slot(m_drawing, "expose-event", &ResizerWidget::on_expose_event, this);
set_corner(TopRight);
}
@@ -99,7 +101,7 @@ void ResizerWidget::set_corner(Corner corner)
//-----------------------------------------------------------------------------
-bool ResizerWidget::on_button_press_event(GdkEventButton* event)
+gboolean ResizerWidget::on_button_press_event(GtkWidget*, GdkEventButton* event)
{
gtk_window_begin_resize_drag(m_window,
m_edge,
@@ -112,7 +114,7 @@ bool ResizerWidget::on_button_press_event(GdkEventButton* event)
//-----------------------------------------------------------------------------
-bool ResizerWidget::on_enter_notify_event(GtkWidget* widget)
+gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEventCrossing*)
{
gtk_widget_set_state(widget, GTK_STATE_PRELIGHT);
GdkWindow* window = gtk_widget_get_window(widget);
@@ -122,7 +124,7 @@ bool ResizerWidget::on_enter_notify_event(GtkWidget* widget)
//-----------------------------------------------------------------------------
-bool ResizerWidget::on_leave_notify_event(GtkWidget* widget)
+gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEventCrossing*)
{
gtk_widget_set_state(widget, GTK_STATE_NORMAL);
GdkWindow* window = gtk_widget_get_window(widget);
@@ -132,7 +134,7 @@ bool ResizerWidget::on_leave_notify_event(GtkWidget* widget)
//-----------------------------------------------------------------------------
-bool ResizerWidget::on_expose_event(GtkWidget* widget)
+gboolean ResizerWidget::on_expose_event(GtkWidget* widget, GdkEventExpose*)
{
cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
diff --git a/panel-plugin/resizer-widget.h b/panel-plugin/resizer-widget.h
index 8695fc3..7cbb10d 100644
--- a/panel-plugin/resizer-widget.h
+++ b/panel-plugin/resizer-widget.h
@@ -46,10 +46,10 @@ public:
void set_corner(Corner corner);
private:
- bool on_button_press_event(GdkEventButton* event);
- bool on_enter_notify_event(GtkWidget* widget);
- bool on_leave_notify_event(GtkWidget* widget);
- bool on_expose_event(GtkWidget* widget);
+ gboolean on_button_press_event(GtkWidget*, GdkEventButton* event);
+ gboolean on_enter_notify_event(GtkWidget* widget, GdkEventCrossing*);
+ gboolean on_leave_notify_event(GtkWidget* widget, GdkEventCrossing*);
+ gboolean on_expose_event(GtkWidget* widget, GdkEventExpose*);
private:
GtkWindow* m_window;
@@ -58,28 +58,6 @@ private:
GdkCursor* m_cursor;
GdkWindowEdge m_edge;
std::vector<GdkPoint> m_shape;
-
-
-private:
- static gboolean on_button_press_event_slot(GtkWidget*, GdkEventButton* event, ResizerWidget* obj)
- {
- return obj->on_button_press_event(event);
- }
-
- static gboolean on_enter_notify_event_slot(GtkWidget* widget, GdkEventCrossing*, ResizerWidget* obj)
- {
- return obj->on_enter_notify_event(widget);
- }
-
- static gboolean on_leave_notify_event_slot(GtkWidget* widget, GdkEventCrossing*, ResizerWidget* obj)
- {
- return obj->on_leave_notify_event(widget);
- }
-
- static gboolean on_expose_event_slot(GtkWidget* widget, GdkEventExpose*, ResizerWidget* obj)
- {
- return obj->on_expose_event(widget);
- }
};
}
diff --git a/panel-plugin/search-page.cpp b/panel-plugin/search-page.cpp
index ad47693..1c338bc 100644
--- a/panel-plugin/search-page.cpp
+++ b/panel-plugin/search-page.cpp
@@ -19,6 +19,7 @@
#include "launcher.h"
#include "launcher-view.h"
+#include "slot.h"
#include "window.h"
#include <algorithm>
@@ -34,8 +35,8 @@ SearchPage::SearchPage(Window* window) :
{
get_view()->set_selection_mode(GTK_SELECTION_BROWSE);
- g_signal_connect(window->get_search_entry(), "icon-release", G_CALLBACK(SearchPage::clear_search_slot), this);
- g_signal_connect(window->get_search_entry(), "key-press-event", G_CALLBACK(SearchPage::search_entry_key_press_slot), this);
+ g_signal_connect_slot(window->get_search_entry(), "icon-release", &SearchPage::clear_search, this);
+ g_signal_connect_slot(window->get_search_entry(), "key-press-event", &SearchPage::search_entry_key_press, this);
}
//-----------------------------------------------------------------------------
@@ -152,7 +153,7 @@ void SearchPage::unset_menu_items()
//-----------------------------------------------------------------------------
-void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos)
+void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*)
{
if (icon_pos == GTK_ENTRY_ICON_SECONDARY)
{
@@ -162,7 +163,7 @@ void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos)
//-----------------------------------------------------------------------------
-bool SearchPage::search_entry_key_press(GtkWidget* widget, GdkEventKey* event)
+gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEventKey* event)
{
if (event->keyval == GDK_Escape)
{
diff --git a/panel-plugin/search-page.h b/panel-plugin/search-page.h
index 699375b..7337b5d 100644
--- a/panel-plugin/search-page.h
+++ b/panel-plugin/search-page.h
@@ -39,8 +39,8 @@ public:
void unset_menu_items();
private:
- void clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos);
- bool search_entry_key_press(GtkWidget* widget, GdkEventKey* event);
+ void clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*);
+ gboolean search_entry_key_press(GtkWidget* widget, GdkEventKey* event);
private:
Query m_query;
@@ -81,18 +81,6 @@ private:
int m_relevancy;
};
std::vector<Match> m_matches;
-
-
-private:
- static void clear_search_slot(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*, SearchPage* obj)
- {
- obj->clear_search(entry, icon_pos);
- }
-
- static gboolean search_entry_key_press_slot(GtkWidget* widget, GdkEventKey* event, SearchPage* obj)
- {
- return obj->search_entry_key_press(widget, event);
- }
};
}
diff --git a/panel-plugin/slot.h b/panel-plugin/slot.h
new file mode 100644
index 0000000..16d2cae
--- /dev/null
+++ b/panel-plugin/slot.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2013 Graeme Gott <graeme at gottcode.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WHISKERMENU_SLOT_H
+#define WHISKERMENU_SLOT_H
+
+#include <glib-object.h>
+
+namespace WhiskerMenu
+{
+
+// Member function without parameters
+template<typename T, typename R>
+gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(T::*member)(), T* obj, bool after = false)
+{
+ class Slot
+ {
+ T* m_instance;
+ R (T::*m_member)();
+
+ public:
+ Slot(T* instance, R (T::*member)()) :
+ m_instance(instance),
+ m_member(member)
+ {
+ }
+
+ static R invoke(Slot* slot)
+ {
+ return (slot->m_instance->*slot->m_member)();
+ }
+
+ static void destroy(Slot* slot)
+ {
+ delete slot;
+ }
+ };
+ R (*invoke_slot)(Slot*) = &Slot::invoke;
+ void (*destroy_slot)(Slot*) = &Slot::destroy;
+
+ return g_signal_connect_data(instance, detailed_signal,
+ reinterpret_cast<GCallback>(invoke_slot),
+ new Slot(obj, member),
+ reinterpret_cast<GClosureNotify>(destroy_slot),
+ after ? GConnectFlags(G_CONNECT_AFTER | G_CONNECT_SWAPPED) : G_CONNECT_SWAPPED);
+}
+
+// Member function with 1 parameter
+template<typename T, typename R, typename A1>
+gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(T::*member)(A1), T* obj, bool after = false)
+{
+ class Slot
+ {
+ T* m_instance;
+ R (T::*m_member)(A1);
+
+ public:
+ Slot(T* instance, R (T::*member)(A1)) :
+ m_instance(instance),
+ m_member(member)
+ {
+ }
+
+ static R invoke(A1 a1, Slot* slot)
+ {
+ return (slot->m_instance->*slot->m_member)(a1);
+ }
+
+ static void destroy(Slot* slot)
+ {
+ delete slot;
+ }
+ };
+ R (*invoke_slot)(A1,Slot*) = &Slot::invoke;
+ void (*destroy_slot)(Slot*) = &Slot::destroy;
+
+ return g_signal_connect_data(instance, detailed_signal,
+ reinterpret_cast<GCallback>(invoke_slot),
+ new Slot(obj, member),
+ reinterpret_cast<GClosureNotify>(destroy_slot),
+ after ? G_CONNECT_AFTER : GConnectFlags(0));
+}
+
+// Member function with 2 parameters
+template<typename T, typename R, typename A1, typename A2>
+gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(T::*member)(A1,A2), T* obj, bool after = false)
+{
+ class Slot
+ {
+ T* m_instance;
+ R (T::*m_member)(A1,A2);
+
+ public:
+ Slot(T* instance, R (T::*member)(A1,A2)) :
+ m_instance(instance),
+ m_member(member)
+ {
+ }
+
+ static R invoke(A1 a1, A2 a2, Slot* slot)
+ {
+ return (slot->m_instance->*slot->m_member)(a1, a2);
+ }
+
+ static void destroy(Slot* slot)
+ {
+ delete slot;
+ }
+ };
+ R (*invoke_slot)(A1,A2,Slot*) = &Slot::invoke;
+ void (*destroy_slot)(Slot*) = &Slot::destroy;
+
+ return g_signal_connect_data(instance, detailed_signal,
+ reinterpret_cast<GCallback>(invoke_slot),
+ new Slot(obj, member),
+ reinterpret_cast<GClosureNotify>(destroy_slot),
+ after ? G_CONNECT_AFTER : GConnectFlags(0));
+}
+
+// Member function with 3 parameters
+template<typename T, typename R, typename A1, typename A2, typename A3>
+gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(T::*member)(A1,A2,A3), T* obj, bool after = false)
+{
+ class Slot
+ {
+ T* m_instance;
+ R (T::*m_member)(A1,A2,A3);
+
+ public:
+ Slot(T* instance, R (T::*member)(A1,A2,A3)) :
+ m_instance(instance),
+ m_member(member)
+ {
+ }
+
+ static R invoke(A1 a1, A2 a2, A3 a3, Slot* slot)
+ {
+ return (slot->m_instance->*slot->m_member)(a1, a2, a3);
+ }
+
+ static void destroy(Slot* slot)
+ {
+ delete slot;
+ }
+ };
+ R (*invoke_slot)(A1,A2,A3,Slot*) = &Slot::invoke;
+ void (*destroy_slot)(Slot*) = &Slot::destroy;
+
+ return g_signal_connect_data(instance, detailed_signal,
+ reinterpret_cast<GCallback>(invoke_slot),
+ new Slot(obj, member),
+ reinterpret_cast<GClosureNotify>(destroy_slot),
+ after ? G_CONNECT_AFTER : GConnectFlags(0));
+}
+
+}
+
+#endif // WHISKERMENU_SLOT_H
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index 6f16699..937d45f 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -26,6 +26,7 @@
#include "search-page.h"
#include "section-button.h"
#include "settings.h"
+#include "slot.h"
#include <exo/exo.h>
#include <gdk/gdkkeysyms.h>
@@ -60,14 +61,14 @@ Window::Window() :
gtk_window_set_skip_pager_hint(m_window, true);
gtk_window_stick(m_window);
gtk_widget_add_events(GTK_WIDGET(m_window), GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK);
- g_signal_connect(m_window, "enter-notify-event", G_CALLBACK(Window::on_enter_notify_event_slot), this);
- g_signal_connect(m_window, "leave-notify-event", G_CALLBACK(Window::on_leave_notify_event_slot), this);
- g_signal_connect(m_window, "focus-in-event", G_CALLBACK(on_focus_in_event_slot), this);
- g_signal_connect(m_window, "button-press-event", G_CALLBACK(Window::on_button_press_event_slot), this);
- g_signal_connect(m_window, "key-press-event", G_CALLBACK(Window::on_key_press_event_slot), this);
- g_signal_connect_after(m_window, "key-press-event", G_CALLBACK(Window::on_key_press_event_after_slot), this);
- g_signal_connect(m_window, "map-event", G_CALLBACK(Window::on_map_event_slot), this);
- g_signal_connect(m_window, "configure-event", G_CALLBACK(Window::on_configure_event_slot), this);
+ g_signal_connect_slot(m_window, "enter-notify-event", &Window::on_enter_notify_event, this);
+ g_signal_connect_slot(m_window, "leave-notify-event", &Window::on_leave_notify_event, this);
+ g_signal_connect_slot(m_window, "focus-in-event", &Window::on_focus_in_event, this);
+ g_signal_connect_slot(m_window, "button-press-event", &Window::on_button_press_event, this);
+ g_signal_connect_slot(m_window, "key-press-event", &Window::on_key_press_event, this);
+ g_signal_connect_slot(m_window, "key-press-event", &Window::on_key_press_event_after, this, true);
+ g_signal_connect_slot(m_window, "map-event", &Window::on_map_event, this);
+ g_signal_connect_slot(m_window, "configure-event", &Window::on_configure_event, this);
m_window_box = GTK_BOX(gtk_vbox_new(false, 0));
gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_window_box));
@@ -108,7 +109,7 @@ Window::Window() :
m_commands_button[3] = wm_settings->command[Settings::CommandLogOut]->get_button();
for (int i = 0; i < 4; ++i)
{
- g_signal_connect_swapped(m_commands_button[i], "clicked", G_CALLBACK(Window::hide_slot), this);
+ g_signal_connect_slot(m_commands_button[i], "clicked", &Window::hide, this);
}
m_resizer = new ResizerWidget(m_window);
@@ -117,20 +118,20 @@ Window::Window() :
m_search_entry = GTK_ENTRY(gtk_entry_new());
gtk_entry_set_icon_from_stock(m_search_entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FIND);
gtk_entry_set_icon_activatable(m_search_entry, GTK_ENTRY_ICON_SECONDARY, false);
- g_signal_connect(m_search_entry, "changed", G_CALLBACK(Window::search_slot), this);
+ g_signal_connect_slot(m_search_entry, "changed", &Window::search, this);
// Create favorites
m_favorites = new FavoritesPage(this);
m_favorites_button = new SectionButton("user-bookmarks", _("Favorites"));
- g_signal_connect(m_favorites_button->get_button(), "toggled", G_CALLBACK(Window::favorites_toggled_slot), this);
+ g_signal_connect_slot(m_favorites_button->get_button(), "toggled", &Window::favorites_toggled, this);
// Create recent
m_recent = new RecentPage(this);
m_recent_button = new SectionButton("document-open-recent", _("Recently Used"));
m_recent_button->set_group(m_favorites_button->get_group());
- g_signal_connect(m_recent_button->get_button(), "toggled", G_CALLBACK(Window::recent_toggled_slot), this);
+ g_signal_connect_slot(m_recent_button->get_button(), "toggled", &Window::recent_toggled, this);
// Create applications
m_applications = new ApplicationsPage(this);
@@ -571,7 +572,7 @@ void Window::set_categories(const std::vector<SectionButton*>& categories)
{
(*i)->set_group(m_recent_button->get_group());
gtk_box_pack_start(m_sidebar_box, GTK_WIDGET((*i)->get_button()), false, false, 0);
- g_signal_connect((*i)->get_button(), "toggled", G_CALLBACK(Window::category_toggled_slot), this);
+ g_signal_connect_slot((*i)->get_button(), "toggled", &Window::category_toggled, this);
}
gtk_widget_show_all(GTK_WIDGET(m_sidebar_box));
@@ -588,7 +589,7 @@ void Window::set_items()
// Handle switching to favorites are added
GtkTreeModel* favorites_model = m_favorites->get_view()->get_model();
- g_signal_connect(favorites_model, "row-inserted", G_CALLBACK(Window::show_favorites_slot), this);
+ g_signal_connect_slot(favorites_model, "row-inserted", &Window::show_favorites, this);
}
//-----------------------------------------------------------------------------
@@ -612,7 +613,7 @@ void Window::unset_items()
//-----------------------------------------------------------------------------
-bool Window::on_enter_notify_event(GdkEventCrossing* event)
+gboolean Window::on_enter_notify_event(GtkWidget*, GdkEventCrossing* event)
{
if ( (event->detail == GDK_NOTIFY_INFERIOR)
|| (event->mode == GDK_CROSSING_GRAB)
@@ -636,7 +637,7 @@ bool Window::on_enter_notify_event(GdkEventCrossing* event)
//-----------------------------------------------------------------------------
-bool Window::on_leave_notify_event(GdkEventCrossing* event)
+gboolean Window::on_leave_notify_event(GtkWidget*, GdkEventCrossing* event)
{
if ( (event->detail == GDK_NOTIFY_INFERIOR)
|| (event->mode != GDK_CROSSING_NORMAL) )
@@ -661,7 +662,7 @@ bool Window::on_leave_notify_event(GdkEventCrossing* event)
//-----------------------------------------------------------------------------
-bool Window::on_focus_in_event()
+gboolean Window::on_focus_in_event(GtkWidget*, GdkEventFocus*)
{
gdk_pointer_grab(gtk_widget_get_window(GTK_WIDGET(m_window)), true,
GdkEventMask(
@@ -674,7 +675,7 @@ bool Window::on_focus_in_event()
//-----------------------------------------------------------------------------
-bool Window::on_button_press_event(GdkEventButton* event)
+gboolean Window::on_button_press_event(GtkWidget*, GdkEventButton* event)
{
// Hide menu if user clicks outside
if ((event->x_root <= m_geometry.x) || (event->x_root >= m_geometry.x + m_geometry.width)
@@ -687,7 +688,7 @@ bool Window::on_button_press_event(GdkEventButton* event)
//-----------------------------------------------------------------------------
-bool Window::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
+gboolean Window::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
{
// Hide if escape is pressed and there is no text in search entry
if ( (event->keyval == GDK_Escape) && exo_str_is_empty(gtk_entry_get_text(m_search_entry)) )
@@ -728,7 +729,7 @@ bool Window::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
//-----------------------------------------------------------------------------
-bool Window::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
+gboolean Window::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
{
// Pass unhandled key presses to search entry
GtkWidget* search_entry = GTK_WIDGET(m_search_entry);
@@ -743,7 +744,7 @@ bool Window::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
//-----------------------------------------------------------------------------
-bool Window::on_map_event()
+gboolean Window::on_map_event(GtkWidget*, GdkEventAny*)
{
m_favorites->reset_selection();
@@ -765,7 +766,7 @@ bool Window::on_map_event()
//-----------------------------------------------------------------------------
-bool Window::on_configure_event(GdkEventConfigure* event)
+gboolean Window::on_configure_event(GtkWidget*, GdkEventConfigure* event)
{
if (event->width && event->height)
{
diff --git a/panel-plugin/window.h b/panel-plugin/window.h
index 3749a84..720ba80 100644
--- a/panel-plugin/window.h
+++ b/panel-plugin/window.h
@@ -73,14 +73,14 @@ public:
void unset_items();
private:
- bool on_enter_notify_event(GdkEventCrossing* event);
- bool on_leave_notify_event(GdkEventCrossing* event);
- bool on_focus_in_event();
- bool on_button_press_event(GdkEventButton* event);
- bool on_key_press_event(GtkWidget* widget, GdkEventKey* event);
- bool on_key_press_event_after(GtkWidget* widget, GdkEventKey* event);
- bool on_map_event();
- bool on_configure_event(GdkEventConfigure* event);
+ gboolean on_enter_notify_event(GtkWidget*, GdkEventCrossing* event);
+ gboolean on_leave_notify_event(GtkWidget*, GdkEventCrossing* event);
+ gboolean on_focus_in_event(GtkWidget*, GdkEventFocus*);
+ gboolean on_button_press_event(GtkWidget*, GdkEventButton* event);
+ gboolean on_key_press_event(GtkWidget* widget, GdkEventKey* event);
+ gboolean on_key_press_event_after(GtkWidget* widget, GdkEventKey* event);
+ gboolean on_map_event(GtkWidget*, GdkEventAny*);
+ gboolean on_configure_event(GtkWidget*, GdkEventConfigure* event);
void favorites_toggled();
void recent_toggled();
void category_toggled();
@@ -128,78 +128,6 @@ private:
bool m_layout_bottom;
bool m_layout_search_alternate;
bool m_layout_commands_alternate;
-
-
-private:
- static gboolean on_enter_notify_event_slot(GtkWidget*, GdkEventCrossing* event, Window* obj)
- {
- return obj->on_enter_notify_event(event);
- }
-
- static gboolean on_leave_notify_event_slot(GtkWidget*, GdkEventCrossing* event, Window* obj)
- {
- return obj->on_leave_notify_event(event);
- }
-
- static gboolean on_focus_in_event_slot(GtkWidget*, GdkEventFocus*, Window* obj)
- {
- return obj->on_focus_in_event();
- }
-
- static gboolean on_button_press_event_slot(GtkWidget*, GdkEventButton* event, Window* obj)
- {
- return obj->on_button_press_event(event);
- }
-
- static gboolean on_key_press_event_slot(GtkWidget* widget, GdkEventKey* event, Window* obj)
- {
- return obj->on_key_press_event(widget, event);
- }
-
- static gboolean on_key_press_event_after_slot(GtkWidget* widget, GdkEventKey* event, Window* obj)
- {
- return obj->on_key_press_event_after(widget, event);
- }
-
- static gboolean on_map_event_slot(GtkWidget*, GdkEventAny*, Window* obj)
- {
- return obj->on_map_event();
- }
-
- static gboolean on_configure_event_slot(GtkWidget*, GdkEventConfigure* event, Window* obj)
- {
- return obj->on_configure_event(event);
- }
-
- static void favorites_toggled_slot(GtkToggleButton*, Window* obj)
- {
- obj->favorites_toggled();
- }
-
- static void recent_toggled_slot(GtkToggleButton*, Window* obj)
- {
- obj->recent_toggled();
- }
-
- static void category_toggled_slot(GtkToggleButton*, Window* obj)
- {
- obj->category_toggled();
- }
-
- static void show_favorites_slot(GtkTreeModel*, GtkTreePath*, GtkTreeIter*, Window* obj)
- {
- obj->show_favorites();
- }
-
- static void search_slot(GtkEditable*, Window* obj)
- {
- obj->search();
- }
-
- static void hide_slot(Window* obj)
- {
- obj->hide();
- }
};
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list