Commit 9bbb8ab6 authored by Andre Miranda's avatar Andre Miranda
Browse files

Drop gtk2 support

parent eaca83b9
Pipeline #696 passed with stages
in 1 minute and 27 seconds
......@@ -73,16 +73,8 @@ XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.5.0])
dnl ***********************************
dnl *** Check for optional packages ***
dnl ***********************************
XDT_CHECK_OPTIONAL_PACKAGE([GTK2],
[gtk+-2.0], [2.24.0], [gtk2],
[GTK+ 2 support], [no])
AM_CONDITIONAL([USE_GTK2], [test "x$GTK2_FOUND" = "xyes"])
if test "x$GTK2_FOUND" = "xyes"; then
XDT_CHECK_OPTIONAL_PACKAGE([WNCK], [libwnck-1.0], [2.0], [wnck], [building with libwnck for window icons/names], [yes])
XDT_CHECK_OPTIONAL_PACKAGE([GKSU], [libgksu2], [2.0], [gksu], [building with libgksu to run as root], [yes])
else
XDT_CHECK_OPTIONAL_PACKAGE([WNCK], [libwnck-3.0], [3.2], [wnck3], [building with libwnck3 for window icons/names], [yes])
fi
XDT_CHECK_OPTIONAL_PACKAGE([WNCK], [libwnck-3.0], [3.2], [wnck3], [building with libwnck3 for window icons/names], [yes])
AM_CONDITIONAL([HAVE_WNCK], [test x"$WNCK_FOUND" = x"yes"])
AM_CONDITIONAL([HAVE_GKSU], [test x"$GKSU_FOUND" = x"yes"])
dnl ***********************************
......@@ -167,11 +159,7 @@ echo
echo "* Gksu: ${GKSU_VERSION:-no}"
echo "* Wnck: ${WNCK_VERSION:-no}"
echo "* Cairo: ${CAIRO_VERSION}"
if test "x$GTK2_FOUND" = "xyes" ; then
echo "* GTK+: ${GTK2_VERSION}"
else
echo "* GTK+: ${GTK3_VERSION}"
fi
echo "* Target OS: $target_os ($ac_os_implementation)"
echo "* Debug: $enable_debug"
echo
......@@ -7,10 +7,8 @@ src/process-statusbar.c
src/process-tree-view.c
src/process-window.c
[type: gettext/glade]src/process-window.ui
[type: gettext/glade]src/process-window-gtk3.ui
src/settings.c
src/settings-dialog.c
[type: gettext/glade]src/settings-dialog.ui
[type: gettext/glade]src/settings-dialog-gtk3.ui
src/settings-tool-button.c
src/task-manager.c
......@@ -11,6 +11,8 @@ xfce4_taskmanager_CFLAGS = \
$(GKSU_CFLAGS) \
$(LIBX11_CFLAGS) \
$(LIBXMU_CFLAGS) \
$(GTK3_CFLAGS) \
$(WNCK_CFLAGS) \
$(NULL)
xfce4_taskmanager_LDADD = \
......@@ -18,11 +20,13 @@ xfce4_taskmanager_LDADD = \
$(GKSU_LIBS) \
$(LIBX11_LIBS) \
$(LIBXMU_LIBS) \
$(GTK3_LIBS) \
$(WNCK_LIBS) \
$(NULL)
xfce4_taskmanager_SOURCES = \
main.c \
process-window_ui.h process-window-gtk3_ui.h \
process-window_ui.h \
process-window.c process-window.h \
process-monitor.c process-monitor.h \
process-tree-model.c process-tree-model.h \
......@@ -30,20 +34,12 @@ xfce4_taskmanager_SOURCES = \
process-statusbar.c process-statusbar.h \
exec-tool-button.c exec-tool-button.h \
settings-tool-button.c settings-tool-button.h \
settings-dialog_ui.h settings-dialog-gtk3_ui.h \
settings-dialog_ui.h \
settings-dialog.c settings-dialog.h \
settings.c settings.h \
task-manager.c task-manager.h \
$(NULL)
if USE_GTK2
xfce4_taskmanager_LDADD += $(GTK2_LIBS) $(WNCK_LIBS)
xfce4_taskmanager_CFLAGS += $(GTK2_CFLAGS) $(WNCK_CFLAGS)
else
xfce4_taskmanager_LDADD += $(GTK3_LIBS) $(WNCK_LIBS)
xfce4_taskmanager_CFLAGS += $(GTK3_CFLAGS) $(WNCK_CFLAGS)
endif
if HAVE_WNCK
xfce4_taskmanager_SOURCES += app-manager.c app-manager.h
endif
......@@ -65,15 +61,11 @@ xfce4_taskmanager_SOURCES += task-manager-skel.c
endif
if MAINTAINER_MODE
BUILT_SOURCES = process-window_ui.h settings-dialog_ui.h process-window-gtk3_ui.h settings-dialog-gtk3_ui.h
BUILT_SOURCES = process-window_ui.h settings-dialog_ui.h
process-window_ui.h: process-window.ui
$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=process_window_ui $< >$@
settings-dialog_ui.h: settings-dialog.ui
$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=settings_dialog_ui $< >$@
process-window-gtk3_ui.h: process-window-gtk3.ui
$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=process_window_ui $< >$@
settings-dialog-gtk3_ui.h: settings-dialog-gtk3.ui
$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=settings_dialog_ui $< >$@
endif
EXTRA_DIST = process-window.ui settings-dialog.ui process-window-gtk3.ui settings-dialog-gtk3.ui
EXTRA_DIST = process-window.ui settings-dialog.ui
......@@ -79,7 +79,6 @@ static void
execute_command (const gchar *command)
{
GError *error = NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
GdkScreen *screen;
GdkDisplay *display;
GdkAppLaunchContext *launch_context;
......@@ -95,9 +94,7 @@ execute_command (const gchar *command)
g_object_unref (launch_context);
}
g_object_unref (app_info);
#else
gdk_spawn_command_line_on_screen (gdk_screen_get_default (), command, &error);
#endif
if (error != NULL)
{
GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
......
......@@ -126,7 +126,6 @@ init_timeout (void)
if (gtk_status_icon_get_visible (status_icon))
{
#if GTK_CHECK_VERSION (2,16,0)
g_snprintf (tooltip, sizeof(tooltip),
_("<b>Processes:</b> %u\n"
"<b>CPU:</b> %.0f%%\n"
......@@ -134,15 +133,6 @@ init_timeout (void)
"<b>Swap:</b> %s"),
num_processes, cpu, memory_info, swap_info);
gtk_status_icon_set_tooltip_markup (GTK_STATUS_ICON (status_icon), tooltip);
#else
g_snprintf (tooltip, sizeof(tooltip),
_("Processes: %u\n"
"CPU: %.0f%%\n"
"Memory: %s\n"
"Swap: %s"),
num_processes, cpu, memory_info, swap_info);
gtk_status_icon_set_tooltip (GTK_STATUS_ICON (status_icon), tooltip);
#endif
}
xtm_task_manager_update_model (task_manager);
......
......@@ -41,12 +41,8 @@ G_DEFINE_TYPE (XtmProcessMonitor, xtm_process_monitor, GTK_TYPE_DRAWING_AREA)
static void xtm_process_monitor_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void xtm_process_monitor_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean xtm_process_monitor_draw (GtkWidget *widget, cairo_t *cr);
#else
static gboolean xtm_process_monitor_expose (GtkWidget *widget, GdkEventExpose *event);
#endif
static void xtm_process_monitor_paint (XtmProcessMonitor *monitor, cairo_t *cr);
static void xtm_process_monitor_paint (XtmProcessMonitor *monitor, cairo_t *cr);
......@@ -58,11 +54,8 @@ xtm_process_monitor_class_init (XtmProcessMonitorClass *klass)
xtm_process_monitor_parent_class = g_type_class_peek_parent (klass);
class->get_property = xtm_process_monitor_get_property;
class->set_property = xtm_process_monitor_set_property;
#if GTK_CHECK_VERSION(3, 0, 0)
widget_class->draw = xtm_process_monitor_draw;
#else
widget_class->expose_event = xtm_process_monitor_expose;
#endif
g_object_class_install_property (class, PROP_STEP_SIZE,
g_param_spec_float ("step-size", "StepSize", "Step size", 0.1f, G_MAXFLOAT, 1, G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
g_object_class_install_property (class, PROP_TYPE,
......@@ -115,7 +108,6 @@ xtm_process_monitor_set_property (GObject *object, guint property_id, const GVal
}
}
#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean
xtm_process_monitor_draw (GtkWidget *widget, cairo_t *cr)
{
......@@ -129,24 +121,6 @@ xtm_process_monitor_draw (GtkWidget *widget, cairo_t *cr)
xtm_process_monitor_paint (monitor, cr);
return FALSE;
}
#else
static gboolean
xtm_process_monitor_expose (GtkWidget *widget, GdkEventExpose *event __unused)
{
XtmProcessMonitor *monitor = XTM_PROCESS_MONITOR (widget);
guint minimum_history_length;
cairo_t *cr;
minimum_history_length = (guint)(widget->allocation.width / monitor->step_size);
if (monitor->history->len < minimum_history_length)
g_array_set_size (monitor->history, minimum_history_length + 1);
cr = gdk_cairo_create (gtk_widget_get_window(GTK_WIDGET(monitor)));
xtm_process_monitor_paint (monitor, cr);
cairo_destroy (cr);
return FALSE;
}
#endif
static cairo_surface_t *
xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor, gint width, gint height)
......@@ -218,13 +192,9 @@ xtm_process_monitor_paint (XtmProcessMonitor *monitor, cairo_t *cr)
gint width, height;
static const double dashed[] = {1.5};
gint i;
#if GTK_CHECK_VERSION(3, 0, 0)
width = gtk_widget_get_allocated_width(GTK_WIDGET(monitor));
height = gtk_widget_get_allocated_height(GTK_WIDGET(monitor));
#else
width = GTK_WIDGET (monitor)->allocation.width;
height = GTK_WIDGET (monitor)->allocation.height;
#endif
/* Don't draw anything if the graph is too small */
if (height < 3)
return;
......
......@@ -81,15 +81,9 @@ xtm_process_statusbar_init (XtmProcessStatusbar *statusbar)
GtkWidget *hbox, *hbox_cpu, *hbox_mem;
statusbar->settings = xtm_settings_get_default ();
#if GTK_CHECK_VERSION(3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
hbox_cpu = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
hbox_mem = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
#else
hbox = gtk_hbox_new (FALSE, 16);
hbox_cpu = gtk_hbox_new (FALSE, 16);
hbox_mem = gtk_hbox_new (FALSE, 16);
#endif
statusbar->label_cpu = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (hbox_cpu), statusbar->label_cpu, TRUE, FALSE, 0);
......@@ -133,11 +127,7 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
XtmProcessStatusbar *statusbar = XTM_PROCESS_STATUSBAR (object);
gchar *text;
gchar *float_value;
#if GTK_CHECK_VERSION(3, 0, 0)
GdkRGBA color;
#else
GdkColor color;
#endif
switch (property_id)
{
......@@ -146,13 +136,8 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
float_value = rounded_float_value (statusbar->cpu, statusbar->settings);
text = g_strdup_printf (_("CPU: %s%%"), float_value);
gtk_label_set_text (GTK_LABEL (statusbar->label_cpu), text);
#if GTK_CHECK_VERSION(3, 0, 0)
gdk_rgba_parse (&color, "#ff6e00");
gtk_widget_override_color (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
#else
gdk_color_parse ("#ff6e00", &color);
gtk_widget_modify_fg (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
#endif
g_free (float_value);
g_free (text);
break;
......@@ -161,13 +146,8 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
g_strlcpy(statusbar->memory, g_value_get_string (value), sizeof(statusbar->memory));
text = g_strdup_printf (_("Memory: %s"), statusbar->memory);
gtk_label_set_text (GTK_LABEL (statusbar->label_memory), text);
#if GTK_CHECK_VERSION(3, 0, 0)
gdk_rgba_parse (&color, "#ab1852");
gtk_widget_override_color (statusbar->label_memory, GTK_STATE_NORMAL, &color);
#else
gdk_color_parse ("#ab1852", &color);
gtk_widget_modify_fg (statusbar->label_memory, GTK_STATE_NORMAL, &color);
#endif
g_free (text);
break;
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="process-window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Task Manager</property>
<property name="default_width">490</property>
<property name="default_height">465</property>
<property name="icon_name">org.xfce.taskmanager</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="process-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar" id="process-toolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
<property name="icon_size">1</property>
<child>
<object class="GtkToolButton" id="toolbutton-about">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-about</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolItem" id="filter-toolitem">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">2</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="xscale">0.5</property>
<child>
<object class="GtkEntry" id="filter-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
<property name="primary_icon_stock">gtk-find</property>
<property name="secondary_icon_stock">gtk-clear</property>
<property name="secondary_icon_sensitive">False</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="homogeneous">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="root-warning-box">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkEventBox" id="root-warning-ebox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="root-warning-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">6</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Warning, you are using the root account, you may harm your system.</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="root-warning-separator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkPaned" id="mainview-vpaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="orientation">vertical</property>
<property name="position">100</property>
<property name="position_set">True</property>
<child>
<object class="GtkBox" id="graph-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="graph-hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkFrame" id="graph-cpu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
<property name="border_width">2</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<placeholder/>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="graph-mem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
<property name="border_width">2</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<placeholder/>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="mainview-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="legend">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_right">6</property>
<property name="margin_bottom">6</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;span foreground='#000000' background='#aed581'&gt; &lt;/span&gt; Starting task</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;span foreground='#000000' background='#fff176'&gt; &lt;/span&gt; Changing task</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;span foreground='#000000' background='#e57373'&gt; &lt;/span&gt; Terminating task</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
......@@ -31,11 +31,7 @@
#include "settings.h"
#include "task-manager.h"
#include "process-window.h"
#if GTK_CHECK_VERSION(3, 0, 0)
#include "process-window-gtk3_ui.h"
#else
#include "process-window_ui.h"
#endif
#include "process-monitor.h"
#include "process-tree-view.h"
#include "process-statusbar.h"
......@@ -309,7 +305,6 @@ xtm_process_window_init (XtmProcessWindow *window)
if (geteuid () == 0)
{
#if GTK_CHECK_VERSION(3, 0, 0)
GtkCssProvider *css_provider;
css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css_provider,
......@@ -318,11 +313,6 @@ xtm_process_window_init (XtmProcessWindow *window)
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (css_provider);
#else
gtk_rc_parse_string ("style\"root-warning-style\"{bg[NORMAL]=\"#e53935\"\nfg[NORMAL]=\"#ffffff\"}\n"
"widget\"GtkWindow.*.root-warning\"style\"root-warning-style\"\n"
"widget\"GtkWindow.*.root-warning.GtkLabel\"style\"root-warning-style\"");
#endif
gtk_widget_set_name (GTK_WIDGET (gtk_builder_get_object (window->builder, "root-warning-ebox")), "root-warning");
gtk_widget_show_all (GTK_WIDGET (gtk_builder_get_object (window->builder, "root-warning-box")));
}
......@@ -466,7 +456,6 @@ monitor_update_step_size (XtmProcessWindow *window)
g_object_set (window->mem_monitor, "step-size", refresh_rate / 1000.0, NULL);
}
#if !GTK_CHECK_VERSION(2,18,0)
static void
url_hook_about_dialog (GtkAboutDialog *dialog, const gchar *uri, gpointer user_data)
{
......@@ -479,7 +468,6 @@ url_hook_about_dialog (GtkAboutDialog *dialog, const gchar *uri, gpointer user_d
}
g_free (command);
}
#endif
static void
show_about_dialog (XtmProcessWindow *window)
......@@ -515,17 +503,11 @@ show_about_dialog (XtmProcessWindow *window)
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n";
#if !GTK_CHECK_VERSION(2,18,0)
gtk_about_dialog_set_url_hook (url_hook_about_dialog, NULL, NULL);
#endif
gtk_show_about_dialog (GTK_WINDOW (window->window),
"program-name", _("Task Manager"),
"version", PACKAGE_VERSION,
"copyright", "Copyright \302\251 2005-2019 The Xfce development team",
"logo-icon-name", "org.xfce.taskmanager",
#if !GTK_CHECK_VERSION(3, 0, 0)
"icon-name", GTK_STOCK_ABOUT,
#endif
"comments", _("Easy to use task manager"),
"license", license,
"authors", authors,
......