source: trunk/gtk/notify.c @ 12676

Last change on this file since 12676 was 12676, checked in by jordan, 10 years ago

(trunk gtk) remove some unnecessary #includes

  • Property svn:keywords set to Date Rev Author Id
File size: 1.5 KB
Line 
1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2. Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: notify.c 12676 2011-08-13 14:19:40Z jordan $
11 */
12
13#include <glib/gi18n.h>
14#include "conf.h"
15#include "notify.h"
16#include "tr-prefs.h"
17
18void
19gtr_notify_torrent_completed( TrCore * core, int torrent_id )
20{
21    if( gtr_pref_flag_get( PREF_KEY_TORRENT_COMPLETE_SOUND_ENABLED ) )
22    {
23        const char * cmd = gtr_pref_string_get( PREF_KEY_TORRENT_COMPLETE_SOUND_COMMAND );
24        g_spawn_command_line_async( cmd, NULL );
25    }
26
27    if( gtr_pref_flag_get( PREF_KEY_TORRENT_COMPLETE_NOTIFICATION_ENABLED ) )
28    {
29        const tr_torrent * tor = gtr_core_find_torrent( core, torrent_id );
30        const char * fmt = gtr_pref_string_get( PREF_KEY_TORRENT_COMPLETE_NOTIFICATION_COMMAND );
31        char * cmd = g_strdup_printf( fmt, _( "Torrent Complete" ), ( tor ? tr_torrentName( tor ) : "" ) );
32        g_spawn_command_line_async( cmd, NULL );
33        g_free( cmd );
34    }
35}
36
37void
38gtr_notify_torrent_added( const char * name )
39{
40    if( gtr_pref_flag_get( PREF_KEY_TORRENT_ADDED_NOTIFICATION_ENABLED ) )
41    {
42        const char * fmt = gtr_pref_string_get( PREF_KEY_TORRENT_ADDED_NOTIFICATION_COMMAND );
43        char * cmd = g_strdup_printf( fmt, _( "Torrent Added" ), name );
44        g_spawn_command_line_async( cmd, NULL );
45        g_free( cmd );
46    }
47}
Note: See TracBrowser for help on using the repository browser.