KGtk (Use KDE Dialogs in Gtk Apps)

Various KDE 1.-4. Improvements

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

11
Score 76.7%
Description:

This is a quick-and-dirty LD_PRELOAD hack that allows *some* Gtk applications to use KDE's file dialogs when run under KDE.

The Gtk file chooser functions have been overridden to communicate with this KDE module/application.

After compiling and installing this, you can run Gtk applications in 2 ways:

A. call /usr/local/bin/kgtk-wrapper gimp

B. i. Create a symbolic link from the wrapper script to your application, e.g.
ln -s /usr/local/bin/kgtk-wrapper /usr/local/bin/gimp
ii. Make sure /usr/local/bin is before /usr/bin (or wherever gimp is installed) in your $PATH
iii. Now simply run 'gimp' - this should find the wrapper script first.

If this works OK, then edit the .desktop file (e.g. /usr/share/applications/gimp.desktop) to have "Exec=/usr/local/bin/[appname]" instead of "Exec=[appname]", e.g. for gimp.desktop this would be:

Exec=/usr/local/bin/gimp-remote-2.2 %U

or:

Exec=/usr/local/bin/kgtk-wrapper gimp-remote-2.2 %U


So far I have tested this with the following applications:

1. Kino. Works perfectly - in fact Kino was my main reason for doing this.
2. Firefox. Works with Firefox 1.5, but *not* Firefox 1.0.x
3. GIMP. Again, seems to work just fine. However, there is no progress bar on file loading - as GIMP uses a progress bar embedded in the file chooser.
4. Inkscape. Works OK - at least 0.43
5. Streamtuner - the folder browser button works.
6. AbiWord - does *not* work. Don't even try...
7. Glade2. Seems to work OK, however I have had it crash when loading Kino's .glade file, but not always. So I'm not sure if this is Glade's fault, or mine.
8. Eclipse. Will work only if dlsym can be overriden

As the only Gtk apps I use are Kino, GIMP, and a little of Firefox, this library works great for me. Your millage may vary, and please note that this is only a quick hack to get things working now for me. I'm not sure how stable it will be under heavy usage, so don't be surprised if it breaks. However, if it does break - the only thing that should happen is that the Gtk apps will fall back to using the standard Gtk dialogs.


p.s. Before anyone asks, as they always do:
Widget style: QtCurve, works for KDE and Gtk (also does KDE->Gtk icon mapping). This is set on the "Clear" variation.
Window decoration: Crystal with Knifty buttons
Font: Verdana. However, I have recompiled FreeType with the TrueType byte encoder enabled - this give great looking non anti-aliased fonts (otherwise they look *horrible*)
Last changelog:

8 years ago

0.11.0
------
1. Gtk3 support.
2. Better, and safer, lookup of file filters.
3. Correctly determine size of string needed for pidfile!
4. Add thunderbird, and LibreOffice apps, to list of gtk2 apps.
5. Cleanup usless stuff; remove kdialogd3, qt3, qt4, kgtk2-wrapper, kqt3-wrapper, kqt4-wrapper.
6. Merge kgtkXX-wrapper scripts into kgtk-wrapper
7. Install kdialogd4 into KDE4 libexec dir.
8. Fix crash where client is terminated whilst file dialog is open.
9. Configurable debug. Pass cmake -DKGTK_DEBUG=true
When starting app, set KGTK_DEBUG env var, e.g.

KGTK_DEBUG=0x10 kgtk-wrapper lowriter

0x01 Connection debug
0x02 General debug
0x04 Filter get and set debug
0x08 Filter creation debug
0x10 Custom widget debug
0x20 dlsym debug
Values may be combined

10. If LibreOffice is detected (app is libreoffice, lowriter, etc.) then also set the OOO_FORCE_DESKTOP env var to gnome, so that we get nicer
themeing.
11. When passing filters to KFileDialog, replace / with \/
12. Make filter combo non-editable.
13. When returning selected filter to Gtk app, also return the filter name and not just the file pattern. This way if two filters have the same file pattern the corrent one can be selected.
14. Support for checkbox custom widgets.
15. Save location history per app.

toadhall

12 years ago

Hi,

I get an error when trying to call up the programme. However, my path appears to be correct and when I am in

# /usr/local/bin

I link

# ln -s /usr/bin/kgtk-wrapper gimp

Then, as user, I change to
$ /usr/local/bin

