gnome-system-monitor r2366 - trunk/src
- From: bdejean svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-system-monitor r2366 - trunk/src
- Date: Tue, 18 Mar 2008 20:35:45 +0000 (GMT)
Author: bdejean
Date: Tue Mar 18 20:35:45 2008
New Revision: 2366
URL: http://svn.gnome.org/viewvc/gnome-system-monitor?rev=2366&view=rev
Log:
Add an option to start with the system tab.
Patch by Matthias Clasen <mclasen redhat com>.
Closes #522988.
Modified:
trunk/src/procman.cpp
trunk/src/procman.h
Modified: trunk/src/procman.cpp
==============================================================================
--- trunk/src/procman.cpp (original)
+++ trunk/src/procman.cpp Tue Mar 18 20:35:45 2008
@@ -595,14 +595,20 @@
{
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 && procman::SHOW_SYSTEM_TAB_CMD == msg) {
+ 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)
{
@@ -630,6 +636,13 @@
}
+namespace procman
+{
+ const std::string SHOW_SYSTEM_TAB_CMD("SHOWSYSTAB");
+}
+
+
+
int
main (int argc, char *argv[])
{
@@ -638,12 +651,28 @@
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");
@@ -660,6 +689,9 @@
timestamp = g_strdup_printf ("%" G_GUINT32_FORMAT, startup_timestamp);
+ if (show_system_tab)
+ bacon_message_connection_send(conn, procman::SHOW_SYSTEM_TAB_CMD.c_str());
+
bacon_message_connection_send (conn, timestamp);
gdk_notify_startup_complete ();
@@ -696,6 +728,12 @@
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");
Modified: trunk/src/procman.h
==============================================================================
--- trunk/src/procman.h (original)
+++ trunk/src/procman.h Tue Mar 18 20:35:45 2008
@@ -31,6 +31,7 @@
#include <time.h>
#include <map>
+#include <string>
typedef struct _ProcConfig ProcConfig;
struct ProcInfo;
@@ -54,6 +55,13 @@
static const unsigned MAX_UPDATE_INTERVAL = 100 * 1000;
+namespace procman
+{
+ extern const std::string SHOW_SYSTEM_TAB_CMD;
+}
+
+
+
enum ProcmanTab
{
PROCMAN_TAB_SYSINFO,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]