gnome-system-monitor/gnome-system-monitor-2.21.92-system-tab-arg.patch

90 lines
3.2 KiB
Diff

diff -up gnome-system-monitor-2.21.92/src/procman.h.system-tab-arg gnome-system-monitor-2.21.92/src/procman.h
--- gnome-system-monitor-2.21.92/src/procman.h.system-tab-arg 2008-03-08 10:18:31.000000000 -0500
+++ gnome-system-monitor-2.21.92/src/procman.h 2008-03-08 10:18:31.000000000 -0500
@@ -58,6 +58,7 @@ enum
static const unsigned MIN_UPDATE_INTERVAL = 1 * 1000;
static const unsigned MAX_UPDATE_INTERVAL = 100 * 1000;
+#define SHOW_SYSTEM_TAB_CMD "SHOWSYSTAB" /* elegant, eh */
enum ProcmanTab
{
diff -up gnome-system-monitor-2.21.92/src/procman.cpp.system-tab-arg gnome-system-monitor-2.21.92/src/procman.cpp
--- gnome-system-monitor-2.21.92/src/procman.cpp.system-tab-arg 2008-03-08 10:18:31.000000000 -0500
+++ gnome-system-monitor-2.21.92/src/procman.cpp 2008-03-08 10:36:19.000000000 -0500
@@ -626,14 +626,20 @@ cb_server (const gchar *msg, gpointer us
{
GdkWindow *window;
ProcData *procdata;
- guint32 timestamp;
+ guint32 timestamp = 0;
window = gdk_get_default_root_window ();
procdata = *(ProcData**)user_data;
g_assert (procdata != NULL);
- timestamp = strtoul(msg, NULL, 0);
+ procman_debug("cb_server(%s)", msg);
+ if (msg != NULL && strcmp(SHOW_SYSTEM_TAB_CMD, msg) == 0) {
+ procman_debug("Changing to PROCMAN_TAB_SYSINFO via bacon message");
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO);
+ cb_change_current_page (GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata);
+ } else
+ timestamp = strtoul(msg, NULL, 0);
if (timestamp == 0)
{
@@ -669,12 +675,28 @@ main (int argc, char *argv[])
ProcData *procdata;
BaconMessageConnection *conn;
+ /* Parse commandline arguments */
+ GError *error = NULL;
+ GOptionContext *context;
+ static gboolean show_system_tab = FALSE;
+ static GOptionEntry entries[] =
+ {
+ { "show-system-tab", 's', 0, G_OPTION_ARG_NONE, &show_system_tab, "Show the System tab", NULL },
+ { NULL }
+ };
+
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
startup_timestamp = get_startup_timestamp();
+ context = g_option_context_new("- a simple process and system monitor.");
+ g_option_context_set_ignore_unknown_options(context, TRUE);
+ g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
+ g_option_context_parse(context, &argc, &argv, &error);
+ g_option_context_free(context);
+
Gtk::Main kit(&argc, &argv);
procman_debug("post gtk_init");
@@ -691,6 +713,9 @@ main (int argc, char *argv[])
timestamp = g_strdup_printf ("%" G_GUINT32_FORMAT, startup_timestamp);
+ if (show_system_tab)
+ bacon_message_connection_send(conn, SHOW_SYSTEM_TAB_CMD);
+
bacon_message_connection_send (conn, timestamp);
gdk_notify_startup_complete ();
@@ -727,6 +752,12 @@ main (int argc, char *argv[])
g_assert(procdata->app);
+ if (show_system_tab) {
+ procman_debug("Starting with PROCMAN_TAB_SYSINFO by commandline request");
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO);
+ cb_change_current_page (GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata);
+ }
+
gtk_widget_show(procdata->app);
procman_debug("begin gtk_main");