|
|
e43452d |
From 6c8061acd30f7cb604953dd75f00bb8f8cc7323b Mon Sep 17 00:00:00 2001
|
|
|
e43452d |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
e43452d |
Date: Thu, 3 Mar 2011 20:54:01 +0100
|
|
|
f1996ec |
Subject: [PATCH] systemadm: add libgee as dependency and use it for a unit
|
|
|
f1996ec |
map (cherry picked from commit
|
|
|
e43452d |
11216eb0bd5aab6b14af004fd2f24d423e3d356d)
|
|
|
e43452d |
|
|
|
e43452d |
---
|
|
|
e43452d |
Makefile.am | 1 +
|
|
|
e43452d |
configure.ac | 2 +-
|
|
|
e43452d |
src/systemadm.vala | 14 ++++++++++++++
|
|
|
e43452d |
3 files changed, 16 insertions(+), 1 deletions(-)
|
|
|
e43452d |
|
|
|
e43452d |
diff --git a/Makefile.am b/Makefile.am
|
|
|
e43452d |
index 54bccb5..4416ab7 100644
|
|
|
e43452d |
--- a/Makefile.am
|
|
|
e43452d |
+++ b/Makefile.am
|
|
|
e43452d |
@@ -1440,6 +1440,7 @@ systemadm_CFLAGS = \
|
|
|
e43452d |
systemadm_VALAFLAGS = \
|
|
|
e43452d |
--pkg=posix \
|
|
|
e43452d |
--pkg=gtk+-2.0 \
|
|
|
e43452d |
+ --pkg=gee-1.0 \
|
|
|
e43452d |
-g
|
|
|
e43452d |
|
|
|
e43452d |
systemadm_LDADD = \
|
|
|
e43452d |
diff --git a/configure.ac b/configure.ac
|
|
|
e43452d |
index 0ec6f69..56b7d7a 100644
|
|
|
e43452d |
--- a/configure.ac
|
|
|
e43452d |
+++ b/configure.ac
|
|
|
e43452d |
@@ -327,7 +327,7 @@ AM_CONDITIONAL(ENABLE_LOCALED, [test "$have_localed" = "yes"])
|
|
|
e43452d |
have_gtk=no
|
|
|
e43452d |
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
|
|
|
e43452d |
if test "x$enable_gtk" != "xno"; then
|
|
|
e43452d |
- PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
|
|
|
e43452d |
+ PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 gee-1.0],
|
|
|
e43452d |
[AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
|
|
|
e43452d |
AC_SUBST(GTK_CFLAGS)
|
|
|
e43452d |
AC_SUBST(GTK_LIBS)
|
|
|
e43452d |
diff --git a/src/systemadm.vala b/src/systemadm.vala
|
|
|
e43452d |
index 68652d0..c893da0 100644
|
|
|
e43452d |
--- a/src/systemadm.vala
|
|
|
e43452d |
+++ b/src/systemadm.vala
|
|
|
e43452d |
@@ -79,6 +79,8 @@ public class MainWindow : Window {
|
|
|
e43452d |
private ListStore unit_model;
|
|
|
e43452d |
private ListStore job_model;
|
|
|
e43452d |
|
|
|
e43452d |
+ private Gee.HashMap<string, Unit> unit_map;
|
|
|
e43452d |
+
|
|
|
e43452d |
private Button start_button;
|
|
|
e43452d |
private Button stop_button;
|
|
|
e43452d |
private Button restart_button;
|
|
|
e43452d |
@@ -180,6 +182,8 @@ public class MainWindow : Window {
|
|
|
e43452d |
unit_model = new ListStore(7, typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Unit));
|
|
|
e43452d |
job_model = new ListStore(6, typeof(string), typeof(string), typeof(string), typeof(string), typeof(Job), typeof(uint32));
|
|
|
e43452d |
|
|
|
e43452d |
+ unit_map = new Gee.HashMap<string, Unit>();
|
|
|
e43452d |
+
|
|
|
e43452d |
TreeModelFilter unit_model_filter;
|
|
|
e43452d |
unit_model_filter = new TreeModelFilter(unit_model, null);
|
|
|
e43452d |
unit_model_filter.set_visible_func(unit_filter);
|
|
|
e43452d |
@@ -355,6 +359,8 @@ public class MainWindow : Window {
|
|
|
e43452d |
"org.freedesktop.systemd1",
|
|
|
e43452d |
i.unit_path);
|
|
|
e43452d |
|
|
|
e43452d |
+ unit_map[i.id] = u;
|
|
|
e43452d |
+
|
|
|
e43452d |
unit_model.append(out iter);
|
|
|
e43452d |
unit_model.set(iter,
|
|
|
e43452d |
0, i.id,
|
|
|
e43452d |
@@ -415,6 +421,10 @@ public class MainWindow : Window {
|
|
|
e43452d |
return u;
|
|
|
e43452d |
}
|
|
|
e43452d |
|
|
|
e43452d |
+ public Unit? get_unit(string id) {
|
|
|
e43452d |
+ return this.unit_map[id];
|
|
|
e43452d |
+ }
|
|
|
e43452d |
+
|
|
|
e43452d |
public void unit_changed() {
|
|
|
e43452d |
Unit u = get_current_unit();
|
|
|
e43452d |
|
|
|
e43452d |
@@ -712,6 +722,8 @@ public class MainWindow : Window {
|
|
|
e43452d |
"org.freedesktop.systemd1",
|
|
|
e43452d |
path);
|
|
|
e43452d |
|
|
|
e43452d |
+ unit_map[id] = u;
|
|
|
e43452d |
+
|
|
|
e43452d |
update_unit_iter(iter, id, u);
|
|
|
e43452d |
} catch (IOError e) {
|
|
|
e43452d |
show_error(e.message);
|
|
|
e43452d |
@@ -773,6 +785,8 @@ public class MainWindow : Window {
|
|
|
e43452d |
}
|
|
|
e43452d |
|
|
|
e43452d |
} while (unit_model.iter_next(ref iter));
|
|
|
e43452d |
+
|
|
|
e43452d |
+ unit_map.unset(id);
|
|
|
e43452d |
}
|
|
|
e43452d |
|
|
|
e43452d |
public void on_job_removed(uint32 id, ObjectPath path, string res) {
|
|
|
e43452d |
--
|
|
|
e43452d |
1.7.7.5
|
|
|
e43452d |
|