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.

antro001

11 years ago

Yeah, dont forget to thanx

Report

cotelo

11 years ago

it does not work with iceweasel 3 and gimp

/usr/bin/kgtk-wrapper: line 96: kgtk2-wrapper: command not found

Report

kim42

11 years ago

When I type kgtk-wrapper gimp after installing, I see:
/usr/bin/kgtk-wrapper: line 96: kgtk2-wrapper: command not found

Report

C

CraigD

11 years ago

Do you have the GTK2 development headers installed?

When you did a make install you should see lines such as:

-- Installing /usr/bin/kdialogd-wrapper
-- Installing /usr/bin/kgtk-wrapper
...
-- Installing /usr/lib/kgtk/libkgtk2.so
-- Installing /usr/bin/kgtk2-wrapper

Report

pierreth

11 years ago

Cool! This was the solution for me! Thank you.

Report

kim42

11 years ago

What should I install?

Report

ste

11 years ago

Hello !

when I click on the download link (http://home.freeuk.com/cpdrummond/KGtk-0.10.tar.bz2) I have a « 404 Not Found » error.

Thanks in advance to fix it ;-)

Report

C

CraigD

11 years ago

Oops! Fixed URL now...

Report

ste

11 years ago

Thanks it work ;-)
and many thanks for this useful hack :-)

Report

antro001

11 years ago

Well, nice work.
However, in my system, when using kgtk 0.9.4 (since i dont have cmake 2.6 to compile KGTK 0.9.5/6) on kde3/qt3 with firefox to save pages, Its say "You can only select local Files !".
After read the kdialogd.cpp i know that KIO::NetAccess:mostLocalURL wont work if files not exist, if we save a pages or something else its not yet exist so KIO::NetAccess:mostLocalURL wont work.

Solution:
I adding this code in urls2Local function:


for(; it!=end; ++it)
if((*it).isLocalFile())
items.append((*it).path());
else
{
#if KDE_IS_VERSION(3, 5, 0)
- KURL url(KIO::NetAccess::mostLocalURL(*it, parent));

+ KURL lovex((*it).url());
+ QString strx(lovex.fileName());
+ lovex.cd("..");
+ KURL url = KIO::NetAccess::mostLocalURL(lovex, parent->topLevelWidget());
+ url.addPath(strx);

if(url.isLocalFile())
items.append(url.path());
else
break;
#else
break;
#endif
}

Correct me if i am wrong :)

Report

antro001

11 years ago

Thats if You Using media:/ or system:/ kioslaves on your KDE File Dialog

Report

k-bochi

11 years ago

I just compiled the KDE4 Version of KGtk and it seems to work just fine - except for one thing, the window loses focus when it opens kdialog4 - ie. I have firefox3 running and go to file->open, the firefox window jumps behind all other windows on the current desktop. Is this a known issue?

Report

Israphel

11 years ago

Will work with Firefox 3?

Are you going to do a QT4 version?

Report

C

CraigD

11 years ago

Firefox - works for me.
Qt4 - already done! (Has been part of KGtk from some time...)

Also, if you use the latest Qt4 QtCurve with KDE4 installed - it makes Qt use KDE's file dialogs without the need for KGtk.

Report

joth666

11 years ago

Which Qt4 Qtcurve and/or KDE4 version would that be?

Qt 4.4 and KDE 4.1? I certainly don't get KDE filedialogues in my qt-apps (using OpenSuse 11, KDE 4.0.4, qtcure 0.59.3)

Report

gassauer

11 years ago

-- Up-to-date: /usr/local/bin/kdialogd3
CMake Error at kdialogd3/po/cmake_install.cmake:36 (FILE):
file INSTALL cannot find file
"/home/gass/Documents/downloads/KGtk-0.9.6/build/kdialogd3/po//home/gass/Documents/downloads/KGtk-0.9.6/build/kdialogd3/po/cs.gmo"
to install.

after replacing
/home/gass/Documents/downloads/KGtk-0.9.6/build/kdialogd3/po//home/gass/Documents/downloads/KGtk-0.9.6/build/kdialogd3/po
with
/home/gass/Documents/downloads/KGtk-0.9.6/build/kdialogd3/po
it installs

Report

YuGiOhJCJ

11 years ago

