Show
Ignore:
Timestamp:
07/22/09 23:26:25 (3 years ago)
Author:
Leo Antunes <leo@…>
Children:
d1a41d2b9e8293b7310d616fd8ccd24ddf38d9be
Parents:
c5606aa8a15998dd28faee8a3141cb8ac83b8d24
git-committer:
Leo Antunes <leo@…> (07/22/09 23:26:25)
Message:

KScreensaver support + close DBus on load error

- support KScreensaver (thanks Daniel Eckl for pointing out

that it indeed DOES use DBus)

- correct description to include current functionality
- avoid dangling DBus connection on error during load

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • awayonlock.c

    reac542b re3cc7b2  
    2121#define PURPLE_PLUGINS 
    2222 
    23 #define AWAYONLOCK_VERSION "0.3" 
     23#define AWAYONLOCK_VERSION "0.4" 
    2424#define AWAYONLOCK_PLUGIN_ID "core-costela-awayonlock" 
    2525 
     
    4848 
    4949static gboolean plugin_load(PurplePlugin *plugin) { 
     50        DBusGProxy *dbus_proxy_gnome = NULL; 
    5051        DBusGProxy *dbus_proxy = NULL; 
    5152        GError *error = NULL; 
     
    6566 
    6667        /* 
    67          * Gnome-screensaver specific stuff 
    68          */ 
    69         dbus_proxy = dbus_g_proxy_new_for_name( dbus_conn, 
     68         * Gnome-screensaver 2.26 specific stuff 
     69         */ 
     70        dbus_proxy_gnome = dbus_g_proxy_new_for_name( dbus_conn, 
    7071                        "org.gnome.ScreenSaver", 
    7172                        "/org/gnome/ScreenSaver", 
     
    7374                        ); 
    7475 
     76        if(dbus_proxy_gnome == NULL) { 
     77                purple_debug(PURPLE_DEBUG_ERROR, PACKAGE, N_("failed to get DBus proxy\n")); 
     78                purple_notify_error(plugin, "Away-on-lock", _("Failed to create a DBus Proxy."), NULL); 
     79                dbus_g_connection_unref(dbus_conn); 
     80                return FALSE; 
     81        } 
     82 
     83        dbus_g_proxy_add_signal( dbus_proxy_gnome, 
     84                        "ActiveChanged", 
     85                        G_TYPE_BOOLEAN, 
     86                        G_TYPE_INVALID 
     87                        ); 
     88 
     89        dbus_g_proxy_connect_signal( dbus_proxy_gnome, 
     90                        "ActiveChanged", 
     91                        G_CALLBACK(awayonlock_idle_changed_callback), 
     92                        NULL, 
     93                        NULL 
     94                        ); 
     95        /* 
     96         * END Gnome-screensaver specific stuff 
     97         */ 
     98 
     99        /* 
     100         * freedesktop stuff 
     101         */ 
     102        dbus_proxy = dbus_g_proxy_new_for_name( dbus_conn, 
     103                        "org.freedesktop.ScreenSaver", 
     104                        "/ScreenSaver", 
     105                        "org.freedesktop.ScreenSaver" 
     106                        ); 
     107 
    75108        if(dbus_proxy == NULL) { 
    76109                purple_debug(PURPLE_DEBUG_ERROR, PACKAGE, N_("failed to get DBus proxy\n")); 
    77110                purple_notify_error(plugin, "Away-on-lock", _("Failed to create a DBus Proxy."), NULL); 
    78  
     111                dbus_g_connection_unref(dbus_conn); 
    79112                return FALSE; 
    80113        } 
     
    93126                        ); 
    94127        /* 
    95          * END Gnome-screensaver specific stuff 
     128         * END freedesktop stuff 
    96129         */ 
    97130 
     
    156189 
    157190        info.name = _("Away-on-lock"); 
    158         info.summary = _("Sets you as away when your screensaver is activated"); 
    159         info.description = _("This plugin sets your status to the default away status whenever your screensaver gets activated."); 
     191        info.summary = _("Changes your status when your screensaver gets activated"); 
     192        info.description = _("This plugin changes your status to a preselected saved status or the default away status whenever your screensaver gets activated. It doesn't interfere if you're already marked as auto-away and can also avoid changing your status if you've manually marked yourself as any non-available status."); 
    160193        info.author = _("Leo Antunes <leo@costela.net>"); 
    161194