summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-18 21:45:30 +0100
committerinfirit <[email protected]>2014-12-18 21:45:30 +0100
commit120ef9172463db2778b4790baa8ba7ae650aa247 (patch)
tree0db727e3e8cd174980292e53c0ab302ace641fac
parente11a700443d383ab35b84995962dfbe06c056063 (diff)
downloadmate-system-monitor-120ef9172463db2778b4790baa8ba7ae650aa247.tar.bz2
mate-system-monitor-120ef9172463db2778b4790baa8ba7ae650aa247.tar.xz
Add command line flags for each tab to display it on startup
Taken from GSM commit: fdc3dac969e9961fd0ae525595534b25b7920e8b From: Robert Roth <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=629571
-rw-r--r--src/argv.cpp24
-rw-r--r--src/argv.h3
-rw-r--r--src/procman.cpp49
-rw-r--r--src/procman.h3
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 6f4057e..2171670 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -559,6 +559,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)
@@ -573,10 +579,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);
@@ -618,10 +634,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[])
{
@@ -669,6 +687,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 ();
@@ -703,8 +730,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, "mate-system-monitor");
diff --git a/src/procman.h b/src/procman.h
index 5bfb7b8..940ac8a 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;
}