Merge remote-tracking branch 'ochosi/fix_gtk3'

This commit is contained in:
Landry Breuil
2014-12-17 20:49:45 +01:00
14 changed files with 754 additions and 187 deletions

View File

@@ -9,22 +9,18 @@ bin_PROGRAMS = \
xfce4-taskmanager
xfce4_taskmanager_CFLAGS = \
$(GTK_CFLAGS) \
$(CAIRO_CFLAGS) \
$(WNCK_CFLAGS) \
$(GKSU_CFLAGS) \
$(NULL)
xfce4_taskmanager_LDADD = \
$(GTK_LIBS) \
$(CAIRO_LIBS) \
$(WNCK_LIBS) \
$(GKSU_LIBS) \
$(NULL)
xfce4_taskmanager_SOURCES = \
main.c \
process-window_ui.h \
process-window_ui.h process-window-gtk3_ui.h \
process-window.c process-window.h \
process-monitor.c process-monitor.h \
process-tree-model.c process-tree-model.h \
@@ -32,12 +28,20 @@ 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_ui.h settings-dialog-gtk3_ui.h \
settings-dialog.c settings-dialog.h \
settings.c settings.h \
task-manager.c task-manager.h \
$(NULL)
if USE_GTK3
xfce4_taskmanager_LDADD += $(GTK3_LIBS) $(WNCK3_LIBS)
xfce4_taskmanager_CFLAGS += $(GTK3_CFLAGS) $(WNCK3_CFLAGS)
else
xfce4_taskmanager_LDADD += $(GTK_LIBS) $(WNCK_LIBS)
xfce4_taskmanager_CFLAGS += $(GTK_CFLAGS) $(WNCK_CFLAGS)
endif
if HAVE_WNCK
xfce4_taskmanager_SOURCES += app-manager.c app-manager.h
endif
@@ -59,12 +63,16 @@ xfce4_taskmanager_SOURCES += task-manager-skel.c
endif
if MAINTAINER_MODE
BUILT_SOURCES = process-window_ui.h settings-dialog_ui.h
BUILT_SOURCES = process-window_ui.h settings-dialog_ui.h process-window-gtk3_ui.h settings-dialog-gtk3_ui.h
process-window_ui.h: process-window.ui
$(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=process_window_ui $< >$@
settings-dialog_ui.h: settings-dialog.ui
$(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=settings_dialog_ui $< >$@
process-window-gtk3_ui.h: process-window-gtk3.ui
$(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=process_window_ui $< >$@
settings-dialog-gtk3_ui.h: settings-dialog-gtk3.ui
$(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=settings_dialog_ui $< >$@
endif
EXTRA_DIST = process-window.ui settings-dialog.ui
EXTRA_DIST = process-window.ui settings-dialog.ui process-window-gtk3.ui settings-dialog-gtk3.ui

View File

@@ -51,7 +51,7 @@ xtm_exec_tool_button_init (XtmExecToolButton *button)
{
GtkWidget *menu;
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (button), "gtk-execute");
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "gtk-execute");
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (button), TRUE);
menu = construct_menu ();
@@ -79,8 +79,24 @@ static void
execute_command (const gchar *command)
{
GError *error = NULL;
#ifdef HAVE_GTK3
GdkScreen *screen;
GdkDisplay *display;
GdkAppLaunchContext *launch_context;
GAppInfo *app_info;
app_info = g_app_info_create_from_commandline (command, NULL, G_APP_INFO_CREATE_NONE, &error);
if (!error) {
display = gdk_screen_get_display (screen);
launch_context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_screen (launch_context, screen);
g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT
(launch_context), &error);
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,

View File

@@ -31,7 +31,11 @@ static gboolean timeout = 0;
static void
status_icon_activated (void)
{
#ifdef HAVE_GTK3
if (!(gtk_widget_is_visible (window)))
#else
if (!(GTK_WIDGET_VISIBLE (window)))
#endif
gtk_widget_show (window);
else
gtk_widget_hide (window);

View File

@@ -21,10 +21,6 @@
enum
{
PROP_STEP_SIZE = 1,
PROP_COLOR_RED,
PROP_COLOR_GREEN,
PROP_COLOR_BLUE,
PROP_PAINT_BOX,
};
typedef struct _XtmProcessMonitorClass XtmProcessMonitorClass;
struct _XtmProcessMonitorClass
@@ -37,10 +33,6 @@ struct _XtmProcessMonitor
/*<private>*/
gfloat step_size;
GArray * history;
gfloat color_red;
gfloat color_green;
gfloat color_blue;
gboolean paint_box;
};
G_DEFINE_TYPE (XtmProcessMonitor, xtm_process_monitor, GTK_TYPE_DRAWING_AREA)
@@ -59,33 +51,19 @@ 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;
#ifdef HAVE_GTK3
widget_class->draw = xtm_process_monitor_expose;
#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.1, G_MAXFLOAT, 1, G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
g_object_class_install_property (class, PROP_COLOR_RED,
g_param_spec_float ("color-red", "ColorRed", "Color red", 0, 1, 0, G_PARAM_READWRITE));
g_object_class_install_property (class, PROP_COLOR_GREEN,
g_param_spec_float ("color-green", "ColorGreen", "Color green", 0, 1, 0, G_PARAM_READWRITE));
g_object_class_install_property (class, PROP_COLOR_BLUE,
g_param_spec_float ("color-blue", "ColorBlue", "Color blue", 0, 1, 0, G_PARAM_READWRITE));
g_object_class_install_property (class, PROP_PAINT_BOX,
g_param_spec_boolean ("paint-box", "PaintBox", "Paint box around monitor", TRUE, G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
}
static void
init_source_color (GtkWidget *widget, GtkStyle *prev_style, gpointer user_data)
{
GdkColor *color = &widget->style->base[GTK_STATE_SELECTED];
XTM_PROCESS_MONITOR (widget)->color_red = color->red / 65535.0;
XTM_PROCESS_MONITOR (widget)->color_green = color->green / 65535.0;
XTM_PROCESS_MONITOR (widget)->color_blue = color->blue / 65535.0;
}
static void
xtm_process_monitor_init (XtmProcessMonitor *monitor)
{
monitor->history = g_array_new (FALSE, TRUE, sizeof (gfloat));
g_signal_connect (monitor, "style-set", G_CALLBACK (init_source_color), NULL);
}
static void
@@ -98,22 +76,6 @@ xtm_process_monitor_get_property (GObject *object, guint property_id, GValue *va
g_value_set_float (value, monitor->step_size);
break;
case PROP_COLOR_RED:
g_value_set_float (value, monitor->color_red);
break;
case PROP_COLOR_GREEN:
g_value_set_float (value, monitor->color_green);
break;
case PROP_COLOR_BLUE:
g_value_set_float (value, monitor->color_blue);
break;
case PROP_PAINT_BOX:
g_value_set_boolean (value, monitor->paint_box);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -130,22 +92,6 @@ xtm_process_monitor_set_property (GObject *object, guint property_id, const GVal
monitor->step_size = g_value_get_float (value);
break;
case PROP_COLOR_RED:
monitor->color_red = g_value_get_float (value);
break;
case PROP_COLOR_GREEN:
monitor->color_green = g_value_get_float (value);
break;
case PROP_COLOR_BLUE:
monitor->color_blue = g_value_get_float (value);
break;
case PROP_PAINT_BOX:
monitor->paint_box = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -158,7 +104,11 @@ xtm_process_monitor_expose (GtkWidget *widget, GdkEventExpose *event)
XtmProcessMonitor *monitor = XTM_PROCESS_MONITOR (widget);
guint minimum_history_length;
#ifdef HAVE_GTK3
minimum_history_length = gtk_widget_get_allocated_width(widget) / monitor->step_size;
#else
minimum_history_length = widget->allocation.width / monitor->step_size;
#endif
if (monitor->history->len < minimum_history_length)
g_array_set_size (monitor->history, minimum_history_length + 1);
@@ -167,14 +117,12 @@ xtm_process_monitor_expose (GtkWidget *widget, GdkEventExpose *event)
}
static cairo_surface_t *
xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor)
xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor, gint width, gint height)
{
cairo_t *cr;
cairo_surface_t *graph_surface;
cairo_pattern_t *linpat;
gfloat *peak;
gfloat step_size;
gint width, height;
gint i;
if (monitor->history->len <= 1)
@@ -182,20 +130,13 @@ xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor)
g_warning ("Cannot paint graph with n_peak <= 1");
return NULL;
}
width = GTK_WIDGET (monitor)->allocation.width;
height = GTK_WIDGET (monitor)->allocation.height;
step_size = monitor->step_size;
graph_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
cr = cairo_create (graph_surface);
/* Draw area */
linpat = cairo_pattern_create_linear (0, 0, 0, height);
cairo_pattern_add_color_stop_rgba (linpat, 0.4, monitor->color_red, monitor->color_green, monitor->color_blue, 0.3);
cairo_pattern_add_color_stop_rgba (linpat, 0.9, monitor->color_red, monitor->color_green, monitor->color_blue, 0.5);
cairo_pattern_add_color_stop_rgba (linpat, 1, monitor->color_red, monitor->color_green, monitor->color_blue, 0.6);
cairo_set_source (cr, linpat);
/* Draw area below the line */
cairo_set_source_rgba (cr, 1.0, 0.43, 0.0, 0.3);
cairo_set_line_width (cr, 0.0);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
@@ -210,12 +151,10 @@ xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor)
cairo_line_to (cr, width, height);
cairo_fill (cr);
cairo_pattern_destroy (linpat);
/* Draw line */
cairo_translate (cr, step_size * i, 0);
cairo_set_source_rgb (cr, monitor->color_red, monitor->color_green, monitor->color_blue);
cairo_set_source_rgba (cr, 1.0, 0.43, 0.0, 1.0);
cairo_set_line_width (cr, 0.85);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
@@ -240,19 +179,38 @@ xtm_process_monitor_paint (XtmProcessMonitor *monitor)
cairo_t *cr;
cairo_surface_t *graph_surface;
gint width, height;
static const double dashed[] = {1.5};
gint i;
cr = gdk_cairo_create (GTK_WIDGET (monitor)->window);
cr = gdk_cairo_create (gtk_widget_get_window(GTK_WIDGET(monitor)));
#ifdef HAVE_GTK3
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
/* Paint a box */
if (monitor->paint_box)
gtk_paint_box (GTK_WIDGET (monitor)->style, GTK_WIDGET (monitor)->window, GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
NULL, GTK_WIDGET (monitor), "trough", 0, 0, width, height);
/* Paint the graph's background box */
cairo_rectangle (cr, 0.0, 0.0, width, height);
cairo_set_source_rgb (cr, 0.96, 0.96, 0.96);
cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_set_line_width (cr, 0.75);
cairo_stroke (cr);
/* Paint dashed lines at 25%, 50% and 75% */
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.3);
cairo_set_line_width (cr, 1.0);
cairo_set_dash(cr, dashed, 1.0, 0);
for (i = 25; i <= 75; i += 25)
{
cairo_move_to (cr, 1.5, i * height / 100 + 0.5);
cairo_line_to (cr, width - 0.5, i * height / 100 + 0.5);
cairo_stroke (cr);
}
/* Paint the graph */
graph_surface = xtm_process_monitor_graph_surface_create (monitor);
/* Paint the graph on a slightly smaller surface not to overlap with the background box */
graph_surface = xtm_process_monitor_graph_surface_create (monitor, width - 1, height - 1);
if (graph_surface != NULL)
{
cairo_set_source_surface (cr, graph_surface, 0.0, 0.0);
@@ -260,35 +218,6 @@ xtm_process_monitor_paint (XtmProcessMonitor *monitor)
cairo_surface_destroy (graph_surface);
}
/* Trace some marks */
cairo_set_line_width (cr, 0.75);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
for (i = 10; i < 100; i += 10)
{
cairo_move_to (cr, 0.0, i * height / 100);
cairo_line_to (cr, width, i * height / 100);
}
cairo_stroke (cr);
gdk_cairo_set_source_color (cr, &GTK_WIDGET (monitor)->style->fg[GTK_STATE_NORMAL]);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_set_line_width (cr, 1.0);
for (i = 25; i <= 75; i += 25)
{
cairo_move_to (cr, 0.0, i * height / 100);
cairo_line_to (cr, 4.0, i * height / 100);
cairo_move_to (cr, width, i * height / 100);
cairo_line_to (cr, width - 4.0, i * height / 100);
}
cairo_stroke (cr);
/* Repaint a shadow on top of everything to clear corners */
if (monitor->paint_box)
gtk_paint_shadow (GTK_WIDGET (monitor)->style, GTK_WIDGET (monitor)->window, GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
NULL, GTK_WIDGET (monitor), "trough", 0, 0, width, height);
cairo_destroy (cr);
}
@@ -308,8 +237,8 @@ xtm_process_monitor_add_peak (XtmProcessMonitor *monitor, gfloat peak)
if (monitor->history->len > 1)
g_array_remove_index (monitor->history, monitor->history->len - 1);
if (GDK_IS_WINDOW (GTK_WIDGET (monitor)->window))
gdk_window_invalidate_rect (GTK_WIDGET (monitor)->window, NULL, FALSE);
if (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET(monitor))))
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET(monitor)), NULL, FALSE);
}
void
@@ -317,8 +246,8 @@ xtm_process_monitor_set_step_size (XtmProcessMonitor *monitor, gfloat step_size)
{
g_return_if_fail (XTM_IS_PROCESS_MONITOR (monitor));
g_object_set (monitor, "step_size", step_size, NULL);
if (GDK_IS_WINDOW (GTK_WIDGET (monitor)->window))
gdk_window_invalidate_rect (GTK_WIDGET (monitor)->window, NULL, FALSE);
if (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET(monitor))))
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET(monitor)), NULL, FALSE);
}
void
@@ -326,25 +255,6 @@ xtm_process_monitor_clear (XtmProcessMonitor *monitor)
{
g_return_if_fail (XTM_IS_PROCESS_MONITOR (monitor));
g_array_set_size (monitor->history, 0);
if (GDK_IS_WINDOW (GTK_WIDGET (monitor)->window))
gdk_window_invalidate_rect (GTK_WIDGET (monitor)->window, NULL, FALSE);
}
void
xtm_process_monitor_set_source_color (XtmProcessMonitor *monitor, gdouble red, gdouble green, gdouble blue)
{
g_return_if_fail (XTM_IS_PROCESS_MONITOR (monitor));
g_signal_handlers_disconnect_by_func (GTK_WIDGET (monitor), init_source_color, NULL);
g_object_set (monitor, "color-red", red, "color-green", green, "color-blue", blue, NULL);
if (GDK_IS_WINDOW (GTK_WIDGET (monitor)->window))
gdk_window_invalidate_rect (GTK_WIDGET (monitor)->window, NULL, FALSE);
}
void
xtm_process_monitor_set_paint_box (XtmProcessMonitor *monitor, gboolean paint_box)
{
g_return_if_fail (XTM_IS_PROCESS_MONITOR (monitor));
g_object_set (monitor, "paint-box", paint_box, NULL);
if (GDK_IS_WINDOW (GTK_WIDGET (monitor)->window))
gdk_window_invalidate_rect (GTK_WIDGET (monitor)->window, NULL, FALSE);
}
if (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET(monitor))))
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET(monitor)), NULL, FALSE);
}

