diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-18 15:07:11 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-18 15:07:11 +0200 |
commit | 43fe926f20bd427e96a22081deace10752bb4533 (patch) | |
tree | 64a3a9950ad659ad3ff193df2916d05e31fa085c /src/Applet/CCApplet.cpp | |
parent | 73c3f5fba688d9359dbf79f70b8759aee2857e41 (diff) | |
download | abrt-43fe926f20bd427e96a22081deace10752bb4533.tar.gz abrt-43fe926f20bd427e96a22081deace10752bb4533.tar.xz abrt-43fe926f20bd427e96a22081deace10752bb4533.zip |
abrt-applet: remove dbus-c++ glue. -50k of code
text data bss dec hex filename
70529 2144 1528 74201 121d9 abrt.t0/UNPACKED/usr/bin/abrt-applet
22116 1688 376 24180 5e74 abrt.t1/UNPACKED/usr/bin/abrt-applet
Also, we do not use dbus-c++ anymore, which is 200k of code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Applet/CCApplet.cpp')
-rw-r--r-- | src/Applet/CCApplet.cpp | 102 |
1 files changed, 9 insertions, 93 deletions
diff --git a/src/Applet/CCApplet.cpp b/src/Applet/CCApplet.cpp index 7b1a7f1b..3bd0dbca 100644 --- a/src/Applet/CCApplet.cpp +++ b/src/Applet/CCApplet.cpp @@ -17,31 +17,23 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "abrtlib.h" -#include "CCApplet.h" #include <iostream> #include <cstdarg> #include <sstream> #include <cstdio> -#include <unistd.h> - - - #if HAVE_CONFIG_H #include <config.h> #endif - #if ENABLE_NLS #include <libintl.h> #define _(S) gettext(S) #else #define _(S) (S) #endif +#include "abrtlib.h" +#include "CCApplet.h" - -static const char *DBUS_SERVICE_NAME = "org.freedesktop.DBus"; -static const char *DBUS_SERVICE_PATH = "/org/freedesktop/DBus"; const gchar *CApplet::menu_xml = "<?xml version=\"1.0\"?>\ <interface>\ @@ -118,12 +110,8 @@ You should have received a copy of the GNU General Public License along with thi </object>\ </interface>"; -CApplet::CApplet(DBus::Connection &system, DBus::Connection &session, const char *path, const char *name) -: DBus::ObjectProxy(system, path, name) +CApplet::CApplet() { - m_pSessionDBus = &session; - m_pDaemonWatcher = new DaemonWatcher(system, DBUS_SERVICE_PATH, DBUS_SERVICE_NAME); - m_pDaemonWatcher->ConnectStateChangeHandler(DaemonStateChange_cb, this); m_pStatusIcon = gtk_status_icon_new_from_stock(GTK_STOCK_DIALOG_WARNING); m_bDaemonRunning = true; notify_init("ABRT"); @@ -153,87 +141,17 @@ CApplet::CApplet(DBus::Connection &system, DBus::Connection &session, const char m_pAboutDialog = gtk_builder_get_object(m_pBuilder, "aboutdialog"); m_pmiAbout = gtk_builder_get_object(m_pBuilder, "miAbout"); { - g_signal_connect(m_pmiAbout,"activate",G_CALLBACK(CApplet::onAbout_cb),m_pAboutDialog); + g_signal_connect(m_pmiAbout, "activate", G_CALLBACK(CApplet::onAbout_cb),m_pAboutDialog); } } else { - fprintf(stderr,_("Can't create menu from the description, popup won't be available!\n")); + fprintf(stderr, _("Can't create menu from the description, popup won't be available!\n")); } } CApplet::~CApplet() { - delete m_pDaemonWatcher; -} - -/* dbus related */ -void CApplet::Crash(const std::string& progname, const std::string& uid ) -{ - if (m_pSessionDBus->has_name("com.redhat.abrt.gui")) - { - return; - } - else - { - if (m_pCrashHandler) - { - std::istringstream input_string(uid); - uid_t num; - input_string >> num; - - if (num == getuid()) - m_pCrashHandler(progname.c_str()); - } - else - { - std::cout << _("This is default handler, you should register your own with ConnectCrashHandler") << std::endl; - std::cout.flush(); - } - } -} - -void CApplet::QuotaExceed(const char* str) -{ - if (m_pSessionDBus->has_name("com.redhat.abrt.gui")) - { - return; - } - else - { - if(m_pQuotaExceedHandler) - { - m_pQuotaExceedHandler(str); - } - else - { - std::cout << _("This is default handler, you should register your own with ConnectQuotaExceedHandler") << std::endl; - std::cout.flush(); - } - } -} - -void CApplet::DaemonStateChange_cb(bool running, void* data) -{ - CApplet *applet = (CApplet *)data; - if (!running) - { - applet->Disable(_("ABRT service is not running")); - } - else - { - applet->Enable(_("ABRT service has been started")); - } -} - -void CApplet::ConnectCrashHandler(void (*pCrashHandler)(const char *progname)) -{ - m_pCrashHandler = pCrashHandler; -} - -void CApplet::ConnectQuotaExceedHandler(void (*pQuotaExceedHandler)(const char *progname)) -{ - m_pQuotaExceedHandler = pQuotaExceedHandler; } void CApplet::SetIconTooltip(const char *format, ...) @@ -251,10 +169,8 @@ void CApplet::SetIconTooltip(const char *format, ...) gtk_status_icon_set_tooltip_text(m_pStatusIcon, buf); free(buf); } - else - { - gtk_status_icon_set_tooltip_text(m_pStatusIcon, _("Out of memory")); - } + /* else: out of memory. Let's not do anything, + * or else it may only get worse */ } void CApplet::CrashNotify(const char *format, ...) @@ -270,7 +186,7 @@ void CApplet::CrashNotify(const char *format, ...) va_end(args); notify_notification_update(m_pNotification, _("Warning"), buf, NULL); - if (gtk_status_icon_is_embedded (m_pStatusIcon)) + if (gtk_status_icon_is_embedded(m_pStatusIcon)) notify_notification_show(m_pNotification, &err); if (err != NULL) g_print(err->message); @@ -313,7 +229,7 @@ void CApplet::ShowIcon() { gtk_status_icon_set_visible(m_pStatusIcon, true); //Active wait for icon to be REALLY visible in status area - //while(!gtk_status_icon_is_embedded (m_pStatusIcon)); + //while(!gtk_status_icon_is_embedded(m_pStatusIcon)) continue; } void CApplet::onHide_cb(GtkMenuItem *menuitem, gpointer applet) |