add --show-system-tab flag and about-this-computer.desktop

This commit is contained in:
Will Woods 2008-03-09 21:28:25 +00:00
parent 2de3c038bd
commit 97bb2451f7
3 changed files with 111 additions and 1 deletions

View File

@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Name=About This Computer
Name[en_US]=About This Computer
Comment=Get some basic information about this computer
Comment[en_US]=Get some basic information about this computer
Exec=gnome-system-monitor --show-system-tab
Icon=computer
Terminal=false
Type=Application
Categories=X-System-About;
StartupNotify=true
OnlyShowIn=GNOME;

View File

@ -0,0 +1,89 @@
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");

View File

@ -13,11 +13,12 @@
Summary: Simple process monitor
Name: gnome-system-monitor
Version: 2.21.92
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.gnome.org/
Source: http://download.gnome.org/sources/gnome-system-monitor/2.21/%{name}-%{version}.tar.bz2
Source1: about-this-computer.desktop
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: GConf2-devel
BuildRequires: gnome-vfs2-devel
@ -42,6 +43,7 @@ BuildRequires: autoconf, automake, libtool
# send upstream: http://bugzilla.gnome.org/show_bug.cgi?id=491462
Patch0: gnome-system-monitor-2.21.92-polkit.patch
Patch1: gnome-system-monitor-2.21.92-system-tab-arg.patch
Requires: PolicyKit-gnome >= %{polkit_gnome_version}
Requires(pre): GConf2 >= %{gconf_version}
@ -56,6 +58,7 @@ gnome-system-monitor is a simple process and system monitor.
%prep
%setup -q
%patch0 -p1 -b .polkit
%patch1 -p1 -b .system-tab-arg
%build
autoreconf
@ -76,6 +79,8 @@ desktop-file-install --vendor gnome --delete-original \
--remove-category Application \
$RPM_BUILD_ROOT%{_datadir}/applications/*
desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE1}
rm -rf $RPM_BUILD_ROOT/var/scrollkeeper
%find_lang %{name} --with-gnome
@ -118,6 +123,9 @@ scrollkeeper-update -q
%changelog
* Sat Mar 8 2008 Will Woods <wwoods@redhat.com> - 2.21.92-3
- Add --show-system-tab commandline flag and about-this-computer.desktop
* Thu Mar 6 2008 Matthias Clasen <mclasen@redhat.com> - 2.21.92-2
- Don't OnlyShowIn=GNOME