summaryrefslogtreecommitdiff
path: root/src/procman.cpp
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 /src/procman.cpp
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
Diffstat (limited to 'src/procman.cpp')
-rw-r--r--src/procman.cpp49
1 files changed, 42 insertions, 7 deletions
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");