[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 96/473: Remove slot macros.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:54:26 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 afd590322b865b5bdb34dfad466b3cd20b405ae1
Author: Graeme Gott <graeme at gottcode.org>
Date: Sat Jul 13 07:22:22 2013 -0400
Remove slot macros.
---
src/applications_page.cpp | 24 +++++-----
src/applications_page.hpp | 21 +++++---
src/configuration_dialog.cpp | 30 ++++++------
src/configuration_dialog.hpp | 67 +++++++++++++++++++++-----
src/favorites_page.cpp | 8 ++--
src/favorites_page.hpp | 16 +++++--
src/list_page.cpp | 8 ++--
src/list_page.hpp | 24 ++++++++--
src/menu.cpp | 44 ++++++++---------
src/menu.hpp | 109 +++++++++++++++++++++++++++++++++++-------
src/page.cpp | 24 +++++-----
src/page.hpp | 69 +++++++++++++++++++++-----
src/panel_plugin.cpp | 28 +++++------
src/panel_plugin.hpp | 73 +++++++++++++++++++---------
src/recent_page.cpp | 4 +-
src/recent_page.hpp | 11 +++--
src/resizer_widget.cpp | 16 +++----
src/resizer_widget.hpp | 32 ++++++++++---
src/search_page.cpp | 10 ++--
src/search_page.hpp | 19 ++++++--
src/slot.hpp | 57 ----------------------
21 files changed, 445 insertions(+), 249 deletions(-)
diff --git a/src/applications_page.cpp b/src/applications_page.cpp
index 2f0f8f5..6b17dd1 100644
--- a/src/applications_page.cpp
+++ b/src/applications_page.cpp
@@ -143,6 +143,13 @@ bool ApplicationsPage::on_filter(GtkTreeModel* model, GtkTreeIter* iter)
//-----------------------------------------------------------------------------
+void ApplicationsPage::invalidate_applications()
+{
+ m_loaded = false;
+}
+
+//-----------------------------------------------------------------------------
+
void ApplicationsPage::load_applications()
{
if (m_loaded)
@@ -158,7 +165,7 @@ void ApplicationsPage::load_applications()
g_object_ref(m_garcon_menu);
if (garcon_menu_load(m_garcon_menu, NULL, NULL))
{
- g_signal_connect_swapped(m_garcon_menu, "reload-required", SLOT_CALLBACK(ApplicationsPage::invalidate_applications), this);
+ g_signal_connect_swapped(m_garcon_menu, "reload-required", G_CALLBACK(ApplicationsPage::invalidate_applications_slot), this);
load_menu(m_garcon_menu);
}
@@ -192,13 +199,6 @@ void ApplicationsPage::load_applications()
//-----------------------------------------------------------------------------
-void ApplicationsPage::invalidate_applications()
-{
- m_loaded = false;
-}
-
-//-----------------------------------------------------------------------------
-
void ApplicationsPage::clear_applications()
{
// Free categories
@@ -295,7 +295,7 @@ void ApplicationsPage::load_menu(GarconMenu* menu)
}
// Listen for menu changes
- g_signal_connect_swapped(menu, "directory-changed", SLOT_CALLBACK(ApplicationsPage::invalidate_applications), this);
+ g_signal_connect_swapped(menu, "directory-changed", G_CALLBACK(ApplicationsPage::invalidate_applications_slot), this);
}
//-----------------------------------------------------------------------------
@@ -323,7 +323,7 @@ void ApplicationsPage::load_menu_item(const gchar* desktop_id, GarconMenuItem* m
}
// Listen for menu changes
- g_signal_connect_swapped(menu_item, "changed", SLOT_CALLBACK(ApplicationsPage::invalidate_applications), page);
+ g_signal_connect_swapped(menu_item, "changed", G_CALLBACK(ApplicationsPage::invalidate_applications_slot), page);
}
//-----------------------------------------------------------------------------
@@ -334,7 +334,7 @@ void ApplicationsPage::load_categories()
// Add button for all applications
SectionButton* all_button = new SectionButton("applications-other", _("All"));
- g_signal_connect(all_button->get_button(), "toggled", SLOT_CALLBACK(ApplicationsPage::apply_filter), this);
+ g_signal_connect(all_button->get_button(), "toggled", G_CALLBACK(ApplicationsPage::apply_filter_slot), this);
m_category_buttons[all_button] = NULL;
category_buttons.push_back(all_button);
@@ -351,7 +351,7 @@ void ApplicationsPage::load_categories()
for (std::map<std::string, Category*>::const_iterator i = sorted_categories.begin(), end = sorted_categories.end(); i != end; ++i)
{
SectionButton* category_button = new SectionButton(i->second->get_icon(), i->second->get_text());
- g_signal_connect(category_button->get_button(), "toggled", SLOT_CALLBACK(ApplicationsPage::apply_filter), this);
+ g_signal_connect(category_button->get_button(), "toggled", G_CALLBACK(ApplicationsPage::apply_filter_slot), this);
m_category_buttons[category_button] = i->second;
category_buttons.push_back(category_button);
}
diff --git a/src/applications_page.hpp b/src/applications_page.hpp
index cb9bd01..e8a05b5 100644
--- a/src/applications_page.hpp
+++ b/src/applications_page.hpp
@@ -18,7 +18,6 @@
#define WHISKERMENU_APPLICATIONS_PAGE_HPP
#include "filter_page.hpp"
-#include "slot.hpp"
#include <map>
#include <string>
@@ -65,15 +64,11 @@ public:
Launcher* get_application(const std::string& desktop_id) const;
+ void invalidate_applications();
void load_applications();
-public:
- SLOT_0(void, ApplicationsPage, invalidate_applications);
-
-private:
- SLOT_1(void, ApplicationsPage, apply_filter, GtkToggleButton*);
-
private:
+ void apply_filter(GtkToggleButton* togglebutton);
bool on_filter(GtkTreeModel* model, GtkTreeIter* iter);
void clear_applications();
void load_menu(GarconMenu* menu);
@@ -87,6 +82,18 @@ private:
std::map<Category*, std::vector<Launcher*> > m_categories;
std::map<std::string, Launcher*> m_items;
bool m_loaded;
+
+
+private:
+ static void invalidate_applications_slot(ApplicationsPage* obj)
+ {
+ obj->invalidate_applications();
+ }
+
+ static void apply_filter_slot(GtkToggleButton* togglebutton, ApplicationsPage* obj)
+ {
+ obj->apply_filter(togglebutton);
+ }
};
}
diff --git a/src/configuration_dialog.cpp b/src/configuration_dialog.cpp
index 42b2332..3d8e385 100644
--- a/src/configuration_dialog.cpp
+++ b/src/configuration_dialog.cpp
@@ -54,7 +54,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* 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", SLOT_CALLBACK(ConfigurationDialog::response), this);
+ g_signal_connect(m_window, "response", G_CALLBACK(ConfigurationDialog::response_slot), this);
g_signal_connect_swapped(m_window, "destroy", G_CALLBACK(whiskermenu_config_dialog_delete), this);
// Fetch contents box
@@ -73,13 +73,13 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
m_show_names = gtk_check_button_new_with_mnemonic(_("Show applications by _name"));
gtk_box_pack_start(appearance_vbox, m_show_names, true, true, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_show_names), Launcher::get_show_name());
- g_signal_connect(m_show_names, "toggled", SLOT_CALLBACK(ConfigurationDialog::toggle_show_name), this);
+ g_signal_connect(m_show_names, "toggled", G_CALLBACK(ConfigurationDialog::toggle_show_name_slot), 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), Launcher::get_show_description());
- g_signal_connect(m_show_descriptions, "toggled", SLOT_CALLBACK(ConfigurationDialog::toggle_show_description), this);
+ g_signal_connect(m_show_descriptions, "toggled", G_CALLBACK(ConfigurationDialog::toggle_show_description_slot), this);
// Add item icon size selector
GtkBox* hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -99,7 +99,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
gtk_combo_box_set_active(GTK_COMBO_BOX(m_item_icon_size), LauncherView::get_icon_size());
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", SLOT_CALLBACK(ConfigurationDialog::item_icon_size_changed), this);
+ g_signal_connect(m_item_icon_size, "changed", G_CALLBACK(ConfigurationDialog::item_icon_size_changed_slot), this);
// Add category icon size selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -118,7 +118,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
gtk_combo_box_set_active(GTK_COMBO_BOX(m_category_icon_size), SectionButton::get_icon_size());
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", SLOT_CALLBACK(ConfigurationDialog::category_icon_size_changed), this);
+ g_signal_connect(m_category_icon_size, "changed", G_CALLBACK(ConfigurationDialog::category_icon_size_changed_slot), this);
// Create panel button section
GtkBox* panel_vbox = GTK_BOX(gtk_vbox_new(false, 8));
@@ -142,7 +142,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
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", SLOT_CALLBACK(ConfigurationDialog::style_changed), this);
+ g_signal_connect(m_button_style, "changed", G_CALLBACK(ConfigurationDialog::style_changed_slot), this);
// Add title selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -157,7 +157,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
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", SLOT_CALLBACK(ConfigurationDialog::title_changed), this);
+ g_signal_connect(m_title, "changed", G_CALLBACK(ConfigurationDialog::title_changed_slot), this);
// Add icon selector
hbox = GTK_BOX(gtk_hbox_new(false, 12));
@@ -171,7 +171,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
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_swapped(m_icon_button, "clicked", SLOT_CALLBACK(ConfigurationDialog::choose_icon), this);
+ g_signal_connect(m_icon_button, "clicked", G_CALLBACK(ConfigurationDialog::choose_icon_slot), 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);
@@ -187,7 +187,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
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), SectionButton::get_hover_activate());
- g_signal_connect(m_hover_switch_category, "toggled", SLOT_CALLBACK(ConfigurationDialog::toggle_hover_switch_category), this);
+ g_signal_connect(m_hover_switch_category, "toggled", G_CALLBACK(ConfigurationDialog::toggle_hover_switch_category_slot), this);
// Show GTK window
gtk_widget_show_all(m_window);
@@ -254,7 +254,7 @@ void ConfigurationDialog::style_changed(GtkComboBox* combo)
//-----------------------------------------------------------------------------
-void ConfigurationDialog::title_changed(GtkEditable*)
+void ConfigurationDialog::title_changed()
{
const gchar* text = gtk_entry_get_text(GTK_ENTRY(m_title));
m_plugin->set_button_title(text ? text : "");
@@ -269,23 +269,23 @@ void ConfigurationDialog::toggle_hover_switch_category(GtkToggleButton* button)
//-----------------------------------------------------------------------------
-void ConfigurationDialog::toggle_show_name(GtkToggleButton*)
+void ConfigurationDialog::toggle_show_name(GtkToggleButton* button)
{
- Launcher::set_show_name(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_show_names)));
+ Launcher::set_show_name(gtk_toggle_button_get_active(button));
m_plugin->reload();
}
//-----------------------------------------------------------------------------
-void ConfigurationDialog::toggle_show_description(GtkToggleButton*)
+void ConfigurationDialog::toggle_show_description(GtkToggleButton* button)
{
- Launcher::set_show_description(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_show_descriptions)));
+ Launcher::set_show_description(gtk_toggle_button_get_active(button));
m_plugin->reload();
}
//-----------------------------------------------------------------------------
-void ConfigurationDialog::response(GtkDialog*, gint response_id)
+void ConfigurationDialog::response(int response_id)
{
if ((m_plugin->get_button_style() == PanelPlugin::ShowText) && m_plugin->get_button_title().empty())
{
diff --git a/src/configuration_dialog.hpp b/src/configuration_dialog.hpp
index 1838a9d..51f7dbc 100644
--- a/src/configuration_dialog.hpp
+++ b/src/configuration_dialog.hpp
@@ -17,8 +17,6 @@
#ifndef WHISKERMENU_CONFIGURATION_DIALOG_HPP
#define WHISKERMENU_CONFIGURATION_DIALOG_HPP
-#include "slot.hpp"
-
extern "C"
{
#include <gtk/gtk.h>
@@ -41,15 +39,15 @@ public:
}
private:
- SLOT_0(void, ConfigurationDialog, choose_icon);
- SLOT_1(void, ConfigurationDialog, category_icon_size_changed, GtkComboBox*);
- SLOT_1(void, ConfigurationDialog, item_icon_size_changed, GtkComboBox*);
- SLOT_1(void, ConfigurationDialog, style_changed, GtkComboBox*);
- SLOT_1(void, ConfigurationDialog, title_changed, GtkEditable*);
- SLOT_1(void, ConfigurationDialog, toggle_hover_switch_category, GtkToggleButton*);
- SLOT_1(void, ConfigurationDialog, toggle_show_name, GtkToggleButton*);
- SLOT_1(void, ConfigurationDialog, toggle_show_description, GtkToggleButton*);
- SLOT_2(void, ConfigurationDialog, response, GtkDialog*, gint);
+ void choose_icon();
+ void category_icon_size_changed(GtkComboBox* combo);
+ void item_icon_size_changed(GtkComboBox* combo);
+ void style_changed(GtkComboBox* combo);
+ void title_changed();
+ void toggle_hover_switch_category(GtkToggleButton* button);
+ void toggle_show_name(GtkToggleButton* button);
+ void toggle_show_description(GtkToggleButton* button);
+ void response(int response_id);
private:
PanelPlugin* m_plugin;
@@ -64,6 +62,53 @@ private:
GtkWidget* m_show_names;
GtkWidget* m_show_descriptions;
GtkWidget* m_hover_switch_category;
+
+
+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_name_slot(GtkToggleButton* button, ConfigurationDialog* obj)
+ {
+ obj->toggle_show_name(button);
+ }
+
+ static void toggle_show_description_slot(GtkToggleButton* button, ConfigurationDialog* obj)
+ {
+ obj->toggle_show_description(button);
+ }
+
+ static void response_slot(GtkDialog*, gint response_id, ConfigurationDialog* obj)
+ {
+ obj->response(response_id);
+ }
};
}
diff --git a/src/favorites_page.cpp b/src/favorites_page.cpp
index c4d613c..a5e8c67 100644
--- a/src/favorites_page.cpp
+++ b/src/favorites_page.cpp
@@ -73,13 +73,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", SLOT_CALLBACK(FavoritesPage::sort_ascending), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(FavoritesPage::sort_ascending_slot), 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", SLOT_CALLBACK(FavoritesPage::sort_descending), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(FavoritesPage::sort_descending_slot), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
@@ -103,7 +103,7 @@ void FavoritesPage::sort(std::map<std::string, Launcher*>& items) const
//-----------------------------------------------------------------------------
-void FavoritesPage::sort_ascending(GtkMenuItem*)
+void FavoritesPage::sort_ascending()
{
std::vector<std::string> desktop_ids;
std::map<std::string, Launcher*> items;
@@ -117,7 +117,7 @@ void FavoritesPage::sort_ascending(GtkMenuItem*)
//-----------------------------------------------------------------------------
-void FavoritesPage::sort_descending(GtkMenuItem*)
+void FavoritesPage::sort_descending()
{
std::vector<std::string> desktop_ids;
std::map<std::string, Launcher*> items;
diff --git a/src/favorites_page.hpp b/src/favorites_page.hpp
index de0f8cf..a0e9a7d 100644
--- a/src/favorites_page.hpp
+++ b/src/favorites_page.hpp
@@ -19,8 +19,6 @@
#include "list_page.hpp"
-#include "slot.hpp"
-
namespace WhiskerMenu
{
@@ -36,10 +34,20 @@ public:
private:
void extend_context_menu(GtkWidget* menu);
void sort(std::map<std::string, Launcher*>& items) const;
+ void sort_ascending();
+ void sort_descending();
+
private:
- SLOT_1(void, FavoritesPage, sort_ascending, GtkMenuItem*);
- SLOT_1(void, FavoritesPage, sort_descending, GtkMenuItem*);
+ 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/src/list_page.cpp b/src/list_page.cpp
index 5f93535..e2a87cd 100644
--- a/src/list_page.cpp
+++ b/src/list_page.cpp
@@ -128,9 +128,9 @@ void ListPage::set_menu_items()
// Replace treeview contents
get_view()->set_model(model.get_model());
- g_signal_connect(get_view()->get_model(), "row-changed", SLOT_CALLBACK(ListPage::on_row_changed), this);
- g_signal_connect(get_view()->get_model(), "row-inserted", SLOT_CALLBACK(ListPage::on_row_inserted), this);
- g_signal_connect(get_view()->get_model(), "row-deleted", SLOT_CALLBACK(ListPage::on_row_deleted), this);
+ g_signal_connect(get_view()->get_model(), "row-changed", G_CALLBACK(ListPage::on_row_changed_slot), this);
+ g_signal_connect(get_view()->get_model(), "row-inserted", G_CALLBACK(ListPage::on_row_inserted_slot), this);
+ g_signal_connect(get_view()->get_model(), "row-deleted", G_CALLBACK(ListPage::on_row_deleted_slot), this);
}
//-----------------------------------------------------------------------------
@@ -194,7 +194,7 @@ void ListPage::on_row_inserted(GtkTreeModel* model, GtkTreePath* path, GtkTreeIt
//-----------------------------------------------------------------------------
-void ListPage::on_row_deleted(GtkTreeModel*, GtkTreePath* path)
+void ListPage::on_row_deleted(GtkTreePath* path)
{
size_t pos = gtk_tree_path_get_indices(path)[0];
if (pos < m_desktop_ids.size())
diff --git a/src/list_page.hpp b/src/list_page.hpp
index a2c6a2f..bb329a8 100644
--- a/src/list_page.hpp
+++ b/src/list_page.hpp
@@ -18,7 +18,6 @@
#define WHISKERMENU_LIST_PAGE_HPP
#include "page.hpp"
-#include "slot.hpp"
#include <map>
#include <string>
@@ -62,13 +61,30 @@ protected:
void set_desktop_ids(const std::vector<std::string>& desktop_ids);
private:
- SLOT_3(void, ListPage, on_row_changed, GtkTreeModel*, GtkTreePath*, GtkTreeIter*);
- SLOT_3(void, ListPage, on_row_inserted, GtkTreeModel*, GtkTreePath*, GtkTreeIter*);
- SLOT_2(void, ListPage, on_row_deleted, GtkTreeModel*, GtkTreePath*);
+ 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*);
private:
const gchar* m_key;
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/src/menu.cpp b/src/menu.cpp
index 94fad8b..5d6ea2f 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -70,13 +70,13 @@ Menu::Menu(XfceRc* settings) :
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_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK);
- g_signal_connect(m_window, "enter-notify-event", SLOT_CALLBACK(Menu::on_enter_notify_event), this);
- g_signal_connect(m_window, "leave-notify-event", SLOT_CALLBACK(Menu::on_leave_notify_event), this);
- g_signal_connect(m_window, "button-press-event", SLOT_CALLBACK(Menu::on_button_press_event), this);
- g_signal_connect(m_window, "key-press-event", SLOT_CALLBACK(Menu::on_key_press_event), this);
- g_signal_connect_after(m_window, "key-press-event", SLOT_CALLBACK(Menu::on_key_press_event_after), this);
- g_signal_connect(m_window, "map-event", SLOT_CALLBACK(Menu::on_map_event), this);
- g_signal_connect(m_window, "configure-event", SLOT_CALLBACK(Menu::on_configure_event), this);
+ g_signal_connect(m_window, "enter-notify-event", G_CALLBACK(Menu::on_enter_notify_event_slot), this);
+ g_signal_connect(m_window, "leave-notify-event", G_CALLBACK(Menu::on_leave_notify_event_slot), this);
+ g_signal_connect(m_window, "button-press-event", G_CALLBACK(Menu::on_button_press_event_slot), this);
+ g_signal_connect(m_window, "key-press-event", G_CALLBACK(Menu::on_key_press_event_slot), this);
+ g_signal_connect_after(m_window, "key-press-event", G_CALLBACK(Menu::on_key_press_event_after_slot), this);
+ g_signal_connect(m_window, "map-event", G_CALLBACK(Menu::on_map_event_slot), this);
+ g_signal_connect(m_window, "configure-event", G_CALLBACK(Menu::on_configure_event_slot), this);
// Create the border of the window
GtkWidget* frame = gtk_frame_new(NULL);
@@ -97,13 +97,13 @@ Menu::Menu(XfceRc* settings) :
// Create action buttons
m_settings_button = new_action_button("preferences-desktop", _("All Settings"));
- g_signal_connect_swapped(m_settings_button, "clicked", SLOT_CALLBACK(Menu::launch_settings_manager), this);
+ g_signal_connect(m_settings_button, "clicked", G_CALLBACK(Menu::launch_settings_manager_slot), this);
m_lock_screen_button = new_action_button("system-lock-screen", _("Lock Screen"));
- g_signal_connect_swapped(m_lock_screen_button, "clicked", SLOT_CALLBACK(Menu::lock_screen), this);
+ g_signal_connect(m_lock_screen_button, "clicked", G_CALLBACK(Menu::lock_screen_slot), this);
m_log_out_button = new_action_button("system-log-out", _("Log Out"));
- g_signal_connect_swapped(m_log_out_button, "clicked", SLOT_CALLBACK(Menu::log_out), this);
+ g_signal_connect(m_log_out_button, "clicked", G_CALLBACK(Menu::log_out_slot), this);
m_resizer = new ResizerWidget(m_window);
@@ -111,20 +111,20 @@ Menu::Menu(XfceRc* settings) :
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_swapped(m_search_entry, "changed", SLOT_CALLBACK(Menu::search), this);
+ g_signal_connect(m_search_entry, "changed", G_CALLBACK(Menu::search_slot), this);
// Create favorites
m_favorites = new FavoritesPage(settings, this);
m_favorites_button = new SectionButton("user-bookmarks", _("Favorites"));
- g_signal_connect_swapped(m_favorites_button->get_button(), "toggled", SLOT_CALLBACK(Menu::favorites_toggled), this);
+ g_signal_connect(m_favorites_button->get_button(), "toggled", G_CALLBACK(Menu::favorites_toggled_slot), this);
// Create recent
m_recent = new RecentPage(settings, this);
m_recent_button = new SectionButton("document-open-recent", _("Recently Used"));
m_recent_button->set_group(m_favorites_button->get_group());
- g_signal_connect_swapped(m_recent_button->get_button(), "toggled", SLOT_CALLBACK(Menu::recent_toggled), this);
+ g_signal_connect(m_recent_button->get_button(), "toggled", G_CALLBACK(Menu::recent_toggled_slot), this);
// Create applications
m_applications = new ApplicationsPage(this);
@@ -442,7 +442,7 @@ void Menu::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_swapped((*i)->get_button(), "toggled", SLOT_CALLBACK(Menu::category_toggled), this);
+ g_signal_connect((*i)->get_button(), "toggled", G_CALLBACK(Menu::category_toggled_slot), this);
}
gtk_widget_show_all(GTK_WIDGET(m_sidebar_box));
@@ -459,7 +459,7 @@ void Menu::set_items()
// Handle switching to favorites are added
GtkTreeModel* favorites_model = m_favorites->get_view()->get_model();
- g_signal_connect_swapped(favorites_model, "row-inserted", SLOT_CALLBACK(Menu::show_favorites), this);
+ g_signal_connect(favorites_model, "row-inserted", G_CALLBACK(Menu::show_favorites_slot), this);
}
//-----------------------------------------------------------------------------
@@ -480,7 +480,7 @@ void Menu::unset_items()
//-----------------------------------------------------------------------------
-gboolean Menu::on_enter_notify_event(GtkWidget*, GdkEventCrossing* event)
+bool Menu::on_enter_notify_event(GdkEventCrossing* event)
{
if ( (event->detail == GDK_NOTIFY_INFERIOR)
|| (event->mode == GDK_CROSSING_GRAB)
@@ -504,7 +504,7 @@ gboolean Menu::on_enter_notify_event(GtkWidget*, GdkEventCrossing* event)
//-----------------------------------------------------------------------------
-gboolean Menu::on_leave_notify_event(GtkWidget*, GdkEventCrossing* event)
+bool Menu::on_leave_notify_event(GdkEventCrossing* event)
{
if ( (event->detail == GDK_NOTIFY_INFERIOR)
|| (event->mode != GDK_CROSSING_NORMAL) )
@@ -530,7 +530,7 @@ gboolean Menu::on_leave_notify_event(GtkWidget*, GdkEventCrossing* event)
//-----------------------------------------------------------------------------
-gboolean Menu::on_button_press_event(GtkWidget*, GdkEventButton* event)
+bool Menu::on_button_press_event(GdkEventButton* event)
{
// Hide menu if user clicks outside
if ((event->x < 0) || (event->x > m_geometry.width) || (event->y < 0) || (event->y > m_geometry.height))
@@ -542,7 +542,7 @@ gboolean Menu::on_button_press_event(GtkWidget*, GdkEventButton* event)
//-----------------------------------------------------------------------------
-gboolean Menu::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
+bool Menu::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)) )
@@ -583,7 +583,7 @@ gboolean Menu::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
//-----------------------------------------------------------------------------
-gboolean Menu::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
+bool Menu::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
{
// Pass unhandled key presses to search entry
GtkWidget* search_entry = GTK_WIDGET(m_search_entry);
@@ -598,7 +598,7 @@ gboolean Menu::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
//-----------------------------------------------------------------------------
-gboolean Menu::on_map_event(GtkWidget*, GdkEventAny*)
+bool Menu::on_map_event()
{
gtk_window_set_keep_above(m_window, true);
@@ -619,7 +619,7 @@ gboolean Menu::on_map_event(GtkWidget*, GdkEventAny*)
//-----------------------------------------------------------------------------
-gboolean Menu::on_configure_event(GtkWidget*, GdkEventConfigure* event)
+bool Menu::on_configure_event(GdkEventConfigure* event)
{
if (event->width && event->height)
{
diff --git a/src/menu.hpp b/src/menu.hpp
index 4959705..a29efa2 100644
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -17,8 +17,6 @@
#ifndef WHISKERMENU_MENU_HPP
#define WHISKERMENU_MENU_HPP
-#include "slot.hpp"
-
#include <map>
#include <string>
#include <vector>
@@ -85,21 +83,21 @@ public:
void unset_items();
private:
- SLOT_2(gboolean, Menu, on_enter_notify_event, GtkWidget*, GdkEventCrossing*);
- SLOT_2(gboolean, Menu, on_leave_notify_event, GtkWidget*, GdkEventCrossing*);
- SLOT_2(gboolean, Menu, on_button_press_event, GtkWidget*, GdkEventButton*);
- SLOT_2(gboolean, Menu, on_key_press_event, GtkWidget*, GdkEventKey*);
- SLOT_2(gboolean, Menu, on_key_press_event_after, GtkWidget*, GdkEventKey*);
- SLOT_2(gboolean, Menu, on_map_event, GtkWidget*, GdkEventAny*);
- SLOT_2(gboolean, Menu, on_configure_event, GtkWidget*, GdkEventConfigure*);
- SLOT_0(void, Menu, favorites_toggled);
- SLOT_0(void, Menu, recent_toggled);
- SLOT_0(void, Menu, category_toggled);
- SLOT_0(void, Menu, show_favorites);
- SLOT_0(void, Menu, search);
- SLOT_0(void, Menu, launch_settings_manager);
- SLOT_0(void, Menu, lock_screen);
- SLOT_0(void, Menu, log_out);
+ bool on_enter_notify_event(GdkEventCrossing* event);
+ bool on_leave_notify_event(GdkEventCrossing* 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);
+ void favorites_toggled();
+ void recent_toggled();
+ void category_toggled();
+ void show_favorites();
+ void search();
+ void launch_settings_manager();
+ void lock_screen();
+ void log_out();
private:
GtkWindow* m_window;
@@ -131,6 +129,83 @@ private:
bool m_layout_left;
bool m_layout_bottom;
bool m_modified;
+
+
+private:
+ static gboolean on_enter_notify_event_slot(GtkWidget*, GdkEventCrossing* event, Menu* obj)
+ {
+ return obj->on_enter_notify_event(event);
+ }
+
+ static gboolean on_leave_notify_event_slot(GtkWidget*, GdkEventCrossing* event, Menu* obj)
+ {
+ return obj->on_leave_notify_event(event);
+ }
+
+ static gboolean on_button_press_event_slot(GtkWidget*, GdkEventButton* event, Menu* obj)
+ {
+ return obj->on_button_press_event(event);
+ }
+
+ static gboolean on_key_press_event_slot(GtkWidget* widget, GdkEventKey* event, Menu* obj)
+ {
+ return obj->on_key_press_event(widget, event);
+ }
+
+ static gboolean on_key_press_event_after_slot(GtkWidget* widget, GdkEventKey* event, Menu* obj)
+ {
+ return obj->on_key_press_event_after(widget, event);
+ }
+
+ static gboolean on_map_event_slot(GtkWidget*, GdkEventAny*, Menu* obj)
+ {
+ return obj->on_map_event();
+ }
+
+ static gboolean on_configure_event_slot(GtkWidget*, GdkEventConfigure* event, Menu* obj)
+ {
+ return obj->on_configure_event(event);
+ }
+
+ static void favorites_toggled_slot(GtkToggleButton*, Menu* obj)
+ {
+ obj->favorites_toggled();
+ }
+
+ static void recent_toggled_slot(GtkToggleButton*, Menu* obj)
+ {
+ obj->recent_toggled();
+ }
+
+ static void category_toggled_slot(GtkToggleButton*, Menu* obj)
+ {
+ obj->category_toggled();
+ }
+
+ static void show_favorites_slot(GtkTreeModel*, GtkTreePath*, GtkTreeIter*, Menu* obj)
+ {
+ obj->show_favorites();
+ }
+
+ static void search_slot(GtkEditable*, Menu* obj)
+ {
+ obj->search();
+ }
+
+ static void launch_settings_manager_slot(GtkButton*, Menu* obj)
+ {
+ obj->launch_settings_manager();
+ }
+
+ static void lock_screen_slot(GtkButton*, Menu* obj)
+ {
+ obj->lock_screen();
+ }
+
+ static void log_out_slot(GtkButton*, Menu* obj)
+ {
+ obj->log_out();
+ }
};
}
diff --git a/src/page.cpp b/src/page.cpp
index 4f0e604..76d0c93 100644
--- a/src/page.cpp
+++ b/src/page.cpp
@@ -38,9 +38,9 @@ Page::Page(Menu* menu) :
{
// Create view
m_view = new LauncherView;
- g_signal_connect(m_view->get_widget(), "button-press-event", SLOT_CALLBACK(Page::view_button_press_event), this);
- g_signal_connect(m_view->get_widget(), "popup-menu", SLOT_CALLBACK(Page::view_popup_menu_event), this);
- g_signal_connect(m_view->get_widget(), "row-activated", SLOT_CALLBACK(Page::launcher_activated), this);
+ 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_swapped(m_view->get_widget(), "start-interactive-search", G_CALLBACK(gtk_widget_grab_focus), m_menu->get_search_entry());
// Add scrolling to view
@@ -48,7 +48,7 @@ Page::Page(Menu* menu) :
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_widget), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_ETCHED_IN);
gtk_container_add(GTK_CONTAINER(m_widget), m_view->get_widget());
- g_signal_connect_swapped(m_widget, "unmap", SLOT_CALLBACK(Page::on_unmap), this);
+ g_signal_connect(m_widget, "unmap", G_CALLBACK(Page::on_unmap_slot), this);
g_object_ref_sink(m_widget);
}
@@ -82,7 +82,7 @@ Launcher* Page::get_selected_launcher() const
//-----------------------------------------------------------------------------
-void Page::launcher_activated(GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn*)
+void Page::launcher_activated(GtkTreeView* view, GtkTreePath* path)
{
GtkTreeIter iter;
GtkTreeModel* model = gtk_tree_view_get_model(view);
@@ -108,7 +108,7 @@ void Page::launcher_activated(GtkTreeView* view, GtkTreePath* path, GtkTreeViewC
//-----------------------------------------------------------------------------
-gboolean Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
+bool Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
{
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
GtkTreeIter iter;
@@ -125,7 +125,7 @@ gboolean Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
//-----------------------------------------------------------------------------
-gboolean Page::view_popup_menu_event(GtkWidget* view)
+bool Page::view_popup_menu_event(GtkWidget* view)
{
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
GtkTreeIter iter;
@@ -167,7 +167,7 @@ void Page::create_context_menu(GtkTreeIter* iter, GdkEventButton* event)
// Create context menu
GtkWidget* menu = gtk_menu_new();
- g_signal_connect(menu, "selection-done", SLOT_CALLBACK(Page::destroy_context_menu), this);
+ g_signal_connect(menu, "selection-done", G_CALLBACK(Page::destroy_context_menu_slot), this);
// Add menu items
GtkWidget* menuitem = gtk_menu_item_new_with_label(launcher->get_display_name());
@@ -182,7 +182,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_swapped(menuitem, "activate", SLOT_CALLBACK(Page::add_selected_to_favorites), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(Page::add_selected_to_favorites_slot), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
else
@@ -190,16 +190,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_swapped(menuitem, "activate", SLOT_CALLBACK(Page::remove_selected_from_favorites), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(Page::remove_selected_from_favorites_slot), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
menuitem = gtk_menu_item_new_with_label(_("Add to Desktop"));
- g_signal_connect_swapped(menuitem, "activate", SLOT_CALLBACK(Page::add_selected_to_desktop), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(Page::add_selected_to_desktop_slot), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label(_("Add to Panel"));
- g_signal_connect_swapped(menuitem, "activate", SLOT_CALLBACK(Page::add_selected_to_panel), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(Page::add_selected_to_panel_slot), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
extend_context_menu(menu);
diff --git a/src/page.hpp b/src/page.hpp
index 96d109d..93297ec 100644
--- a/src/page.hpp
+++ b/src/page.hpp
@@ -17,8 +17,6 @@
#ifndef WHISKERMENU_PAGE_HPP
#define WHISKERMENU_PAGE_HPP
-#include "slot.hpp"
-
extern "C"
{
#include <gtk/gtk.h>
@@ -55,17 +53,15 @@ protected:
}
private:
- SLOT_3(void, Page, launcher_activated, GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*);
- SLOT_2(gboolean, Page, view_button_press_event, GtkWidget*, GdkEventButton*);
- SLOT_1(gboolean, Page, view_popup_menu_event, GtkWidget*);
- SLOT_0(void, Page, on_unmap);
- SLOT_1(void, Page, destroy_context_menu, GtkMenuShell*);
- SLOT_0(void, Page, add_selected_to_desktop);
- SLOT_0(void, Page, add_selected_to_panel);
- SLOT_0(void, Page, add_selected_to_favorites);
- SLOT_0(void, Page, remove_selected_from_favorites);
-
-private:
+ void launcher_activated(GtkTreeView* view, GtkTreePath* path);
+ bool view_button_press_event(GtkWidget* view, GdkEventButton* event);
+ bool view_popup_menu_event(GtkWidget* view);
+ void on_unmap();
+ void destroy_context_menu(GtkMenuShell* menu);
+ void add_selected_to_desktop();
+ void add_selected_to_panel();
+ void add_selected_to_favorites();
+ void remove_selected_from_favorites();
Launcher* get_selected_launcher() const;
void create_context_menu(GtkTreeIter* iter, GdkEventButton* event);
virtual void extend_context_menu(GtkWidget* menu);
@@ -76,6 +72,53 @@ 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 on_unmap_slot(GtkWidget*, Page* obj)
+ {
+ obj->on_unmap();
+ }
+
+ 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/src/panel_plugin.cpp b/src/panel_plugin.cpp
index add8f70..91bed49 100644
--- a/src/panel_plugin.cpp
+++ b/src/panel_plugin.cpp
@@ -74,7 +74,7 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
{
m_menu = new Menu(NULL);
}
- g_signal_connect_swapped(m_menu->get_widget(), "unmap", SLOT_CALLBACK(PanelPlugin::menu_hidden), this);
+ g_signal_connect(m_menu->get_widget(), "unmap", G_CALLBACK(PanelPlugin::menu_hidden_slot), this);
// Prevent empty panel button
if (!m_button_icon_visible)
@@ -92,7 +92,7 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
// 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", SLOT_CALLBACK(PanelPlugin::button_clicked), this);
+ g_signal_connect(m_button, "button-press-event", G_CALLBACK(PanelPlugin::button_clicked_slot), this);
gtk_widget_show(m_button);
m_button_box = GTK_BOX(gtk_hbox_new(false, 1));
@@ -119,15 +119,15 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
// Connect plugin signals to functions
g_signal_connect(plugin, "free-data", G_CALLBACK(whiskermenu_free), this);
- g_signal_connect_swapped(plugin, "configure-plugin", SLOT_CALLBACK(PanelPlugin::configure), this);
+ g_signal_connect(plugin, "configure-plugin", G_CALLBACK(PanelPlugin::configure_slot), this);
#if (LIBXFCE4PANEL_CHECK_VERSION(4,10,0))
g_signal_connect(plugin, "mode-changed", G_CALLBACK(PanelPlugin::mode_changed_slot), this);
#else
g_signal_connect(plugin, "orientation-changed", G_CALLBACK(PanelPlugin::orientation_changed_slot), this);
#endif
- g_signal_connect(plugin, "remote-event", SLOT_CALLBACK(PanelPlugin::remote_event), this);
- g_signal_connect_swapped(plugin, "save", SLOT_CALLBACK(PanelPlugin::save), this);
- g_signal_connect(plugin, "size-changed", SLOT_CALLBACK(PanelPlugin::size_changed), this);
+ g_signal_connect(plugin, "remote-event", G_CALLBACK(PanelPlugin::remote_event_slot), this);
+ g_signal_connect_swapped(plugin, "save", G_CALLBACK(PanelPlugin::save_slot), this);
+ g_signal_connect(plugin, "size-changed", G_CALLBACK(PanelPlugin::size_changed_slot), this);
xfce_panel_plugin_menu_show_configure(plugin);
}
@@ -182,7 +182,7 @@ void PanelPlugin::set_button_style(ButtonStyle style)
gtk_widget_hide(GTK_WIDGET(m_button_label));
}
- size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+ size_changed(xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
@@ -191,7 +191,7 @@ void PanelPlugin::set_button_title(const std::string& title)
{
m_button_title = title;
gtk_label_set_label(m_button_label, m_button_title.c_str());
- size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+ size_changed(xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
@@ -200,7 +200,7 @@ void PanelPlugin::set_button_icon_name(const std::string& icon)
{
m_button_icon_name = icon;
xfce_panel_image_set_from_source(m_button_icon, icon.c_str());
- size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+ size_changed(xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
@@ -219,7 +219,7 @@ void PanelPlugin::set_configure_enabled(bool enabled)
//-----------------------------------------------------------------------------
-gboolean PanelPlugin::button_clicked(GtkWidget*, GdkEventButton* event)
+bool PanelPlugin::button_clicked(GdkEventButton* event)
{
if (event->button != 1 || event->state & GDK_CONTROL_MASK)
{
@@ -255,7 +255,7 @@ void PanelPlugin::menu_hidden()
void PanelPlugin::configure()
{
ConfigurationDialog* dialog = new ConfigurationDialog(this);
- g_signal_connect_swapped(dialog->get_widget(), "destroy", SLOT_CALLBACK(PanelPlugin::save), this);
+ g_signal_connect_swapped(dialog->get_widget(), "destroy", G_CALLBACK(PanelPlugin::save_slot), this);
}
//-----------------------------------------------------------------------------
@@ -264,12 +264,12 @@ void PanelPlugin::orientation_changed(bool vertical)
{
gtk_label_set_angle(m_button_label, vertical ? 270: 0);
- size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+ size_changed(xfce_panel_plugin_get_size(m_plugin));
}
//-----------------------------------------------------------------------------
-gboolean PanelPlugin::remote_event(XfcePanelPlugin*, gchar* name, GValue* value)
+bool PanelPlugin::remote_event(gchar* name, GValue* value)
{
if (strcmp(name, "popup"))
{
@@ -316,7 +316,7 @@ void PanelPlugin::save()
//-----------------------------------------------------------------------------
-gboolean PanelPlugin::size_changed(XfcePanelPlugin*, gint size)
+bool PanelPlugin::size_changed(int size)
{
#if (LIBXFCE4PANEL_CHECK_VERSION(4,10,0))
gint row_size = size / xfce_panel_plugin_get_nrows(m_plugin);
diff --git a/src/panel_plugin.hpp b/src/panel_plugin.hpp
index 8112bb9..ce0df66 100644
--- a/src/panel_plugin.hpp
+++ b/src/panel_plugin.hpp
@@ -17,8 +17,6 @@
#ifndef WHISKERMENU_PANEL_PLUGIN_HPP
#define WHISKERMENU_PANEL_PLUGIN_HPP
-#include "slot.hpp"
-
#include <string>
extern "C"
@@ -74,27 +72,12 @@ public:
void set_configure_enabled(bool enabled);
private:
- SLOT_2(gboolean, PanelPlugin, button_clicked, GtkWidget*, GdkEventButton*);
- SLOT_0(void, PanelPlugin, menu_hidden);
- SLOT_0(void, PanelPlugin, configure);
- SLOT_3(gboolean, PanelPlugin, remote_event, XfcePanelPlugin*, gchar*, GValue*);
- SLOT_0(void, PanelPlugin, save);
- SLOT_2(gboolean, PanelPlugin, size_changed, XfcePanelPlugin*, gint);
-
-private:
-#if (LIBXFCE4PANEL_CHECK_VERSION(4,10,0))
- static void mode_changed_slot(XfcePanelPlugin*, XfcePanelPluginMode mode, PanelPlugin* obj)
- {
- obj->orientation_changed(mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL);
- }
-#else
- static void orientation_changed_slot(XfcePanelPlugin*, GtkOrientation orientation, PanelPlugin* obj)
- {
- obj->orientation_changed(orientation == GTK_ORIENTATION_VERTICAL);
- }
-#endif
-
-private:
+ bool button_clicked(GdkEventButton* event);
+ void menu_hidden();
+ void configure();
+ bool remote_event(gchar* name, GValue* value);
+ void save();
+ bool size_changed(int size);
void orientation_changed(bool vertical);
void popup_menu(bool at_cursor);
@@ -111,6 +94,50 @@ private:
GtkBox* m_button_box;
GtkLabel* m_button_label;
XfcePanelImage* m_button_icon;
+
+
+private:
+ static gboolean button_clicked_slot(GtkWidget*, GdkEventButton* event, PanelPlugin* obj)
+ {
+ return obj->button_clicked(event);
+ }
+
+ static void menu_hidden_slot(GtkWidget*, PanelPlugin* obj)
+ {
+ obj->menu_hidden();
+ }
+
+ static void configure_slot(XfcePanelPlugin*, PanelPlugin* obj)
+ {
+ obj->configure();
+ }
+
+ static gboolean remote_event_slot(XfcePanelPlugin*, gchar* name, GValue* value, PanelPlugin* obj)
+ {
+ return obj->remote_event(name, value);
+ }
+
+ static void save_slot(PanelPlugin* obj)
+ {
+ obj->save();
+ }
+
+ static gboolean size_changed_slot(XfcePanelPlugin*, gint size, PanelPlugin* obj)
+ {
+ return obj->size_changed(size);
+ }
+
+#if (LIBXFCE4PANEL_CHECK_VERSION(4,10,0))
+ static void mode_changed_slot(XfcePanelPlugin*, XfcePanelPluginMode mode, PanelPlugin* obj)
+ {
+ obj->orientation_changed(mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL);
+ }
+#else
+ static void orientation_changed_slot(XfcePanelPlugin*, GtkOrientation orientation, PanelPlugin* obj)
+ {
+ obj->orientation_changed(orientation == GTK_ORIENTATION_VERTICAL);
+ }
+#endif
};
}
diff --git a/src/recent_page.cpp b/src/recent_page.cpp
index bc312cd..71a2fd2 100644
--- a/src/recent_page.cpp
+++ b/src/recent_page.cpp
@@ -70,13 +70,13 @@ 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", SLOT_CALLBACK(RecentPage::clear_menu), this);
+ g_signal_connect(menuitem, "activate", G_CALLBACK(RecentPage::clear_menu_slot), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
//-----------------------------------------------------------------------------
-void RecentPage::clear_menu(GtkMenuItem*)
+void RecentPage::clear_menu()
{
LauncherModel model(GTK_LIST_STORE(get_view()->get_model()));
for (size_t i = 0, count = size(); i < count; ++i)
diff --git a/src/recent_page.hpp b/src/recent_page.hpp
index 32b75d6..1ec588a 100644
--- a/src/recent_page.hpp
+++ b/src/recent_page.hpp
@@ -19,8 +19,6 @@
#include "list_page.hpp"
-#include "slot.hpp"
-
namespace WhiskerMenu
{
@@ -36,12 +34,17 @@ public:
private:
void extend_context_menu(GtkWidget* menu);
+ void clear_menu();
private:
- SLOT_1(void, RecentPage, clear_menu, GtkMenuItem*);
+ size_t m_max_items;
+
private:
- size_t m_max_items;
+ static void clear_menu_slot(GtkMenuItem*, RecentPage* obj)
+ {
+ obj->clear_menu();
+ }
};
}
diff --git a/src/resizer_widget.cpp b/src/resizer_widget.cpp
index 3ee3ca1..3cdf2f2 100644
--- a/src/resizer_widget.cpp
+++ b/src/resizer_widget.cpp
@@ -32,10 +32,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", SLOT_CALLBACK(ResizerWidget::on_button_press_event), this);
- g_signal_connect(m_drawing, "enter-notify-event", SLOT_CALLBACK(ResizerWidget::on_enter_notify_event), this);
- g_signal_connect(m_drawing, "leave-notify-event", SLOT_CALLBACK(ResizerWidget::on_leave_notify_event), this);
- g_signal_connect(m_drawing, "expose-event", SLOT_CALLBACK(ResizerWidget::on_expose_event), this);
+ 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);
set_corner(TopRight);
}
@@ -98,7 +98,7 @@ void ResizerWidget::set_corner(Corner corner)
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_button_press_event(GtkWidget*, GdkEventButton* event)
+bool ResizerWidget::on_button_press_event(GdkEventButton* event)
{
gtk_window_begin_resize_drag(m_window,
m_edge,
@@ -111,7 +111,7 @@ gboolean ResizerWidget::on_button_press_event(GtkWidget*, GdkEventButton* event)
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEventCrossing*)
+bool ResizerWidget::on_enter_notify_event(GtkWidget* widget)
{
gtk_widget_set_state(widget, GTK_STATE_PRELIGHT);
GdkWindow* window = gtk_widget_get_window(widget);
@@ -121,7 +121,7 @@ gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEventCrossin
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEventCrossing*)
+bool ResizerWidget::on_leave_notify_event(GtkWidget* widget)
{
gtk_widget_set_state(widget, GTK_STATE_NORMAL);
GdkWindow* window = gtk_widget_get_window(widget);
@@ -131,7 +131,7 @@ gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEventCrossin
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_expose_event(GtkWidget* widget, GdkEventExpose*)
+bool ResizerWidget::on_expose_event(GtkWidget* widget)
{
cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
diff --git a/src/resizer_widget.hpp b/src/resizer_widget.hpp
index e5d9175..91b6406 100644
--- a/src/resizer_widget.hpp
+++ b/src/resizer_widget.hpp
@@ -17,8 +17,6 @@
#ifndef WHISKERMENU_RESIZER_WIDGET_HPP
#define WHISKERMENU_RESIZER_WIDGET_HPP
-#include "slot.hpp"
-
#include <vector>
extern "C"
@@ -50,10 +48,10 @@ public:
void set_corner(Corner corner);
private:
- SLOT_2(gboolean, ResizerWidget, on_button_press_event, GtkWidget*, GdkEventButton*);
- SLOT_2(gboolean, ResizerWidget, on_enter_notify_event, GtkWidget*, GdkEventCrossing*);
- SLOT_2(gboolean, ResizerWidget, on_leave_notify_event, GtkWidget*, GdkEventCrossing*);
- SLOT_2(gboolean, ResizerWidget, on_expose_event, GtkWidget*, GdkEventExpose*);
+ 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);
private:
GtkWindow* m_window;
@@ -62,6 +60,28 @@ 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/src/search_page.cpp b/src/search_page.cpp
index 98d1ae3..296660b 100644
--- a/src/search_page.cpp
+++ b/src/search_page.cpp
@@ -36,8 +36,8 @@ SearchPage::SearchPage(Menu* menu) :
{
get_view()->set_selection_mode(GTK_SELECTION_BROWSE);
- g_signal_connect(menu->get_search_entry(), "icon-release", SLOT_CALLBACK(SearchPage::clear_search), this);
- g_signal_connect(menu->get_search_entry(), "key-press-event", SLOT_CALLBACK(SearchPage::search_entry_key_press), this);
+ g_signal_connect(menu->get_search_entry(), "icon-release", G_CALLBACK(SearchPage::clear_search_slot), this);
+ g_signal_connect(menu->get_search_entry(), "key-press-event", G_CALLBACK(SearchPage::search_entry_key_press_slot), this);
}
//-----------------------------------------------------------------------------
@@ -168,17 +168,17 @@ void SearchPage::unset_search_model()
//-----------------------------------------------------------------------------
-void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*)
+void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos)
{
if (icon_pos == GTK_ENTRY_ICON_SECONDARY)
{
- gtk_entry_set_text(GTK_ENTRY(entry), "");
+ gtk_entry_set_text(entry, "");
}
}
//-----------------------------------------------------------------------------
-gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEventKey* event)
+bool SearchPage::search_entry_key_press(GtkWidget* widget, GdkEventKey* event)
{
if (event->keyval == GDK_Escape)
{
diff --git a/src/search_page.hpp b/src/search_page.hpp
index e12e677..cd805b9 100644
--- a/src/search_page.hpp
+++ b/src/search_page.hpp
@@ -19,7 +19,6 @@
#include "filter_page.hpp"
#include "query.hpp"
-#include "slot.hpp"
#include <string>
#include <vector>
@@ -40,10 +39,8 @@ public:
void unset_menu_items();
private:
- SLOT_3(void, SearchPage, clear_search, GtkEntry*, GtkEntryIconPosition, GdkEvent*);
- SLOT_2(gboolean, SearchPage, search_entry_key_press, GtkWidget*, GdkEventKey*);
-
-private:
+ void clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos);
+ bool search_entry_key_press(GtkWidget* widget, GdkEventKey* event);
bool on_filter(GtkTreeModel* model, GtkTreeIter* iter);
static gint on_sort(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, SearchPage* page);
void unset_search_model();
@@ -52,6 +49,18 @@ private:
Query m_query;
GtkTreeModelSort* m_sort_model;
std::vector<Launcher*> m_launchers;
+
+
+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/src/slot.hpp b/src/slot.hpp
deleted file mode 100644
index 4ce34fc..0000000
--- a/src/slot.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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_HPP
-#define WHISKERMENU_SLOT_HPP
-
-extern "C"
-{
-#include <glib-object.h>
-}
-
-#define SLOT_CALLBACK(klassmember) G_CALLBACK(klassmember ## _slot)
-
-#define SLOT_0(R, klass, member) \
- static R member ## _slot(klass* obj) \
- { return obj->member(); } \
- R member()
-
-#define SLOT_1(R, klass, member, T1) \
- static R member ## _slot(T1 arg1, klass* obj) \
- { return obj->member(arg1); } \
- R member(T1)
-
-#define SLOT_2(R, klass, member, T1, T2) \
- static R member ## _slot(T1 arg1, T2 arg2, klass* obj) \
- { return obj->member(arg1, arg2); } \
- R member(T1, T2)
-
-#define SLOT_3(R, klass, member, T1, T2, T3) \
- static R member ## _slot(T1 arg1, T2 arg2, T3 arg3, klass* obj) \
- { return obj->member(arg1, arg2, arg3); } \
- R member(T1, T2, T3)
-
-#define SLOT_4(R, klass, member, T1, T2, T3, T4) \
- static R member ## _slot(T1 arg1, T2 arg2, T3 arg3, T4 arg4, klass* obj) \
- { return obj->member(arg1, arg2, arg3, arg4); } \
- R member(T1, T2, T3, T4)
-
-#define SLOT_5(R, klass, member, T1, T2, T3, T4, T5) \
- static R member ## _slot(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, klass* obj) \
- { return obj->member(arg1, arg2, arg3, arg4, arg5); } \
- R member(T1, T2, T3, T4, T5)
-
-#endif // WHISKERMENU_SLOT_HPP
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list