summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-12-12 23:14:17 +0300
committermonsta <[email protected]>2016-01-11 14:05:07 +0300
commitcbb995375f1b97679fd42090e31277666249cc84 (patch)
tree46f1d7dcbbb63837e2ddfe8013bb756d01b72fdb
parent6a9264b25f20fe81d837217a6d4875d4e594983f (diff)
downloadmate-system-monitor-cbb995375f1b97679fd42090e31277666249cc84.tar.bz2
mate-system-monitor-cbb995375f1b97679fd42090e31277666249cc84.tar.xz
drop GTK+2 code and --with-gtk build option
-rw-r--r--configure.ac32
-rw-r--r--src/callbacks.cpp9
-rw-r--r--src/disks.cpp9
-rw-r--r--src/gsm_color_button.c182
-rw-r--r--src/gsm_color_button.h13
-rw-r--r--src/interface.cpp48
-rw-r--r--src/load-graph.cpp51
-rw-r--r--src/load-graph.h8
-rw-r--r--src/lsof.cpp21
-rw-r--r--src/memmaps.cpp3
-rw-r--r--src/openfiles.cpp12
-rw-r--r--src/procdialogs.cpp70
-rw-r--r--src/procman.cpp40
-rw-r--r--src/procman.h10
-rw-r--r--src/procproperties.cpp12
-rw-r--r--src/proctable.cpp3
-rw-r--r--src/sysinfo.cpp79
17 files changed, 67 insertions, 535 deletions
diff --git a/configure.ac b/configure.ac
index f9f5d19..4eb50c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,9 @@ GLIB_REQUIRED=2.36.0
LIBGTOP_REQUIRED=2.23.1
GIOMM_REQUIRED=2.26.0
GLIBMM_REQUIRED=2.22
+GTK_REQUIRED=3.0.0
+GTKMM_REQUIRED=3.0.0
+LIBWNCK_REQUIRED=3.0.0
LIBXML_REQUIRED=2.0
RSVG_REQUIRED=2.35
SYSTEMD_REQUIRED=44
@@ -40,34 +43,8 @@ SYSTEMD_REQUIRED=44
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_36],
[Warn on use of APIs deprecated before GLib 2.36])
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
- [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
- esac],
- [with_gtk=2.0])
- AC_MSG_RESULT([$with_gtk])
- case "$with_gtk" in
- 2.0) GTK_API_VERSION=2.0
- GTK_REQUIRED=2.20.0
- GTKMM_API_VERSION=2.4
- GTKMM_REQUIRED=2.22
- LIBWNCK_API_VERSION=1.0
- LIBWNCK_REQUIRED=2.5.0
- ;;
- 3.0) GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- GTKMM_API_VERSION=3.0
- GTKMM_REQUIRED=3.0.0
- LIBWNCK_API_VERSION=3.0
- LIBWNCK_REQUIRED=2.91.0
- ;;
- esac
-
PKG_CHECK_MODULES(GMODULE,gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""])
-PKG_CHECK_MODULES(PROCMAN,$GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-$LIBWNCK_API_VERSION >= $LIBWNCK_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gtkmm-$GTKMM_API_VERSION >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED)
+PKG_CHECK_MODULES(PROCMAN,$GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-3.0 >= $LIBWNCK_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gtkmm-3.0 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED)
have_systemd=no
AC_ARG_ENABLE(systemd, AS_HELP_STRING([--disable-systemd], [disable systemd support]),,enable_systemd=no)
@@ -144,7 +121,6 @@ Configuration:
C++ Compiler: ${CXX}
CFLAGS: ${CFLAGS}
CXXFLAGS: ${CXXFLAGS}
- Gtk+ Version: ${GTK_API_VERSION}
Maintainer mode: ${USE_MAINTAINER_MODE}
Systemd support: ${have_systemd}
"
diff --git a/src/callbacks.cpp b/src/callbacks.cpp
index bb18e8b..87e6bdf 100644
--- a/src/callbacks.cpp
+++ b/src/callbacks.cpp
@@ -250,7 +250,6 @@ cb_end_process_button_pressed (GtkButton *button, gpointer data)
static void change_settings_color(GSettings *settings, const char *key,
GSMColorButton *cp)
{
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA c;
char *color;
@@ -258,14 +257,6 @@ static void change_settings_color(GSettings *settings, const char *key,
color = gdk_rgba_to_string (&c);
g_settings_set_string (settings, key, color);
g_free (color);
-#else
- GdkColor c;
- char color[24]; /* color should be 1 + 3*4 + 1 = 15 chars -> 24 */
-
- gsm_color_button_get_color(cp, &c);
- g_snprintf(color, sizeof color, "#%04x%04x%04x", c.red, c.green, c.blue);
- g_settings_set_string (settings, key, color);
-#endif
}
diff --git a/src/disks.cpp b/src/disks.cpp
index ee7f4dd..490002c 100644
--- a/src/disks.cpp
+++ b/src/disks.cpp
@@ -13,10 +13,6 @@
#include "interface.h"
#include "iconthemewrapper.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
enum DiskColumns
{
/* string columns* */
@@ -309,7 +305,7 @@ create_disk_view(ProcData *procdata)
N_("Used")
};
- disk_box = gtk_vbox_new(FALSE, 6);
+ disk_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width(GTK_CONTAINER(disk_box), 12);
@@ -338,9 +334,6 @@ create_disk_view(ProcData *procdata)
g_signal_connect(G_OBJECT(disk_tree), "row-activated", G_CALLBACK(open_dir), NULL);
procdata->disk_list = disk_tree;
gtk_container_add(GTK_CONTAINER(scrolled), disk_tree);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(disk_tree), TRUE);
-#endif
g_object_unref(G_OBJECT(model));
/* icon + device */
diff --git a/src/gsm_color_button.c b/src/gsm_color_button.c
index b3744ea..28dee52 100644
--- a/src/gsm_color_button.c
+++ b/src/gsm_color_button.c
@@ -31,9 +31,7 @@
#include <gdk/gdkkeysyms.h>
#include <math.h>
#include <cairo.h>
-#if GTK_CHECK_VERSION(3,0,0)
#include <librsvg/rsvg.h>
-#endif
#include "gsm_color_button.h"
@@ -41,19 +39,11 @@
struct _GSMColorButtonPrivate
{
-#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *cc_dialog; /* Color chooser dialog */
gchar *title; /* Title for the color selection window */
GdkRGBA color;
-#else
- GtkWidget *cs_dialog; /* Color selection dialog */
-
- gchar *title; /* Title for the color selection window */
-
- GdkColor color;
-#endif
gdouble fraction; /* Only used by GSMCP_TYPE_PIE */
guint type;
@@ -94,13 +84,8 @@ static void gsm_color_button_get_property (GObject * object, guint param_id,
GValue * value,
GParamSpec * pspec);
static void gsm_color_button_realize (GtkWidget * widget);
-#if GTK_CHECK_VERSION(3,0,0)
static void gsm_color_button_get_preferred_width (GtkWidget * widget, gint * minimum_width, gint * natural_width);
static void gsm_color_button_get_preferred_height (GtkWidget * widget, gint * minimum_height, gint * natural_height);
-#else
-static void gsm_color_button_size_request (GtkWidget * widget,
- GtkRequisition * requisition);
-#endif
static void gsm_color_button_size_allocate (GtkWidget * widget,
GtkAllocation * allocation);
static void gsm_color_button_unrealize (GtkWidget * widget);
@@ -191,12 +176,8 @@ gsm_color_button_class_init (GSMColorButtonClass * klass)
gobject_class->set_property = gsm_color_button_set_property;
gobject_class->finalize = gsm_color_button_finalize;
widget_class->state_changed = gsm_color_button_state_changed;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_width = gsm_color_button_get_preferred_width;
widget_class->get_preferred_height = gsm_color_button_get_preferred_height;
-#else
- widget_class->size_request = gsm_color_button_size_request;
-#endif
widget_class->size_allocate = gsm_color_button_size_allocate;
widget_class->realize = gsm_color_button_realize;
widget_class->unrealize = gsm_color_button_unrealize;
@@ -230,11 +211,7 @@ gsm_color_button_class_init (GSMColorButtonClass * klass)
g_param_spec_boxed ("color",
_("Current Color"),
_("The selected color"),
-#if GTK_CHECK_VERSION(3,0,0)
GDK_TYPE_RGBA,
-#else
- GDK_TYPE_COLOR,
-#endif
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
@@ -291,7 +268,6 @@ static void
render (GtkWidget * widget)
{
GSMColorButton *color_button = GSM_COLOR_BUTTON (widget);
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *color;
GdkRGBA tmp_color = color_button->priv->color;
color = &tmp_color;
@@ -320,35 +296,7 @@ render (GtkWidget * widget)
color->green = color->green + highlight_factor;
}
gdk_cairo_set_source_rgba (cr, color);
-#else
- GdkColor *color, tmp_color = color_button->priv->color;
- color = &tmp_color;
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
- cairo_path_t *path = NULL;
- gint width, height;
- gdouble radius, arc_start, arc_end;
- gint highlight_factor;
-
- if (color_button->priv->highlight > 0) {
- highlight_factor = 8192 * color_button->priv->highlight;
-
- if (color->red + highlight_factor > 65535)
- color->red = 65535;
- else
- color->red = color->red + highlight_factor;
- if (color->blue + highlight_factor > 65535)
- color->blue = 65535;
- else
- color->blue = color->blue + highlight_factor;
-
- if (color->green + highlight_factor > 65535)
- color->green = 65535;
- else
- color->green = color->green + highlight_factor;
- }
- gdk_cairo_set_source_color (cr, color);
-#endif
width = gdk_window_get_width(gtk_widget_get_window(widget));
height = gdk_window_get_height(gtk_widget_get_window(widget));
@@ -496,11 +444,7 @@ render (GtkWidget * widget)
}
/* Handle exposure events for the color picker's drawing area */
-#if GTK_CHECK_VERSION(3,0,0)
static gboolean draw (GtkWidget * widget, cairo_t * cr, gpointer data)
-#else
-static gboolean expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer data)
-#endif
{
render (GTK_WIDGET (data));
@@ -514,7 +458,6 @@ gsm_color_button_realize (GtkWidget * widget)
render (widget);
}
-#if GTK_CHECK_VERSION(3,0,0)
static void gsm_color_button_get_preferred_width (GtkWidget * widget, gint * minimum_width, gint * natural_width)
{
g_return_if_fail (widget != NULL && minimum_width != NULL && natural_width != NULL);
@@ -531,18 +474,6 @@ static void gsm_color_button_get_preferred_height (GtkWidget * widget, gint * mi
*minimum_height = GSMCP_MIN_HEIGHT;
*natural_height = GSMCP_MIN_HEIGHT;
}
-#else
-static void
-gsm_color_button_size_request (GtkWidget * widget,
- GtkRequisition * requisition)
-{
- g_return_if_fail (widget != NULL || requisition != NULL);
- g_return_if_fail (GSM_IS_COLOR_BUTTON (widget));
-
- requisition->width = GSMCP_MIN_WIDTH;
- requisition->height = GSMCP_MIN_HEIGHT;
-}
-#endif
static void
gsm_color_button_size_allocate (GtkWidget * widget,
@@ -627,25 +558,16 @@ gsm_color_button_drag_data_received (GtkWidget * widget,
static void
-#if GTK_CHECK_VERSION(3,0,0)
set_color_icon (GdkDragContext * context, GdkRGBA * color)
-#else
-set_color_icon (GdkDragContext * context, GdkColor * color)
-#endif
{
GdkPixbuf *pixbuf;
guint32 pixel;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 48, 32);
-#if GTK_CHECK_VERSION(3,0,0)
pixel = ((guint32)(color->red * 0xff) << 24) |
((guint32)(color->green * 0xff) << 16) |
((guint32)(color->blue * 0xff) << 8);
-#else
- pixel = ((color->red & 0xff00) << 16) |
- ((color->green & 0xff00) << 8) | (color->blue & 0xff00);
-#endif
gdk_pixbuf_fill (pixbuf, pixel);
@@ -717,11 +639,7 @@ gsm_color_button_init (GSMColorButton * color_button)
gtk_widget_set_tooltip_text (GTK_WIDGET(color_button), _("Click to set graph colors"));
-#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect (color_button, "draw", G_CALLBACK (draw), color_button);
-#else
- g_signal_connect (color_button, "expose-event", G_CALLBACK (expose_event), color_button);
-#endif
}
static void
@@ -729,15 +647,9 @@ gsm_color_button_finalize (GObject * object)
{
GSMColorButton *color_button = GSM_COLOR_BUTTON (object);
-#if GTK_CHECK_VERSION(3,0,0)
if (color_button->priv->cc_dialog != NULL)
gtk_widget_destroy (color_button->priv->cc_dialog);
color_button->priv->cc_dialog = NULL;
-#else
- if (color_button->priv->cs_dialog != NULL)
- gtk_widget_destroy (color_button->priv->cs_dialog);
- color_button->priv->cs_dialog = NULL;
-#endif
g_free (color_button->priv->title);
color_button->priv->title = NULL;
@@ -749,11 +661,7 @@ gsm_color_button_finalize (GObject * object)
}
GtkWidget *
-#if GTK_CHECK_VERSION(3,0,0)
gsm_color_button_new (const GdkRGBA * color, guint type)
-#else
-gsm_color_button_new (const GdkColor * color, guint type)
-#endif
{
return g_object_new (GSM_TYPE_COLOR_BUTTON, "color", color, "type", type,
NULL);
@@ -763,7 +671,6 @@ static void
dialog_response (GtkWidget * widget, GtkResponseType response, gpointer data)
{
GSMColorButton *color_button = GSM_COLOR_BUTTON (data);
-#if GTK_CHECK_VERSION(3,0,0)
GtkColorChooser *color_chooser;
if (response == GTK_RESPONSE_OK) {
@@ -772,19 +679,6 @@ dialog_response (GtkWidget * widget, GtkResponseType response, gpointer data)
gtk_color_chooser_get_rgba (color_chooser, &color_button->priv->color);
gtk_widget_hide (color_button->priv->cc_dialog);
-#else
- GtkColorSelection *color_selection;
-
- if (response == GTK_RESPONSE_OK) {
- color_selection =
- GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG
- (color_button->priv->cs_dialog)));
-
- gtk_color_selection_get_current_color (color_selection,
- &color_button->priv->color);
-
- gtk_widget_hide (color_button->priv->cs_dialog);
-#endif
gtk_widget_queue_draw (GTK_WIDGET (&color_button->widget));
@@ -795,11 +689,7 @@ dialog_response (GtkWidget * widget, GtkResponseType response, gpointer data)
g_object_thaw_notify (G_OBJECT (color_button));
}
else /* (response == GTK_RESPONSE_CANCEL) */
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_hide (color_button->priv->cc_dialog);
-#else
- gtk_widget_hide (color_button->priv->cs_dialog);
-#endif
}
static gboolean
@@ -807,11 +697,7 @@ dialog_destroy (GtkWidget * widget, gpointer data)
{
GSMColorButton *color_button = GSM_COLOR_BUTTON (data);
-#if GTK_CHECK_VERSION(3,0,0)
color_button->priv->cc_dialog = NULL;
-#else
- color_button->priv->cs_dialog = NULL;
-#endif
return FALSE;
}
@@ -820,7 +706,6 @@ static gint
gsm_color_button_clicked (GtkWidget * widget, GdkEventButton * event)
{
GSMColorButton *color_button = GSM_COLOR_BUTTON (widget);
-#if GTK_CHECK_VERSION(3,0,0)
/* if dialog already exists, make sure it's shown and raised */
if (!color_button->priv->cc_dialog)
@@ -850,53 +735,7 @@ gsm_color_button_clicked (GtkWidget * widget, GdkEventButton * event)
&color_button->priv->color);
gtk_window_present (GTK_WINDOW (color_button->priv->cc_dialog));
-#else
- GtkColorSelectionDialog *color_dialog;
-
- /* if dialog already exists, make sure it's shown and raised */
- if (!color_button->priv->cs_dialog)
- {
- /* Create the dialog and connects its buttons */
- GtkWidget *parent;
-
- parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));
-
- color_button->priv->cs_dialog =
- gtk_color_selection_dialog_new (color_button->priv->title);
-
- color_dialog =
- GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
-
- if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
- {
- if (GTK_WINDOW (parent) !=
- gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
- gtk_window_set_transient_for (GTK_WINDOW (color_dialog),
- GTK_WINDOW (parent));
-
- gtk_window_set_modal (GTK_WINDOW (color_dialog),
- gtk_window_get_modal (GTK_WINDOW (parent)));
- }
-
- g_signal_connect (color_dialog, "response",
- G_CALLBACK (dialog_response), color_button);
-
- g_signal_connect (color_dialog, "destroy",
- G_CALLBACK (dialog_destroy), color_button);
- }
-
- color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
-
- gtk_color_selection_set_previous_color (GTK_COLOR_SELECTION
- (gtk_color_selection_dialog_get_color_selection (color_dialog)),
- &color_button->priv->color);
-
- gtk_color_selection_set_current_color (GTK_COLOR_SELECTION
- (gtk_color_selection_dialog_get_color_selection (color_dialog)),
- &color_button->priv->color);
- gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
-#endif
return 0;
}
@@ -984,29 +823,19 @@ gsm_color_button_set_fraction (GSMColorButton * color_button,
}
void
-#if GTK_CHECK_VERSION(3,0,0)
gsm_color_button_get_color (GSMColorButton * color_button, GdkRGBA * color)
-#else
-gsm_color_button_get_color (GSMColorButton * color_button, GdkColor * color)
-#endif
{
g_return_if_fail (GSM_IS_COLOR_BUTTON (color_button));
color->red = color_button->priv->color.red;
color->green = color_button->priv->color.green;
color->blue = color_button->priv->color.blue;
-#if GTK_CHECK_VERSION(3,0,0)
color->alpha = color_button->priv->color.alpha;
-#endif
}
void
gsm_color_button_set_color (GSMColorButton * color_button,
-#if GTK_CHECK_VERSION(3,0,0)
const GdkRGBA * color)
-#else
- const GdkColor * color)
-#endif
{
g_return_if_fail (GSM_IS_COLOR_BUTTON (color_button));
g_return_if_fail (color != NULL);
@@ -1014,9 +843,7 @@ gsm_color_button_set_color (GSMColorButton * color_button,
color_button->priv->color.red = color->red;
color_button->priv->color.green = color->green;
color_button->priv->color.blue = color->blue;
-#if GTK_CHECK_VERSION(3,0,0)
color_button->priv->color.alpha = color->alpha;
-#endif
gtk_widget_queue_draw (GTK_WIDGET (&color_button->widget)); //->priv->draw_area);
@@ -1035,13 +862,8 @@ gsm_color_button_set_title (GSMColorButton * color_button,
color_button->priv->title = g_strdup (title);
g_free (old_title);
-#if GTK_CHECK_VERSION(3,0,0)
if (color_button->priv->cc_dialog)
gtk_window_set_title (GTK_WINDOW (color_button->priv->cc_dialog),
-#else
- if (color_button->priv->cs_dialog)
- gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog),
-#endif
color_button->priv->title);
g_object_notify (G_OBJECT (color_button), "title");
@@ -1088,11 +910,7 @@ gsm_color_button_get_property (GObject * object,
GValue * value, GParamSpec * pspec)
{
GSMColorButton *color_button = GSM_COLOR_BUTTON (object);
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
switch (param_id)
{
diff --git a/src/gsm_color_button.h b/src/gsm_color_button.h
index bb54f72..be26cdb 100644
--- a/src/gsm_color_button.h
+++ b/src/gsm_color_button.h
@@ -25,10 +25,6 @@
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#include <cairo.h>
-#include <librsvg/rsvg.h>
-#endif
G_BEGIN_DECLS
/* The GtkColorSelectionButton widget is a simple color picker in a button.
@@ -79,20 +75,11 @@ struct _GSMColorButtonClass
};
GType gsm_color_button_get_type (void) G_GNUC_CONST;
-#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *gsm_color_button_new (const GdkRGBA * color, guint type);
void gsm_color_button_set_color (GSMColorButton * color_button, const GdkRGBA * color);
-#else
-GtkWidget *gsm_color_button_new (const GdkColor * color, guint type);
-void gsm_color_button_set_color (GSMColorButton * color_button, const GdkColor * color);
-#endif
void gsm_color_button_set_fraction (GSMColorButton * color_button, const gdouble fraction);
void gsm_color_button_set_cbtype (GSMColorButton * color_button, guint type);
-#if GTK_CHECK_VERSION(3,0,0)
void gsm_color_button_get_color (GSMColorButton * color_button, GdkRGBA * color);
-#else
-void gsm_color_button_get_color (GSMColorButton * color_button, GdkColor * color);
-#endif
gdouble gsm_color_button_get_fraction (GSMColorButton * color_button);
guint gsm_color_button_get_cbtype (GSMColorButton * color_button);
void gsm_color_button_set_title (GSMColorButton * color_button, const gchar * title);
diff --git a/src/interface.cpp b/src/interface.cpp
index f4f5b81..fd18ba1 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -41,11 +41,6 @@
#include "sysinfo.h"
#include "gsm_color_button.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
static void cb_toggle_tree (GtkAction *action, gpointer data);
static void cb_proc_goto_tab (gint tab);
@@ -209,10 +204,10 @@ create_proc_view (ProcData *procdata)
GtkWidget *hbox2;
char* string;
- vbox1 = gtk_vbox_new (FALSE, 18);
+ vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 12);
- hbox1 = gtk_hbox_new (FALSE, 12);
+ hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
string = make_loadavg_string ();
@@ -230,7 +225,7 @@ create_proc_view (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (vbox1), scrolled, TRUE, TRUE, 0);
- hbox2 = gtk_hbox_new (FALSE, 0);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);
procdata->endprocessbutton = gtk_button_new_with_mnemonic (_("End _Process"));
@@ -287,19 +282,19 @@ create_sys_view (ProcData *procdata)
// Translators: color picker title, %s is CPU, Memory, Swap, Receiving, Sending
title_template = g_strdup(_("Pick a Color for '%s'"));
- vbox = gtk_vbox_new (FALSE, 18);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
/* The CPU BOX */
- cpu_box = gtk_vbox_new (FALSE, 6);
+ cpu_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), cpu_box, TRUE, TRUE, 0);
label = make_title_label (_("CPU History"));
gtk_box_pack_start (GTK_BOX (cpu_box), label, FALSE, FALSE, 0);
- cpu_graph_box = gtk_vbox_new (FALSE, 6);
+ cpu_graph_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (cpu_box), cpu_graph_box, TRUE, TRUE, 0);
cpu_graph = new LoadGraph(LOAD_GRAPH_CPU);
@@ -309,7 +304,7 @@ create_sys_view (ProcData *procdata)
TRUE,
0);
- hbox = gtk_hbox_new(FALSE, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
spacer = gtk_label_new ("");
gtk_widget_set_size_request(GTK_WIDGET(spacer), 57, -1);
gtk_box_pack_start (GTK_BOX (hbox), spacer,
@@ -329,7 +324,7 @@ create_sys_view (ProcData *procdata)
for (i=0;i<procdata->config.num_cpus; i++) {
GtkWidget *temp_hbox;
- temp_hbox = gtk_hbox_new (FALSE, 0);
+ temp_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_table_attach(GTK_TABLE(cpu_table), temp_hbox,
i % 4, i % 4 + 1,
i / 4, i / 4 + 1,
@@ -367,13 +362,13 @@ create_sys_view (ProcData *procdata)
procdata->cpu_graph = cpu_graph;
- mem_box = gtk_vbox_new (FALSE, 6);
+ mem_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), mem_box, TRUE, TRUE, 0);
label = make_title_label (_("Memory and Swap History"));
gtk_box_pack_start (GTK_BOX (mem_box), label, FALSE, FALSE, 0);
- mem_graph_box = gtk_vbox_new (FALSE, 6);
+ mem_graph_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (mem_box), mem_graph_box, TRUE, TRUE, 0);
@@ -384,7 +379,7 @@ create_sys_view (ProcData *procdata)
TRUE,
0);
- hbox = gtk_hbox_new(FALSE, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
spacer = gtk_label_new ("");
gtk_widget_set_size_request(GTK_WIDGET(spacer), 54, -1);
gtk_box_pack_start (GTK_BOX (hbox), spacer,
@@ -394,7 +389,7 @@ create_sys_view (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (mem_graph_box), hbox,
FALSE, FALSE, 0);
- mem_legend_box = gtk_hbox_new(TRUE, 10);
+ mem_legend_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (hbox), mem_legend_box,
TRUE, TRUE, 0);
@@ -471,13 +466,13 @@ create_sys_view (ProcData *procdata)
procdata->mem_graph = mem_graph;
/* The net box */
- net_box = gtk_vbox_new (FALSE, 6);
+ net_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), net_box, TRUE, TRUE, 0);
label = make_title_label (_("Network History"));
gtk_box_pack_start (GTK_BOX (net_box), label, FALSE, FALSE, 0);
- net_graph_box = gtk_vbox_new (FALSE, 6);
+ net_graph_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (net_box), net_graph_box, TRUE, TRUE, 0);
net_graph = new LoadGraph(LOAD_GRAPH_NET);
@@ -487,7 +482,7 @@ create_sys_view (ProcData *procdata)
TRUE,
0);
- hbox = gtk_hbox_new(FALSE, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
spacer = gtk_label_new ("");
gtk_widget_set_size_request(GTK_WIDGET(spacer), 54, -1);
gtk_box_pack_start (GTK_BOX (hbox), spacer,
@@ -497,7 +492,7 @@ create_sys_view (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (net_graph_box), hbox,
FALSE, FALSE, 0);
- net_legend_box = gtk_hbox_new(TRUE, 10);
+ net_legend_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (hbox), net_legend_box,
TRUE, TRUE, 0);
@@ -721,19 +716,12 @@ create_main_window (ProcData *procdata)
gtk_window_set_title(GTK_WINDOW(app), _("System Monitor"));
GdkScreen* screen = gtk_widget_get_screen(app);
-#if GTK_CHECK_VERSION(3,0,0)
/* use visual, if available */
GdkVisual* visual = gdk_screen_get_rgba_visual(screen);
if (visual)
gtk_widget_set_visual(app, visual);
-#else
- /* use rgba colormap, if available */
- GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen);
- if (colormap)
- gtk_widget_set_default_colormap(colormap);
-#endif
- main_box = gtk_vbox_new (FALSE, 0);
+ main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(app), main_box);
width = procdata->config.width;
@@ -801,7 +789,7 @@ create_main_window (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (main_box), notebook, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (notebook), 12);
- sysinfo_box = gtk_hbox_new(TRUE, 0); // procman_create_sysinfo_view();
+ sysinfo_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); // procman_create_sysinfo_view();
sysinfo_label = gtk_label_new(_("System"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sysinfo_box, sysinfo_label);
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index ce2e263..c7b843c 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -28,18 +28,10 @@
#include "util.h"
#include "gsm_color_button.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
void LoadGraph::clear_background()
{
if (background) {
-#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_destroy (background);
-#else
- g_object_unref(background);
-#endif
this->background = NULL;
}
}
@@ -83,9 +75,7 @@ static void draw_background(LoadGraph *graph) {
PangoLayout* layout;
PangoFontDescription* font_desc;
PangoRectangle extents;
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA fg, bg;
-#endif
num_bars = graph->num_bars();
graph->graph_dely = (graph->draw_height - 15) / num_bars; /* round to int to avoid AA blur */
@@ -94,34 +84,19 @@ static void draw_background(LoadGraph *graph) {
graph->graph_buffer_offset = (int) (1.5 * graph->graph_delx) + FRAME_WIDTH ;
gtk_widget_get_allocation (graph->disp, &allocation);
-#if GTK_CHECK_VERSION(3,0,0)
graph->background = gdk_window_create_similar_surface (gtk_widget_get_window (graph->disp), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
cr = cairo_create (graph->background);
-#else
- graph->background = gdk_pixmap_new (GDK_DRAWABLE (gtk_widget_get_window (graph->disp)), allocation.width, allocation.height, -1);
- cr = gdk_cairo_create (graph->background);
-#endif
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context = gtk_widget_get_style_context (ProcData::get_instance()->notebook);
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg);
gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
// set the background colour
gdk_cairo_set_source_rgba (cr, &bg);
-#else
- // set the background colour
- GtkStyle *style = gtk_widget_get_style (ProcData::get_instance()->notebook);
- gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
-#endif
cairo_paint (cr);
layout = pango_cairo_create_layout (cr);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);
-#else
- font_desc = pango_font_description_copy (style->font_desc);
-#endif
pango_font_description_set_size (font_desc, 0.8 * graph->fontsize * PANGO_SCALE);
pango_layout_set_font_description (layout, font_desc);
pango_font_description_free (font_desc);
@@ -148,11 +123,7 @@ static void draw_background(LoadGraph *graph) {
else
y = i * graph->graph_dely + graph->fontsize / 2.0;
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba (cr, &fg);
-#else
- gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
-#endif
if (graph->type == LOAD_GRAPH_NET) {
// operation orders matters so it's 0 if i == num_bars
guint64 rate = graph->net.max - (i * graph->net.max / num_bars);
@@ -197,11 +168,7 @@ static void draw_background(LoadGraph *graph) {
pango_layout_set_text (layout, caption, -1);
pango_layout_get_extents (layout, NULL, &extents);
cairo_move_to (cr, ((ceil(x) + 0.5) + graph->rmargin + graph->indent) - (1.0 * extents.width / PANGO_SCALE/2), graph->draw_height - 1.0 * extents.height / PANGO_SCALE);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba (cr, &fg);
-#else
- gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
-#endif
pango_cairo_show_layout (cr, layout);
g_free (caption);
}
@@ -239,11 +206,7 @@ load_graph_configure (GtkWidget *widget,
return TRUE;
}
-#if GTK_CHECK_VERSION(3,0,0)
static gboolean load_graph_draw (GtkWidget *widget, cairo_t *context, gpointer data_ptr)
-#else
-static gboolean load_graph_expose (GtkWidget *widget, GdkEventExpose *event, gpointer data_ptr)
-#endif
{
LoadGraph * const graph = static_cast<LoadGraph*>(data_ptr);
GdkWindow *window;
@@ -255,13 +218,9 @@ static gboolean load_graph_expose (GtkWidget *widget, GdkEventExpose *event, gpo
if (graph->background == NULL) {
draw_background(graph);
-#if GTK_CHECK_VERSION(3,0,0)
cairo_pattern_t *pattern = cairo_pattern_create_for_surface (graph->background);
gdk_window_set_background_pattern (window, pattern);
cairo_pattern_destroy (pattern);
-#else
- gdk_window_set_back_pixmap (window, graph->background, FALSE);
-#endif
}
/* Number of pixels wide for one graph point */
@@ -286,11 +245,7 @@ static gboolean load_graph_expose (GtkWidget *widget, GdkEventExpose *event, gpo
for (j = 0; j < graph->n; ++j) {
cairo_move_to (cr, x_offset, (1.0f - graph->data[0][j]) * graph->real_draw_height);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba (cr, &(graph->colors [j]));
-#else
- gdk_cairo_set_source_color (cr, &(graph->colors [j]));
-#endif
for (i = 1; i < LoadGraph::NUM_POINTS; ++i) {
if (graph->data[i][j] == -1.0f)
@@ -770,17 +725,13 @@ LoadGraph::LoadGraph(guint type)
render_counter = (frames_per_unit - 1);
draw = FALSE;
- main_widget = gtk_vbox_new (FALSE, FALSE);
+ main_widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_size_request(main_widget, -1, LoadGraph::GRAPH_MIN_HEIGHT);
gtk_widget_show (main_widget);
disp = gtk_drawing_area_new ();
gtk_widget_show (disp);
-#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect (G_OBJECT (disp), "draw", G_CALLBACK (load_graph_draw), graph);
-#else
- g_signal_connect (G_OBJECT (disp), "expose_event", G_CALLBACK (load_graph_expose), graph);
-#endif
g_signal_connect (G_OBJECT(disp), "configure_event",
G_CALLBACK (load_graph_configure), graph);
g_signal_connect (G_OBJECT(disp), "destroy",
diff --git a/src/load-graph.h b/src/load-graph.h
index b4b3cdd..6b76cb8 100644
--- a/src/load-graph.h
+++ b/src/load-graph.h
@@ -58,11 +58,7 @@ struct LoadGraph {
double graph_delx;
guint graph_buffer_offset;
-#if GTK_CHECK_VERSION(3,0,0)
std::vector<GdkRGBA> colors;
-#else
- std::vector<GdkColor> colors;
-#endif
std::vector<float> data_block;
gfloat* data[NUM_POINTS];
@@ -70,11 +66,7 @@ struct LoadGraph {
GtkWidget *main_widget;
GtkWidget *disp;
-#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t *background;
-#else
- GdkDrawable *background;
-#endif
guint timer_index;
diff --git a/src/lsof.cpp b/src/lsof.cpp
index 4c1f13a..e589619 100644
--- a/src/lsof.cpp
+++ b/src/lsof.cpp
@@ -21,10 +21,6 @@
#include "lsof.h"
#include "util.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
using std::string;
@@ -252,9 +248,6 @@ void procman_lsof(ProcData *procdata)
GtkWidget *tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
g_object_unref(model);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
-#endif
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
@@ -321,25 +314,25 @@ void procman_lsof(ProcData *procdata)
gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);
gtk_window_set_default_size(GTK_WINDOW(dialog), 575, 400);
gtk_container_set_border_width(GTK_CONTAINER(dialog), 12);
- GtkWidget *mainbox = gtk_vbox_new(FALSE, 12);
+ GtkWidget *mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add(GTK_CONTAINER(dialog), mainbox);
gtk_box_set_spacing(GTK_BOX(mainbox), 6);
// Label, entry and search button
- GtkWidget *hbox1 = gtk_hbox_new(FALSE, 12);
+ GtkWidget *hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start(GTK_BOX(mainbox), hbox1, FALSE, FALSE, 0);
GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start(GTK_BOX(hbox1), image, FALSE, FALSE, 0);
- GtkWidget *vbox2 = gtk_vbox_new(FALSE, 12);
+ GtkWidget *vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start(GTK_BOX(hbox1), vbox2, TRUE, TRUE, 0);
- GtkWidget *hbox = gtk_hbox_new(FALSE, 12);
+ GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 0);
GtkWidget *label = gtk_label_new_with_mnemonic(_("_Name contains:"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
@@ -360,12 +353,12 @@ void procman_lsof(ProcData *procdata)
GtkWidget *case_button = gtk_check_button_new_with_mnemonic(_("Case insensitive matching"));
- GtkWidget *hbox3 = gtk_hbox_new(FALSE, 12);
+ GtkWidget *hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start(GTK_BOX(hbox3), case_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox2), hbox3, FALSE, FALSE, 0);
- GtkWidget *results_box = gtk_hbox_new(FALSE, 12);
+ GtkWidget *results_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start(GTK_BOX(mainbox), results_box, FALSE, FALSE, 0);
GtkWidget *results_label = gtk_label_new_with_mnemonic(_("S_earch results:"));
gtk_box_pack_start(GTK_BOX(results_box), results_label, FALSE, FALSE, 0);
@@ -385,7 +378,7 @@ void procman_lsof(ProcData *procdata)
gtk_container_add(GTK_CONTAINER(scrolled), tree);
gtk_box_pack_start(GTK_BOX(mainbox), scrolled, TRUE, TRUE, 0);
- GtkWidget *bottom_box = gtk_hbox_new(FALSE, 12);
+ GtkWidget *bottom_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
GtkWidget *close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
gtk_box_pack_start(GTK_BOX(mainbox), bottom_box, FALSE, FALSE, 0);
gtk_box_pack_end(GTK_BOX(bottom_box), close_button, FALSE, FALSE, 0);
diff --git a/src/memmaps.cpp b/src/memmaps.cpp
index eb52ad9..ddbb3a9 100644
--- a/src/memmaps.cpp
+++ b/src/memmaps.cpp
@@ -344,9 +344,6 @@ create_memmapsdata (ProcData *procdata)
);
tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree), TRUE);
-#endif
g_object_unref (G_OBJECT (model));
for (i = 0; i < MMAP_COL_MAX; i++) {
diff --git a/src/openfiles.cpp b/src/openfiles.cpp
index 48c7a91..76f2138 100644
--- a/src/openfiles.cpp
+++ b/src/openfiles.cpp
@@ -19,11 +19,6 @@
#define NI_IDN 0
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
enum
{
COL_FD,
@@ -265,9 +260,6 @@ create_openfiles_tree (ProcData *procdata)
);
tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree), TRUE);
-#endif
g_object_unref (G_OBJECT (model));
for (i = 0; i < NUM_OPENFILES_COL-1; i++) {
@@ -340,11 +332,11 @@ create_single_openfiles_dialog (GtkTreeModel *model, GtkTreePath *path,
gtk_box_set_spacing (GTK_BOX (vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- dialog_vbox = gtk_vbox_new (FALSE, 6);
+ dialog_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
gtk_box_pack_start (GTK_BOX (vbox), dialog_vbox, TRUE, TRUE, 0);
- cmd_hbox = gtk_hbox_new (FALSE, 12);
+ cmd_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (dialog_vbox), cmd_hbox, FALSE, FALSE, 0);
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index 2ee21b5..66b1f6e 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -37,10 +37,6 @@
#include "procman_gksu.h"
#include "cgroups.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
static GtkWidget *renice_dialog = NULL;
static GtkWidget *prefs_dialog = NULL;
@@ -158,11 +154,7 @@ procdialog_create_renice_dialog (ProcData *procdata)
GtkWidget *label;
GtkWidget *priority_label;
GtkWidget *table;
-#if GTK_CHECK_VERSION(3,0,0)
GtkAdjustment *renice_adj;
-#else
- GtkObject *renice_adj;
-#endif
GtkWidget *hscale;
GtkWidget *button;
GtkWidget *icon;
@@ -201,7 +193,7 @@ procdialog_create_renice_dialog (ProcData *procdata)
gtk_box_set_spacing (GTK_BOX (dialog_vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (dialog_vbox), vbox, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
@@ -216,11 +208,7 @@ procdialog_create_renice_dialog (ProcData *procdata)
renice_adj = gtk_adjustment_new (info->nice, RENICE_VAL_MIN, RENICE_VAL_MAX, 1, 1, 0);
new_nice_value = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
hscale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, renice_adj);
-#else
- hscale = gtk_hscale_new (GTK_ADJUSTMENT (renice_adj));
-#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), hscale);
gtk_scale_set_digits (GTK_SCALE (hscale), 0);
gtk_table_attach (GTK_TABLE (table), hscale, 1, 2, 0, 1,
@@ -414,7 +402,7 @@ create_field_page(GtkWidget *tree, const char* text)
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
label = gtk_label_new_with_mnemonic (text);
#if GTK_CHECK_VERSION (3, 14, 0)
@@ -553,13 +541,13 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
- proc_box = gtk_vbox_new (FALSE, 18);
+ proc_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_container_set_border_width (GTK_CONTAINER (proc_box), 12);
tab_label = gtk_label_new (_("Processes"));
gtk_widget_show (tab_label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), proc_box, tab_label);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (proc_box), vbox, FALSE, FALSE, 0);
tmp = g_strdup_printf ("<b>%s</b>", _("Behavior"));
@@ -573,16 +561,16 @@ procdialog_create_preferences_dialog (ProcData *procdata)
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new (" ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- vbox2 = gtk_vbox_new (FALSE, 6);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- hbox2 = gtk_hbox_new (FALSE, 12);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Update interval in seconds:"));
@@ -593,7 +581,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
#endif
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
- hbox3 = gtk_hbox_new (FALSE, 6);
+ hbox3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0);
update = (gfloat) procdata->config.update_interval;
@@ -611,7 +599,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button);
- hbox2 = gtk_hbox_new(FALSE, 6);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, 0);
smooth_button = gtk_check_button_new_with_mnemonic(_("Enable _smooth refresh"));
@@ -624,7 +612,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
- hbox2 = gtk_hbox_new (FALSE, 6);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
check_button = gtk_check_button_new_with_mnemonic (_("Alert before ending or _killing processes"));
@@ -637,7 +625,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
- hbox2 = gtk_hbox_new(FALSE, 6);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, 0);
GtkWidget *solaris_button = gtk_check_button_new_with_mnemonic(_("Divide CPU usage by CPU count"));
@@ -652,10 +640,10 @@ procdialog_create_preferences_dialog (ProcData *procdata)
- hbox2 = gtk_hbox_new (FALSE, 6);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (proc_box), vbox, TRUE, TRUE, 0);
tmp = g_strdup_printf ("<b>%s</b>", _("Information Fields"));
@@ -669,7 +657,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new (" ");
@@ -678,13 +666,13 @@ procdialog_create_preferences_dialog (ProcData *procdata)
vbox2 = create_field_page (procdata->tree, _("Process i_nformation shown in list:"));
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- sys_box = gtk_vbox_new (FALSE, 12);
+ sys_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (sys_box), 12);
tab_label = gtk_label_new (_("Resources"));
gtk_widget_show (tab_label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sys_box, tab_label);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (sys_box), vbox, FALSE, FALSE, 0);
tmp = g_strdup_printf ("<b>%s</b>", _("Graphs"));
@@ -698,16 +686,16 @@ procdialog_create_preferences_dialog (ProcData *procdata)
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new (" ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- vbox2 = gtk_vbox_new (FALSE, 6);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- hbox2 = gtk_hbox_new (FALSE, 12);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Update interval in seconds:"));
@@ -719,7 +707,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
gtk_size_group_add_widget (size, label);
- hbox3 = gtk_hbox_new (FALSE, 6);
+ hbox3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0);
update = (gfloat) procdata->config.graph_update_interval;
@@ -745,13 +733,13 @@ procdialog_create_preferences_dialog (ProcData *procdata)
- hbox2 = gtk_hbox_new (FALSE, 12);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
/*
* Devices
*/
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
tab_label = gtk_label_new (_("File Systems"));
gtk_widget_show (tab_label);
@@ -768,16 +756,16 @@ procdialog_create_preferences_dialog (ProcData *procdata)
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new (" ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- vbox2 = gtk_vbox_new (FALSE, 6);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- hbox2 = gtk_hbox_new (FALSE, 12);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Update interval in seconds:"));
@@ -788,7 +776,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
#endif
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
- hbox3 = gtk_hbox_new (FALSE, 6);
+ hbox3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0);
update = (gfloat) procdata->config.disks_update_interval;
@@ -802,7 +790,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
&disks_interval_updater);
- hbox2 = gtk_hbox_new (FALSE, 6);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
check_button = gtk_check_button_new_with_mnemonic (_("Show _all file systems"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
@@ -812,7 +800,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (hbox2), check_button, FALSE, FALSE, 0);
- vbox2 = gtk_vbox_new (FALSE, 6);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
label = gtk_label_new (" ");
@@ -829,7 +817,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new (" ");
diff --git a/src/procman.cpp b/src/procman.cpp
index abfbf69..a21df0e 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -195,46 +195,26 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
for (int i = 0; i < procdata->config.num_cpus; i++) {
string cpu_key = make_string(g_strdup_printf("cpu-color%d", i));
if (cpu_key == key) {
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&procdata->config.cpu_color[i], color);
-#else
- gdk_color_parse (color, &procdata->config.cpu_color[i]);
-#endif
procdata->cpu_graph->colors.at(i) = procdata->config.cpu_color[i];
break;
}
}
}
else if (g_str_equal (key, "mem-color")) {
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&procdata->config.mem_color, color);
-#else
- gdk_color_parse (color, &procdata->config.mem_color);
-#endif
procdata->mem_graph->colors.at(0) = procdata->config.mem_color;
}
else if (g_str_equal (key, "swap-color")) {
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&procdata->config.swap_color, color);
-#else
- gdk_color_parse (color, &procdata->config.swap_color);
-#endif
procdata->mem_graph->colors.at(1) = procdata->config.swap_color;
}
else if (g_str_equal (key, "net-in-color")) {
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&procdata->config.net_in_color, color);
-#else
- gdk_color_parse (color, &procdata->config.net_in_color);
-#endif
procdata->net_graph->colors.at(0) = procdata->config.net_in_color;
}
else if (g_str_equal (key, "net-out-color")) {
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&procdata->config.net_out_color, color);
-#else
- gdk_color_parse (color, &procdata->config.net_out_color);
-#endif
procdata->net_graph->colors.at(1) = procdata->config.net_out_color;
}
else {
@@ -329,11 +309,7 @@ procman_data_new (GSettings *settings)
detail_string = std::string("changed::") + std::string(key);
g_signal_connect (G_OBJECT(settings), detail_string.c_str(),
G_CALLBACK(color_changed_cb), pd);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&pd->config.cpu_color[i], color);
-#else
- gdk_color_parse(color, &pd->config.cpu_color[i]);
-#endif
g_free (color);
g_free (key);
}
@@ -343,11 +319,7 @@ procman_data_new (GSettings *settings)
color = g_strdup ("#000000ff0082");
g_signal_connect (G_OBJECT(settings), "changed::mem-color",
G_CALLBACK(color_changed_cb), pd);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&pd->config.mem_color, color);
-#else
- gdk_color_parse(color, &pd->config.mem_color);
-#endif
g_free (color);
@@ -356,11 +328,7 @@ procman_data_new (GSettings *settings)
color = g_strdup ("#00b6000000ff");
g_signal_connect (G_OBJECT(settings), "changed::swap-color",
G_CALLBACK(color_changed_cb), pd);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&pd->config.swap_color, color);
-#else
- gdk_color_parse(color, &pd->config.swap_color);
-#endif
g_free (color);
color = g_settings_get_string (settings, "net-in-color");
@@ -368,11 +336,7 @@ procman_data_new (GSettings *settings)
color = g_strdup ("#000000f200f2");
g_signal_connect (G_OBJECT(settings), "changed::net-in-color",
G_CALLBACK(color_changed_cb), pd);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&pd->config.net_in_color, color);
-#else
- gdk_color_parse(color, &pd->config.net_in_color);
-#endif
g_free (color);
color = g_settings_get_string (settings, "net-out-color");
@@ -380,11 +344,7 @@ procman_data_new (GSettings *settings)
color = g_strdup ("#00f2000000c1");
g_signal_connect (G_OBJECT(settings), "changed::net-out-color",
G_CALLBACK(color_changed_cb), pd);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_rgba_parse (&pd->config.net_out_color, color);
-#else
- gdk_color_parse(color, &pd->config.net_out_color);
-#endif
g_free (color);
/* Sanity checks */
diff --git a/src/procman.h b/src/procman.h
index 46c93a9..388f0e6 100644
--- a/src/procman.h
+++ b/src/procman.h
@@ -96,7 +96,6 @@ struct ProcConfig
int disks_update_interval;
gint whose_process;
gint current_tab;
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA cpu_color[GLIBTOP_NCPU];
GdkRGBA mem_color;
GdkRGBA swap_color;
@@ -104,15 +103,6 @@ struct ProcConfig
GdkRGBA net_out_color;
GdkRGBA bg_color;
GdkRGBA frame_color;
-#else
- GdkColor cpu_color[GLIBTOP_NCPU];
- GdkColor mem_color;
- GdkColor swap_color;
- GdkColor net_in_color;
- GdkColor net_out_color;
- GdkColor bg_color;
- GdkColor frame_color;
-#endif
gint num_cpus;
bool solaris_mode;
bool network_in_bits;
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index d2f8b55..3d24ab3 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -31,11 +31,6 @@
#include "util.h"
#include "e_date.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
enum
{
COL_PROP = 0,
@@ -190,9 +185,6 @@ create_procproperties_tree (ProcData *procdata)
);
tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree), TRUE);
-#endif
g_object_unref (G_OBJECT (model));
for (i = 0; i < NUM_COLS; i++) {
@@ -257,11 +249,11 @@ create_single_procproperties_dialog (GtkTreeModel *model, GtkTreePath *path,
gtk_box_set_spacing (GTK_BOX (vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- dialog_vbox = gtk_vbox_new (FALSE, 6);
+ dialog_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
gtk_box_pack_start (GTK_BOX (vbox), dialog_vbox, TRUE, TRUE, 0);
- cmd_hbox = gtk_hbox_new (FALSE, 12);
+ cmd_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (dialog_vbox), cmd_hbox, FALSE, FALSE, 0);
label = procman_make_label_for_mmaps_or_ofiles (
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 0023aff..89d9411 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -332,9 +332,6 @@ proctable_new (ProcData * const procdata)
search_equal_func,
NULL,
NULL);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (proctree), TRUE);
-#endif
g_object_unref (G_OBJECT (model));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (proctree));
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index 4884960..2c50005 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -31,10 +31,6 @@
#include "procman.h"
#include "util.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
using std::string;
using std::vector;
@@ -632,11 +628,7 @@ namespace {
#define LOGO_H 351
#define RADIUS 5
-#if GTK_CHECK_VERSION(3,0,0)
static gboolean sysinfo_logo_draw (GtkWidget *widget, cairo_t *context, gpointer data_ptr)
-#else
-static gboolean sysinfo_logo_expose (GtkWidget *widget, GdkEventExpose *event, gpointer data_ptr)
-#endif
{
GtkAllocation allocation;
GtkStyle *style;
@@ -697,15 +689,9 @@ add_section(GtkBox *vbox , const char * title, int num_row, int num_col, GtkWidg
gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 12, 0);
gtk_container_add(GTK_CONTAINER(frame), alignment);
-#if GTK_CHECK_VERSION (3, 0, 0)
table = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(table), 6);
gtk_grid_set_column_spacing(GTK_GRID(table), 6);
-#else
- table = gtk_table_new(num_row, num_col, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 6);
- gtk_table_set_col_spacings(GTK_TABLE(table), 6);
-#endif
gtk_container_set_border_width(GTK_CONTAINER(table), 6);
gtk_container_add(GTK_CONTAINER(alignment), table);
@@ -717,11 +703,7 @@ add_section(GtkBox *vbox , const char * title, int num_row, int num_col, GtkWidg
static GtkWidget*
-#if GTK_CHECK_VERSION (3, 0, 0)
add_row(GtkGrid * table, const char * label, const char * value, int row)
-#else
-add_row(GtkTable * table, const char * label, const char * value, int row)
-#endif
{
GtkWidget *header = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(header), label);
@@ -731,17 +713,9 @@ add_row(GtkTable * table, const char * label, const char * value, int row)
#else
gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
table, header,
0, row, 1, 1);
-#else
- gtk_table_attach(
- table, header,
- 0, 1, row, row + 1,
- GTK_FILL, GTK_FILL, 0, 0
- );
-#endif
GtkWidget *label_widget = gtk_label_new(value);
gtk_label_set_selectable(GTK_LABEL(label_widget), TRUE);
@@ -750,17 +724,10 @@ add_row(GtkTable * table, const char * label, const char * value, int row)
#else
gtk_misc_set_alignment(GTK_MISC(label_widget), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
table, label_widget,
1, row, 1, 1);
-#else
- gtk_table_attach(
- table, label_widget,
- 1, 2, row, row + 1,
- GTK_FILL, GTK_FILL, 0, 0
- );
-#endif
+
return label_widget;
}
@@ -786,7 +753,7 @@ procman_create_sysinfo_view(void)
gchar *markup;
- hbox = gtk_hbox_new(FALSE, 12);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
/* left-side logo */
@@ -808,13 +775,9 @@ procman_create_sysinfo_view(void)
#endif
gtk_box_pack_start(GTK_BOX(hbox), logo, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(logo), "draw", G_CALLBACK(sysinfo_logo_draw), NULL);
-#else
- g_signal_connect(G_OBJECT(logo), "expose-event", G_CALLBACK(sysinfo_logo_expose), NULL);
-#endif
- vbox = gtk_vbox_new(FALSE, 12);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
@@ -849,17 +812,9 @@ procman_create_sysinfo_view(void)
#else
gtk_misc_set_alignment(GTK_MISC(distro_release_label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
GTK_GRID(distro_table), distro_release_label,
0, table_count, 1, 1);
-#else
- gtk_table_attach(
- GTK_TABLE(distro_table), distro_release_label,
- 0, 1, table_count, table_count+1,
- GTK_FILL, GTK_FILL, 0, 0
- );
-#endif
table_count++;
data->set_distro_labels(gtk_frame_get_label_widget(GTK_FRAME(distro_frame)), distro_release_label);
@@ -872,17 +827,9 @@ procman_create_sysinfo_view(void)
#else
gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
GTK_GRID(distro_table), header,
0, table_count, 1, 1);
-#else
- gtk_table_attach(
- GTK_TABLE(distro_table), header,
- 0, 1, table_count, table_count + 1,
- GTK_FILL, GTK_FILL, 0, 0
- );
-#endif
table_count++;
if (data->mate_version != "")
@@ -896,17 +843,9 @@ procman_create_sysinfo_view(void)
#else
gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
GTK_GRID(distro_table), header,
0, table_count, 1, 1);
-#else
- gtk_table_attach(
- GTK_TABLE(distro_table), header,
- 0, 1, table_count, table_count + 1,
- GTK_FILL, GTK_FILL, 0, 0
- );
-#endif
table_count++;
}
@@ -917,19 +856,11 @@ procman_create_sysinfo_view(void)
g_free(markup);
markup = procman::format_size(data->memory_bytes);
-#if GTK_CHECK_VERSION (3, 0, 0)
add_row(GTK_GRID(hardware_table), _("Memory:"), markup, 0);
-#else
- add_row(GTK_TABLE(hardware_table), _("Memory:"), markup, 0);
-#endif
g_free(markup);
markup = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
add_row(GTK_GRID(hardware_table), _("Processor:"),
-#else
- add_row(GTK_TABLE(hardware_table), _("Processor:"),
-#endif
data->processors.c_str(), 1);
if(markup)
@@ -942,11 +873,7 @@ procman_create_sysinfo_view(void)
g_free(markup);
markup = procman::format_size(data->free_space_bytes);
-#if GTK_CHECK_VERSION (3, 0, 0)
add_row(GTK_GRID(disk_space_table), _("Available disk space:"), markup, 0);
-#else
- add_row(GTK_TABLE(disk_space_table), _("Available disk space:"), markup, 0);
-#endif
g_free(markup);
return hbox;