changeset 14396:9e9699792bb9

[gaim-migrate @ 17104] Add option in gntgf to set the URGENT hint for the terminal's window (in X). Unescape the status-string in the statusbox. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 01 Sep 2006 02:07:23 +0000
parents d72cbd259357
children 70f52ff1caec
files configure.ac console/gntblist.c console/libgnt/gntbox.c console/plugins/Makefile.am console/plugins/gntgf.c doc/gntgaim.1.in
diffstat 6 files changed, 66 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Thu Aug 31 22:04:16 2006 +0000
+++ b/configure.ac	Fri Sep 01 02:07:23 2006 +0000
@@ -680,6 +680,11 @@
 	x_incpath_add="-I$x_includes"
 fi
 
+PKG_CHECK_MODULES(X11, x11, 
+	[AC_DEFINE(HAVE_X11, 1, [Define to 1 if you have X11])], [AC_MSG_RESULT(no)])
+AC_SUBST(X11_LIBS)
+AC_SUBST(X11_CFLAGS)
+
 dnl #######################################################################
 dnl # Check for DBUS libraries
 dnl #######################################################################
@@ -823,21 +828,6 @@
 
 if test "x$enable_gtk" = "xyes"; then
 
-AC_PATH_XTRA
-# We can't assume that $x_libraries will be set, because autoconf does not
-# set it in the case when the X libraries are in a standard place.
-# Ditto for $x_includes
-if test X"$x_libraries" = X"" || test X"$x_libraries" = XNONE; then
-	x_libpath_add=
-else
-	x_libpath_add="-L$x_libraries"
-fi
-if test X"$x_includes" = X"" || test X"$x_includes" = XNONE; then
-	x_incpath_add=
-else
-	x_incpath_add="-I$x_includes"
-fi
-
 dnl #######################################################################
 dnl # Check for startup notification
 dnl #######################################################################
--- a/console/gntblist.c	Thu Aug 31 22:04:16 2006 +0000
+++ b/console/gntblist.c	Fri Sep 01 02:07:23 2006 +0000
@@ -127,7 +127,7 @@
 	g_return_if_fail(node != NULL);
 
 	if (list->ui_data == NULL)
-		return;
+		return;   /* XXX: this is probably the place to auto-join chats */
 
 	if (node->ui_data != NULL) {
 		gnt_tree_change_text(GNT_TREE(ggblist->tree), node,
@@ -1417,9 +1417,11 @@
 		StatusBoxItem *item = list->data;
 		if (item->type == STATUS_PRIMITIVE && item->u.prim == prim)
 		{
+			char *mess = gaim_unescape_html(message);
 			gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item);
-			gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), message);
+			gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), mess);
 			gnt_widget_draw(ggblist->status);
+			g_free(mess);
 			break;
 		}
 	}
--- a/console/libgnt/gntbox.c	Thu Aug 31 22:04:16 2006 +0000
+++ b/console/libgnt/gntbox.c	Fri Sep 01 02:07:23 2006 +0000
@@ -67,7 +67,6 @@
 		int pos, right;
 		char *title = g_strdup(box->title);
 		
-		mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width - 2);
 		get_title_thingies(box, title, &pos, &right);
 
 		if (gnt_widget_has_focus(widget))
--- a/console/plugins/Makefile.am	Thu Aug 31 22:04:16 2006 +0000
+++ b/console/plugins/Makefile.am	Fri Sep 01 02:07:23 2006 +0000
@@ -1,4 +1,4 @@
-gntgf_la_LDFLAGS             = -module -avoid-version $(GLIB_LIBS)
+gntgf_la_LDFLAGS             = -module -avoid-version $(GLIB_LIBS) $(X11_LIBS)
 gnthistory_la_LDFLAGS             = -module -avoid-version $(GLIB_LIBS)
 
 if PLUGINS
--- a/console/plugins/gntgf.c	Thu Aug 31 22:04:16 2006 +0000
+++ b/console/plugins/gntgf.c	Fri Sep 01 02:07:23 2006 +0000
@@ -33,6 +33,13 @@
 
 #define MAX_COLS	3
 
+#ifdef HAVE_X11
+#define PREFS_URGENT          PREFS_PREFIX "/urgent"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#endif
+
 #include <glib.h>
 
 #include <plugin.h>
@@ -103,6 +110,35 @@
 	return FALSE;
 }
 
+#ifdef HAVE_X11
+static void
+urgent()
+{
+	/* This is from deryni/tuomov's urgent_test.c */
+	Display *dpy;
+	Window id;
+	const char *ids;
+	XWMHints *hints;
+
+	ids = getenv("WINDOWID");
+	if (ids == NULL)
+		return;
+	
+	id = atoi(ids);
+
+	dpy = XOpenDisplay(NULL);
+	if (dpy == NULL)
+		return;
+
+	hints = XGetWMHints(dpy, id);
+	hints->flags|=XUrgencyHint;
+	XSetWMHints(dpy, id, hints);
+
+	XFlush(dpy);
+	XCloseDisplay(dpy);
+}
+#endif
+
 static void
 notify(const char *fmt, ...)
 {
@@ -114,6 +150,10 @@
 
 	if (gaim_prefs_get_bool(PREFS_BEEP))
 		beep();
+#ifdef HAVE_X11
+	if (gaim_prefs_get_bool(PREFS_URGENT))
+		urgent();
+#endif
 
 	window = gnt_vbox_new(FALSE);
 	GNT_WIDGET_SET_FLAGS(window, GNT_WIDGET_TRANSIENT);
@@ -254,9 +294,9 @@
 }
 
 static void
-beep_toggled(GntCheckBox *check, gpointer null)
+toggle_option(GntCheckBox *check, gpointer str)
 {
-	gaim_prefs_set_bool(PREFS_BEEP, gnt_check_box_get_checked(check));
+	gaim_prefs_set_bool(str, gnt_check_box_get_checked(check));
 }
 
 static GntWidget *
@@ -288,9 +328,16 @@
 
 	check = gnt_check_box_new(_("Beep too!"));
 	gnt_check_box_set_checked(GNT_CHECK_BOX(check), gaim_prefs_get_bool(PREFS_BEEP));
-	g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(beep_toggled), NULL);
+	g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(toggle_option), PREFS_BEEP);
 	gnt_box_add_widget(GNT_BOX(window), check);
 
+#ifdef HAVE_X11
+	check = gnt_check_box_new(_("Set URGENT for the terminal window."));
+	gnt_check_box_set_checked(GNT_CHECK_BOX(check), gaim_prefs_get_bool(PREFS_URGENT));
+	g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(toggle_option), PREFS_URGENT);
+	gnt_box_add_widget(GNT_BOX(window), check);
+#endif
+
 	return window;
 }
 
@@ -335,6 +382,9 @@
 	gaim_prefs_add_bool(PREFS_EVENT_CHAT_NICK, TRUE);
 
 	gaim_prefs_add_bool(PREFS_BEEP, TRUE);
+#ifdef HAVE_X11
+	gaim_prefs_add_bool(PREFS_URGENT, TRUE);
+#endif
 }
 
 GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info)
--- a/doc/gntgaim.1.in	Thu Aug 31 22:04:16 2006 +0000
+++ b/doc/gntgaim.1.in	Fri Sep 01 02:07:23 2006 +0000
@@ -96,6 +96,9 @@
 .TP
 .B Alt \+ l
 Refresh the windows. This is useful after resizing the terminal window.
+.TP
+.B Alt \+ 1 2 ... 0
+Jump to the 1st, 2nd ... 10th window.
 
 .SH FILES
 \fI~/.gntrc\fR: configuration file for gnt applications.