gnome-system-monitor r2400 - in trunk: . src
- From: bdejean svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-system-monitor r2400 - in trunk: . src
- Date: Tue, 22 Apr 2008 22:54:26 +0100 (BST)
Author: bdejean
Date: Tue Apr 22 21:54:25 2008
New Revision: 2400
URL: http://svn.gnome.org/viewvc/gnome-system-monitor?rev=2400&view=rev
Log:
Merge branch 'gio'
Conflicts:
src/sysinfo.cpp
Modified:
trunk/configure.in
trunk/src/callbacks.cpp
trunk/src/callbacks.h
trunk/src/disks.cpp
trunk/src/load-graph.cpp
trunk/src/memmaps.cpp
trunk/src/procman.cpp
trunk/src/proctable.cpp
trunk/src/util.cpp
trunk/src/util.h
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Apr 22 21:54:25 2008
@@ -28,14 +28,14 @@
LIBWNCK_REQUIRED=2.5.0
LIBGTOP_REQUIRED=2.19.3
GTK_REQUIRED=2.12.0
-GNOME_VFS_REQUIRED=2.6.0
GNOME_ICON_THEME_REQUIRED=2.15.3
GTKMM_REQUIRED=2.8
+GIOMM_REQUIRED=2.16.0
GLIBMM_REQUIRED=2.14
LIBXML_REQUIRED=2.0
RSVG_REQUIRED=2.12
-PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED)
+PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED)
AC_ARG_ENABLE(more-warnings,
Modified: trunk/src/callbacks.cpp
==============================================================================
--- trunk/src/callbacks.cpp (original)
+++ trunk/src/callbacks.cpp Tue Apr 22 21:54:25 2008
@@ -19,7 +19,8 @@
#include <config.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <giomm.h>
+
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <signal.h>
@@ -174,10 +175,11 @@
void
cb_help_contents (GtkAction *action, gpointer data)
{
- GnomeVFSResult res;
-
- if ((res = gnome_vfs_url_show("ghelp:gnome-system-monitor")) != GNOME_VFS_OK)
- g_warning("Could not display help : %s", gnome_vfs_result_to_string(res));
+ GError* error = 0;
+ if (!g_app_info_launch_default_for_uri("ghelp:gnome-system-monitor", NULL, &error)) {
+ g_warning("Could not display help : %s", error->message);
+ g_error_free(error);
+ }
}
@@ -389,15 +391,6 @@
-void
-cb_volume_mounted_or_unmounted(GnomeVFSVolumeMonitor *vfsvolumemonitor,
- GnomeVFSVolume *vol,
- gpointer procdata)
-{
- cb_update_disks(static_cast<ProcData*>(procdata));
-}
-
-
gint
cb_user_refresh (GtkAction*, gpointer data)
{
Modified: trunk/src/callbacks.h
==============================================================================
--- trunk/src/callbacks.h (original)
+++ trunk/src/callbacks.h Tue Apr 22 21:54:25 2008
@@ -24,7 +24,6 @@
#include <gtk/gtk.h>
#include "procman.h"
#include "gsm_color_button.h"
-#include <libgnomevfs/gnome-vfs.h>
void cb_show_memory_maps (GtkAction *action, gpointer data);
@@ -68,10 +67,6 @@
gint cb_user_refresh (GtkAction* action, gpointer data);
gint cb_timeout (gpointer data);
-void cb_volume_mounted_or_unmounted(GnomeVFSVolumeMonitor *vfsvolumemonitor,
- GnomeVFSVolume *vol,
- gpointer procdata);
-
void cb_radio_processes(GtkAction *action,
GtkRadioAction *current,
gpointer data);
Modified: trunk/src/disks.cpp
==============================================================================
--- trunk/src/disks.cpp (original)
+++ trunk/src/disks.cpp Tue Apr 22 21:54:25 2008
@@ -1,6 +1,7 @@
#include <config.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <giomm.h>
+#include <giomm/themedicon.h>
#include <gtk/gtk.h>
#include <glibtop/mountlist.h>
#include <glibtop/fsusage.h>
@@ -57,36 +58,47 @@
}
+namespace
+{
+ string get_icon_for_path(const std::string& path)
+ {
+ using namespace Glib;
+ using namespace Gio;
+
+ // FIXME: I don't know whether i should use Volume or Mount or UnixMount
+ // all i need an icon name.
+ RefPtr<VolumeMonitor> monitor = VolumeMonitor::get();
+
+ std::vector<RefPtr<Mount> > mounts = monitor->get_mounts();
+
+ for (size_t i = 0; i != mounts.size(); ++i) {
+ if (mounts[i]->get_name() != path)
+ continue;
+
+ RefPtr<Icon> icon = mounts[i]->get_icon();
+ RefPtr<ThemedIcon> themed_icon = RefPtr<ThemedIcon>::cast_dynamic(icon);
+
+ if (themed_icon) {
+ char* name = 0;
+ // FIXME: not wrapped yet
+ g_object_get(G_OBJECT(themed_icon->gobj()), "name", &name, NULL);
+ return make_string(name);
+ }
+ }
+
+ return "";
+ }
+}
+
static Glib::RefPtr<Gdk::Pixbuf>
get_icon_for_device(const char *mountpoint)
{
procman::IconThemeWrapper icon_theme;
- GnomeVFSVolumeMonitor *monitor;
- GnomeVFSVolume *volume;
- string icon_name;
-
- monitor = gnome_vfs_get_volume_monitor();
- volume = gnome_vfs_volume_monitor_get_volume_for_path(monitor, mountpoint);
-
- if (!volume) {
- g_warning("Cannot get volume for mount point '%s'",
- mountpoint);
- /* Fallback using / icon */
- volume = gnome_vfs_volume_monitor_get_volume_for_path(monitor, "/");
- }
-
- if (!volume)
- {
- g_warning("Cannot even get volume for mount point '/'");
- icon_name = "gnome-dev-harddisk";
- }
- else
- {
- icon_name = make_string(gnome_vfs_volume_get_icon(volume));
- gnome_vfs_volume_unref(volume);
- }
-
+ string icon_name = get_icon_for_path(mountpoint);
+ if (icon_name == "")
+ // FIXME: defaults to a safe value
+ icon_name = "gnome-dev-harddisk"; // get_icon_for_path("/");
return icon_theme->load_icon(icon_name, 24, Gtk::ICON_LOOKUP_USE_BUILTIN);
}
@@ -256,8 +268,11 @@
url = g_strdup_printf("file://%s", dir);
- if (gnome_vfs_url_show(url) != GNOME_VFS_OK)
- g_warning("Cannot open '%s'\n", url);
+ GError* error = 0;
+ if (!g_app_info_launch_default_for_uri(url, NULL, &error)) {
+ g_warning("Cannot open '%s' : %s\n", url, error->message);
+ g_error_free(error);
+ }
g_free(url);
g_free(dir);
Modified: trunk/src/load-graph.cpp
==============================================================================
--- trunk/src/load-graph.cpp (original)
+++ trunk/src/load-graph.cpp Tue Apr 22 21:54:25 2008
@@ -21,8 +21,6 @@
#include <glibtop/netlist.h>
#include <math.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include <algorithm>
#include "procman.h"
Modified: trunk/src/memmaps.cpp
==============================================================================
--- trunk/src/memmaps.cpp (original)
+++ trunk/src/memmaps.cpp Tue Apr 22 21:54:25 2008
@@ -5,8 +5,6 @@
#include <sys/stat.h>
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include <string>
#include <map>
#include <sstream>
Modified: trunk/src/procman.cpp
==============================================================================
--- trunk/src/procman.cpp (original)
+++ trunk/src/procman.cpp Tue Apr 22 21:54:25 2008
@@ -22,12 +22,12 @@
#include <stdlib.h>
#include <gtkmm.h>
+#include <giomm.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <bacon-message-connection.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <gconf/gconf-client.h>
#include <glibtop.h>
#include <glibtop/close.h>
@@ -615,17 +615,26 @@
}
+
+
+static void
+mount_changed(const Glib::RefPtr<Gio::Mount>&)
+{
+ cb_update_disks(ProcData::get_instance());
+}
+
+
static void
init_volume_monitor(ProcData *procdata)
{
- GnomeVFSVolumeMonitor *mon;
- mon = gnome_vfs_get_volume_monitor();
+ using namespace Gio;
+ using namespace Glib;
- g_signal_connect(mon, "volume_mounted",
- G_CALLBACK(cb_volume_mounted_or_unmounted), procdata);
+ RefPtr<VolumeMonitor> monitor = VolumeMonitor::get();
- g_signal_connect(mon, "volume_unmounted",
- G_CALLBACK(cb_volume_mounted_or_unmounted), procdata);
+ monitor->signal_mount_added().connect(sigc::ptr_fun(&mount_changed));
+ monitor->signal_mount_changed().connect(sigc::ptr_fun(&mount_changed));
+ monitor->signal_mount_removed().connect(sigc::ptr_fun(&mount_changed));
}
@@ -662,6 +671,7 @@
g_error("Arguments parse error : %s", ex.what().c_str());
}
+ Gio::init();
Gtk::Main kit(&argc, &argv);
procman_debug("post gtk_init");
@@ -699,7 +709,6 @@
client = gconf_client_get_default ();
gconf_client_add_dir(client, "/apps/procman", GCONF_CLIENT_PRELOAD_NONE, NULL);
- gnome_vfs_init ();
glibtop_init ();
procman_debug("end init");
@@ -731,7 +740,6 @@
procman_free_data (procdata);
glibtop_close ();
- gnome_vfs_shutdown ();
return 0;
}
Modified: trunk/src/proctable.cpp
==============================================================================
--- trunk/src/proctable.cpp (original)
+++ trunk/src/proctable.cpp Tue Apr 22 21:54:25 2008
@@ -42,8 +42,6 @@
#include <set>
#include <list>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include "procman.h"
#include "selection.h"
#include "proctable.h"
Modified: trunk/src/util.cpp
==============================================================================
--- trunk/src/util.cpp (original)
+++ trunk/src/util.cpp Tue Apr 22 21:54:25 2008
@@ -4,7 +4,6 @@
#include <glib/gstring.h>
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <glibtop/proctime.h>
#include <glibtop/procstate.h>
#include <unistd.h>
Modified: trunk/src/util.h
==============================================================================
--- trunk/src/util.h (original)
+++ trunk/src/util.h Tue Apr 22 21:54:25 2008
@@ -4,7 +4,6 @@
#define H_GNOME_SYSTEM_MONITOR_UTIL_1123178725
#include <glib.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <stddef.h>
#include <cstring>
#include <string>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]