Changeset 826d0d375e42d8e4018950dd84b37689b3f666fa

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

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r7bfa81d r826d0d3  
    88set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Wall" CACHE STRING "" FORCE) 
    99 
    10 add_library(awayonlock SHARED awayonlock.c) 
     10add_library(awayonlock SHARED awayonlock.c callback.c) 
    1111install(TARGETS awayonlock LIBRARY DESTINATION lib/pidgin NAMELINK_SKIP) 
    1212 
  • ChangeLog

    r7bfa81d r826d0d3  
     1Version 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 
    17Version 0.1 (2009-01-31): 
    28 
  • awayonlock.c

    r6b1d64a r826d0d3  
    2424#define AWAYONLOCK_PLUGIN_ID "core-costela-awayonlock" 
    2525 
    26 #include <stdio.h> 
    27 #include <stdlib.h> 
    28  
    2926#include <dbus/dbus-glib.h> 
    3027 
     
    3431#include <version.h> 
    3532#include <notify.h> 
    36 #include <savedstatuses.h> 
    3733 
    3834#include "i18n.h" 
     35#include "callback.h" 
    3936 
    4037static 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 } 
    6338 
    6439static gboolean plugin_load(PurplePlugin *plugin) { 
     
    7146         
    7247        dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error); 
    73         //dbus_conn = dbus_connection_get_g_connection(purple_dbus_get_connection()); 
    7448         
    7549        if(dbus_conn == NULL) {  
     
    11488} 
    11589 
    116 static void init_plugin(PurplePlugin *plugin) 
    117 { 
    118 } 
    119  
    12090static PurplePluginInfo info = { 
    12191        PURPLE_PLUGIN_MAGIC, 
     
    12999 
    130100        AWAYONLOCK_PLUGIN_ID, 
    131         N_("Away-on-lock"), 
     101        0, 
    132102        AWAYONLOCK_VERSION, 
    133103 
    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, 
    137107        N_("http://costela.net/projects/away-on-lock"), 
    138108         
     
    151121}; 
    152122 
     123static 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 
    153133PURPLE_INIT_PLUGIN(awayonlock, init_plugin, info); 
    154134 
  • i18n.h

    r7bfa81d r826d0d3  
    1919*/ 
    2020 
    21 #ifndef _AWAYONLOCK_I18N 
    22 #define _AWAYONLOCK_I18N 
     21#ifndef _AWAYONLOCK_I18N_H 
     22#define _AWAYONLOCK_I18N_H 
    2323 
    2424#ifdef ENABLE_NLS 
  • i18n/pidgin-awayonlock.pot

    r7bfa81d r826d0d3  
    99"Project-Id-Version: PACKAGE VERSION\n" 
    1010"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" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     
    1717"Content-Transfer-Encoding: 8bit\n" 
    1818 
    19 #: awayonlock.c:88 
     19#: awayonlock.c:125 
     20msgid "Away-on-lock" 
     21msgstr "" 
     22 
     23#: awayonlock.c:62 
    2024msgid "Failed to create a DBus Proxy." 
    2125msgstr "" 
    2226 
    23 #: awayonlock.c:76 
     27#: awayonlock.c:50 
    2428msgid "Failed to get a DBus connection." 
    2529msgstr "" 
     30 
     31#: awayonlock.c:128 
     32msgid "Leo Antunes <leo@costela.net>" 
     33msgstr "" 
     34 
     35#: awayonlock.c:126 
     36msgid "Sets you as away when your screensaver is activated" 
     37msgstr "" 
     38 
     39#: awayonlock.c:127 
     40msgid "" 
     41"This plugin sets your status to the default away status whenever your " 
     42"screensaver gets activated." 
     43msgstr "" 
  • i18n/pt_BR.po

    r7bfa81d r826d0d3  
    88"Project-Id-Version: PACKAGE VERSION\n" 
    99"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" 
    1111"PO-Revision-Date: 2009-01-31 22:13+0100\n" 
    1212"Last-Translator:  <leo@costela.net>\n" 
     
    1717"Plural-Forms: nplurals=2; plural=(n > 1);\n" 
    1818 
    19 #: awayonlock.c:88 
     19#: awayonlock.c:125 
     20msgid "Away-on-lock" 
     21msgstr "" 
     22 
     23#: awayonlock.c:62 
    2024msgid "Failed to create a DBus Proxy." 
    2125msgstr "Falha ao criar um Proxy DBus" 
    2226 
    23 #: awayonlock.c:76 
     27#: awayonlock.c:50 
    2428msgid "Failed to get a DBus connection." 
    2529msgstr "Falha ao conseguir uma conexão DBus" 
     30 
     31#: awayonlock.c:128 
     32msgid "Leo Antunes <leo@costela.net>" 
     33msgstr "" 
     34 
     35#: awayonlock.c:126 
     36msgid "Sets you as away when your screensaver is activated" 
     37msgstr "Define status como ausente quando o salva-tela é ativado" 
     38 
     39#: awayonlock.c:127 
     40msgid "" 
     41"This plugin sets your status to the default away status whenever your " 
     42"screensaver gets activated." 
     43msgstr "Este plugin define o status atual como o status ausente padrão quando o salva-tela é ativado"