[Goodies-commits] r5719 - xfce4-power-manager/trunk/src
Ali Abdallah
aliov at xfce.org
Mon Oct 20 16:33:19 CEST 2008
Author: aliov
Date: 2008-10-20 14:33:19 +0000 (Mon, 20 Oct 2008)
New Revision: 5719
Added:
xfce4-power-manager/trunk/src/xfpm-popups.c
xfce4-power-manager/trunk/src/xfpm-popups.h
Modified:
xfce4-power-manager/trunk/src/Makefile.am
xfce4-power-manager/trunk/src/xfpm-driver.c
Log:
Added popups messages that doesn't block the main event loop
Modified: xfce4-power-manager/trunk/src/Makefile.am
===================================================================
--- xfce4-power-manager/trunk/src/Makefile.am 2008-10-20 13:59:32 UTC (rev 5718)
+++ xfce4-power-manager/trunk/src/Makefile.am 2008-10-20 14:33:19 UTC (rev 5719)
@@ -33,7 +33,7 @@
xfce4_power_manager_SOURCES = $(generated_files) \
xfpm-main.c \
xfpm-debug.h \
- xfpm-hal.c \
+ xfpm-hal.c \
xfpm-hal.h \
xfpm-driver.c \
xfpm-driver.h \
@@ -57,6 +57,8 @@
xfpm-dpms.h \
xfpm-dpms-spins.c \
xfpm-dpms-spins.h \
+ xfpm-popups.c \
+ xfpm-popups.h \
xfpm-notify.c \
xfpm-notify.h \
xfpm-enums.h \
Modified: xfce4-power-manager/trunk/src/xfpm-driver.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-driver.c 2008-10-20 13:59:32 UTC (rev 5718)
+++ xfce4-power-manager/trunk/src/xfpm-driver.c 2008-10-20 14:33:19 UTC (rev 5719)
@@ -61,7 +61,7 @@
#include "xfpm-ac-adapter.h"
#include "xfpm-button.h"
#include "xfpm-lcd-brightness.h"
-#include "xfpm-notify.h"
+#include "xfpm-popups.h"
#include "xfpm-enum-types.h"
#include "xfpm-settings.h"
#include "xfpm-dbus-messages.h"
@@ -279,15 +279,15 @@
XfpmDriverPrivate *priv;
priv = XFPM_DRIVER_GET_PRIVATE(drv);
-#ifdef HAVE_LIBNOTIFY
+ const gchar *error;
+ error = _("Unable to get adapter status, the power manager will not work properly. "\
+ "Possible reasons: ac adapter driver is not loaded into the kernel "\
+ "broken connection with the hardware abstract layer or the message bus daemon is not running");
if ( !state_ok && priv->formfactor == SYSTEM_LAPTOP )
{
+#ifdef HAVE_LIBNOTIFY
gboolean visible;
g_object_get(G_OBJECT(priv->adapter),"visible",&visible,NULL);
- const gchar *error;
- error = _("Unable to get adapter status, the power manager will not work properly. "\
- "Possible reasons: ac adapter driver is not loaded into the kernel "\
- "broken connection with the hardware abstract layer or the message bus daemon is not running");
if ( visible )
{
@@ -304,8 +304,11 @@
{
xfpm_battery_show_error(priv->batt,"gpm-ac-adapter",error);
}
+#else
+ xfpm_popup_message(_("Xfce4 power manager"),error,GTK_MESSAGE_ERROR);
+#endif
}
-#endif
+
XFPM_DEBUG("start \n");
priv->ac_adapter_present = present;
Added: xfce4-power-manager/trunk/src/xfpm-popups.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-popups.c (rev 0)
+++ xfce4-power-manager/trunk/src/xfpm-popups.c 2008-10-20 14:33:19 UTC (rev 5719)
@@ -0,0 +1,47 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
+ *
+ * * Copyright (C) 2008 Ali <ali.slackware at gmail.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+void xfpm_popup_message(const gchar *title,
+ const gchar *message,
+ GtkMessageType message_type)
+{
+
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new_with_markup(NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ message_type,
+ GTK_BUTTONS_CLOSE,
+ "<span size='larger'><b>%s</b></span>",
+ title);
+
+ gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),message);
+
+ g_signal_connect(dialog,
+ "response",
+ G_CALLBACK(gtk_widget_destroy),
+ NULL);
+
+ gtk_widget_show(dialog);
+
+}
Added: xfce4-power-manager/trunk/src/xfpm-popups.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-popups.h (rev 0)
+++ xfce4-power-manager/trunk/src/xfpm-popups.h 2008-10-20 14:33:19 UTC (rev 5719)
@@ -0,0 +1,30 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
+ *
+ * * Copyright (C) 2008 Ali <ali.slackware at gmail.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFPM_POPUPS_H
+#define __XFPM_POPUPS_H
+
+void xfpm_popup_message(const gchar *title,
+ const gchar *message,
+ GtkMessageType message_type);
+
+
+#endif /* __XFPM_POPUPS_H */
More information about the Goodies-commits
mailing list