axboe / fio

Flexible I/O Tester
GNU General Public License v2.0
5.26k stars 1.26k forks source link

Port gfio to gtk3 #820

Open anatol opened 5 years ago

anatol commented 5 years ago

gfio uses gtk2 that is the old version of the toolkit. Currently gtk2 is in maintatence mode but at some point it will be deprecated.

gfio should look at the possibility of using gtk3 that is current version of the toolkit.

anatol commented 5 years ago

FYI this simple patch allows me to compile gfio with gtk3. gtk3 still provides API compatibility with gtk2 though produces a number of compile-time warnings

diff --git a/configure b/configure
index b174a6fc..74e5291f 100755
--- a/configure
+++ b/configure
@@ -1348,23 +1348,23 @@ int main(void)
   gdk_threads_enter();
   gdk_threads_leave();

-  return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
+  return GTK_CHECK_VERSION(3, 0, 0) ? 0 : 1; /* 0 on success */
 }
 EOF
-GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
+GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-3.0 gthread-2.0)
 ORG_LDFLAGS=$LDFLAGS
 LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
 if test "$?" != "0" ; then
   echo "configure: gtk and gthread not found"
   exit 1
 fi
-GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
+GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-3.0 gthread-2.0)
 if test "$?" != "0" ; then
   echo "configure: gtk and gthread not found"
   exit 1
 fi
-if ! ${cross_prefix}pkg-config --atleast-version 2.18.0 gtk+-2.0; then
-  echo "GTK found, but need version 2.18 or higher"
+if ! ${cross_prefix}pkg-config --atleast-version 3.0.0 gtk+-3.0; then
+  echo "GTK found, but need version 3.0 or higher"
   gfio="no"
 else
   if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
@@ -1380,7 +1380,7 @@ LDFLAGS=$ORG_LDFLAGS
 fi

 if test "$gfio_check" = "yes" ; then
-  print_config "gtk 2.18 or higher" "$gfio"
+  print_config "gtk 3.0 or higher" "$gfio"
 fi

 ##########################################
sitsofe commented 5 years ago

Nice start! Any chance you can fix up the warnings too and eyeball the resulting GUI?

axboe commented 5 years ago

I took a quick look at this, and most of the changes needed seem pretty trivial. The only exception is uses of gdk_threads_enter() and gdk_thread_leave(). Those are a bit harder to convert, as it requires more fundamental changes in how events are received and processed.

snizovtsev commented 3 years ago

Hi!

I started from @anatol changes and fixed some deprecation warnings [1] but quickly realized that current gfio doesn't fit well with modern GTK3 concepts. I think it's better to draw new UI in Glade and drop all that markup in C.

Since I'm not proficient in UX and HIG I suggest someone help drawing new UI in Glade. I will bind it to backend after that.

[1] https://github.com/axboe/fio/compare/master...snizovtsev:gtk3?expand=1