and call up gimp I get

$ /bin/bash: /lib/tls/i686/cmov/libc.so.6: version `GLIBC_2.4' not found (required by /usr/lib/kgtk/libkgtk2.so)

Am I missing something incredibly obvious? I googled but no joy :(

Report

epsilom

12 years ago

Packages for kubuntu gutsy of kgtk 0.9.4 :

http://eidos.un.googlepages.com/kgtk_0.9.4-1_i386.deb

Report

cookies

12 years ago

In Opera, when you save a file, you have to manually supply the name... Is this an Opera issue, or a KGTK issue?

Report

C

CraigD

12 years ago

...ok, found the problem - and a solution. Will be fixed in the next release.

Report

C

CraigD

12 years ago

...probably a KGtk issue - as opera supplies a filename to the standard dialogs. I'll take a look and see if I can fix.

Report

MamiyaOtaru

12 years ago

-DKGTK_KDE3=true instructs CMake to create makefiles for the KDE3 version of KDialogD. ... Turning this on, sets ... -DKGTK_QT4=false

Why? This means I can no longer have KDE3 dialogs in Qt4 apps. This is something that was entirely possible with kgtk-0.9.0.

With that version I could get kde3 dialogs in gtk2, qt3 and qt4 apps. If this is not possible with cmake, then switching to cmake was IMHO a regression.

This is IMHO broken. Qt4 apps are becoming rather common, but most kde users are still with kde3.

Report

C

CraigD

12 years ago

It is not broken. Please try reading the README file before complaining. If you did you would've noticed:

"Mixing '-DKGTK_KDE3=true' and '-DKGTK_KDE4=true' wont work, so compile the Qt3/KDE3, and Qt4/KDE4 variants separately. Also, the 'build' folder *must* be cleaned before switching to/from Qt3/KDE3 from/to Qt4/KDE4"

So, to compile the Qt4 variant, remove the 'build' folder, create a new one, and then call

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DKGTK_KDE4=true -DKGTK_QT4=true -DKGTK_GTK2=false
make && sudo make install

..this will build the Qt4 LD_PRELOAD library only (if you do not have KDE4)


Basically you *can't* *compile* the Qt4/KDE4 version *at the same time* as the Qt3/KDE3 versions. After compiling Qt3/KDE3, delete the build folder, and start a Qt4/KDE4 build. Simple really.

Report

MamiyaOtaru

12 years ago

http://img80.imageshack.us/my.php?image=kgtkoldusagetn2.png for something that was possible with 0.9.0 but is no longer

Report

JardaK

12 years ago

I build rpm of KGtk 0.9.3 for Mandriva 2008.0. You can download here: ftp://mandrivauser.cz/people/jardak/MDV_2008.0/kgtk-0.9.3-1mjk.mdv2008.0.i586.rpm

Report

anv

12 years ago

Excelente. Sería bueno que Mandriva lo incluyera en los repositorios de contrib, o que lo pusieran en el PLF.

Una idea: podrías incluir un script post-install que verifique que programas estan instalados y genere entradas de menú incluyendo su llamado a traves del wrapper de kgtk (sin quitar la original)

Report

sanfanling

12 years ago

it's strange, mhwaveedit use kgtk, can't import any media file

Report

bertrandG

12 years ago

Some compilation problems on Kubuntu Gutsy Gibbons RC.

root@CORI-CELESTI:/home/bertrand/KGtk-0.9.2/build# cmake .. -DCMAKE_INSTALL_PREFIX=/usr
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Looking for getpeereid
-- Looking for getpeereid - not found
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found KDE3 include dir: /usr/include/kde
-- Found KDE3 library dir: /usr/lib
-- Found KDE3 dcopidl preprocessor: /usr/bin/dcopidl
-- Found KDE3 dcopidl2cpp preprocessor: /usr/bin/dcopidl2cpp
-- Found KDE3 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
** INFORMATION: KDialogD for KDE3 will be built.
-- Found xgettext: /usr/bin/xgettext
** INFORMATION: Gtk2 LD_PRELOAD library will be built.
** INFORMATION: Qt3 LD_PRELOAD library will be built.
** INFORMATION: Using installation prefix: /usr
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bertrand/KGtk-0.9.2/build


make
[ 12%] Generating kdialogd.moc
Scanning dependencies of target kdialogd3
[ 25%] Building CXX object kdialogd3/CMakeFiles/kdialogd3.dir/kdialogd.o
Linking CXX executable kdialogd3
[ 25%] Built target kdialogd3
[ 25%] Generating ../../../kdialogd3/po/zh_CN.gmo
/home/bertrand/KGtk-0.9.2/kdialogd3/po/zh_CN.po: warning: Charset "CHARSET" is not a portable encoding name.
Message conversion to user's charset might not work.
[ 25%] Generating ../../../kdialogd3/po/fr.gmo
/home/bertrand/KGtk-0.9.2/kdialogd3/po/fr.po: warning: Charset "CHARSET" is not a portable encoding name.
Message conversion to user's charset might not work.
[ 25%] Generating ../../../kdialogd3/po/en_GB.gmo
[ 62%] Built target pofiles
Scanning dependencies of target kgtk2
[ 75%] Building C object gtk2/CMakeFiles/kgtk2.dir/kgtk2.o
In file included from /home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:62:
/home/bertrand/KGtk-0.9.2/common/connect.h:98:5: warning: #warning "Using sloppy security checks"
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: In function ‘kdialogdMain’:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:187: warning: initialization from incompatible pointer type
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: In function ‘sendMessage’:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:247: warning: passing argument 1 of ‘gdk_x11_drawable_get_xid’ from incompatible pointer type
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: In function ‘gtk_init_check’:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:630: warning: assignment makes integer from pointer without a cast
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: In function ‘gtk_dialog_run’:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1165: warning: passing argument 1 of ‘kgtk_file_chooser_get_do_overwrite_confirmation’ from incompatible pointer type
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1176: warning: passing argument 1 of ‘kgtk_file_chooser_set_do_overwrite_confirmation’ from incompatible pointer type
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1316: warning: return makes integer from pointer without a cast
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: In function ‘handleGtkFileChooserButtonClicked’:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1672: warning: passing argument 1 of ‘gtk_dialog_run’ from incompatible pointer type
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: In function ‘handleGtkFileChooserComboChanged’:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1691: warning: passing argument 1 of ‘gtk_dialog_run’ from incompatible pointer type
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c: At top level:
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1810: warning: ‘struct PR_LoadLibrary’ declared inside parameter list
/home/bertrand/KGtk-0.9.2/gtk2/kgtk2.c:1810: warning: its scope is only this definition or declaration, which is probably not what you want
Linking C shared library libkgtk2.so
[ 75%] Built target kgtk2
[ 87%] Generating mangled.h
Scanning dependencies of target kqt3
[100%] Building CXX object qt3/CMakeFiles/kqt3.dir/kqt3.o
/home/bertrand/KGtk-0.9.2/qt3/kqt3.cpp:28:1: warning: "_GNU_SOURCE" redefined
<command line>:1:1: warning: this is the location of the previous definition
In file included from /home/bertrand/KGtk-0.9.2/qt3/kqt3.cpp:56:
/home/bertrand/KGtk-0.9.2/common/connect.h:98:5: warning: #warning "Using sloppy security checks"
Linking CXX shared library libkqt3.so
[100%] Built target kqt3

bertrand@CORI-CELESTI:/usr/bin$ kgtk-wrapper firefox
kdialogd3: Timeout:30
kdialogd3: New connection
kdialogd3: new client...firefox-bin (12)
kdialogd3: read
kdialogd3: Comms error, closing connection...12
kdialogd3: close 12
kdialogd3: Delete client
kdialogd3: Deleted client

Any idea ?

Report

C

CraigD

12 years ago

...at the moment, no idea. However, I use KUbuntu - and will upgrade to Gutsy a week or so after the release, so I'll check then.

Report

C

CraigD

12 years ago

...well I've literally just finished upgrading to Gutsy, and kgtk works fine with firefox. (Apart from when trying to overwrite a file - but that is a different issue, which will be fixed in the next release)

Report

ktulu77

12 years ago

I am very interrested in this patch.
It would be nice if we could have a .deb for our Gutsy :)
thank you !

Report

SputnikRock

12 years ago

To have a package would be great! - KGtk should really be standard in every Kubuntu!

Report

bertrandG

12 years ago

Have you tried to recompile it ?

I have tried with the following versions :
gnome-devel and gnome-core-devel 1:2.18.3ubuntu2
kde-devel 5:47

Maybe I miss one package ?
What do I need as package except from gnome-devel and gnome-core-devel and kde-devel ?

Report

mattepiu

12 years ago

In the sources there aren't .pot, .po
or .mo files, how do I start a
translation in a new language?

Report

C

CraigD

12 years ago

...umm, yes there are! Look in KGtk-0.9.2/kdialogd3/po, there you should find:

kdialogd3.pot
en_GB.po
fr.po
zh_CN.po

[KGtk-0.9.2/kdialogd4/po also contains similar files]

Report

jbpuertam

12 years ago

There seems to be a problem in gimp, handling a path with blank spaces. If you open an image, that is located in a path with blank spaces, and then do a "save as" , gimp displays an error message. It is working fine otherwise.

Report

C

CraigD

12 years ago

Well spotted! I think I've worked out the fix - and I'll do a new release soon.

Report

jbpuertam

12 years ago

It's working now... thanx

Report

jbpuertam

12 years ago

There seems to be a problem in gimp, handling a path with blank spaces. If you open an image, that is located in a path with blank spaces, and then do a "save as" , gimp displays an error message. It is working fine otherwise.

Report

jakuhr

12 years ago

Really nice work! But it would be much better if you could fix the translation of the dialog. Unfortunately i18n is still broken at least for me.

Thank you and keep up your great work!

Report

C

CraigD

12 years ago

OK, it seems like I need a translation file for each language. Can you provide such a translation? There's only about 7 strings that really need to be translated.

To do this (for Spanish), copy kdialogd3/po/kdialogd3.pot to kdialogd3/po/es.po and edit the new es.po file, look for the 'msgid' strings, and place there translation into 'msgstr' . Then email me the .po file, and I'll include it with the next release.

(Looks like if I create a dummy es.po file, compile it, and install it, then the standard KDE strings get translated - otherwise they don't)

Report

8 years ago

0.11.0
------
1. Gtk3 support.
2. Better, and safer, lookup of file filters.
3. Correctly determine size of string needed for pidfile!
4. Add thunderbird, and LibreOffice apps, to list of gtk2 apps.
5. Cleanup usless stuff; remove kdialogd3, qt3, qt4, kgtk2-wrapper, kqt3-wrapper, kqt4-wrapper.
6. Merge kgtkXX-wrapper scripts into kgtk-wrapper
7. Install kdialogd4 into KDE4 libexec dir.
8. Fix crash where client is terminated whilst file dialog is open.
9. Configurable debug. Pass cmake -DKGTK_DEBUG=true
When starting app, set KGTK_DEBUG env var, e.g.

KGTK_DEBUG=0x10 kgtk-wrapper lowriter

0x01 Connection debug
0x02 General debug
0x04 Filter get and set debug
0x08 Filter creation debug
0x10 Custom widget debug
0x20 dlsym debug
Values may be combined

10. If LibreOffice is detected (app is libreoffice, lowriter, etc.) then also set the OOO_FORCE_DESKTOP env var to gnome, so that we get nicer
themeing.
11. When passing filters to KFileDialog, replace / with \/
12. Make filter combo non-editable.
13. When returning selected filter to Gtk app, also return the filter name and not just the file pattern. This way if two filters have the same file pattern the corrent one can be selected.
14. Support for checkbox custom widgets.
15. Save location history per app.

12345678910
8
product-maker arcanis Jun 15 2014 9 excellent
product-maker YAFU Sep 26 2012 9 excellent
product-maker frag Sep 20 2012 9 excellent
product-maker dreamsoul Nov 04 2011 9 excellent
product-maker deabru Nov 04 2011 9 excellent
product-maker tcat Jun 20 2011 9 excellent
product-maker unikum111 Apr 25 2011 9 excellent
product-maker ZaWertun Nov 11 2010 9 excellent
product-maker Base: 4 x 5.0 Ratings
deabru
Nov 04 2011
tcat
Jun 20 2011
unikum111
Nov 12 2010
tigerfoot
Mar 07 2010
Raboch
Feb 24 2010
DaiVied
Dec 30 2009
Camberwell
Dec 01 2009
usrkl
Oct 07 2009
-luk-
Feb 23 2009
val-gaav
Feb 23 2009
alecs1
Feb 15 2009
File (click to download) Version Description PackagetypeArchitecture Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.11.0
updated Nov 03 2011
added Mar 06 2006
downloads 24h
0
mediaviews 24h 0
pageviews 24h 13