Verified Commit da488d93 authored by Zander Brown's avatar Zander Brown

build: always use gtop

Was only optional for the flatpak build
parent b50df5ad
......@@ -24,11 +24,6 @@ conf.set_quoted('GETTEXT_PACKAGE', 'kgx')
conf.set_quoted('LOCALEDIR', prefix / get_option('localedir'))
conf.set_quoted('RES_PATH', '/org/gnome/zbrown/KingsCross/')
conf.set('BINDIR', prefix / get_option('bindir'))
if get_option('gtop')
conf.set('HAS_GTOP', 1)
else
conf.set('HAS_GTOP', 0)
endif
if get_option('generic')
conf.set('IS_GENERIC', 1)
else
......
option('gtop',
type: 'boolean',
value: true,
description: 'Use libgtop to track children, you probably DO want this')
option('gtk_doc',
type: 'boolean',
value: false,
......
......@@ -165,7 +165,7 @@ kgx_application_activate (GApplication *app)
gtk_window_present_with_time (window, timestamp);
}
#if HAS_GTOP
static gboolean
handle_watch_iter (gpointer pid,
gpointer val,
......@@ -250,14 +250,12 @@ watch (gpointer data)
return G_SOURCE_CONTINUE;
}
#endif
static inline void
set_watcher (KgxApplication *self, gboolean focused)
{
g_debug ("updated watcher focused? %s", focused ? "yes" : "no");
#if HAS_GTOP
if (self->timeout != 0) {
g_source_remove (self->timeout);
}
......@@ -267,7 +265,6 @@ set_watcher (KgxApplication *self, gboolean focused)
// Translators: This is the name of the timeout that looks for programs
// running in the terminal
g_source_set_name_by_id (self->timeout, _("child watcher"));
#endif
}
static void
......@@ -668,7 +665,7 @@ kgx_application_init (KgxApplication *self)
self->timeout = 0;
}
#if HAS_GTOP
/**
* kgx_application_add_watch:
* @self: the #KgxApplication
......@@ -720,7 +717,7 @@ kgx_application_remove_watch (KgxApplication *self,
g_warning ("Unknown process %i", pid);
}
}
#endif
/**
* kgx_application_get_font:
......
......@@ -90,13 +90,12 @@ struct _KgxApplication
G_DECLARE_FINAL_TYPE (KgxApplication, kgx_application, KGX, APPLICATION, GtkApplication)
#if HAS_GTOP
void kgx_application_add_watch (KgxApplication *self,
GPid pid,
KgxPage *page);
void kgx_application_remove_watch (KgxApplication *self,
GPid pid);
#endif
PangoFontDescription *kgx_application_get_font (KgxApplication *self);
void kgx_application_push_active (KgxApplication *self);
void kgx_application_pop_active (KgxApplication *self);
......
......@@ -824,7 +824,7 @@ kgx_page_get_id (KgxPage *self)
return priv->id;
}
#if HAS_GTOP
static inline KgxStatus
push_type (GHashTable *table,
GPid pid,
......@@ -840,7 +840,6 @@ push_type (GHashTable *table,
return status;
}
#endif
/**
......@@ -856,7 +855,6 @@ void
kgx_page_push_child (KgxPage *self,
KgxProcess *process)
{
#if HAS_GTOP
GtkStyleContext *context;
GPid pid = 0;
const char *exec = NULL;
......@@ -885,7 +883,6 @@ kgx_page_push_child (KgxPage *self,
priv->status = new_status;
g_object_notify_by_pspec (G_OBJECT (self), pspecs[PROP_PAGE_STATUS]);
}
#endif
}
......@@ -936,9 +933,7 @@ kgx_page_pop_child (KgxPage *self,
priv = kgx_page_get_instance_private (self);
context = gtk_widget_get_style_context (GTK_WIDGET (self));
#if HAS_GTOP
pid = kgx_process_get_pid (process);
#endif
new_status |= pop_type (priv->remote, pid, context, KGX_REMOTE);
new_status |= pop_type (priv->root, pid, context, KGX_PRIVILEGED);
......@@ -953,9 +948,8 @@ kgx_page_pop_child (KgxPage *self,
g_autoptr (GNotification) noti = NULL;
noti = g_notification_new (_("Command completed"));
#if HAS_GTOP
g_notification_set_body (noti, kgx_process_get_exec (process));
#endif
g_notification_set_default_action_and_target (noti,
"app.focus-page",
"u",
......
/* kgx-process-dummy.c
*
* Copyright 2019 Zander Brown
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kgx-process.h"
/*
* Provided to simplify gtop-free builds, does nothing and never will
*
* If the gtop-free build is working it should never even run
*/
void
kgx_process_unref (KgxProcess *self)
{
g_critical ("%s shouldn't be reached", G_STRLOC);
}
int
kgx_pid_cmp (gconstpointer a, gconstpointer b, gpointer data)
{
g_critical ("%s shouldn't be reached", G_STRLOC);
return 0;
}
......@@ -29,11 +29,6 @@ typedef struct _KgxProcess KgxProcess;
#define KGX_TYPE_PROCESS (kgx_process_get_type ())
/* The type itself is always defined but we hide the symbols
* when libgtop isn't used to highlight other places where things
* need to be #if HAS_GTOP
*/
#if HAS_GTOP
GTree *kgx_process_get_list (void);
KgxProcess *kgx_process_new (GPid pid);
GPid kgx_process_get_pid (KgxProcess *self);
......@@ -41,7 +36,6 @@ gint32 kgx_process_get_uid (KgxProcess *self);
gboolean kgx_process_get_is_root (KgxProcess *self);
GPid kgx_process_get_parent (KgxProcess *self);
const char *kgx_process_get_exec (KgxProcess *self);
#endif
GType kgx_process_get_type (void);
void kgx_process_unref (KgxProcess *self);
......
......@@ -78,9 +78,7 @@ started (GObject *src,
{
g_autoptr (GError) error = NULL;
KgxPage *page = KGX_PAGE (src);
#if HAS_GTOP
GtkApplication *app = NULL;
#endif
GPid pid;
pid = kgx_page_start_finish (page, res, &error);
......@@ -91,11 +89,9 @@ started (GObject *src,
error->message);
}
#if HAS_GTOP
app = gtk_window_get_application (GTK_WINDOW (win));
kgx_application_add_watch (KGX_APPLICATION (app), pid, page);
#endif
}
......@@ -274,7 +270,7 @@ kgx_window_finalize (GObject *object)
G_OBJECT_CLASS (kgx_window_parent_class)->finalize (object);
}
#if HAS_GTOP
static void
delete_response (GtkWidget *dlg,
int response,
......@@ -321,14 +317,6 @@ kgx_window_delete_event (GtkWidget *widget,
return TRUE; // Block the close
}
#else
static gboolean
kgx_window_delete_event (GtkWidget *widget,
GdkEventAny *event)
{
return FALSE; // Aka no, I don't want to block closing
}
#endif
static void
......
......@@ -19,6 +19,7 @@ kgx_sources = [
'kgx-close-dialog-row.h',
'kgx-window.c',
'kgx-window.h',
'kgx-process.c',
'kgx-process.h',
]
......@@ -26,6 +27,7 @@ kgx_deps = [
dependency('gio-2.0', version: '>= 2.58'),
dependency('gtk+-3.0', version: '>= 3.24'),
dependency('libhandy-0.0', version: '>= 0.0.11', fallback: ['handy', 'libhandy_dep']),
dependency('libgtop-2.0'),
cc.find_library('m', required: false),
]
......@@ -41,13 +43,6 @@ else
kgx_deps += [ideal_vte]
endif
if get_option('gtop')
kgx_deps += dependency('libgtop-2.0')
kgx_sources += 'kgx-process.c'
else
kgx_sources += 'kgx-process-dummy.c'
endif
kgx_sources += config_h
gnome = import('gnome')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment