~aleksandr-rakov/pantheon-dock/pantheon-dock

« back to all changes in this revision

Viewing changes to Plank/Plank.vala

  • Committer: Robert Dyer
  • Date: 2011-04-04 04:29:00 UTC
  • Revision ID: psybers@gmail.com-20110404042900-50xdby3ko1abyvph
start abstracting plank some so it can be extended by other docks

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
using Gtk;
19
19
using Unique;
20
20
 
 
21
using Plank.Factories;
21
22
using Plank.Services;
22
23
using Plank.Services.Windows;
23
24
using Plank.Widgets;
24
25
 
25
26
namespace Plank
26
27
{
27
 
        public class Plank : GLib.Object
 
28
        public class Plank : AbstractMain
28
29
        {
29
 
                [CCode (cheader_filename = "sys/prctl.h", cname = "prctl")]
30
 
                extern static int prctl (int option, string arg2, ulong arg3, ulong arg4, ulong arg5);
31
 
                
32
 
                struct utsname
33
 
                {
34
 
                        char sysname [65];
35
 
                        char nodename [65];
36
 
                        char release [65];
37
 
                        char version [65];
38
 
                        char machine [65];
39
 
                        char domainname [65];
40
 
                }
41
 
                
42
 
                [CCode (cheader_filename = "sys/utsname.h", cname = "uname")]
43
 
                extern static int uname (utsname buf);
44
 
                
45
 
                static bool DEBUG = false;
46
 
 
47
 
                const OptionEntry[] options = {
48
 
                        { "debug", 'd', 0, OptionArg.NONE, out DEBUG, "Enable debug logging", null },
49
 
                        { null }
50
 
                };
51
 
                
52
 
                static void sig_handler (int sig)
53
 
                {
54
 
                        Logger.warn<Plank> ("Caught signal (%d), exiting".printf (sig));
55
 
                        quit ();
56
 
                }
57
 
                
58
30
                public static int main (string[] args)
59
31
                {
 
32
                        var main_class = new Plank ();
 
33
                        Factory.init (main_class);
 
34
                        return main_class.start (args);
 
35
                }
 
36
                
 
37
                private int start (string[] args)
 
38
                {
60
39
                        // set program name
61
40
                        prctl (15, "plank", 0, 0, 0);
62
41
                        
111
90
                        return 0;
112
91
                }
113
92
                
114
 
                static void set_options ()
115
 
                {
116
 
                        if (DEBUG)
117
 
                                Logger.DisplayLevel = LogLevel.DEBUG;
118
 
                }
119
 
                
120
 
                public static void quit ()
 
93
                public override void quit ()
121
94
                {
122
95
                        Gtk.main_quit ();
123
96
                }
124
97
                
125
 
                public static void show_about ()
 
98
                public override void show_about ()
126
99
                {
127
100
                        var dlg = new AboutDialog ();
128
101