View File

@@ -30,7 +30,5 @@ GtkWidget * xtm_process_monitor_new (void);
void xtm_process_monitor_add_peak (XtmProcessMonitor *monitor, gfloat peak);
void xtm_process_monitor_set_step_size (XtmProcessMonitor *monitor, gfloat step_size);
void xtm_process_monitor_clear (XtmProcessMonitor *monitor);
void xtm_process_monitor_set_source_color (XtmProcessMonitor *monitor, gdouble red, gdouble green, gdouble blue);
void xtm_process_monitor_set_paint_box (XtmProcessMonitor *monitor, gboolean paint_box);
#endif /* !PROCESS_MONITOR_H */

View File

@@ -100,7 +100,11 @@ xtm_process_statusbar_init (XtmProcessStatusbar *statusbar)
}
#endif
#ifdef HAVE_GTK3
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
#else
hbox = gtk_hbox_new (FALSE, 16);
#endif
gtk_box_pack_start (GTK_BOX (area), hbox, TRUE, TRUE, 6);
statusbar->label_num_processes = gtk_label_new (NULL);

View File

@@ -15,7 +15,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "process-tree-model.h"
#include "process-tree-view.h"
#include "task-manager.h"
@@ -557,7 +556,7 @@ treeview_key_pressed (XtmProcessTreeView *treeview, GdkEventKey *event)
{
guint pid;
if (event->keyval != GDK_Menu)
if (event->keyval != GDK_KEY_Menu)
return FALSE;
{

161
src/process-window-gtk3.ui Normal file
View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<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">utilities-system-monitor</property>
<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="GtkToolItem" id="cpu-toolitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">2</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolItem" id="mem-toolitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">2</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
<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>
</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="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="primary_icon_activatable">False</property>
<property name="secondary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">2</property>
<property name="position">2</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>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -22,7 +22,11 @@
#include "settings.h"
#include "process-window.h"
#ifdef HAVE_GTK3
#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"
@@ -62,7 +66,6 @@ static gboolean emit_delete_event_signal (XtmProcessWindow *window, GdkEvent *
static gboolean xtm_process_window_key_pressed (XtmProcessWindow *window, GdkEventKey *event);
static void toolbar_update_style (XtmProcessWindow *window);
static void monitor_update_step_size (XtmProcessWindow *window);
static void monitor_update_paint_box (XtmProcessWindow *window);
static void show_about_dialog (XtmProcessWindow *window);
@@ -155,8 +158,6 @@ xtm_process_window_init (XtmProcessWindow *window)
gtk_widget_show (window->mem_monitor);
gtk_container_add (GTK_CONTAINER (toolitem), window->mem_monitor);
monitor_update_paint_box (window);
g_signal_connect_swapped (window->settings, "notify::monitor-paint-box", G_CALLBACK (monitor_update_paint_box), window);
g_signal_connect_swapped (window->settings, "notify::refresh-rate", G_CALLBACK (monitor_update_step_size), window);
}
@@ -285,15 +286,6 @@ toolbar_update_style (XtmProcessWindow *window)
}
}
static void
monitor_update_paint_box (XtmProcessWindow *window)
{
gboolean paint_box;
g_object_get (window->settings, "monitor-paint-box", &paint_box, NULL);
xtm_process_monitor_set_paint_box (XTM_PROCESS_MONITOR (window->cpu_monitor), paint_box);
xtm_process_monitor_set_paint_box (XTM_PROCESS_MONITOR (window->mem_monitor), paint_box);
}
static void
monitor_update_step_size (XtmProcessWindow *window)
{
@@ -354,7 +346,9 @@ show_about_dialog (XtmProcessWindow *window)
"version", PACKAGE_VERSION,
"copyright", "Copyright \302\251 2005-2010 The Xfce development team",
"logo-icon-name", "utilities-system-monitor",
#ifndef HAVE_GTK3
"icon-name", GTK_STOCK_ABOUT,
#endif
"comments", _("Easy to use task manager"),
"license", license,
"authors", authors,
@@ -383,7 +377,9 @@ xtm_process_window_show (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (XTM_PROCESS_WINDOW (widget)->window));
gtk_widget_show (XTM_PROCESS_WINDOW (widget)->window);
gtk_window_present (GTK_WINDOW (XTM_PROCESS_WINDOW (widget)->window));
#ifndef HAVE_GTK3
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
#endif
}
static void
@@ -396,7 +392,9 @@ xtm_process_window_hide (GtkWidget *widget)
gtk_window_get_position (GTK_WINDOW (XTM_PROCESS_WINDOW (widget)->window), &winx, &winy);
gtk_widget_hide (XTM_PROCESS_WINDOW (widget)->window);
gtk_window_move (GTK_WINDOW (XTM_PROCESS_WINDOW (widget)->window), winx, winy);
#ifndef HAVE_GTK3
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
#endif
}
GtkTreeModel *

