[Xfce4-commits] [panel-plugins/xfce4-hardware-monitor-plugin] 38/96: You dont need to use void pointers to pass Applet* in a gcallback
noreply at xfce.org
noreply at xfce.org
Thu Nov 27 22:20:43 CET 2014
This is an automated email from the git hooks/post-receive script.
nick pushed a commit to branch master
in repository panel-plugins/xfce4-hardware-monitor-plugin.
commit b23fc3d8e5a362bae7d7bb37a49b34e3fee7fb5d
Author: Omega Weapon <OmegaPhil at gmail.com>
Date: Mon Nov 4 20:59:05 2013 +0000
You dont need to use void pointers to pass Applet* in a gcallback
---
src/applet.cpp | 21 ++++++++++-----------
src/applet.hpp | 10 ++++++----
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/applet.cpp b/src/applet.cpp
index 5cd63c0..e88d555 100644
--- a/src/applet.cpp
+++ b/src/applet.cpp
@@ -86,28 +86,27 @@ void applet_free(XfcePanelPlugin*, Applet* applet)
}
// Helpers for popping up the various things
-void display_preferences(void *applet)
+void display_preferences(Applet *applet)
{
- static_cast<Applet *>(applet)->on_preferences_activated();
+ applet->on_preferences_activated();
}
-void display_help(void *applet)
+void display_help(Applet *applet)
{
- static_cast<Applet *>(applet)->on_help_activated();
+ applet->on_help_activated();
}
-void display_about(void *applet)
+void display_about(Applet *applet)
{
- static_cast<Applet *>(applet)->on_about_activated();
+ applet->on_about_activated();
}
/* Function declared here as its a callback for a C signal, so cant be a
* method */
-void save_monitors(void *applet)
+void save_monitors(Applet *applet)
{
// Getting at applet/plugin objects
- Applet *tmp_applet = static_cast<Applet*>(applet);
- XfcePanelPlugin *panel_applet = tmp_applet->panel_applet;
+ XfcePanelPlugin *panel_applet = applet->panel_applet;
// Search for a writeable settings file, create one if it doesnt exist
gchar* file = xfce_panel_plugin_save_location(panel_applet, true);
@@ -119,8 +118,8 @@ void save_monitors(void *applet)
g_free(file);
// Looping for all monitors and calling save on each
- for (monitor_iter i = tmp_applet->monitors.begin(),
- end = tmp_applet->monitors.end(); i != end; ++i)
+ for (monitor_iter i = applet->monitors.begin(),
+ end = applet->monitors.end(); i != end; ++i)
(*i)->save(settings);
// Close settings file
diff --git a/src/applet.hpp b/src/applet.hpp
index 74eef2d..7eaa05b 100644
--- a/src/applet.hpp
+++ b/src/applet.hpp
@@ -116,10 +116,12 @@ private:
std::auto_ptr<PreferencesWindow> preferences_window;
Gtk::Tooltips tooltips;
- friend void display_preferences(void *applet);
- friend void display_help(void *applet);
- friend void display_about(void *applet);
- friend void save_monitors(void *applet);
+ friend void display_preferences(Applet *applet);
+ friend void display_help(Applet *applet);
+ friend void display_about(Applet *applet);
+ friend void save_monitors(Applet *applet);
+ friend gboolean size_changed(XfcePanelPlugin* plugin, gint size,
+ Applet* applet);
};
#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list