[gnome-system-monitor/gtk3: 16/17] Fixed build issues for gtk3.
- From: Chris Kühl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor/gtk3: 16/17] Fixed build issues for gtk3.
- Date: Fri, 11 Feb 2011 15:21:47 +0000 (UTC)
commit 0ae088ac855d6f453b2ff28a76fa559937567f09
Author: Chris Kühl <chrisk openismus com>
Date: Wed Feb 9 17:10:16 2011 +0100
Fixed build issues for gtk3.
src/gsm_color_button.c | 40 +++++++++++++++++++++++++++++-----------
src/interface.cpp | 8 ++++----
src/load-graph.cpp | 34 ++++++++++++++++++----------------
src/load-graph.h | 4 ++--
src/openfiles.cpp | 1 -
src/procdialogs.cpp | 6 ++----
src/sysinfo.cpp | 10 +++++-----
7 files changed, 60 insertions(+), 43 deletions(-)
---
diff --git a/src/gsm_color_button.c b/src/gsm_color_button.c
index e829694..f3ff0db 100644
--- a/src/gsm_color_button.c
+++ b/src/gsm_color_button.c
@@ -81,8 +81,12 @@ static void gsm_color_button_get_property (GObject * object, guint param_id,
GValue * value,
GParamSpec * pspec);
static void gsm_color_button_realize (GtkWidget * widget);
-static void gsm_color_button_size_request (GtkWidget * widget,
- GtkRequisition * requisition);
+static void gsm_color_button_get_preferred_width (GtkWidget * widget,
+ gint * minimum,
+ gint * natural);
+static void gsm_color_button_get_preferred_height (GtkWidget * widget,
+ gint * minimum,
+ gint * natural);
static void gsm_color_button_size_allocate (GtkWidget * widget,
GtkAllocation * allocation);
static void gsm_color_button_unrealize (GtkWidget * widget);
@@ -171,7 +175,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;
- widget_class->size_request = gsm_color_button_size_request;
+ widget_class->get_preferred_width = gsm_color_button_get_preferred_width;
+ widget_class->get_preferred_height = gsm_color_button_get_preferred_height;
widget_class->size_allocate = gsm_color_button_size_allocate;
widget_class->realize = gsm_color_button_realize;
widget_class->unrealize = gsm_color_button_unrealize;
@@ -435,7 +440,7 @@ render (GtkWidget * widget)
/* Handle exposure events for the color picker's drawing area */
static gint
-expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer data)
+draw (GtkWidget * widget, cairo_t * cr, gpointer data)
{
render (GTK_WIDGET (data));
@@ -450,14 +455,27 @@ gsm_color_button_realize (GtkWidget * widget)
}
static void
-gsm_color_button_size_request (GtkWidget * widget,
- GtkRequisition * requisition)
+gsm_color_button_get_preferred_width (GtkWidget * widget,
+ gint * minimum,
+ gint * natural)
{
- g_return_if_fail (widget != NULL || requisition != NULL);
+ g_return_if_fail (widget != NULL || minimum != NULL || natural != NULL);
g_return_if_fail (GSM_IS_COLOR_BUTTON (widget));
- requisition->width = GSMCP_MIN_WIDTH;
- requisition->height = GSMCP_MIN_HEIGHT;
+ *minimum = GSMCP_MIN_WIDTH;
+ *natural = GSMCP_MIN_WIDTH;
+}
+
+static void
+gsm_color_button_get_preferred_height (GtkWidget * widget,
+ gint * minimum,
+ gint * natural)
+{
+ g_return_if_fail (widget != NULL || minimum != NULL || natural != NULL);
+ g_return_if_fail (GSM_IS_COLOR_BUTTON (widget));
+
+ *minimum = GSMCP_MIN_HEIGHT;
+ *natural = GSMCP_MIN_HEIGHT;
}
static void
@@ -624,8 +642,8 @@ gsm_color_button_init (GSMColorButton * color_button)
gtk_widget_set_tooltip_text (GTK_WIDGET(color_button), _("Click to set graph colors"));
- g_signal_connect (color_button, "expose-event",
- G_CALLBACK (expose_event), color_button);
+ g_signal_connect (color_button, "draw",
+ G_CALLBACK (draw), color_button);
}
static void
diff --git a/src/interface.cpp b/src/interface.cpp
index 06335a6..f605361 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -619,11 +619,11 @@ create_main_window (ProcData *procdata)
gtk_window_set_title(GTK_WINDOW(app), _("System Monitor"));
GdkScreen* screen = gtk_widget_get_screen(app);
- GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen);
+ GdkVisual* visual = gdk_screen_get_rgba_visual(screen);
- /* use rgba colormap, if available */
- if (colormap)
- gtk_widget_set_default_colormap(colormap);
+ /* use visual, if available */
+ if (visual)
+ gtk_widget_set_visual(app, visual);
main_box = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER(app), main_box);
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 3cf8683..57bca17 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -32,7 +32,7 @@
void LoadGraph::clear_background()
{
if (this->background) {
- g_object_unref(this->background);
+ cairo_surface_destroy (this->background);
this->background = NULL;
}
}
@@ -82,11 +82,11 @@ void draw_background(LoadGraph *g) {
g->graph_buffer_offset = (int) (1.5 * g->graph_delx) + FRAME_WIDTH ;
gtk_widget_get_allocation (g->disp, &allocation);
- g->background = gdk_pixmap_new (GDK_DRAWABLE (gtk_widget_get_window (g->disp)),
- allocation.width,
- allocation.height,
- -1);
- cr = gdk_cairo_create (g->background);
+ g->background = gdk_window_create_similar_surface (gtk_widget_get_window (g->disp),
+ CAIRO_CONTENT_COLOR,
+ allocation.width,
+ allocation.height);
+ cr = cairo_create (g->background);
// set the background colour
GtkStyle *style = gtk_widget_get_style (ProcData::get_instance()->notebook);
@@ -169,7 +169,7 @@ void draw_background(LoadGraph *g) {
/* Redraws the backing buffer for the load graph and updates the window */
void
-load_graph_draw (LoadGraph *g)
+load_graph_queue_draw (LoadGraph *g)
{
/* repaint */
gtk_widget_queue_draw (g->disp);
@@ -191,15 +191,15 @@ load_graph_configure (GtkWidget *widget,
g->clear_background();
- load_graph_draw (g);
+ load_graph_queue_draw (g);
return TRUE;
}
static gboolean
-load_graph_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data_ptr)
+load_graph_draw (GtkWidget *widget,
+ cairo_t * context,
+ gpointer data_ptr)
{
LoadGraph * const g = static_cast<LoadGraph*>(data_ptr);
GtkAllocation allocation;
@@ -213,8 +213,10 @@ load_graph_expose (GtkWidget *widget,
if (g->background == NULL) {
draw_background(g);
- gdk_window_set_back_pixmap (window, g->background, FALSE);
- }
+ cairo_pattern_t * pattern = cairo_pattern_create_for_surface (g->background);
+ gdk_window_set_background_pattern (window, pattern);
+ cairo_pattern_destroy (pattern);
+ }
/* Number of pixels wide for one graph point */
sample_width = (float)(g->draw_width - g->rmargin - g->indent) / (float)LoadGraph::NUM_POINTS;
@@ -558,7 +560,7 @@ load_graph_update (gpointer user_data)
}
if (g->draw)
- load_graph_draw (g);
+ load_graph_queue_draw (g);
g->render_counter++;
@@ -687,8 +689,8 @@ LoadGraph::LoadGraph(guint type)
g->disp = gtk_drawing_area_new ();
gtk_widget_show (g->disp);
- g_signal_connect (G_OBJECT (g->disp), "expose_event",
- G_CALLBACK (load_graph_expose), g);
+ g_signal_connect (G_OBJECT (g->disp), "draw",
+ G_CALLBACK (load_graph_draw), g);
g_signal_connect (G_OBJECT(g->disp), "configure_event",
G_CALLBACK (load_graph_configure), g);
g_signal_connect (G_OBJECT(g->disp), "destroy",
diff --git a/src/load-graph.h b/src/load-graph.h
index 9dd28bb..d90cf38 100644
--- a/src/load-graph.h
+++ b/src/load-graph.h
@@ -66,7 +66,7 @@ struct LoadGraph {
GtkWidget *main_widget;
GtkWidget *disp;
- GdkDrawable *background;
+ cairo_surface_t *background;
guint timer_index;
@@ -98,7 +98,7 @@ struct LoadGraph {
/* Force a drawing update */
void
-load_graph_draw (LoadGraph *g);
+load_graph_queue_draw (LoadGraph *g);
/* Start load graph. */
void
diff --git a/src/openfiles.cpp b/src/openfiles.cpp
index 98c14b7..1435e84 100644
--- a/src/openfiles.cpp
+++ b/src/openfiles.cpp
@@ -335,7 +335,6 @@ create_single_openfiles_dialog (GtkTreeModel *model, GtkTreePath *path,
NULL);
gtk_window_set_resizable (GTK_WINDOW (openfilesdialog), TRUE);
gtk_window_set_default_size (GTK_WINDOW (openfilesdialog), 575, 400);
- g_object_set(G_OBJECT(openfilesdialog), "has-separator", FALSE, NULL);
gtk_container_set_border_width (GTK_CONTAINER (openfilesdialog), 5);
vbox = gtk_dialog_get_content_area (GTK_DIALOG (openfilesdialog));
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index 2e16504..da34407 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -159,7 +159,7 @@ procdialog_create_renice_dialog (ProcData *procdata)
GtkWidget *label;
GtkWidget *priority_label;
GtkWidget *table;
- GtkObject *renice_adj;
+ GtkAdjustment *renice_adj;
GtkWidget *hscale;
GtkWidget *button;
GtkWidget *align;
@@ -178,7 +178,6 @@ procdialog_create_renice_dialog (ProcData *procdata)
NULL);
renice_dialog = dialog;
gtk_window_set_resizable (GTK_WINDOW (renice_dialog), FALSE);
- g_object_set (G_OBJECT (renice_dialog), "has-separator", FALSE, NULL);
gtk_container_set_border_width (GTK_CONTAINER (renice_dialog), 5);
button = gtk_button_new ();
@@ -220,7 +219,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;
- hscale = gtk_hscale_new (GTK_ADJUSTMENT (renice_adj));
+ hscale = gtk_hscale_new (renice_adj);
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,
@@ -505,7 +504,6 @@ procdialog_create_preferences_dialog (ProcData *procdata)
/* any function to set list height by contents/items inside it. */
gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 420);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- g_object_set (G_OBJECT (dialog), "has-separator", FALSE, NULL);
prefs_dialog = dialog;
main_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index a6b7870..9377a7e 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -412,9 +412,9 @@ namespace {
#define RADIUS 5
static gboolean
-sysinfo_logo_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data_ptr)
+sysinfo_logo_draw (GtkWidget *widget,
+ cairo_t *context,
+ gpointer data_ptr)
{
GtkAllocation allocation;
GtkStyle *style;
@@ -546,8 +546,8 @@ procman_create_sysinfo_view(void)
gtk_misc_set_padding(GTK_MISC(logo), 5, 12);
gtk_box_pack_start(GTK_BOX(hbox), logo, FALSE, FALSE, 0);
- g_signal_connect(G_OBJECT(logo), "expose-event",
- G_CALLBACK(sysinfo_logo_expose), NULL);
+ g_signal_connect(G_OBJECT(logo), "draw",
+ G_CALLBACK(sysinfo_logo_draw), NULL);
vbox = gtk_vbox_new(FALSE, 12);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]