File: gswitchit_util.c

package info (click to toggle)
control-center 1%3A2.8.2-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,208 kB
  • ctags: 3,408
  • sloc: ansic: 37,294; sh: 10,539; makefile: 844; xml: 18
file content (72 lines) | stat: -rw-r--r-- 2,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 *  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 Library 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 "config.h"

#include <gnome.h>
#include <libgnomeui/gnome-help.h>

#include "gswitchit_util.h"

#include "libxklavier/xklavier.h"

void
GSwitchItHelp (GtkWidget * appWidget, const gchar * bookmark)
{
	GError *error = NULL;

	gnome_help_display_on_screen ("gswitchit", bookmark,
				    gtk_widget_get_screen (appWidget),
				    &error);

	if (error != NULL) {
		GtkWidget *dialog = gtk_message_dialog_new (NULL,
							    GTK_DIALOG_DESTROY_WITH_PARENT,
							    GTK_MESSAGE_ERROR,
							    GTK_BUTTONS_CLOSE,
							    _
							    ("There was an error displaying help: %s"),
							    error->
							    message);

		g_signal_connect (G_OBJECT (dialog),
				  "response",
				  G_CALLBACK (gtk_widget_destroy), NULL);

		gtk_window_set_screen (GTK_WINDOW (dialog),
				       gtk_widget_get_screen (appWidget));
		gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);

		gtk_widget_show (dialog);
		g_error_free (error);
	}
}

static void
GSwitchItLogAppender (const char file[], const char function[],
		      int level, const char format[], va_list args)
{
	time_t now = time (NULL);
	g_log (NULL, G_LOG_LEVEL_DEBUG, "[%08ld,%03d,%s:%s/] \t",
	       (long)now, level, file, function);
	g_logv (NULL, G_LOG_LEVEL_DEBUG, format, args);
}

void
GSwitchItInstallGlibLogAppender (void)
{
	XklSetLogAppender (GSwitchItLogAppender);
}