summaryrefslogtreecommitdiff
path: root/libmdock/app-id.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmdock/app-id.c')
-rw-r--r--libmdock/app-id.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libmdock/app-id.c b/libmdock/app-id.c
index b54ed6c..6ea456a 100644
--- a/libmdock/app-id.c
+++ b/libmdock/app-id.c
@@ -49,10 +49,15 @@ void app_id_destroy(AppId *appid)
g_slice_free(AppId, appid);
}
+static inline guint str_hash0(const gchar *s)
+{
+ return s ? g_str_hash(s) : 0;
+}
+
guint app_id_hash(gconstpointer appid_pointer)
{
const AppId *appid = appid_pointer;
- return g_str_hash(appid->host) + appid->uid + g_str_hash(appid->executable) + g_str_hash(appid->wm_class_class) + g_str_hash(appid->wm_class_name);
+ return str_hash0(appid->host) + appid->uid + str_hash0(appid->executable) + str_hash0(appid->wm_class_class) + str_hash0(appid->wm_class_name);
}
gboolean app_id_equal(gconstpointer ap, gconstpointer bp)
@@ -155,3 +160,12 @@ AppId * app_id_from_window(WnckWindow *window)
return appid;
}
+
+gboolean app_id_is_local_user(AppId *appid)
+{
+ if (appid->host && !is_local_host(appid->host)) {
+ return FALSE;
+ }
+
+ return appid->uid == getuid();
+}