453
src/settings-dialog-gtk3.ui Normal file
View File

@@ -0,0 +1,453 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="settings-dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Settings for Task Manager</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="icon_name">gtk-preferences</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button-close">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<child>
<object class="GtkBox" id="hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<child>
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFrame" id="frame-interface">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment-interface">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="vbox-interface">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="button-show-application-icons">
<property name="label" translatable="yes">Show application icons</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-full-command-line">
<property name="label" translatable="yes">Show full command lines</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-more-precision">
<property name="label" translatable="yes">Show values with more precision</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-process-tree">
<property name="label" translatable="yes">Show processes as tree</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-show-memory-in-xbytes">
<property name="label" translatable="yes">Show memory usage in bytes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox-toolbar-style">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label-toolbar-style">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Toolbar style:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">6</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label-interface">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Interface style&lt;/b&gt;</property>
<property name="use_markup">True</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="GtkFrame" id="frame-misc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment-misc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="vbox-misc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="button-prompt-terminate-task">
<property name="label" translatable="yes">Prompt for terminating tasks</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-show-status-icon">
<property name="label" translatable="yes">Hide into the notification area</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label-misc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Miscellaneous&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</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="GtkSeparator" id="vseparator1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="vbox2">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFrame" id="frame-information">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment-information">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="vbox-information">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="hbox-refresh-rate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label-refresh-rate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Refresh rate:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="combobox-refresh-rate">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label-columns">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Columns:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment-columns">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow-columns">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview-columns">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label-information">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Information&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Settings</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">button-close</action-widget>
</action-widgets>
</object>
</interface>

