[gnome-shell-extension-pidgin/f18] fix build with gnome-shell 3.6, improve gnomeShell pidgin plugin
Tom Callaway
spot at fedoraproject.org
Fri Feb 8 21:09:46 UTC 2013
commit fd844bbbcaa7880905232b774276f0f377824366
Author: Tom Callaway <spot at fedoraproject.org>
Date: Fri Feb 8 16:12:33 2013 -0500
fix build with gnome-shell 3.6, improve gnomeShell pidgin plugin
gnome-shell-extension-pidgin-gnome-shell-36.patch | 267 +++++++++++++++++++++
gnome-shell-extension-pidgin.spec | 14 +-
gnomeShellPidgin-fixups.patch | 168 +++++++++++++
3 files changed, 446 insertions(+), 3 deletions(-)
---
diff --git a/gnome-shell-extension-pidgin-gnome-shell-36.patch b/gnome-shell-extension-pidgin-gnome-shell-36.patch
new file mode 100644
index 0000000..508a018
--- /dev/null
+++ b/gnome-shell-extension-pidgin-gnome-shell-36.patch
@@ -0,0 +1,267 @@
+diff -up gnome-shell-extension-pidgin/extension.js.gnome36 gnome-shell-extension-pidgin/extension.js
+--- gnome-shell-extension-pidgin/extension.js.gnome36 2013-02-01 09:35:35.945357102 +0100
++++ gnome-shell-extension-pidgin/extension.js 2013-02-01 09:39:39.505375105 +0100
+@@ -5,6 +5,8 @@
+ *
+ * Credits to the author of Gajim extension as this extension code was modified
+ * from it.
++ *
++ * Merges in code from the Pidgin Persistent Notification extension: https://github.com/githubnemo/Pidgin-Persistent-Notification/
+ *
+ */
+
+@@ -185,37 +187,15 @@ const St = imports.gi.St;
+ const Main = imports.ui.main;
+ const MessageTray = imports.ui.messageTray;
+ const Shell = imports.gi.Shell;
+-const TelepathyClient = imports.ui.telepathyClient;
++const TelepathyClient = imports.ui.components.telepathyClient;
+ const Tp = imports.gi.TelepathyGLib;
++const PURPLE_MESSAGE_SYSTEM = 0x4;
++const PURPLE_CONV_UPDATE_UNSEEN = 4;
++const ICON_SIZE = MessageTray.Source.prototype.SOURCE_ICON_SIZE;
+
+-const TransGettext = imports.gettext;
+ const Gettext = imports.gettext.domain('gnome-shell-extensions');
+ const _ = Gettext.gettext;
+-const Config = imports.misc.config;
+-const ExtensionUtils = imports.misc.extensionUtils;
+-
+-/**
+- * initTranslations:
+- * @domain: (optional): the gettext domain to use
+- *
+- * Initialize Gettext to load translations from extensionsdir/locale.
+- * If @domain is not provided, it will be taken from metadata['gettext-domain']
+- */
+-function initTranslations(domain) {
+- let extension = ExtensionUtils.getCurrentExtension();
+-
+- domain = domain || extension.metadata['gettext-domain'];
+-
+- // check if this extension was built with "make zip-file", and thus
+- // has the locale files in a subfolder
+- // otherwise assume that extension has been installed in the
+- // same prefix as gnome-shell
+- let localeDir = extension.dir.get_child('locale');
+- if (localeDir.query_exists(null))
+- TransGettext.bindtextdomain(domain, localeDir.get_path());
+- else
+- TransGettext.bindtextdomain(domain, Config.LOCALEDIR);
+-}
++let UserMenuButton = imports.ui.main.panel.statusArea.userMenu;
+
+ function wrappedText(text, sender, timestamp, direction) {
+ let currentTime = (Date.now() / 1000);
+@@ -343,8 +323,10 @@ Source.prototype = {
+ this._buddySignedOffId = proxy.connect('BuddySignedOff', Lang.bind(this, this._onBuddySignedOff));
+ this._buddySignedOnId = proxy.connect('BuddySignedOn', Lang.bind(this, this._onBuddySignedOn));
+ this._messageDisplayedId = proxy.connect('DisplayedImMsg', Lang.bind(this, this._onDisplayedImMessage));
++ this._conversationUpdated = proxy.connect('ConversationUpdated',Lang.bind(this, this._onConversationUpdated));
+ this._deleteConversationId = proxy.connect('DeletingConversation', Lang.bind(this, this._onDeleteConversation));
+
++
+ this.notify();
+ },
+
+@@ -381,12 +363,13 @@ Source.prototype = {
+
+ createNotificationIcon: function() {
+ let iconBox = new St.Bin({ style_class: 'avatar-box' });
+- iconBox._size = this.ICON_SIZE;
++ iconBox._size = ICON_SIZE;
+
+ if (!this._iconUri) {
+ iconBox.child = new St.Icon({ icon_name: 'avatar-default',
+- icon_type: St.IconType.FULLCOLOR,
+- icon_size: iconBox._size });
++ //icon_type: St.IconType.FULLCOLOR,
++ icon_size: iconBox._size
++ });
+ } else {
+ let textureCache = St.TextureCache.get_default();
+ iconBox.child = textureCache.load_uri_async(this._iconUri, iconBox._size, iconBox._size);
+@@ -394,6 +377,18 @@ Source.prototype = {
+ return iconBox;
+ },
+
++ createIcon: function() {
++ let iconBox = new St.Bin();
++ iconBox.child = new St.Icon({ icon_name: 'avatar-default' });
++ return iconBox;
++ },
++ createSecondaryIcon: function() {
++ let iconBox = new St.Bin();
++ iconBox.child = new St.Icon({ style_class: 'secondary-icon' });
++ iconBox.child.icon_name = 'user-available';
++ return iconBox;
++ },
++
+ open: function(notification) {
+ let proxy = this._client.proxy();
+ proxy.PurpleConversationPresentRemote(this._conversation);
+@@ -490,13 +485,13 @@ Source.prototype = {
+ this.notify();
+ },
+
++
+ _onDeleteConversation: function(emitter, conversation) {
+ if (conversation != this._conversation) return;
+ this.destroy();
+ },
+
+ _onDisplayedImMessage: function(emitter, account, author, text, conversation, flag) {
+-
+ if (text && (this._conversation == conversation)) {
+ let direction = null;
+ if (flag == 1) {
+@@ -519,13 +514,28 @@ Source.prototype = {
+
+ },
+
++ _addPersistentNotification: function() {
++ UserMenuButton._iconBox.add_style_class_name('pidgin-notification');
++ },
++
++ _removePersistentNotification: function() {
++ UserMenuButton._iconBox.remove_style_class_name('pidgin-notification');
++ },
++
++ _onConversationUpdated: function(emitter, _conv, flags) {
++ if(flags & PURPLE_CONV_UPDATE_UNSEEN) {
++ this._removePersistentNotification();
++ }
++ },
+ _addPendingMessage: function (message) {
+ this._pendingMessages.push(message);
+ this._updateCount();
++ this._addPersistentNotification();
+ },
+
+ _updateCount: function () {
+- this._setCount(this._pendingMessages.length, this._pendingMessages.length > 0);
++ //this._setCount(this._pendingMessages.length, this._pendingMessages.length > 0);
++ //this.countUpdated();
+ },
+
+ _flushPendingMessages: function() {
+@@ -579,11 +589,12 @@ ChatroomSource.prototype = {
+
+ createNotificationIcon: function() {
+ let iconBox = new St.Bin({ style_class: 'avatar-box' });
+- iconBox._size = this.ICON_SIZE;
++ iconBox._size = ICON_SIZE;
+
+ iconBox.child = new St.Icon({ icon_name: 'pidgin',
+- icon_type: St.IconType.FULLCOLOR,
+- icon_size: iconBox._size });
++ //icon_type: St.IconType.FULLCOLOR,
++ icon_size: iconBox._size
++ });
+ return iconBox;
+ },
+
+@@ -637,7 +648,10 @@ const PidginIface = {
+ {name: 'BuddySignedOff', inSignature: 'i'},
+ {name: 'BuddySignedOn', inSignature: 'i'},
+ {name: 'DeletingConversation', inSignature: 'i'},
+- {name: 'ConversationCreated', inSignature: 'i'}
++ {name: 'ConversationCreated', inSignature: 'i'},
++ {name: 'ConversationUpdated', inSignature: 'iu'},
++ {name: 'SignedOn', inSignature: 'i'},
++ {name: 'SignedOff', inSignature: 'i'}
+ ]
+ };
+
+@@ -654,11 +668,15 @@ PidginClient.prototype = {
+ this._proxy = new Pidgin(DBus.session, 'im.pidgin.purple.PurpleService', '/im/pidgin/purple/PurpleObject');
+ this._displayedImMsgId = 0;
+ this._displayedChatMsgId = 0;
++ this._setAvailable = 0;
++ this._setUnavailable = 0;
+ },
+
+ enable: function() {
+ this._displayedImMsgId = this._proxy.connect('DisplayedImMsg', Lang.bind(this, this._messageDisplayed));
+ this._displayedChatMsgId = this._proxy.connect('DisplayedChatMsg', Lang.bind(this, this._chatroomMessageDisplayed));
++ this._setAvailable = this._proxy.connect('SignedOn', Lang.bind(this, this._onSignedOn));
++ this._setUnavailable = this._proxy.connect('SignedOff', Lang.bind(this, this._onSignedOff));
+ },
+
+ disable: function() {
+@@ -671,6 +689,16 @@ PidginClient.prototype = {
+ this._proxy.disconnect(this._displayedChatMsgId);
+ this._displayedChatMsgId = 0;
+ }
++
++ if (this._setAvailable > 0) {
++ this._proxy.disconnect(this._setAvailable);
++ this._setAvailable = 0;
++ }
++ if (this._setUnavailable > 0) {
++ this._proxy.disconnect(this._setUnavailable);
++ this._setUnavailable = 0;
++ }
++
+
+ for (let key in this._sources) {
+ if (this._sources.hasOwnProperty(key))
+@@ -684,7 +712,10 @@ PidginClient.prototype = {
+
+ _messageDisplayed: function(emitter, account, author, message, conversation, flag) {
+ // only trigger on message received/message sent
+- if (flag != 2 && flag != 1) return;
++ if (flag != 2 && flag != 1)
++ {
++ return;
++ }
+
+ if (conversation) {
+ let source = this._sources[conversation];
+@@ -717,10 +748,18 @@ PidginClient.prototype = {
+ }
+ this._chatroomsources[conversation] = source;
+ }
+- }
++ },
++ _onSignedOn: function(emitter, connection) {
++ UserMenuButton._iconBox.child = UserMenuButton._availableIcon;
++ },
++ _onSignedOff: function(emitter, connection) {
++ UserMenuButton._iconBox.child = UserMenuButton._offlineIcon;
++ }
+ }
+
+-function init(metadata) {
+- // initTranslations();
++function init(metaObject) {
++ var LocalDir;
++ LocalDir = metaObject.metadata.localedir;
++ imports.gettext.bindtextdomain('gnome-shell-extensions', LocalDir);
+ return new PidginClient();
+ }
+diff -up gnome-shell-extension-pidgin/metadata.json.gnome36 gnome-shell-extension-pidgin/metadata.json
+--- gnome-shell-extension-pidgin/metadata.json.gnome36 2013-02-01 09:37:15.756364480 +0100
++++ gnome-shell-extension-pidgin/metadata.json 2013-02-01 09:38:24.342369549 +0100
+@@ -1,7 +1,8 @@
+-{"shell-version": ["3.4","3.3.90","3.3.5","3.3.4","3.3.3","3.2", "3.2"],
++{
+ "uuid": "pidgin-conversation-integration at kagesenshi.org",
+ "name": "Pidgin Conversation Integration",
+ "description": "Display Pidgin chats as notifications in the Shell message tray",
+- "url": "https://github.com/kagesenshi/gnome-shell-extensions-pidgin",
+- "version": 0
++ "shell-version": [ "3.6" ],
++ "localedir": "/usr/share/locale",
++ "url": "https://github.com/kagesenshi/gnome-shell-extensions-pidgin"
+ }
+diff -up gnome-shell-extension-pidgin/stylesheet.css.gnome36 gnome-shell-extension-pidgin/stylesheet.css
+--- gnome-shell-extension-pidgin/stylesheet.css.gnome36 2013-02-01 09:39:07.416372733 +0100
++++ gnome-shell-extension-pidgin/stylesheet.css 2013-02-01 09:39:01.342372284 +0100
+@@ -0,0 +1,6 @@
++
++ /*More prominent stylesheet by MassimoBarbieri.*/
++
++.pidgin-notification {
++ color: green;
++}
diff --git a/gnome-shell-extension-pidgin.spec b/gnome-shell-extension-pidgin.spec
index f55dbeb..eb15125 100644
--- a/gnome-shell-extension-pidgin.spec
+++ b/gnome-shell-extension-pidgin.spec
@@ -3,7 +3,7 @@
Name: gnome-shell-extension-pidgin
Version: 0
-Release: 0.8.git%{git}%{?dist}
+Release: 0.9.git%{git}%{?dist}
Summary: The components necessary to integrate Pidgin with GNOME Shell
Group: User Interface/Desktops
License: GPLv2+
@@ -20,8 +20,10 @@ Source3: gnome-shell-extensions-pidgin-License.txt
Source4: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Patch0: gnomeShellPidgin-cleanup.patch
Patch1: gnome-shell-extension-pidgin-gnome-shell-34.patch
+Patch2: gnome-shell-extension-pidgin-gnome-shell-36.patch
+Patch3: gnomeShellPidgin-fixups.patch
BuildRequires: libpurple-devel, dbus-devel, zlib-devel
-Requires: gnome-shell >= 3.0.1
+Requires: gnome-shell >= 3.6
Requires: pidgin
%description
@@ -44,6 +46,8 @@ cp %{SOURCE3} .
cp %{SOURCE4} .
%patch0 -p0 -b .cleanup
%patch1 -p1 -b .gnome34
+%patch2 -p1 -b .gnome36
+%patch3 -p1 -b .fixups
%build
make CFLAGS="%{optflags}"
@@ -52,7 +56,7 @@ make CFLAGS="%{optflags}"
make DESTDIR=%{buildroot} LIBDIR=%{_libdir} install
mkdir -p %{buildroot}%{_datadir}/gnome-shell/extensions/%{uuid}
-install -Dp -m 0644 {extension.js,metadata.json} \
+install -Dp -m 0644 {extension.js,metadata.json,stylesheet.css} \
%{buildroot}%{_datadir}/gnome-shell/extensions/%{uuid}/
%files
@@ -61,6 +65,10 @@ install -Dp -m 0644 {extension.js,metadata.json} \
%{_libdir}/purple-2/libgnomeshell.so
%changelog
+* Fri Feb 8 2013 Tom Callaway <spot at fedoraproject.org> - 0-0.9.git87fc23433d
+- apply fixes from "thedeadparrot" github fork to get things working on gnome 3.6
+- improve gnome-shell connector plugin
+
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0-0.8.git87fc23433d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
diff --git a/gnomeShellPidgin-fixups.patch b/gnomeShellPidgin-fixups.patch
new file mode 100644
index 0000000..48d1dfe
--- /dev/null
+++ b/gnomeShellPidgin-fixups.patch
@@ -0,0 +1,168 @@
+diff -upa gnome-shell-extension-pidgin/gnomeShellPidgin.c.fixups gnome-shell-extension-pidgin/gnomeShellPidgin.c
+--- gnome-shell-extension-pidgin/gnomeShellPidgin.c.fixups 2013-02-01 12:10:05.555042266 +0100
++++ gnome-shell-extension-pidgin/gnomeShellPidgin.c 2013-02-01 12:14:25.096061450 +0100
+@@ -21,9 +21,10 @@
+ #include <dbus-maybe.h>
+ #include <dbus-server.h>
+ #include <dbus-bindings.h>
++#include <gio/gio.h>
+
+ #define N_(x) x
+-#define DISPLAY_VERSION "0.1"
++#define DISPLAY_VERSION "0.2"
+
+ static void message(PurplePlugin* plugin,const char* msg)
+ {
+@@ -75,13 +76,13 @@ static PurpleStatusPrimitive Gnome2Purpl
+ struct SPluginParams
+ {
+ PurplePlugin* plugin;
+- DBusGConnection* connection;
++ GDBusConnection* connection;
+ char status[GNOME_NSTATUS][TITLESIZE];
+ };
+ typedef struct SPluginParams PluginParams;
+
+
+-static void InitPluginParams(PluginParams* params,PurplePlugin* plugin,DBusGConnection* connection)
++static void InitPluginParams(PluginParams* params,PurplePlugin* plugin,GDBusConnection* connection)
+ {
+ size_t i;
+ params->plugin = plugin;
+@@ -92,61 +93,69 @@ static void InitPluginParams(PluginParam
+
+ static void SetInGnome(PluginParams* params,int status)
+ {
++ GVariant *ret;
+ GError* error = NULL;
+ GValue v = {0,{{0}}};
+- DBusGProxy* presence = dbus_g_proxy_new_for_name(
++ GDBusProxy* presence = g_dbus_proxy_new_sync(
+ params->connection,
++ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
++ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
++ NULL,
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager/Presence",
+- "org.freedesktop.DBus.Properties");
++ "org.gnome.SessionManager.Presence",
++ NULL, NULL);
+ g_value_init(&v,G_TYPE_UINT);
+ g_value_set_uint(&v,status);
+- if (!dbus_g_proxy_call(
+- presence,"Set",&error,
+- G_TYPE_STRING,"org.gnome.SessionManager.Presence",
+- G_TYPE_STRING,"status",
+- G_TYPE_VALUE,&v,G_TYPE_INVALID,G_TYPE_INVALID))
++ ret = g_dbus_proxy_call_sync(presence, "SetStatus", g_variant_new ("(u)", status), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
++ g_object_unref (presence);
++
++ if (ret == NULL)
+ {
+- message(params->plugin,error->message);
++ g_warning ("Failed to set presence: %s", error->message);
+ g_error_free(error);
++ return;
+ }
++ g_variant_unref (ret);
+ }
+
+-static void status_signal_handler(DBusGProxy* presence,guint gnome_status,PluginParams* params)
++static void status_signal_handler(GDBusProxy* presence, gchar *sender_name, gchar *signal_name, PluginParams* params, guint gnome_status)
+ {
+- PurpleSavedStatus* current_status = purple_savedstatus_get_current();
+- guint current_pidgin_status = Purple2Gnome(purple_savedstatus_get_type(current_status));
+- if (current_pidgin_status < GNOME_NSTATUS && !purple_savedstatus_is_transient(current_status))
+- {
+- const char* title = purple_savedstatus_get_title(current_status);
+- if (title)
+- strcpy(params->status[current_pidgin_status],title);
+- }
+- if (gnome_status >= GNOME_NSTATUS)
+- return;
+- if (current_pidgin_status != gnome_status)
+- {
+- PurpleSavedStatus* new_status = NULL;
+- if (params->status[gnome_status][0])
+- new_status = purple_savedstatus_find(params->status[gnome_status]);
+- if (new_status)
+- purple_savedstatus_activate(new_status);
+- else
++ if (g_str_equal (signal_name, "StatusChanged")) {
++ PurpleSavedStatus* current_status = purple_savedstatus_get_current();
++ guint current_pidgin_status = Purple2Gnome(purple_savedstatus_get_type(current_status));
++ if (current_pidgin_status < GNOME_NSTATUS && !purple_savedstatus_is_transient(current_status))
++ {
++ const char* title = purple_savedstatus_get_title(current_status);
++ if (title)
++ strcpy(params->status[current_pidgin_status],title);
++ }
++ if (gnome_status >= GNOME_NSTATUS)
++ return;
++ if (current_pidgin_status != gnome_status)
+ {
+- PurpleSavedStatus* newStatus = purple_savedstatus_new(NULL,Gnome2Purple(gnome_status));
+- purple_savedstatus_activate(newStatus);
++ PurpleSavedStatus* new_status = NULL;
++ if (params->status[gnome_status][0])
++ new_status = purple_savedstatus_find(params->status[gnome_status]);
++ if (new_status)
++ purple_savedstatus_activate(new_status);
++ else
++ {
++ PurpleSavedStatus* newStatus = purple_savedstatus_new(NULL,Gnome2Purple(gnome_status));
++ purple_savedstatus_activate(newStatus);
++ }
+ }
+ }
+ }
+
+ static gboolean plugin_load(PurplePlugin *plugin)
+ {
+- DBusGProxy* presence;
++ GDBusProxy* presence;
+ PurpleSavedStatus* currentStatus;
+ GError* error = NULL;
+ PluginParams* params = malloc(sizeof(PluginParams));
+ plugin->extra = params;
+- DBusGConnection* connection = dbus_g_bus_get(DBUS_BUS_SESSION,&error);
++ GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
+ if (!connection)
+ {
+ message(plugin,error->message);
+@@ -154,15 +163,19 @@ static gboolean plugin_load(PurplePlugin
+ return FALSE;
+ }
+ InitPluginParams(params,plugin,connection);
+- presence = dbus_g_proxy_new_for_name(
++ presence = g_dbus_proxy_new_sync (
+ connection,
++ G_DBUS_PROXY_FLAGS_NONE,
++ NULL, /* interface info */
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager/Presence",
+- "org.gnome.SessionManager.Presence");
++ "org.gnome.SessionManager.Presence",
++ NULL, /* cancellable */
++ NULL /* error */);
+ currentStatus = purple_savedstatus_get_current();
+ SetInGnome(params,Purple2Gnome(purple_savedstatus_get_type(currentStatus)));
+- dbus_g_proxy_add_signal(presence,"StatusChanged",G_TYPE_UINT,G_TYPE_INVALID);
+- dbus_g_proxy_connect_signal(presence,"StatusChanged",G_CALLBACK(status_signal_handler),params,NULL);
++ g_signal_connect (presence, "g-signal", G_CALLBACK (status_signal_handler), params);
++ g_object_unref (presence);
+ return TRUE;
+ }
+
+diff -upa gnome-shell-extension-pidgin/Makefile.fixups gnome-shell-extension-pidgin/Makefile
+--- gnome-shell-extension-pidgin/Makefile.fixups 2013-02-01 12:10:05.546042265 +0100
++++ gnome-shell-extension-pidgin/Makefile 2013-02-01 12:10:05.569042267 +0100
+@@ -3,7 +3,7 @@ LIBDIR=$(PREFIX)/lib
+ SOURCES = \
+ gnomeShellPidgin.c
+
+-PURPLE_CFLAGS := $(shell pkg-config --cflags --libs dbus-1 purple)
++PURPLE_CFLAGS := $(shell pkg-config --cflags --libs dbus-1 gio-2.0 purple)
+ PURPLE_CFLAGS += -DPURPLE_PLUGINS -DENABLE_NLS -fPIC -DPIC -DHAVE_ZLIB -shared $(CFLAGS)
+ CC=gcc
+
More information about the scm-commits
mailing list