I have the same error :
$ make install DESTDIR=/tmp/kgtk
[ 15%] Built target kdialogd3
[ 76%] Built target pofiles
[ 84%] Built target kgtk2
[100%] Built target kqt3
Install the project...
-- Install configuration: ""
-- Installing /tmp/kgtk/usr/bin/kdialogd-wrapper
-- Installing /tmp/kgtk/usr/bin/kgtk-wrapper
-- Install configuration: ""
-- Installing /tmp/kgtk/usr/bin/kdialogd3
-- Install configuration: ""
CMake Error: Error in cmake code at
/home/yugiohjcj/kgtk/KGtk-0.9.6/build/kdialogd3/po/cmake_install.cmake:35:
FILE INSTALL cannot find file "/home/yugiohjcj/kgtk/KGtk-0.9.6/build/kdialogd3/po//home/yugiohjcj/kgtk/KGtk-0.9.6/build/kdialogd3/po/zh_CN.gmo" to install.
Current CMake stack:
[3] /home/yugiohjcj/kgtk/KGtk-0.9.6/build/kdialogd3/po/cmake_install.cmake
[2] /home/yugiohjcj/kgtk/KGtk-0.9.6/build/kdialogd3/cmake_install.cmake
[1] /home/yugiohjcj/kgtk/KGtk-0.9.6/build/cmake_install.cmake
make: *** [install] Erreur 255

I am on Slackware 12.1, I use cmake-2.4.8 and KGtk-0.9.6.

Why this error?

Report

C

CraigD

11 years ago

Which version of CMake? I've tested against 2.4-patch 7 (Kunbutu 8.04), and 2.6

Report

michan

11 years ago

I'm getting that error with both CMake 2.4 (from Debian's testing repos) and 2.6 (from the unstable repos).

Report

gassauer

11 years ago

extension to get kde filedialog in python - tested with OpenERP client

kgtk-wrapper
46c46
< eclipse | gimp | inkscape | firefox | kino | iceweasel | swiftfox | azureus | mozilla* )
---
> *.py | python | eclipse | gimp | inkscape | firefox | kino | iceweasel | swiftfox | azureus | mozilla* )

Report

gassauer

11 years ago

extension to get kde filedialog in python - tested with OpenERP client

kgtk-wrapper
46c46
< eclipse | gimp | inkscape | firefox | kino | iceweasel | swiftfox | azureus | mozilla* )
---
> *.py | python | eclipse | gimp | inkscape | firefox | kino | iceweasel | swiftfox | azureus | mozilla* )

Report

daphreak

11 years ago

This is the message in english:

[code]# make
[ 7%] Generating kdialogd.moc
Scanning dependencies of target kdialogd3
[ 15%] Building CXX object kdialogd3/CMakeFiles/kdialogd3.dir/kdialogd.o
Linking CXX executable kdialogd3
[ 15%] Built target kdialogd3
Scanning dependencies of target pofiles
make[2]: *** No rule to make target `../kdialogd3/po/cs.gmo', needed by `kdialogd3/po/CMakeFiles/pofiles'. Stop.
make[1]: *** [kdialogd3/po/CMakeFiles/pofiles.dir/all] Error 2
make: *** [all] Error 2
[/code]

Report

beojan

11 years ago

Is there any chance you could turn the kgtk2-wrapper into a patch for GTK, so that ALL gtk applications use the KDE dialogs.

The QtGtk libraries may help here.

Report

pedrotux

11 years ago

Please make a update
of KGtk-0.96 i
can't make binary files

( ~/Documents/download/KGtk-0.9.4/build> cmake .. -DCMAKE_INSTALL_PREFIX=/usr )

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- 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
-- Found X11: /usr/lib/libX11.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_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: /opt/kde3/include
-- Found KDE3 library dir: /opt/kde3/lib
-- Found KDE3 dcopidl preprocessor: /opt/kde3/bin/dcopidl
-- Found KDE3 dcopidl2cpp preprocessor: /opt/kde3/bin/dcopidl2cpp
-- Found KDE3 kconfig_compiler preprocessor: /opt/kde3/bin/kconfig_compiler
** INFORMATION: KDialogD for KDE3 will be built.
-- Found xgettext: /usr/bin/xgettext
CMake Warning (dev) at CMakeLists.txt:54 (list):
Policy CMP0007 is not set: list command no longer ignores empty elements.
Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy
command to set the policy and suppress this warning. List has value =
[00000d40;g;;;;DF;.text 000000a7;;GLIBC_2.0;;;dlsym

].
This warning is for project developers. Use -Wno-dev to suppress it.

-- WARNING: you are using the obsolete 'PKGCONFIG' macro use FindPkgConfig
** INFORMATION: Gtk2 LD_PRELOAD library will be built.
** INFORMATION: Qt3 LD_PRELOAD library will be built.
** INFORMATION: Using installation prefix: /usr
-- Configuring done
CMake Warning (dev) at qt3/CMakeLists.txt:16 (add_library):
Policy CMP0003 should be set before this line. Add code such as

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