View File

@@ -17,7 +17,11 @@
#include "settings.h"
#include "settings-dialog.h"
#ifdef HAVE_GTK3
#include "settings-dialog-gtk3_ui.h"
#else
#include "settings-dialog_ui.h"
#endif
@@ -105,7 +109,6 @@ xtm_settings_dialog_init (XtmSettingsDialog *dialog)
builder_bind_toggle_button (builder, "button-show-application-icons", dialog->settings, "show-application-icons");
builder_bind_toggle_button (builder, "button-full-command-line", dialog->settings, "full-command-line");
builder_bind_toggle_button (builder, "button-more-precision", dialog->settings, "more-precision");
builder_bind_toggle_button (builder, "button-monitor-paint-box", dialog->settings, "monitor-paint-box");
builder_bind_toggle_button (builder, "button-prompt-terminate-task", dialog->settings, "prompt-terminate-task");
builder_bind_toggle_button (builder, "button-show-status-icon", dialog->settings, "show-status-icon");
builder_bind_toggle_button (builder, "button-show-memory-in-xbytes", dialog->settings, "show-memory-in-xbytes");
@@ -119,13 +122,21 @@ xtm_settings_dialog_init (XtmSettingsDialog *dialog)
XtmToolbarStyle toolbar_style;
box = GTK_WIDGET (gtk_builder_get_object (builder, "hbox-toolbar-style"));
#if GTK_CHECK_VERSION(2, 24, 1)
combobox = gtk_combo_box_text_new ();
#else
combobox = gtk_combo_box_new_text ();
#endif
gtk_box_pack_start (GTK_BOX (box), combobox, FALSE, FALSE, 0);
gtk_widget_show (combobox);
klass = g_type_class_ref (XTM_TYPE_TOOLBAR_STYLE);
for (n = 0; n < klass->n_values; ++n)
#if GTK_CHECK_VERSION(2, 24, 1)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _(klass->values[n].value_nick));
#else
gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _(klass->values[n].value_nick));
#endif
g_type_class_unref (klass);
g_object_get (dialog->settings, "toolbar-style", &toolbar_style, NULL);
@@ -162,7 +173,9 @@ xtm_settings_dialog_show (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (XTM_SETTINGS_DIALOG (widget)->window));
gtk_widget_show (XTM_SETTINGS_DIALOG (widget)->window);
gtk_window_present (GTK_WINDOW (XTM_SETTINGS_DIALOG (widget)->window));
#ifndef HAVE_GTK3
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
#endif
}
static void
@@ -175,7 +188,9 @@ xtm_settings_dialog_hide (GtkWidget *widget)
gtk_window_get_position (GTK_WINDOW (XTM_SETTINGS_DIALOG (widget)->window), &winx, &winy);
gtk_widget_hide (XTM_SETTINGS_DIALOG (widget)->window);
gtk_window_move (GTK_WINDOW (XTM_SETTINGS_DIALOG (widget)->window), winx, winy);
#ifndef HAVE_GTK3
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
#endif
}
void

