cpw.attention_ui: ee7b5c37: Added plugin to vibrate conversation win...
malu at pidgin.im
malu at pidgin.im
Thu Nov 6 13:50:33 EST 2008
-----------------------------------------------------------------
Revision: ee7b5c371117a927ab642147d60b47e118e56db4
Ancestor: 511a35afab8f8326628967cd9bc470decc2261d3
Author: malu at pidgin.im
Date: 2008-11-06T18:48:04
Branch: im.pidgin.cpw.attention_ui
URL: http://d.pidgin.im/viewmtn/revision/info/ee7b5c371117a927ab642147d60b47e118e56db4
Added files:
pidgin/plugins/vibes.c
Modified files:
pidgin/plugins/Makefile.am
ChangeLog:
Added plugin to vibrate conversation window on attentions.
Currently doesn't have any configuration and may need some polishing...
-------------- next part --------------
============================================================
--- pidgin/plugins/vibes.c 4d79130695b77f7f8af87eed6c15e69543044d7f
+++ pidgin/plugins/vibes.c 4d79130695b77f7f8af87eed6c15e69543044d7f
@@ -0,0 +1,151 @@
+/***************************************************************************
+ * vibes.c
+ *
+ * Thu Oct 30 23:32:34 2008
+ * Copyright 2008 marcus
+ * <ml at update.uu.se>
+ ****************************************************************************/
+
+/*
+ * 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "internal.h"
+
+#include "version.h"
+
+#include "pidgin.h"
+
+#include "gtkconv.h"
+#include "gtkplugin.h"
+#include "debug.h"
+
+static void
+move_window_sync(GtkWindow *win, guint x, guint y)
+{
+ GdkDisplay *disp = gdk_display_get_default();
+ gtk_window_move(win, x, y);
+ /* synchronize display */
+ gdk_error_trap_pop();
+ gdk_display_sync(disp);
+}
+
+static void
+vibrate_conv_window(PurpleConversation *conv)
+{
+ PidginConversation *pconv = PIDGIN_CONVERSATION(conv);
+ PidginWindow *pwin = pidgin_conv_get_window(pconv);
+ GtkWindow *win = pwin->window;
+ int x, y, i;
+
+ gtk_window_get_position(win, &x, &y);
+
+ for (i = 0 ; i < 20 ; i++) {
+ move_window_sync(win, x, y + 10);
+ usleep(10);
+ move_window_sync(win, x, y - 10);
+ usleep(10);
+ move_window_sync(win, x - 10, y);
+ usleep(10);
+ move_window_sync(win, x, y);
+ usleep(10);
+ }
+}
+
+static void
+sent_attention_cb(PurpleAccount *account, const char *who,
+ PurpleConversation *conv, guint type)
+{
+ purple_debug_info("vibes", "sent_attention_cb called\n");
+ vibrate_conv_window(conv);
+}
+
+static void
+got_attention_cb(PurpleAccount *account, const char *who,
+ PurpleConversation *conv, guint type)
+{
+ purple_debug_info("vibes", "got_attention_cb called\n");
+ vibrate_conv_window(conv);
+}
+
+static gboolean
+plugin_load(PurplePlugin *plugin)
+{
+ purple_signal_connect(purple_conversations_get_handle(),
+ "sent-attention", plugin,
+ PURPLE_CALLBACK(sent_attention_cb), NULL);
+ purple_signal_connect(purple_conversations_get_handle(),
+ "got-attention", plugin,
+ PURPLE_CALLBACK(got_attention_cb), NULL);
+ return TRUE;
+}
+
+static gboolean
+plugin_unload(PurplePlugin *plugin)
+{
+ purple_signal_disconnect(purple_conversations_get_handle(),
+ "sent-attention", plugin, PURPLE_CALLBACK(sent_attention_cb));
+ purple_signal_disconnect(purple_conversations_get_handle(),
+ "got-attention", plugin, PURPLE_CALLBACK(got_attention_cb));
+ return TRUE;
+}
+
+static PurplePluginInfo info =
+{
+ PURPLE_PLUGIN_MAGIC,
+ PURPLE_MAJOR_VERSION, /**< major version */
+ PURPLE_MINOR_VERSION, /**< minor version */
+ PURPLE_PLUGIN_STANDARD, /**< type */
+ PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
+ 0, /**< flags */
+ NULL, /**< dependencies */
+ PURPLE_PRIORITY_DEFAULT, /**< priority */
+
+ "gtk-vibes", /**< id */
+ N_("Vibes"), /**< name */
+ DISPLAY_VERSION, /**< version */
+ N_("Shake the Conversation Window on Attentions."), /**< summary */
+ N_("Enables shaking of the conversation window "
+ "when sending and receiving attentions "
+ "(buzz, nudge etc."), /**< description */
+ "Marcus Lundblad <ml at update.uu.se>", /**< author */
+ PURPLE_WEBSITE, /**< homepage */
+ plugin_load, /**< load */
+ plugin_unload, /**< unload */
+ NULL, /**< destroy */
+ NULL, /**< ui_info */
+ NULL, /**< extra_info */
+ NULL, /**< prefs_info */
+ NULL, /**< actions */
+
+ /* padding */
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+static void
+init_plugin(PurplePlugin *plugin)
+{
+ /* register prefs */
+
+}
+
+PURPLE_INIT_PLUGIN(sendbutton, init_plugin, info)
============================================================
--- pidgin/plugins/Makefile.am 48cdb81a1b626377bf739819f346282e031a0265
+++ pidgin/plugins/Makefile.am 253035c8271fd0deb3d0246e50a9c9bbc07d4250
@@ -45,6 +45,7 @@ timestamp_format_la_LDFLAGS = -module -a
spellchk_la_LDFLAGS = -module -avoid-version
timestamp_la_LDFLAGS = -module -avoid-version
timestamp_format_la_LDFLAGS = -module -avoid-version
+vibes_la_LDFLAGS = -module -avoid-version
xmppconsole_la_LDFLAGS = -module -avoid-version
if PLUGINS
@@ -63,6 +64,7 @@ plugin_LTLIBRARIES = \
spellchk.la \
timestamp.la \
timestamp_format.la \
+ vibes.la \
xmppconsole.la
noinst_LTLIBRARIES = \
@@ -84,6 +86,7 @@ timestamp_format_la_SOURCES = timestamp_
spellchk_la_SOURCES = spellchk.c
timestamp_la_SOURCES = timestamp.c
timestamp_format_la_SOURCES = timestamp_format.c
+vibes_la_SOURCES = vibes.c
xmppconsole_la_SOURCES = xmppconsole.c
convcolors_la_LIBADD = $(GTK_LIBS)
@@ -101,6 +104,7 @@ timestamp_format_la_LIBADD = $(GTK_LIBS
spellchk_la_LIBADD = $(GTK_LIBS)
timestamp_la_LIBADD = $(GTK_LIBS)
timestamp_format_la_LIBADD = $(GTK_LIBS)
+vibes_la_LIBADD = $(GTK_LIBS)
xmppconsole_la_LIBADD = $(GTK_LIBS)
endif # PLUGINS
More information about the Commits
mailing list