as early as possible but after the most recent call to
cmake_minimum_required or cmake_policy(VERSION). This warning appears
because target "kqt3" links to some libraries for which the linker must
search:

dl, -lpthread, -lc, -ldl

and other libraries with known full path:

/usr/lib/qt3/lib/libqassistantclient.a

CMake is adding directories in the second list to the linker search path in
case they are needed to find libraries from the first list (for backwards
compatibility with CMake 2.4). Set policy CMP0003 to OLD or NEW to enable
or disable this behavior explicitly. Run "cmake --help-policy CMP0003" for
more information.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: ~/Documents/download/KGtk-0.9.4/build

( make )
[ 9%] Generating kdialogd.moc
Scanning dependencies of target kdialogd3
[ 18%] Building CXX object kdialogd3/CMakeFiles/kdialogd3.dir/kdialogd.o
Linking CXX executable kdialogd3
[ 18%] Built target kdialogd3
Scanning dependencies of target pofiles
make[2]: *** Keine Regel vorhanden, um das Target »../kdialogd3/po/de.gmo«,
benötigt von »kdialogd3/po/CMakeFiles/pofiles«, zu erstellen. Schluss.
make[1]: *** [kdialogd3/po/CMakeFiles/pofiles.dir/all] Fehler 2
make: *** [all] Fehler 2

its not nice
if i downgrade cmake-2.6 to 2.4x
i can do it
but other packages don't need this

Report

pedrotux

11 years ago

Please make a update
of KGtk-0.96 i
can't make binary files

( ~/Documents/download/KGtk-0.9.4/build> cmake .. -DCMAKE_INSTALL_PREFIX=/usr )

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- 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
-- Found X11: /usr/lib/libX11.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_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: /opt/kde3/include
-- Found KDE3 library dir: /opt/kde3/lib
-- Found KDE3 dcopidl preprocessor: /opt/kde3/bin/dcopidl
-- Found KDE3 dcopidl2cpp preprocessor: /opt/kde3/bin/dcopidl2cpp
-- Found KDE3 kconfig_compiler preprocessor: /opt/kde3/bin/kconfig_compiler
** INFORMATION: KDialogD for KDE3 will be built.
-- Found xgettext: /usr/bin/xgettext
CMake Warning (dev) at CMakeLists.txt:54 (list):
Policy CMP0007 is not set: list command no longer ignores empty elements.
Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy
command to set the policy and suppress this warning. List has value =
[00000d40;g;;;;DF;.text 000000a7;;GLIBC_2.0;;;dlsym

].
This warning is for project developers. Use -Wno-dev to suppress it.

-- WARNING: you are using the obsolete 'PKGCONFIG' macro use FindPkgConfig
** INFORMATION: Gtk2 LD_PRELOAD library will be built.
** INFORMATION: Qt3 LD_PRELOAD library will be built.
** INFORMATION: Using installation prefix: /usr
-- Configuring done
CMake Warning (dev) at qt3/CMakeLists.txt:16 (add_library):
Policy CMP0003 should be set before this line. Add code such as

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

as early as possible but after the most recent call to
cmake_minimum_required or cmake_policy(VERSION). This warning appears
because target "kqt3" links to some libraries for which the linker must
search:

dl, -lpthread, -lc, -ldl

and other libraries with known full path:

/usr/lib/qt3/lib/libqassistantclient.a

CMake is adding directories in the second list to the linker search path in
case they are needed to find libraries from the first list (for backwards
compatibility with CMake 2.4). Set policy CMP0003 to OLD or NEW to enable
or disable this behavior explicitly. Run "cmake --help-policy CMP0003" for
more information.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: ~/Documents/download/KGtk-0.9.4/build

( make )
[ 9%] Generating kdialogd.moc
Scanning dependencies of target kdialogd3
[ 18%] Building CXX object kdialogd3/CMakeFiles/kdialogd3.dir/kdialogd.o
Linking CXX executable kdialogd3
[ 18%] Built target kdialogd3
Scanning dependencies of target pofiles
make[2]: *** Keine Regel vorhanden, um das Target »../kdialogd3/po/de.gmo«,
benötigt von »kdialogd3/po/CMakeFiles/pofiles«, zu erstellen. Schluss.
make[1]: *** [kdialogd3/po/CMakeFiles/pofiles.dir/all] Fehler 2
make: *** [all] Fehler 2

its not nice
if i downgrade cmake-2.6 to 2.4x
i can do it
but other packages don't need this

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 3