View File

@@ -26,7 +26,7 @@
<property name="visible">True</property>
<property name="border_width">6</property>
<child>
<object class="GtkVBox" id="vbox1">
<object class="GtkHBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
@@ -41,7 +41,7 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox-interface">
<object class="GtkHBox" id="vbox-interface">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
@@ -85,21 +85,6 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-monitor-paint-box">
<property name="label" translatable="yes">Draw borders around monitors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.49000000953674316</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="button-process-tree">
<property name="label" translatable="yes">Show processes as tree</property>
@@ -385,7 +370,7 @@
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area">
<object class="GtkButtonBox" id="dialog-action_area">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>

View File

@@ -49,7 +49,7 @@ xtm_settings_tool_button_init (XtmSettingsToolButton *button)
{
GtkWidget *menu;
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (button), "gtk-preferences");
gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (button), "gtk-preferences");
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (button), TRUE);
menu = construct_menu ();
@@ -73,7 +73,7 @@ show_settings_dialog (XtmSettingsToolButton *button)
static void
refresh_rate_toggled (GtkCheckMenuItem *mi, XtmSettings *settings)
{
if(mi->active)
if(gtk_check_menu_item_get_active(mi))
{
guint refresh_rate = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (mi), "refresh-rate"));
g_object_set (settings, "refresh-rate", refresh_rate, NULL);