Changeset eac542b8dbbb0cd226442fbe8494256371810a8a
- Timestamp:
- 07/19/09 00:21:28 (3 years ago)
- Author:
- Leo Antunes <leo@…>
- Children:
- c5606aa8a15998dd28faee8a3141cb8ac83b8d24
- Parents:
- ebf9132bb918ff995e2b561867be329ec3e9a9ee
- git-committer:
- Leo Antunes <leo@…> (07/19/09 00:21:28)
- Message:
-
add option to activate only if Available
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rebf9132
|
reac542b
|
|
| | 1 | Version 0.3 (??-??-2009): |
| | 2 | |
| | 3 | - add option to activate only if Available |
| | 4 | |
| 1 | 5 | Version 0.2.2 (2009-07-14): |
| 2 | 6 | |
-
|
rebf9132
|
reac542b
|
|
| 2 | 2 | awayonlock - plugin to set away status on screensaver activation |
| 3 | 3 | Copyright (C) 2009 Leo Antunes <leo@costela.net> |
| 4 | | |
| | 4 | |
| 5 | 5 | This program is free software; you can redistribute it and/or |
| 6 | 6 | modify it under the terms of the GNU General Public License |
| 7 | 7 | as published by the Free Software Foundation; either version 2 |
| 8 | 8 | of the License, or (at your option) any later version. |
| 9 | | |
| | 9 | |
| 10 | 10 | This program is distributed in the hope that it will be useful, |
| 11 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | 13 | GNU General Public License for more details. |
| 14 | | |
| | 14 | |
| 15 | 15 | You should have received a copy of the GNU General Public License |
| 16 | 16 | along with this program; if not, write to the Free Software |
| … |
… |
|
| 21 | 21 | #define PURPLE_PLUGINS |
| 22 | 22 | |
| 23 | | #define AWAYONLOCK_VERSION "0.2.2" |
| | 23 | #define AWAYONLOCK_VERSION "0.3" |
| 24 | 24 | #define AWAYONLOCK_PLUGIN_ID "core-costela-awayonlock" |
| 25 | 25 | |
| … |
… |
|
| 54 | 54 | |
| 55 | 55 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("plugin_load called\n")); |
| 56 | | |
| | 56 | |
| 57 | 57 | dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
| 58 | | |
| 59 | | if(dbus_conn == NULL) { |
| | 58 | |
| | 59 | if(dbus_conn == NULL) { |
| 60 | 60 | purple_debug(PURPLE_DEBUG_ERROR, PACKAGE, N_("failed to get DBus connection\n")); |
| 61 | 61 | purple_notify_error(plugin, "Away-on-lock", _("Failed to get a DBus connection."), g_strdup_printf("DBus error: %s\n",error->message)); |
| 62 | 62 | return FALSE; |
| 63 | 63 | } |
| 64 | | |
| | 64 | |
| 65 | 65 | |
| 66 | 66 | /* |
| … |
… |
|
| 136 | 136 | 0, |
| 137 | 137 | N_("http://costela.net/projects/awayonlock"), |
| 138 | | |
| | 138 | |
| 139 | 139 | plugin_load, |
| 140 | 140 | plugin_unload, |
| … |
… |
|
| 154 | 154 | { |
| 155 | 155 | bindtextdomain(PACKAGE, LOCALEDIR); |
| 156 | | |
| | 156 | |
| 157 | 157 | info.name = _("Away-on-lock"); |
| 158 | 158 | info.summary = _("Sets you as away when your screensaver is activated"); |
| … |
… |
|
| 160 | 160 | info.author = _("Leo Antunes <leo@costela.net>"); |
| 161 | 161 | |
| 162 | | purple_prefs_add_none("/plugins/core/awayonlock"); |
| 163 | | purple_prefs_add_string("/plugins/core/awayonlock/status", NULL); |
| | 162 | purple_prefs_add_none(AWAYONLOCK_PREF_ROOT); |
| | 163 | purple_prefs_add_string(AWAYONLOCK_PREF_STATUS, NULL); |
| | 164 | purple_prefs_add_bool(AWAYONLOCK_PREF_AVAILABLE_ONLY, 0); |
| 164 | 165 | } |
| 165 | 166 | |
-
|
rbbdcdb4
|
reac542b
|
|
| 2 | 2 | awayonlock - plugin to set away status on screensaver activation |
| 3 | 3 | Copyright (C) 2009 Leo Antunes <leo@costela.net> |
| 4 | | |
| | 4 | |
| 5 | 5 | This program is free software; you can redistribute it and/or |
| 6 | 6 | modify it under the terms of the GNU General Public License |
| 7 | 7 | as published by the Free Software Foundation; either version 2 |
| 8 | 8 | of the License, or (at your option) any later version. |
| 9 | | |
| | 9 | |
| 10 | 10 | This program is distributed in the hope that it will be useful, |
| 11 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | 13 | GNU General Public License for more details. |
| 14 | | |
| | 14 | |
| 15 | 15 | You should have received a copy of the GNU General Public License |
| 16 | 16 | along with this program; if not, write to the Free Software |
| … |
… |
|
| 44 | 44 | } |
| 45 | 45 | |
| | 46 | gboolean available_only = purple_prefs_get_bool(AWAYONLOCK_PREF_AVAILABLE_ONLY); |
| 46 | 47 | |
| 47 | 48 | PurpleSavedStatus *status_current = purple_savedstatus_get_current(); |
| 48 | 49 | |
| 49 | | if(screensaver_status && (purple_savedstatus_get_type(status_current) != PURPLE_STATUS_OFFLINE && purple_savedstatus_get_type(status_current) != PURPLE_STATUS_INVISIBLE) && ! purple_savedstatus_is_idleaway()) { |
| | 50 | if(screensaver_status && ! purple_savedstatus_is_idleaway() && ((!available_only && purple_savedstatus_get_type(status_current) != PURPLE_STATUS_OFFLINE && purple_savedstatus_get_type(status_current) != PURPLE_STATUS_INVISIBLE) || purple_savedstatus_get_type(status_current) == PURPLE_STATUS_AVAILABLE)) { |
| 50 | 51 | status_saved = status_current; |
| 51 | | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("setting status as away and storing '%s'\n"), purple_savedstatus_get_title(status_saved)); |
| | 52 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("setting status as '%s' and storing '%s'\n"), purple_savedstatus_get_title(status_idle), purple_savedstatus_get_title(status_saved)); |
| 52 | 53 | purple_savedstatus_activate(status_idle); |
| 53 | 54 | } |
| … |
… |
|
| 57 | 58 | status_saved = NULL; |
| 58 | 59 | } |
| | 60 | else { |
| | 61 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("ignoring...\n")); |
| | 62 | } |
| 59 | 63 | } |
| 60 | 64 | |
-
|
rf61e5d9
|
reac542b
|
|
| 9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
| 10 | 10 | "Report-Msgid-Bugs-To: \n" |
| 11 | | "POT-Creation-Date: 2009-06-01 22:51+0200\n" |
| | 11 | "POT-Creation-Date: 2009-07-19 00:16+0200\n" |
| 12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| … |
… |
|
| 50 | 50 | msgid "Default away status" |
| 51 | 51 | msgstr "" |
| | 52 | |
| | 53 | #: prefs.c:65 |
| | 54 | msgid "Activate only if available" |
| | 55 | msgstr "" |
-
|
rebf9132
|
reac542b
|
|
| 1 | 1 | # #-#-#-#-# pidgin-awayonlock.pot (PACKAGE VERSION) #-#-#-#-# |
| 2 | | # SOME DESCRIPTIVE TITLE. |
| 3 | | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
| 4 | | # This file is distributed under the same license as the PACKAGE package. |
| 5 | | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| | 2 | # pidgin plugin to set as away on screensaver activation. |
| | 3 | # Copyright (C) 2009 |
| | 4 | # This file is distributed under the same license as the awayonlock package. |
| | 5 | # Leo Antunes <leo@costela.net>. |
| 6 | 6 | # |
| 7 | 7 | # #-#-#-#-# pt_BR.po (PACKAGE VERSION) #-#-#-#-# |
| 8 | | # Portuguese translations for PACKAGE package. |
| 9 | | # Copyright (C) 2009 THE PACKAGE'S COPYRIGHT HOLDER |
| 10 | | # This file is distributed under the same license as the PACKAGE package. |
| 11 | | # <leo@costela.net>, 2009. |
| | 8 | # Portuguese translations for awayonlock package. |
| | 9 | # Copyright (C) 2009 Leo Antunes <leo@costela.net> |
| | 10 | # This file is distributed under the same license as the awayonlock package. |
| | 11 | # Leo Antunes <leo@costela.net>, 2009. |
| 12 | 12 | # |
| 13 | 13 | #, fuzzy |
| … |
… |
|
| 16 | 16 | "Project-Id-Version: PACKAGE VERSION\n" |
| 17 | 17 | "Report-Msgid-Bugs-To: \n" |
| 18 | | "POT-Creation-Date: 2009-06-01 22:51+0200\n" |
| | 18 | "POT-Creation-Date: 2009-07-19 00:16+0200\n" |
| 19 | 19 | "PO-Revision-Date: 2009-01-31 22:13+0100\n" |
| 20 | 20 | "Last-Translator: <leo@costela.net>\n" |
| … |
… |
|
| 26 | 26 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
| 27 | 27 | |
| 28 | | #: awayonlock.c:157 |
| 29 | | msgid "Away-on-lock" |
| 30 | | msgstr "" |
| 31 | | |
| 32 | | #: prefs.c:44 |
| 33 | | msgid "Default away status" |
| 34 | | msgstr "Status ausente padrão" |
| | 28 | #: awayonlock.c:61 |
| | 29 | msgid "Failed to get a DBus connection." |
| | 30 | msgstr "Falha ao conseguir uma conexão DBus" |
| 35 | 31 | |
| 36 | 32 | #: awayonlock.c:77 |
| … |
… |
|
| 38 | 34 | msgstr "Falha ao criar um Proxy DBus" |
| 39 | 35 | |
| 40 | | #: awayonlock.c:61 |
| 41 | | msgid "Failed to get a DBus connection." |
| 42 | | msgstr "Falha ao conseguir uma conexão DBus" |
| 43 | | |
| 44 | | #: awayonlock.c:160 |
| 45 | | msgid "Leo Antunes <leo@costela.net>" |
| | 36 | #: awayonlock.c:157 |
| | 37 | msgid "Away-on-lock" |
| 46 | 38 | msgstr "" |
| 47 | 39 | |
| … |
… |
|
| 49 | 41 | msgid "Sets you as away when your screensaver is activated" |
| 50 | 42 | msgstr "Define status como ausente quando o salva-tela é ativado" |
| 51 | | |
| 52 | | #: prefs.c:42 |
| 53 | | msgid "Status to set on screensaver activation" |
| 54 | | msgstr "Status para usar quando o salva-tela for ativado" |
| 55 | 43 | |
| 56 | 44 | #: awayonlock.c:159 |
| … |
… |
|
| 61 | 49 | "Este plugin define o status atual como o status ausente padrão quando o " |
| 62 | 50 | "salva-tela é ativado" |
| | 51 | |
| | 52 | #: awayonlock.c:160 |
| | 53 | msgid "Leo Antunes <leo@costela.net>" |
| | 54 | msgstr "" |
| | 55 | |
| | 56 | #: prefs.c:42 |
| | 57 | msgid "Status to set on screensaver activation" |
| | 58 | msgstr "Status para usar quando o salva-tela for ativado" |
| | 59 | |
| | 60 | #: prefs.c:44 |
| | 61 | msgid "Default away status" |
| | 62 | msgstr "Status ausente padrão" |
| | 63 | |
| | 64 | #: prefs.c:65 |
| | 65 | msgid "Activate only if available" |
| | 66 | msgstr "Ativar somente quando disponÃvel" |
-
|
rbbdcdb4
|
reac542b
|
|
| 2 | 2 | awayonlock - plugin to set away status on screensaver activation |
| 3 | 3 | Copyright (C) 2009 Leo Antunes <leo@costela.net> |
| 4 | | |
| | 4 | |
| 5 | 5 | This program is free software; you can redistribute it and/or |
| 6 | 6 | modify it under the terms of the GNU General Public License |
| 7 | 7 | as published by the Free Software Foundation; either version 2 |
| 8 | 8 | of the License, or (at your option) any later version. |
| 9 | | |
| | 9 | |
| 10 | 10 | This program is distributed in the hope that it will be useful, |
| 11 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | 13 | GNU General Public License for more details. |
| 14 | | |
| | 14 | |
| 15 | 15 | You should have received a copy of the GNU General Public License |
| 16 | 16 | along with this program; if not, write to the Free Software |
| … |
… |
|
| 54 | 54 | purple_plugin_pref_add_choice(ppref, (gchar *)purple_savedstatus_get_title(statuses->data), creation_time); |
| 55 | 55 | /* |
| 56 | | * FIXME: memleak! how can we free this after the frame has |
| 57 | | * been destroyed? Alternatively, how could we pass a |
| 58 | | * pointer to the original creation_time inside the |
| 59 | | * PurpleSavedStatus struct? |
| | 56 | * FIXME: memleak! how can we free this after the frame has |
| | 57 | * been destroyed? |
| 60 | 58 | */ |
| 61 | 59 | //g_free(creation_time); |
| … |
… |
|
| 64 | 62 | purple_plugin_pref_frame_add(frame, ppref); |
| 65 | 63 | g_list_free(statuses); |
| | 64 | |
| | 65 | ppref = purple_plugin_pref_new_with_name_and_label(AWAYONLOCK_PREF_AVAILABLE_ONLY, _("Activate only if available")); |
| | 66 | purple_plugin_pref_frame_add(frame, ppref); |
| 66 | 67 | |
| 67 | 68 | return frame; |
-
|
rbbdcdb4
|
reac542b
|
|
| 2 | 2 | awayonlock - plugin to set away status on screensaver activation |
| 3 | 3 | Copyright (C) 2009 Leo Antunes <leo@costela.net> |
| 4 | | |
| | 4 | |
| 5 | 5 | This program is free software; you can redistribute it and/or |
| 6 | 6 | modify it under the terms of the GNU General Public License |
| 7 | 7 | as published by the Free Software Foundation; either version 2 |
| 8 | 8 | of the License, or (at your option) any later version. |
| 9 | | |
| | 9 | |
| 10 | 10 | This program is distributed in the hope that it will be useful, |
| 11 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | 13 | GNU General Public License for more details. |
| 14 | | |
| | 14 | |
| 15 | 15 | You should have received a copy of the GNU General Public License |
| 16 | 16 | along with this program; if not, write to the Free Software |
| … |
… |
|
| 26 | 26 | #include <savedstatuses.h> |
| 27 | 27 | |
| | 28 | #define AWAYONLOCK_PREF_ROOT "/plugins/core/awayonlock" |
| 28 | 29 | #define AWAYONLOCK_PREF_STATUS "/plugins/core/awayonlock/status" |
| | 30 | #define AWAYONLOCK_PREF_AVAILABLE_ONLY "/plugins/core/awayonlock/available_only" |
| 29 | 31 | |
| 30 | 32 | PurplePluginPrefFrame* get_prefs_frame(PurplePlugin*); |