~ubuntu-branches/debian/jessie/systemd/jessie

« back to all changes in this revision

Viewing changes to src/systemadm.vala

  • Committer: Package Import Robot
  • Author(s): Tollef Fog Heen, Tollef Fog Heen, Michael Biebl
  • Date: 2012-04-03 19:59:17 UTC
  • mfrom: (1.1.10) (6.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20120403195917-l532urrbg4pkreas
Tags: 44-1
[ Tollef Fog Heen ]
* New upstream version.
  - Backport 3492207: journal: PAGE_SIZE is not known on ppc and other
    archs
  - Backport 5a2a2a1: journal: react with immediate rotation to a couple
    of more errors
  - Backport 693ce21: util: never follow symlinks in rm_rf_children()
    Fixes CVE-2012-1174, closes: #664364
* Drop output message from init-functions hook, it's pointless.
* Only rmdir /lib/init/rw if it exists.
* Explicitly order debian-fixup before sysinit.target to prevent a
  possible race condition with the creation of sockets.  Thanks to
  Michael Biebl for debugging this.
* Always restart the initctl socket on upgrades, to mask sysvinit
  removing it.

[ Michael Biebl ]
* Remove workaround for non-interactive sessions from pam config again.
* Create compat /dev/initctl symlink in case we are upgrading from a system
  running a newer version of sysvinit (using /run/initctl) and sysvinit is
  replaced with systemd-sysv during the upgrade. Closes: #663219
* Install new man pages.
* Build-Depend on valac (>= 0.12) instead of valac-0.12. Closes: #663323

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
static bool user = false;
25
25
 
 
26
public string format_time(uint64 time_ns) {
 
27
        if (time_ns <= 0)
 
28
                return "";
 
29
        Time timestamp = Time.local((time_t) (time_ns / 1000000));
 
30
        return timestamp.format("%a, %d %b %Y %H:%M:%S");
 
31
}
 
32
 
 
33
public void new_column(TreeView view, int column_id, string title) {
 
34
        TreeViewColumn col;
 
35
        col = new TreeViewColumn.with_attributes(title, new CellRendererText(), "text", column_id);
 
36
        col.set_sort_column_id(column_id);
 
37
        view.insert_column(col, -1);
 
38
}
 
39
 
26
40
public class LeftLabel : Label {
27
41
        public LeftLabel(string? text = null) {
28
42
                if (text != null)
32
46
        }
33
47
}
34
48
 
35
 
public class RightLabel : Label {
 
49
public class RightLabel : WrapLabel {
 
50
 
36
51
        public RightLabel(string? text = null) {
 
52
                set_selectable(true);
37
53
                set_text_or_na(text);
38
 
                set_alignment(0, 0);
39
 
                set_ellipsize(EllipsizeMode.START);
40
 
                set_selectable(true);
41
54
        }
42
55
 
43
56
        public void set_text_or_na(string? text = null) {
66
79
        private ListStore unit_model;
67
80
        private ListStore job_model;
68
81
 
 
82
        private Gee.HashMap<string, Unit> unit_map;
 
83
 
69
84
        private Button start_button;
70
85
        private Button stop_button;
71
86
        private Button restart_button;
81
96
        private Manager manager;
82
97
 
83
98
        private RightLabel unit_id_label;
84
 
        private RightLabel unit_aliases_label;
85
99
        private RightLabel unit_dependency_label;
86
100
        private RightLabel unit_description_label;
87
101
        private RightLabel unit_load_state_label;
99
113
        private RightLabel job_type_label;
100
114
 
101
115
        private ComboBox unit_type_combo_box;
 
116
        private CheckButton inactive_checkbox;
102
117
 
103
118
        public MainWindow() throws IOError {
104
119
                title = user ? "systemd User Service Manager" : "systemd System Manager";
123
138
                type_hbox.pack_start(unit_type_combo_box, false, false, 0);
124
139
                unit_vbox.pack_start(type_hbox, false, false, 0);
125
140
 
126
 
                unit_type_combo_box.append_text("Show All Units");
127
 
                unit_type_combo_box.append_text("Show Only Live Units");
 
141
                unit_type_combo_box.append_text("All unit types");
 
142
                unit_type_combo_box.append_text("Targets");
128
143
                unit_type_combo_box.append_text("Services");
129
 
                unit_type_combo_box.append_text("Sockets");
130
144
                unit_type_combo_box.append_text("Devices");
131
145
                unit_type_combo_box.append_text("Mounts");
132
146
                unit_type_combo_box.append_text("Automounts");
133
 
                unit_type_combo_box.append_text("Targets");
 
147
                unit_type_combo_box.append_text("Swaps");
 
148
                unit_type_combo_box.append_text("Sockets");
 
149
                unit_type_combo_box.append_text("Paths");
 
150
                unit_type_combo_box.append_text("Timers");
134
151
                unit_type_combo_box.append_text("Snapshots");
135
 
                unit_type_combo_box.set_active(1);
 
152
                unit_type_combo_box.set_active(0); // Show All
136
153
                unit_type_combo_box.changed.connect(unit_type_changed);
137
154
 
 
155
                inactive_checkbox = new CheckButton.with_label("inactive too");
 
156
                inactive_checkbox.toggled.connect(unit_type_changed);
 
157
                type_hbox.pack_start(inactive_checkbox, false, false, 0);
 
158
 
138
159
                unit_load_entry = new Entry();
139
160
                unit_load_button = new Button.with_mnemonic("_Load");
140
161
                unit_load_button.set_sensitive(false);
160
181
                unit_model = new ListStore(7, typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Unit));
161
182
                job_model = new ListStore(6, typeof(string), typeof(string), typeof(string), typeof(string), typeof(Job), typeof(uint32));
162
183
 
 
184
                unit_map = new Gee.HashMap<string, Unit>();
 
185
 
163
186
                TreeModelFilter unit_model_filter;
164
187
                unit_model_filter = new TreeModelFilter(unit_model, null);
165
188
                unit_model_filter.set_visible_func(unit_filter);
166
189
 
167
 
                unit_view = new TreeView.with_model(unit_model_filter);
 
190
                TreeModelSort unit_model_sort = new TreeModelSort.with_model(unit_model_filter);
 
191
 
 
192
                unit_view = new TreeView.with_model(unit_model_sort);
168
193
                job_view = new TreeView.with_model(job_model);
169
194
 
170
195
                unit_view.cursor_changed.connect(unit_changed);
171
196
                job_view.cursor_changed.connect(job_changed);
172
197
 
173
 
                unit_view.insert_column_with_attributes(-1, "Load State", new CellRendererText(), "text", 2);
174
 
                unit_view.insert_column_with_attributes(-1, "Active State", new CellRendererText(), "text", 3);
175
 
                unit_view.insert_column_with_attributes(-1, "Unit State", new CellRendererText(), "text", 4);
176
 
                unit_view.insert_column_with_attributes(-1, "Unit", new CellRendererText(), "text", 0);
177
 
                unit_view.insert_column_with_attributes(-1, "Job", new CellRendererText(), "text", 5);
 
198
                new_column(unit_view, 2, "Load State");
 
199
                new_column(unit_view, 3, "Active State");
 
200
                new_column(unit_view, 4, "Unit State");
 
201
                new_column(unit_view, 0, "Unit");
 
202
                new_column(unit_view, 5, "Job");
178
203
 
179
 
                job_view.insert_column_with_attributes(-1, "Job", new CellRendererText(), "text", 0);
180
 
                job_view.insert_column_with_attributes(-1, "Unit", new CellRendererText(), "text", 1);
181
 
                job_view.insert_column_with_attributes(-1, "Type", new CellRendererText(), "text", 2);
182
 
                job_view.insert_column_with_attributes(-1, "State", new CellRendererText(), "text", 3);
 
204
                new_column(job_view, 0, "Job");
 
205
                new_column(job_view, 1, "Unit");
 
206
                new_column(job_view, 2, "Type");
 
207
                new_column(job_view, 3, "State");
183
208
 
184
209
                ScrolledWindow scroll = new ScrolledWindow(null, null);
185
210
                scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
194
219
                job_vbox.pack_start(scroll, true, true, 0);
195
220
 
196
221
                unit_id_label = new RightLabel();
197
 
                unit_aliases_label = new RightLabel();
198
222
                unit_dependency_label = new RightLabel();
199
223
                unit_description_label = new RightLabel();
200
224
                unit_load_state_label = new RightLabel();
212
236
                job_type_label = new RightLabel();
213
237
 
214
238
                unit_dependency_label.set_track_visited_links(false);
215
 
                unit_dependency_label.set_selectable(false);
 
239
                unit_dependency_label.set_selectable(true);
216
240
                unit_dependency_label.activate_link.connect(on_activate_link);
217
241
 
218
242
                unit_fragment_path_label.set_track_visited_links(false);
229
253
 
230
254
                unit_table.attach(new LeftLabel("Id:"),                     0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
231
255
                unit_table.attach(unit_id_label,                            1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
232
 
                unit_table.attach(new LeftLabel("Aliases:"),                0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
233
 
                unit_table.attach(unit_aliases_label,                       1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
234
 
                unit_table.attach(new LeftLabel("Description:"),            0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
235
 
                unit_table.attach(unit_description_label,                   1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
236
 
                unit_table.attach(new LeftLabel("Dependencies:"),           0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
237
 
                unit_table.attach(unit_dependency_label,                    1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
238
 
                unit_table.attach(new LeftLabel("Fragment Path:"),          0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
239
 
                unit_table.attach(unit_fragment_path_label,                 1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
240
 
                unit_table.attach(new LeftLabel("Control Group:"),          0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
241
 
                unit_table.attach(unit_cgroup_label,                        1, 6, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
242
 
 
243
 
                unit_table.attach(new LeftLabel("Load State:"),             0, 1, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
244
 
                unit_table.attach(unit_load_state_label,                    1, 2, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
245
 
                unit_table.attach(new LeftLabel("Active State:"),           0, 1, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
246
 
                unit_table.attach(unit_active_state_label,                  1, 2, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
247
 
                unit_table.attach(new LeftLabel("Unit State:"),             0, 1, 8, 9, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
248
 
                unit_table.attach(unit_sub_state_label,                     1, 2, 8, 9, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
249
 
 
250
 
                unit_table.attach(new LeftLabel("Active Enter Timestamp:"), 2, 3, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
251
 
                unit_table.attach(unit_active_enter_timestamp_label,        3, 4, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
252
 
                unit_table.attach(new LeftLabel("Active Exit Timestamp:"),  2, 3, 8, 9, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
253
 
                unit_table.attach(unit_active_exit_timestamp_label,         3, 4, 8, 9, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
254
 
 
255
 
                unit_table.attach(new LeftLabel("Can Start/Stop:"),         4, 5, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
256
 
                unit_table.attach(unit_can_start_label,                     5, 6, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
257
 
                unit_table.attach(new LeftLabel("Can Reload:"),             4, 5, 8, 9, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
258
 
                unit_table.attach(unit_can_reload_label,                    5, 6, 8, 9, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
256
                unit_table.attach(new LeftLabel("Description:"),            0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
257
                unit_table.attach(unit_description_label,                   1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
258
                unit_table.attach(new LeftLabel("Dependencies:"),           0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
259
                unit_table.attach(unit_dependency_label,                    1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
260
                unit_table.attach(new LeftLabel("Fragment Path:"),          0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
261
                unit_table.attach(unit_fragment_path_label,                 1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
262
                unit_table.attach(new LeftLabel("Control Group:"),          0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
263
                unit_table.attach(unit_cgroup_label,                        1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
264
 
 
265
                unit_table.attach(new LeftLabel("Load State:"),             0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
266
                unit_table.attach(unit_load_state_label,                    1, 2, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
267
                unit_table.attach(new LeftLabel("Active State:"),           0, 1, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
268
                unit_table.attach(unit_active_state_label,                  1, 2, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
269
                unit_table.attach(new LeftLabel("Unit State:"),             0, 1, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
270
                unit_table.attach(unit_sub_state_label,                     1, 2, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
271
 
 
272
                unit_table.attach(new LeftLabel("Activated:"),              2, 3, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
273
                unit_table.attach(unit_active_enter_timestamp_label,        3, 4, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
274
                unit_table.attach(new LeftLabel("Deactivated:"),            2, 3, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
275
                unit_table.attach(unit_active_exit_timestamp_label,         3, 4, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
276
 
 
277
                unit_table.attach(new LeftLabel("Can Start/Stop:"),         4, 5, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
278
                unit_table.attach(unit_can_start_label,                     5, 6, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
279
                unit_table.attach(new LeftLabel("Can Reload:"),             4, 5, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
280
                unit_table.attach(unit_can_reload_label,                    5, 6, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
259
281
 
260
282
                job_table.attach(new LeftLabel("Id:"),                      0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
261
283
                job_table.attach(job_id_label,                              1, 2, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
333
355
                                        "org.freedesktop.systemd1",
334
356
                                        i.unit_path);
335
357
 
 
358
                        unit_map[i.id] = u;
 
359
 
336
360
                        unit_model.append(out iter);
337
361
                        unit_model.set(iter,
338
362
                                       0, i.id,
393
417
                return u;
394
418
        }
395
419
 
 
420
        public Unit? get_unit(string id) {
 
421
                return this.unit_map[id];
 
422
        }
 
423
 
396
424
        public void unit_changed() {
397
425
                Unit u = get_current_unit();
398
426
 
411
439
                restart_button.set_sensitive(false);
412
440
 
413
441
                unit_id_label.set_text_or_na();
414
 
                unit_aliases_label.set_text_or_na();
415
442
                unit_description_label.set_text_or_na();
416
443
                unit_description_label.set_text_or_na();
417
444
                unit_load_state_label.set_text_or_na();
425
452
                unit_cgroup_label.set_text_or_na();
426
453
        }
427
454
 
 
455
        public string format_unit_link(string i, bool link) {
 
456
                Unit? u = get_unit(i);
 
457
                if(u == null)
 
458
                        return "<span color='grey'>" + i + "</span";
 
459
 
 
460
                string color;
 
461
                switch (u.sub_state) {
 
462
                case "active": color = "blue"; break;
 
463
                case "dead": color = "red"; break;
 
464
                case "running": color = "green"; break;
 
465
                default: color = "black"; break;
 
466
                }
 
467
                string span = "<span underline='none' color='" + color + "'>"
 
468
                              + i + "(" +
 
469
                              u.sub_state + ")" + "</span>";
 
470
                if(link)
 
471
                        return  " <a href='" + i + "'>" + span + "</a>";
 
472
                else
 
473
                        return span;
 
474
        }
 
475
 
 
476
 
428
477
        public string make_dependency_string(string? prefix, string word, string[] dependencies) {
 
478
                Gee.Collection<unowned string> sorted = new Gee.TreeSet<string>();
 
479
                foreach (string i in dependencies)
 
480
                        sorted.add(i);
 
481
 
429
482
                bool first = true;
430
483
                string r;
431
484
 
434
487
                else
435
488
                        r = prefix;
436
489
 
437
 
                foreach (string i in dependencies) {
 
490
                foreach (string i in sorted) {
438
491
                        if (r != "")
439
492
                                r += first ? "\n" : ",";
440
493
 
441
494
                        if (first) {
442
 
                                r += word;
 
495
                                r += "<b>" + word + ":</b>";
443
496
                                first = false;
444
497
                        }
445
498
 
446
 
                        r += " <a href=\"" + i + "\">" + i + "</a>";
 
499
                        r += format_unit_link(i, true);
447
500
                }
448
501
 
449
502
                return r;
452
505
        public void show_unit(Unit unit) {
453
506
                current_unit_id = unit.id;
454
507
 
455
 
                unit_id_label.set_text_or_na(current_unit_id);
456
 
 
457
 
                string a = "";
 
508
                string id_display = format_unit_link(current_unit_id, false);
 
509
                bool has_alias = false;
458
510
                foreach (string i in unit.names) {
459
511
                        if (i == current_unit_id)
460
512
                                continue;
461
513
 
462
 
                        if (a == "")
463
 
                                a = i;
464
 
                        else
465
 
                                a += "\n" + i;
 
514
                        if (!has_alias) {
 
515
                                id_display += " (aliases:";
 
516
                                has_alias = true;
 
517
                        }
 
518
 
 
519
                        id_display += " " + i;
466
520
                }
 
521
                if(has_alias)
 
522
                        id_display += ")";
467
523
 
468
 
                unit_aliases_label.set_text_or_na(a);
 
524
                unit_id_label.set_markup_or_na(id_display);
469
525
 
470
526
                string[]
471
527
                        requires = unit.requires,
511
567
 
512
568
                string fp = unit.fragment_path;
513
569
                if (fp != "")
514
 
                        unit_fragment_path_label.set_markup_or_na("<a href=\"file://" + fp +"\">" + fp + "</a>" );
 
570
                        unit_fragment_path_label.set_markup_or_na(
 
571
                                "<a href=\"file://" + fp +"\">" +
 
572
                                "<span underline='none' color='black'>" + fp + "</span></a>");
515
573
                else
516
574
                        unit_fragment_path_label.set_text_or_na();
517
575
 
518
 
                uint64 t = unit.active_enter_timestamp;
519
 
                if (t > 0) {
520
 
                        Time timestamp = Time.local((time_t) (t / 1000000));
521
 
                        unit_active_enter_timestamp_label.set_text_or_na(timestamp.format("%a, %d %b %Y %H:%M:%S %z"));
522
 
                } else
523
 
                        unit_active_enter_timestamp_label.set_text_or_na();
524
 
 
525
 
                t = unit.active_exit_timestamp;
526
 
                if (t > 0) {
527
 
                        Time timestamp = Time.local((time_t) (t / 1000000));
528
 
                        unit_active_exit_timestamp_label.set_text_or_na(timestamp.format("%a, %d %b %Y %H:%M:%S %z"));
529
 
                } else
530
 
                        unit_active_exit_timestamp_label.set_text_or_na();
 
576
 
 
577
                unit_active_enter_timestamp_label.set_text_or_na(format_time(unit.active_enter_timestamp));
 
578
 
 
579
                unit_active_exit_timestamp_label.set_text_or_na(format_time(unit.active_exit_timestamp));
531
580
 
532
581
                bool b = unit.can_start;
533
582
                start_button.set_sensitive(b);
596
645
 
597
646
                try {
598
647
                        u.start("replace");
599
 
                } catch (IOError e) {
 
648
                } catch (Error e) {
600
649
                        show_error(e.message);
601
650
                }
602
651
        }
609
658
 
610
659
                try {
611
660
                        u.stop("replace");
612
 
                } catch (IOError e) {
 
661
                } catch (Error e) {
613
662
                        show_error(e.message);
614
663
                }
615
664
        }
622
671
 
623
672
                try {
624
673
                        u.reload("replace");
625
 
                } catch (IOError e) {
 
674
                } catch (Error e) {
626
675
                        show_error(e.message);
627
676
                }
628
677
        }
635
684
 
636
685
                try {
637
686
                        u.restart("replace");
638
 
                } catch (IOError e) {
 
687
                } catch (Error e) {
639
688
                        show_error(e.message);
640
689
                }
641
690
        }
648
697
 
649
698
                try {
650
699
                        j.cancel();
651
 
                } catch (IOError e) {
 
700
                } catch (Error e) {
652
701
                        show_error(e.message);
653
702
                }
654
703
        }
676
725
                                       4, u.sub_state,
677
726
                                       5, t != "" ? "→ %s".printf(t) : "",
678
727
                                       6, u);
679
 
                } catch (IOError e) {
 
728
                } catch (Error e) {
680
729
                        show_error(e.message);
681
730
                }
682
731
        }
699
748
                                        "org.freedesktop.systemd1",
700
749
                                        path);
701
750
 
 
751
                        unit_map[id] = u;
 
752
 
702
753
                        update_unit_iter(iter, id, u);
703
 
                } catch (IOError e) {
 
754
                } catch (Error e) {
704
755
                        show_error(e.message);
705
756
                }
706
757
        }
736
787
 
737
788
                        update_job_iter(iter, id, j);
738
789
 
739
 
                } catch (IOError e) {
 
790
                } catch (Error e) {
740
791
                        show_error(e.message);
741
792
                }
742
793
        }
760
811
                        }
761
812
 
762
813
                } while (unit_model.iter_next(ref iter));
 
814
 
 
815
                unit_map.unset(id);
763
816
        }
764
817
 
765
818
        public void on_job_removed(uint32 id, ObjectPath path, string res) {
816
869
 
817
870
                        } while (unit_model.iter_next(ref iter));
818
871
 
819
 
                } catch (IOError e) {
 
872
                } catch (Error e) {
820
873
                        show_error(e.message);
821
874
                }
822
875
        }
852
905
 
853
906
                        } while (job_model.iter_next(ref iter));
854
907
 
855
 
                } catch (IOError e) {
 
908
                } catch (Error e) {
856
909
                        show_error(e.message);
857
910
                }
858
911
        }
865
918
                if (id == null)
866
919
                        return false;
867
920
 
 
921
                if (!inactive_checkbox.get_active()
 
922
                    && active_state == "inactive" && job == "")
 
923
                        return false;
 
924
 
868
925
                switch (unit_type_combo_box.get_active()) {
869
 
 
870
 
                        case 0:
871
 
                                return true;
872
 
 
873
 
                        case 1:
874
 
                                return active_state != "inactive" || job != "";
875
 
 
876
 
                        case 2:
877
 
                                return id.has_suffix(".service");
878
 
 
879
 
                        case 3:
880
 
                                return id.has_suffix(".socket");
881
 
 
882
 
                        case 4:
883
 
                                return id.has_suffix(".device");
884
 
 
885
 
                        case 5:
886
 
                                return id.has_suffix(".mount");
887
 
 
888
 
                        case 6:
889
 
                                return id.has_suffix(".automount");
890
 
 
891
 
                        case 7:
892
 
                                return id.has_suffix(".target");
893
 
 
894
 
                        case 8:
895
 
                                return id.has_suffix(".snapshot");
 
926
                case 0:
 
927
                        return true;
 
928
                case 1:
 
929
                        return id.has_suffix(".target");
 
930
                case 2:
 
931
                        return id.has_suffix(".service");
 
932
                case 3:
 
933
                        return id.has_suffix(".device");
 
934
                case 4:
 
935
                        return id.has_suffix(".mount");
 
936
                case 5:
 
937
                        return id.has_suffix(".automount");
 
938
                case 6:
 
939
                        return id.has_suffix(".swap");
 
940
                case 7:
 
941
                        return id.has_suffix(".socket");
 
942
                case 8:
 
943
                        return id.has_suffix(".path");
 
944
                case 9:
 
945
                        return id.has_suffix(".timer");
 
946
                case 10:
 
947
                        return id.has_suffix(".snapshot");
 
948
                default:
 
949
                        assert(false);
 
950
                        return false;
896
951
                }
897
 
 
898
 
                return false;
899
952
        }
900
953
 
901
954
        public void unit_type_changed() {
902
 
                TreeModelFilter model = (TreeModelFilter) unit_view.get_model();
 
955
                TreeModelFilter model = (TreeModelFilter) ((TreeModelSort) unit_view.get_model()).get_model();
903
956
 
904
957
                model.refilter();
905
958
        }
907
960
        public void on_server_reload() {
908
961
                try {
909
962
                        manager.reload();
910
 
                } catch (IOError e) {
 
963
                } catch (Error e) {
911
964
                        show_error(e.message);
912
965
                }
913
966
        }
919
972
                        if (unit_type_combo_box.get_active() != 0)
920
973
                                unit_type_combo_box.set_active(8);
921
974
 
922
 
                } catch (IOError e) {
 
975
                } catch (Error e) {
923
976
                        show_error(e.message);
924
977
                }
925
978
        }
948
1001
                        m.destroy();
949
1002
 
950
1003
                        show_unit(u);
951
 
                } catch (IOError e) {
 
1004
                } catch (Error e) {
952
1005
                        show_error(e.message);
953
1006
                }
954
1007
        }
968
1021
                                        path);
969
1022
 
970
1023
                        show_unit(u);
971
 
                } catch (IOError e) {
 
1024
                } catch (Error e) {
972
1025
                        show_error(e.message);
973
1026
                }
974
1027