summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2008-03-02 15:14:24 -0500
committerDana Jansens <danakj@orodu.net>2008-03-02 15:14:24 -0500
commit722a712b8c8884cab44bedcb53fa3e13f4c29edc (patch)
tree1f3cdf5cab9ad3628d375a09a8323e51b89a0fa5 /openbox
parentc70379fa8f771e499a4d47e84af06d71838b780d (diff)
show prompts when printing error messages
Diffstat (limited to 'openbox')
-rw-r--r--openbox/debug.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbox/debug.c b/openbox/debug.c
index 42644868..04a95820 100644
--- a/openbox/debug.c
+++ b/openbox/debug.c
@@ -17,6 +17,8 @@
*/
#include "debug.h"
+#include "prompt.h"
+#include "openbox.h"
#include "gettext.h"
#include "obt/paths.h"
@@ -35,9 +37,12 @@ static FILE *log_file = NULL;
static guint rr_handler_id = 0;
static guint obt_handler_id = 0;
static guint ob_handler_id = 0;
+static guint ob_handler_prompt_id = 0;
static void log_handler(const gchar *log_domain, GLogLevelFlags log_level,
const gchar *message, gpointer user_data);
+static void prompt_handler(const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer user_data);
void ob_debug_startup(void)
{
@@ -67,6 +72,9 @@ void ob_debug_startup(void)
ob_handler_id =
g_log_set_handler("Openbox", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, log_handler, NULL);
+ ob_handler_prompt_id =
+ g_log_set_handler("Openbox", G_LOG_LEVEL_MASK & ~G_LOG_LEVEL_DEBUG,
+ prompt_handler, NULL);
obt_paths_unref(p);
g_free(dir);
@@ -77,6 +85,7 @@ void ob_debug_shutdown(void)
g_log_remove_handler("ObRender", rr_handler_id);
g_log_remove_handler("Obt", obt_handler_id);
g_log_remove_handler("Openbox", ob_handler_id);
+ g_log_remove_handler("Openbox", ob_handler_prompt_id);
if (log_file) {
fclose(log_file);
@@ -122,6 +131,13 @@ static void log_handler(const gchar *log_domain, GLogLevelFlags log_level,
if (log_file) log_print(log_file, log_domain, level, message);
}
+static void prompt_handler(const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer data)
+{
+ if (ob_state() == OB_STATE_RUNNING)
+ prompt_show_message(message, _("Close"));
+}
+
static inline void log_argv(ObDebugType type,
const gchar *format, va_list args)
{