Changeset eac542b8dbbb0cd226442fbe8494256371810a8a

Show
Ignore:
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:
7 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rebf9132 reac542b  
     1Version 0.3 (??-??-2009): 
     2 
     3        - add option to activate only if Available 
     4 
    15Version 0.2.2 (2009-07-14): 
    26 
  • awayonlock.c

    rebf9132 reac542b  
    22 awayonlock - plugin to set away status on screensaver activation 
    33 Copyright (C) 2009  Leo Antunes <leo@costela.net> 
    4   
     4 
    55 This program is free software; you can redistribute it and/or 
    66 modify it under the terms of the GNU General Public License 
    77 as published by the Free Software Foundation; either version 2 
    88 of the License, or (at your option) any later version. 
    9   
     9 
    1010 This program is distributed in the hope that it will be useful, 
    1111 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313 GNU General Public License for more details. 
    14   
     14 
    1515 You should have received a copy of the GNU General Public License 
    1616 along with this program; if not, write to the Free Software 
     
    2121#define PURPLE_PLUGINS 
    2222 
    23 #define AWAYONLOCK_VERSION "0.2.2" 
     23#define AWAYONLOCK_VERSION "0.3" 
    2424#define AWAYONLOCK_PLUGIN_ID "core-costela-awayonlock" 
    2525 
     
    5454 
    5555        purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("plugin_load called\n")); 
    56          
     56 
    5757        dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error); 
    58          
    59         if(dbus_conn == NULL) {  
     58 
     59        if(dbus_conn == NULL) { 
    6060                purple_debug(PURPLE_DEBUG_ERROR, PACKAGE, N_("failed to get DBus connection\n")); 
    6161                purple_notify_error(plugin, "Away-on-lock", _("Failed to get a DBus connection."), g_strdup_printf("DBus error: %s\n",error->message)); 
    6262                return FALSE; 
    6363        } 
    64          
     64 
    6565 
    6666        /* 
     
    136136        0, 
    137137        N_("http://costela.net/projects/awayonlock"), 
    138          
     138 
    139139        plugin_load, 
    140140        plugin_unload, 
     
    154154{ 
    155155        bindtextdomain(PACKAGE, LOCALEDIR); 
    156          
     156 
    157157        info.name = _("Away-on-lock"); 
    158158        info.summary = _("Sets you as away when your screensaver is activated"); 
     
    160160        info.author = _("Leo Antunes <leo@costela.net>"); 
    161161 
    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); 
    164165} 
    165166 
  • callback.c

    rbbdcdb4 reac542b  
    22 awayonlock - plugin to set away status on screensaver activation 
    33 Copyright (C) 2009  Leo Antunes <leo@costela.net> 
    4   
     4 
    55 This program is free software; you can redistribute it and/or 
    66 modify it under the terms of the GNU General Public License 
    77 as published by the Free Software Foundation; either version 2 
    88 of the License, or (at your option) any later version. 
    9   
     9 
    1010 This program is distributed in the hope that it will be useful, 
    1111 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313 GNU General Public License for more details. 
    14   
     14 
    1515 You should have received a copy of the GNU General Public License 
    1616 along with this program; if not, write to the Free Software 
     
    4444        } 
    4545 
     46        gboolean available_only = purple_prefs_get_bool(AWAYONLOCK_PREF_AVAILABLE_ONLY); 
    4647 
    4748        PurpleSavedStatus *status_current = purple_savedstatus_get_current(); 
    4849 
    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)) { 
    5051                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)); 
    5253                purple_savedstatus_activate(status_idle); 
    5354        } 
     
    5758                status_saved = NULL; 
    5859        } 
     60        else { 
     61                purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("ignoring...\n")); 
     62        } 
    5963} 
    6064 
  • i18n/pidgin-awayonlock.pot

    rf61e5d9 reac542b  
    99"Project-Id-Version: PACKAGE VERSION\n" 
    1010"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" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     
    5050msgid "Default away status" 
    5151msgstr "" 
     52 
     53#: prefs.c:65 
     54msgid "Activate only if available" 
     55msgstr "" 
  • i18n/pt_BR.po

    rebf9132 reac542b  
    11# #-#-#-#-#  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>. 
    66# 
    77# #-#-#-#-#  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. 
    1212# 
    1313#, fuzzy 
     
    1616"Project-Id-Version: PACKAGE VERSION\n" 
    1717"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" 
    1919"PO-Revision-Date: 2009-01-31 22:13+0100\n" 
    2020"Last-Translator:  <leo@costela.net>\n" 
     
    2626"Plural-Forms: nplurals=2; plural=(n > 1);\n" 
    2727 
    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 
     29msgid "Failed to get a DBus connection." 
     30msgstr "Falha ao conseguir uma conexão DBus" 
    3531 
    3632#: awayonlock.c:77 
     
    3834msgstr "Falha ao criar um Proxy DBus" 
    3935 
    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 
     37msgid "Away-on-lock" 
    4638msgstr "" 
    4739 
     
    4941msgid "Sets you as away when your screensaver is activated" 
    5042msgstr "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" 
    5543 
    5644#: awayonlock.c:159 
     
    6149"Este plugin define o status atual como o status ausente padrão quando o " 
    6250"salva-tela é ativado" 
     51 
     52#: awayonlock.c:160 
     53msgid "Leo Antunes <leo@costela.net>" 
     54msgstr "" 
     55 
     56#: prefs.c:42 
     57msgid "Status to set on screensaver activation" 
     58msgstr "Status para usar quando o salva-tela for ativado" 
     59 
     60#: prefs.c:44 
     61msgid "Default away status" 
     62msgstr "Status ausente padrão" 
     63 
     64#: prefs.c:65 
     65msgid "Activate only if available" 
     66msgstr "Ativar somente quando disponível" 
  • prefs.c

    rbbdcdb4 reac542b  
    22 awayonlock - plugin to set away status on screensaver activation 
    33 Copyright (C) 2009  Leo Antunes <leo@costela.net> 
    4   
     4 
    55 This program is free software; you can redistribute it and/or 
    66 modify it under the terms of the GNU General Public License 
    77 as published by the Free Software Foundation; either version 2 
    88 of the License, or (at your option) any later version. 
    9   
     9 
    1010 This program is distributed in the hope that it will be useful, 
    1111 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313 GNU General Public License for more details. 
    14   
     14 
    1515 You should have received a copy of the GNU General Public License 
    1616 along with this program; if not, write to the Free Software 
     
    5454                        purple_plugin_pref_add_choice(ppref, (gchar *)purple_savedstatus_get_title(statuses->data), creation_time); 
    5555                        /* 
    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? 
    6058                         */ 
    6159                        //g_free(creation_time); 
     
    6462        purple_plugin_pref_frame_add(frame, ppref); 
    6563        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); 
    6667 
    6768        return frame; 
  • prefs.h

    rbbdcdb4 reac542b  
    22 awayonlock - plugin to set away status on screensaver activation 
    33 Copyright (C) 2009  Leo Antunes <leo@costela.net> 
    4   
     4 
    55 This program is free software; you can redistribute it and/or 
    66 modify it under the terms of the GNU General Public License 
    77 as published by the Free Software Foundation; either version 2 
    88 of the License, or (at your option) any later version. 
    9   
     9 
    1010 This program is distributed in the hope that it will be useful, 
    1111 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313 GNU General Public License for more details. 
    14   
     14 
    1515 You should have received a copy of the GNU General Public License 
    1616 along with this program; if not, write to the Free Software 
     
    2626#include <savedstatuses.h> 
    2727 
     28#define AWAYONLOCK_PREF_ROOT "/plugins/core/awayonlock" 
    2829#define AWAYONLOCK_PREF_STATUS "/plugins/core/awayonlock/status" 
     30#define AWAYONLOCK_PREF_AVAILABLE_ONLY "/plugins/core/awayonlock/available_only" 
    2931 
    3032PurplePluginPrefFrame* get_prefs_frame(PurplePlugin*);