aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-06-23 13:36:25 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-06-23 13:36:25 +0000
commit51a842184c67368c3955f03142e4af05db1141c9 (patch)
treec86b20bbd678637b7fc26ab12937f4c44167a2ba /gtk
parentca9bb67aa6097867f1633a0379acf3d61bdd9265 (diff)
Fix some of the GTK deprecated functions.
svn path=/trunk/; revision=37766
Diffstat (limited to 'gtk')
-rw-r--r--gtk/io_stat.c71
1 files changed, 67 insertions, 4 deletions
diff --git a/gtk/io_stat.c b/gtk/io_stat.c
index 9ad0aa2f2d..1e7fa7ce66 100644
--- a/gtk/io_stat.c
+++ b/gtk/io_stat.c
@@ -1518,13 +1518,21 @@ create_pixels_per_tick_menu_items(io_stat_t *io)
char str[5];
GtkWidget *combo_box;
int i;
+#if GTK_CHECK_VERSION(2,24,0)
+ combo_box = gtk_combo_box_text_new ();
+ for(i=0;i<MAX_PIXELS_PER_TICK;i++){
+ g_snprintf(str, 5, "%u", pixels_per_tick[i]);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), str);
+ }
+#else
combo_box = gtk_combo_box_new_text ();
for(i=0;i<MAX_PIXELS_PER_TICK;i++){
g_snprintf(str, 5, "%u", pixels_per_tick[i]);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), str);
}
+#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), DEFAULT_PIXELS_PER_TICK_INDEX);
g_signal_connect(combo_box, "changed", G_CALLBACK(pixels_per_tick_select), io);
@@ -1550,7 +1558,11 @@ create_tick_interval_menu_items(io_stat_t *io)
char str[15];
int i;
+#if GTK_CHECK_VERSION(2,24,0)
+ combo_box = gtk_combo_box_text_new ();
+#else
combo_box = gtk_combo_box_new_text ();
+#endif
for(i=0;i<MAX_TICK_VALUES;i++){
if(tick_interval_values[i]>=60000){
@@ -1564,7 +1576,11 @@ create_tick_interval_menu_items(io_stat_t *io)
} else {
g_snprintf(str, sizeof(str), "0.%03u sec", (tick_interval_values[i])%10);
}
+#if GTK_CHECK_VERSION(2,24,0)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), str);
+#else
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), str);
+#endif
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), DEFAULT_TICK_VALUE_INDEX);
g_signal_connect(combo_box, "changed", G_CALLBACK(tick_interval_select), io);
@@ -1579,8 +1595,11 @@ create_yscale_max_menu_items(io_stat_t *io)
GtkWidget *combo_box;
int i;
+#if GTK_CHECK_VERSION(2,24,0)
+ combo_box = gtk_combo_box_text_new ();
+#else
combo_box = gtk_combo_box_new_text ();
-
+#endif
for(i=0;i<MAX_YSCALE;i++){
if(yscale_max[i]==LOGARITHMIC_YSCALE){
g_strlcpy(str, "Logarithmic", 15);
@@ -1589,7 +1608,11 @@ create_yscale_max_menu_items(io_stat_t *io)
} else {
g_snprintf(str, 15, "%u", yscale_max[i]);
}
+#if GTK_CHECK_VERSION(2,24,0)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), str);
+#else
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), str);
+#endif
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), DEFAULT_YSCALE_INDEX);
g_signal_connect(combo_box, "changed", G_CALLBACK(yscale_select), io);
@@ -1635,10 +1658,18 @@ create_frames_or_bytes_menu_items(io_stat_t *io)
GtkWidget *combo_box;
int i;
+#if GTK_CHECK_VERSION(2,24,0)
+ combo_box = gtk_combo_box_text_new ();
+#else
combo_box = gtk_combo_box_new_text ();
+#endif
for(i=0;i<MAX_COUNT_TYPES;i++){
+#if GTK_CHECK_VERSION(2,24,0)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), count_type_names[i]);
+#else
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), count_type_names[i]);
+#endif
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), DEFAULT_COUNT_TYPE);
g_signal_connect(combo_box, "changed", G_CALLBACK(count_type_select), io);
@@ -1878,10 +1909,17 @@ create_calc_types_menu_items(io_stat_graph_t *gio)
GtkWidget *combo_box;
int i;
+#if GTK_CHECK_VERSION(2,24,0)
+ combo_box = gtk_combo_box_text_new ();
+#else
combo_box = gtk_combo_box_new_text ();
-
+#endif
for(i=0;i<MAX_CALC_TYPES;i++){
+#if GTK_CHECK_VERSION(2,24,0)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), calc_type_names[i]);
+#else
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), calc_type_names[i]);
+#endif
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), DEFAULT_CALC_TYPE);
g_signal_connect(combo_box, "changed", G_CALLBACK(calc_type_select), gio);
@@ -2022,9 +2060,17 @@ create_filter_box(io_stat_graph_t *gio, GtkWidget *box, int num)
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION(2,24,0)
+ combo_box = gtk_combo_box_text_new ();
+#else
combo_box = gtk_combo_box_new_text ();
+#endif
for(i=0;i<MAX_PLOT_STYLES;i++){
+#if GTK_CHECK_VERSION(2,24,0)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), plot_style_name[i]);
+#else
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), plot_style_name[i]);
+#endif
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), DEFAULT_PLOT_STYLE);
g_signal_connect(combo_box, "changed", G_CALLBACK(plot_style_select), &gio->io->graphs[num-1]);
@@ -2101,7 +2147,10 @@ init_io_stat_window(io_stat_t *io)
GtkWidget *hbox;
GtkWidget *bbox;
GtkWidget *close_bt, *help_bt;
+#if GTK_CHECK_VERSION(2,12,0)
+#else
GtkTooltips *tooltips = gtk_tooltips_new();
+#endif
GtkWidget *copy_bt;
#if GTK_CHECK_VERSION(2,6,0)
GtkWidget *save_bt;
@@ -2140,25 +2189,39 @@ init_io_stat_window(io_stat_t *io)
close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
window_set_cancel_button(io->window, close_bt, window_cancel_button_cb);
+#if GTK_CHECK_VERSION(2,12,0)
+ gtk_widget_set_tooltip_text(close_bt, "Enter the hostname or host IP address to be used as a source for remote capture.");
+#else
gtk_tooltips_set_tip(tooltips, close_bt, "Close this dialog", NULL);
-
+#endif
#if GTK_CHECK_VERSION(2,6,0)
save_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_SAVE);
gtk_widget_set_sensitive(save_bt, FALSE);
+#if GTK_CHECK_VERSION(2,12,0)
+ gtk_widget_set_tooltip_text(save_bt, "Save the displayed graph to a file");
+#else
gtk_tooltips_set_tip(tooltips, save_bt, "Save the displayed graph to a file", NULL);
+#endif
g_signal_connect(save_bt, "clicked", G_CALLBACK(pixmap_save_cb), NULL);
g_object_set_data(G_OBJECT(io->window), "save_bt", save_bt);
#endif
copy_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY);
+#if GTK_CHECK_VERSION(2,12,0)
+ gtk_widget_set_tooltip_text(copy_bt, "Copy values from selected graphs to the clipboard in CSV (Comma Separated Values) format");
+#else
gtk_tooltips_set_tip(tooltips, copy_bt,
"Copy values from selected graphs to the clipboard in CSV (Comma Separated Values) format", NULL);
+#endif
g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), io);
help_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP);
g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_STATS_IO_GRAPH_DIALOG);
+#if GTK_CHECK_VERSION(2,12,0)
+ gtk_widget_set_tooltip_text (help_bt, "Show topic specific help");
+#else
gtk_tooltips_set_tip (tooltips, help_bt, "Show topic specific help", NULL);
-
+#endif
g_signal_connect(io->window, "delete-event", G_CALLBACK(window_delete_event_cb), NULL);
gtk_widget_show(io->window);