~ubuntu-branches/ubuntu/saucy/amsn/saucy

« back to all changes in this revision

Viewing changes to plugins/movewin/movewin.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2010-04-13 23:21:29 UTC
  • mfrom: (1.1.11 upstream) (3.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100413232129-vgpx20brdd2qavs7
Tags: 0.98.3-0ubuntu1
* Merge from Debian unstable (LP: #449072), remaining Ubuntu changes:
  - add 08_use_aplay_for_sound.dpatch patch by Festor Wailon Dacoba to use
    aplay to play sounds
  + debian/control:
    - modify iceweasel to firefox | abrowser in amsn Suggests field
    - add xdg-utils and gstreamer0.10-nice to amsn Depends field
    - mofify sox to alsa-utils in amsn Suggests field as we are now using
      aplay
* New upstream release (LP: #562619), tarball repacked according to
  debian/README.source.
* Fix missing-debian-source-format lintian warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
namespace eval ::movewin {
 
2
        variable config
 
3
        variable configlist
 
4
 
 
5
        proc Init { dir } {
 
6
                ::plugins::RegisterPlugin movewin
 
7
                ::plugins::RegisterEvent movewin new_chatwindow move
 
8
                ::plugins::RegisterEvent movewin chat_msg_received message
 
9
 
 
10
                array set ::movewin::config {
 
11
                        x {0}
 
12
                        y {0}
 
13
                        state {}
 
14
                        make_normal 0
 
15
                }
 
16
 
 
17
                set ::movewin::configlist [list \
 
18
                        [list str "x position" x] \
 
19
                        [list str "y position" y] \
 
20
                        [list bool "Deiconify window when messages are received" make_normal] \
 
21
                        [list str "only in states (blank for any)" state] \
 
22
                ]
 
23
        }
 
24
 
 
25
        proc ::movewin::on { } {
 
26
                global automessage
 
27
 
 
28
                if { $::movewin::config(state) == "" } {
 
29
                        return 1
 
30
                }
 
31
 
 
32
                if { [info exists automessage] && $automessage != -1 \
 
33
                        && [lsearch $::movewin::config(state) [lindex $automessage 0]] >=0 \
 
34
                   } {
 
35
                        return 1
 
36
                } else {
 
37
                        return 0
 
38
                }               
 
39
        }
 
40
 
 
41
        proc ::movewin::move { event epvar } {
 
42
                upvar 2 $epvar vars
 
43
 
 
44
                set w [winfo toplevel $vars(win)]
 
45
                after idle [list ::movewin::move_delayed $w]
 
46
        }
 
47
 
 
48
        proc ::movewin::move_delayed {w } {
 
49
                if { [winfo exists $w] && [::movewin::on] } {
 
50
                        wm geometry $w +$::movewin::config(x)+$::movewin::config(y)
 
51
                        if { $::movewin::config(make_normal) } {
 
52
                                wm state $w normal
 
53
                        }
 
54
                }
 
55
        }
 
56
 
 
57
        proc ::movewin::message { event epvar } {
 
58
                upvar 2 $epvar vars
 
59
                upvar 2 $vars(chatid) chatid
 
60
 
 
61
                set w [winfo toplevel [::ChatWindow::For $chatid]]
 
62
                if { [::movewin::on] && $::movewin::config(make_normal)} {
 
63
                        wm state $w normal
 
64
                }
 
65
        }
 
66
}
 
 
b'\\ No newline at end of file'