[gnome-system-monitor] Add command line flags for each tab to display it on startup.
- From: Chris KÃhl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Add command line flags for each tab to display it on startup.
- Date: Mon, 12 Dec 2011 00:20:49 +0000 (UTC)
commit fdc3dac969e9961fd0ae525595534b25b7920e8b
Author: Robert Roth <robert roth off gmail com>
Date: Sun Nov 27 00:45:06 2011 +0200
Add command line flags for each tab to display it on startup.
https://bugzilla.gnome.org/show_bug.cgi?id=629571
src/argv.cpp | 24 +++++++++++++++++++++++-
src/argv.h | 3 +++
src/procman.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++-------
src/procman.h | 3 +++
4 files changed, 71 insertions(+), 8 deletions(-)
---
diff --git a/src/argv.cpp b/src/argv.cpp
index f1a3a86..42e8d70 100644
--- a/src/argv.cpp
+++ b/src/argv.cpp
@@ -10,13 +10,35 @@ namespace procman
{
OptionGroup::OptionGroup()
: Glib::OptionGroup("", ""),
- show_system_tab(false)
+ show_system_tab(false),
+ show_processes_tab(false),
+ show_resources_tab(false),
+ show_file_systems_tab(false)
{
Glib::OptionEntry sys_tab;
sys_tab.set_long_name("show-system-tab");
sys_tab.set_short_name('s');
sys_tab.set_description(_("Show the System tab"));
+
+ Glib::OptionEntry proc_tab;
+ proc_tab.set_long_name("show-processes-tab");
+ proc_tab.set_short_name('p');
+ proc_tab.set_description(_("Show the Processes tab"));
+
+ Glib::OptionEntry res_tab;
+ res_tab.set_long_name("show-resources-tab");
+ res_tab.set_short_name('r');
+ res_tab.set_description(_("Show the Resources tab"));
+
+ Glib::OptionEntry fs_tab;
+ fs_tab.set_long_name("show-file-systems-tab");
+ fs_tab.set_short_name('f');
+ fs_tab.set_description(_("Show the File Systems tab"));
+
this->add_entry(sys_tab, this->show_system_tab);
+ this->add_entry(proc_tab, this->show_processes_tab);
+ this->add_entry(res_tab, this->show_resources_tab);
+ this->add_entry(fs_tab, this->show_file_systems_tab);
}
}
diff --git a/src/argv.h b/src/argv.h
index 9a604d5..8d8ff21 100644
--- a/src/argv.h
+++ b/src/argv.h
@@ -12,6 +12,9 @@ namespace procman
OptionGroup();
bool show_system_tab;
+ bool show_processes_tab;
+ bool show_resources_tab;
+ bool show_file_systems_tab;
};
}
diff --git a/src/procman.cpp b/src/procman.cpp
index 85789a2..2d35e22 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -544,6 +544,12 @@ get_startup_timestamp ()
return retval;
}
+static void
+set_tab(GtkNotebook* notebook, gint tab, ProcData* procdata)
+{
+ gtk_notebook_set_current_page(notebook, tab);
+ cb_change_current_page(notebook, tab, procdata);
+}
static void
cb_server (const gchar *msg, gpointer user_data)
@@ -558,10 +564,20 @@ cb_server (const gchar *msg, gpointer user_data)
g_assert (procdata != NULL);
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);
+ if (msg != NULL) {
+ if (procman::SHOW_SYSTEM_TAB_CMD == msg) {
+ procman_debug("Changing to PROCMAN_TAB_SYSINFO via bacon message");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata);
+ } else if (procman::SHOW_PROCESSES_TAB_CMD == msg) {
+ procman_debug("Changing to PROCMAN_TAB_PROCESSES via bacon message");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_PROCESSES, procdata);
+ } else if (procman::SHOW_RESOURCES_TAB_CMD == msg) {
+ procman_debug("Changing to PROCMAN_TAB_RESOURCES via bacon message");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_RESOURCES, procdata);
+ } else if (procman::SHOW_FILE_SYSTEMS_TAB_CMD == msg) {
+ procman_debug("Changing to PROCMAN_TAB_DISKS via bacon message");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_DISKS, procdata);
+ }
} else
timestamp = strtoul(msg, NULL, 0);
@@ -603,10 +619,12 @@ init_volume_monitor(ProcData *procdata)
namespace procman
{
const std::string SHOW_SYSTEM_TAB_CMD("SHOWSYSTAB");
+ const std::string SHOW_PROCESSES_TAB_CMD("SHOWPROCTAB");
+ const std::string SHOW_RESOURCES_TAB_CMD("SHOWRESTAB");
+ const std::string SHOW_FILE_SYSTEMS_TAB_CMD("SHOWFSTAB");
}
-
int
main (int argc, char *argv[])
{
@@ -654,6 +672,15 @@ main (int argc, char *argv[])
if (option_group.show_system_tab)
bacon_message_connection_send(conn, procman::SHOW_SYSTEM_TAB_CMD.c_str());
+ if (option_group.show_processes_tab)
+ bacon_message_connection_send(conn, procman::SHOW_PROCESSES_TAB_CMD.c_str());
+
+ if (option_group.show_resources_tab)
+ bacon_message_connection_send(conn, procman::SHOW_RESOURCES_TAB_CMD.c_str());
+
+ if (option_group.show_file_systems_tab)
+ bacon_message_connection_send(conn, procman::SHOW_FILE_SYSTEMS_TAB_CMD.c_str());
+
bacon_message_connection_send (conn, timestamp);
gdk_notify_startup_complete ();
@@ -691,8 +718,16 @@ main (int argc, char *argv[])
if (option_group.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);
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata);
+ } else if (option_group.show_processes_tab) {
+ procman_debug("Starting with PROCMAN_TAB_PROCESSES by commandline request");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_PROCESSES, procdata);
+ } else if (option_group.show_resources_tab) {
+ procman_debug("Starting with PROCMAN_TAB_RESOURCES by commandline request");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_RESOURCES, procdata);
+ } else if (option_group.show_file_systems_tab) {
+ procman_debug("Starting with PROCMAN_TAB_DISKS by commandline request");
+ set_tab(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_DISKS, procdata);
}
gtk_widget_set_name(procdata->app, "gnome-system-monitor");
diff --git a/src/procman.h b/src/procman.h
index 08e32dc..f285cc8 100644
--- a/src/procman.h
+++ b/src/procman.h
@@ -66,6 +66,9 @@ static const unsigned MAX_UPDATE_INTERVAL = 100 * 1000;
namespace procman
{
extern const std::string SHOW_SYSTEM_TAB_CMD;
+ extern const std::string SHOW_PROCESSES_TAB_CMD;
+ extern const std::string SHOW_RESOURCES_TAB_CMD;
+ extern const std::string SHOW_FILE_SYSTEMS_TAB_CMD;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]