Changeset 826d0d375e42d8e4018950dd84b37689b3f666fa
- Timestamp:
- 02/09/09 20:46:06 (3 years ago)
- Author:
- Leo 'costela' Antunes <leo@…>
- Children:
- 56547456e406341caca65cfab1abe64869a0ffa0
- Parents:
- 6b1d64afe2adb48823dd4dd68d1d563a80537874
- git-author:
- Leo Antunes <leo@…> (02/09/09 20:32:08)
- git-committer:
- Leo 'costela' Antunes <leo@…> (02/09/09 20:46:06)
- Message:
-
split some code; localized plugin info
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r7bfa81d
|
r826d0d3
|
|
| 8 | 8 | set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Wall" CACHE STRING "" FORCE) |
| 9 | 9 | |
| 10 | | add_library(awayonlock SHARED awayonlock.c) |
| | 10 | add_library(awayonlock SHARED awayonlock.c callback.c) |
| 11 | 11 | install(TARGETS awayonlock LIBRARY DESTINATION lib/pidgin NAMELINK_SKIP) |
| 12 | 12 | |
-
|
r7bfa81d
|
r826d0d3
|
|
| | 1 | Version 0.2 (2009-??-??): |
| | 2 | |
| | 3 | - solved problem when the auto-away feature got activated before the screensaver |
| | 4 | - added pref to select which away status should be set by the screensaver |
| | 5 | - plugin info finally translateable |
| | 6 | |
| 1 | 7 | Version 0.1 (2009-01-31): |
| 2 | 8 | |
-
|
r6b1d64a
|
r826d0d3
|
|
| 24 | 24 | #define AWAYONLOCK_PLUGIN_ID "core-costela-awayonlock" |
| 25 | 25 | |
| 26 | | #include <stdio.h> |
| 27 | | #include <stdlib.h> |
| 28 | | |
| 29 | 26 | #include <dbus/dbus-glib.h> |
| 30 | 27 | |
| … |
… |
|
| 34 | 31 | #include <version.h> |
| 35 | 32 | #include <notify.h> |
| 36 | | #include <savedstatuses.h> |
| 37 | 33 | |
| 38 | 34 | #include "i18n.h" |
| | 35 | #include "callback.h" |
| 39 | 36 | |
| 40 | 37 | static DBusGConnection *dbus_conn = NULL; |
| 41 | | |
| 42 | | static PurpleSavedStatus *status_saved = NULL; |
| 43 | | |
| 44 | | static void awayonlock_idle_changed_callback(DBusGProxy *proxy, gboolean screensaver_status, gpointer data) { |
| 45 | | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("got message from screensaver: active=%u\n"), screensaver_status); |
| 46 | | |
| 47 | | PurpleSavedStatus *status_idle = purple_savedstatus_get_idleaway(); |
| 48 | | |
| 49 | | PurpleSavedStatus *status_current = purple_savedstatus_get_current(); |
| 50 | | PurpleStatusPrimitive status_type = purple_savedstatus_get_type(status_current); |
| 51 | | |
| 52 | | if(screensaver_status && (status_type != PURPLE_STATUS_OFFLINE && status_type != PURPLE_STATUS_INVISIBLE) && ! purple_savedstatus_is_idleaway()) { |
| 53 | | status_saved = status_current; |
| 54 | | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("setting status as away and storing '%s'\n"), purple_savedstatus_get_title(status_saved)); |
| 55 | | purple_savedstatus_activate(status_idle); |
| 56 | | } |
| 57 | | else if (!screensaver_status && status_saved != NULL && status_saved != status_idle) { |
| 58 | | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("restoring status '%s'\n"), purple_savedstatus_get_title(status_saved)); |
| 59 | | purple_savedstatus_activate(status_saved); |
| 60 | | status_saved = NULL; |
| 61 | | } |
| 62 | | } |
| 63 | 38 | |
| 64 | 39 | static gboolean plugin_load(PurplePlugin *plugin) { |
| … |
… |
|
| 71 | 46 | |
| 72 | 47 | dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
| 73 | | //dbus_conn = dbus_connection_get_g_connection(purple_dbus_get_connection()); |
| 74 | 48 | |
| 75 | 49 | if(dbus_conn == NULL) { |
| … |
… |
|
| 114 | 88 | } |
| 115 | 89 | |
| 116 | | static void init_plugin(PurplePlugin *plugin) |
| 117 | | { |
| 118 | | } |
| 119 | | |
| 120 | 90 | static PurplePluginInfo info = { |
| 121 | 91 | PURPLE_PLUGIN_MAGIC, |
| … |
… |
|
| 129 | 99 | |
| 130 | 100 | AWAYONLOCK_PLUGIN_ID, |
| 131 | | N_("Away-on-lock"), |
| | 101 | 0, |
| 132 | 102 | AWAYONLOCK_VERSION, |
| 133 | 103 | |
| 134 | | N_("Sets you as away when your screensaver is activated"), |
| 135 | | N_("This plugin sets your status as your default away status whenever your screensaver get activated."), |
| 136 | | N_("Leo Antunes <leo@costela.net>"), |
| | 104 | 0, |
| | 105 | 0, |
| | 106 | 0, |
| 137 | 107 | N_("http://costela.net/projects/away-on-lock"), |
| 138 | 108 | |
| … |
… |
|
| 151 | 121 | }; |
| 152 | 122 | |
| | 123 | static void init_plugin(PurplePlugin *plugin) |
| | 124 | { |
| | 125 | bindtextdomain(PACKAGE, LOCALEDIR); |
| | 126 | |
| | 127 | info.name = _("Away-on-lock"); |
| | 128 | info.summary = _("Sets you as away when your screensaver is activated"); |
| | 129 | info.description = _("This plugin sets your status to the default away status whenever your screensaver gets activated."); |
| | 130 | info.author = _("Leo Antunes <leo@costela.net>"); |
| | 131 | } |
| | 132 | |
| 153 | 133 | PURPLE_INIT_PLUGIN(awayonlock, init_plugin, info); |
| 154 | 134 | |
-
|
r7bfa81d
|
r826d0d3
|
|
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | | #ifndef _AWAYONLOCK_I18N |
| 22 | | #define _AWAYONLOCK_I18N |
| | 21 | #ifndef _AWAYONLOCK_I18N_H |
| | 22 | #define _AWAYONLOCK_I18N_H |
| 23 | 23 | |
| 24 | 24 | #ifdef ENABLE_NLS |
-
|
r7bfa81d
|
r826d0d3
|
|
| 9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
| 10 | 10 | "Report-Msgid-Bugs-To: \n" |
| 11 | | "POT-Creation-Date: 2009-01-31 22:10+0100\n" |
| | 11 | "POT-Creation-Date: 2009-02-09 18:09+0100\n" |
| 12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| … |
… |
|
| 17 | 17 | "Content-Transfer-Encoding: 8bit\n" |
| 18 | 18 | |
| 19 | | #: awayonlock.c:88 |
| | 19 | #: awayonlock.c:125 |
| | 20 | msgid "Away-on-lock" |
| | 21 | msgstr "" |
| | 22 | |
| | 23 | #: awayonlock.c:62 |
| 20 | 24 | msgid "Failed to create a DBus Proxy." |
| 21 | 25 | msgstr "" |
| 22 | 26 | |
| 23 | | #: awayonlock.c:76 |
| | 27 | #: awayonlock.c:50 |
| 24 | 28 | msgid "Failed to get a DBus connection." |
| 25 | 29 | msgstr "" |
| | 30 | |
| | 31 | #: awayonlock.c:128 |
| | 32 | msgid "Leo Antunes <leo@costela.net>" |
| | 33 | msgstr "" |
| | 34 | |
| | 35 | #: awayonlock.c:126 |
| | 36 | msgid "Sets you as away when your screensaver is activated" |
| | 37 | msgstr "" |
| | 38 | |
| | 39 | #: awayonlock.c:127 |
| | 40 | msgid "" |
| | 41 | "This plugin sets your status to the default away status whenever your " |
| | 42 | "screensaver gets activated." |
| | 43 | msgstr "" |
-
|
r7bfa81d
|
r826d0d3
|
|
| 8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
| 9 | 9 | "Report-Msgid-Bugs-To: \n" |
| 10 | | "POT-Creation-Date: 2009-01-31 22:10+0100\n" |
| | 10 | "POT-Creation-Date: 2009-02-09 17:58+0100\n" |
| 11 | 11 | "PO-Revision-Date: 2009-01-31 22:13+0100\n" |
| 12 | 12 | "Last-Translator: <leo@costela.net>\n" |
| … |
… |
|
| 17 | 17 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
| 18 | 18 | |
| 19 | | #: awayonlock.c:88 |
| | 19 | #: awayonlock.c:125 |
| | 20 | msgid "Away-on-lock" |
| | 21 | msgstr "" |
| | 22 | |
| | 23 | #: awayonlock.c:62 |
| 20 | 24 | msgid "Failed to create a DBus Proxy." |
| 21 | 25 | msgstr "Falha ao criar um Proxy DBus" |
| 22 | 26 | |
| 23 | | #: awayonlock.c:76 |
| | 27 | #: awayonlock.c:50 |
| 24 | 28 | msgid "Failed to get a DBus connection." |
| 25 | 29 | msgstr "Falha ao conseguir uma conexão DBus" |
| | 30 | |
| | 31 | #: awayonlock.c:128 |
| | 32 | msgid "Leo Antunes <leo@costela.net>" |
| | 33 | msgstr "" |
| | 34 | |
| | 35 | #: awayonlock.c:126 |
| | 36 | msgid "Sets you as away when your screensaver is activated" |
| | 37 | msgstr "Define status como ausente quando o salva-tela é ativado" |
| | 38 | |
| | 39 | #: awayonlock.c:127 |
| | 40 | msgid "" |
| | 41 | "This plugin sets your status to the default away status whenever your " |
| | 42 | "screensaver gets activated." |
| | 43 | msgstr "Este plugin define o status atual como o status ausente padrão quando o salva-tela é ativado" |