Show
Ignore:
Timestamp:
19/07/09 00:21:28 (3 years ago)
Author:
Leo Antunes <leo@…>
Children:
c5606aa8a15998dd28faee8a3141cb8ac83b8d24
Parents:
ebf9132bb918ff995e2b561867be329ec3e9a9ee
git-committer:
Leo Antunes <leo@…> (19/07/09 00:21:28)
Message:

add option to activate only if Available

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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