LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   dockapp, gtk updating dockapp to gtk2 or gtk3 (https://www.linuxquestions.org/questions/slackware-14/dockapp-gtk-updating-dockapp-to-gtk2-or-gtk3-4175625274/)

BW-userx 03-09-2018 01:20 PM

dockapp, gtk updating dockapp to gtk2 or gtk3
 
I got this one dockapp that is not behaving absolutely the way I believe it should. it is called "minicontrol" that shows the then and two buttons one for WPref the other is to display a ShutDown,restart,cancel message box window.

When the second button is pressed to shutdown, or reboot. that window and another window gets displayed. the second window that shows up is like another dockapp and takes its place in the dockapp area. Which is no big deal if one is shutting down or rebooting, because it will go away along with the entire desktop.


BUT, if cancel is selected that is when I get upset. The extra dockapp window that shows up with the message selection box window, (or whatever it is called) does not go away.

this is the sniplet of code that fires off the box and how it deals with the cancle button part.

Code:

        gtk_signal_connect (GTK_OBJECT(button3), "clicked", GTK_SIGNAL_FUNC(exitwidget), dialog);
       
        gtk_container_add (GTK_CONTAINER (dialog), table);
        gtk_widget_show_all (dialog);
  return;


} // end launchdialog

void exitwidget (GtkWidget *wgt, gpointer data){
        gtk_widget_destroy (GTK_WIDGET(data));
        return;
} // end exitwidget

this is gtk 1

as I have been googling around looking for a way to fix it. Seeing that it is
Code:

gtk_signal_connect is deprecated and should not be used in newly-written code.
with no use this instead to take its place, and the simple fact this is Slackware 41.2 I am using I am putting this in Slackware, and not programming.

Because if I take on this task, I thought to just fix that one thing, why not just updated the entire file which is only approx 400 lines of code. so it complies and works with the gtk that is being used today.

Code:

$ whereis gtk-3.0
gtk-3: /usr/lib64/gtk-3.0 /etc/gtk-3.0 /usr/include/gtk-3.0 /usr/share/gtk-3.0
userx@slackwhere101:~/Documents/minicontrol
$ whereis gtk-2.0
gtk-2: /usr/lib64/gtk-2.0 /etc/gtk-2.0 /usr/include/gtk-2.0 /usr/share/gtk-2.0

make file that came with it updated to reflect 2.0 or 3.0.

Code:


#LIBCONFIG = `gtk-config  --cflags --libs`
LIBCONFIG = `pkg-config --cflags --libs gtk+-3.0`

c file replaced
Code:

/*
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
*/
#include <gtk-2.0/gtk.h>
#include <gdk-2.0/gdk.h>
#include <gdk-2.0/gdkx.h>

2.0 or 3.0 does not matter I keep getting that same Ole error.
Code:

$ make
gcc -g -Wall -D__CONFPATH='"/usr/local/share/minicontrol"' -D__CONFFILE='"minicontrol.cf"' `pkg-config --cflags --libs gtk+-2.0` -o minicontrol minicontrol.c
minicontrol.c:19:25: fatal error: gtk-2.0/gtk.h: No such file or directory
compilation terminated.
makefile:28: recipe for target 'minicontrol' failed
make: *** [minicontrol] Error 1
-----
$ make
gcc -g -Wall -D__CONFPATH='"/usr/local/share/minicontrol"' -D__CONFFILE='"minicontrol.cf"' `pkg-config --cflags --libs gtk+-3.0` -o minicontrol minicontrol.c
minicontrol.c:19:25: fatal error: gtk-3.0/gtk.h: No such file or directory
compilation terminated.
makefile:28: recipe for target 'minicontrol' failed
make: *** [minicontrol] Error 1

so after all of that, how do I get that to work? :D

keefaz 03-09-2018 01:36 PM

Code:

pkg-config --cflags gtk+-2.0
-pthread -I/usr/include/gtk-2.0 ...

Using locate to find /gtk.h...
Code:

...
/usr/include/gtk-3.0/gtk/gtk.h
...
/usr/include/gtk-2.0/gtk/gtk.h
...

So change code to:
Code:

#include <gtk/gtk.h>
...


BW-userx 03-09-2018 02:04 PM

Quote:

Originally Posted by keefaz (Post 5829110)
Code:

pkg-config --cflags gtk+-2.0
-pthread -I/usr/include/gtk-2.0 ...

Using locate to find /gtk.h...
Code:

...
/usr/include/gtk-3.0/gtk/gtk.h
...
/usr/include/gtk-2.0/gtk/gtk.h
...

So change code to:
Code:

#include <gtk/gtk.h>
...


SO the header file define in the code stays gtk , in there lays my error.
thanks. Let me give that a try.

BW-userx 03-09-2018 02:11 PM

well it got rid of that where is it error,
Code:

/usr/lib64/gcc/x86_64-slackware-linux/5.5.0/../../../../x86_64-slackware-linux/bin/ld: /tmp/ccmxkEpS.o: undefined reference to symbol 'XSetCommand'
/usr/lib64/../lib64/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
makefile:28: recipe for target 'minicontrol' failed
make: *** [minicontrol] Error 1

thanks, now i got something I can work with,...

keefaz 03-09-2018 02:44 PM

Maybe add -lX11 to gcc options (before pkg-config gtk...)
or ' pkg-config --libs x11 ' but it's same thing :)

BW-userx 03-09-2018 02:52 PM

Quote:

Originally Posted by keefaz (Post 5829145)
Maybe add -lX11 to gcc options (before pkg-config gtk...)
or ' pkg-config --libs x11 ' but it's same thing :)

thanks!

as it stands it should be all the gtk gdk functions are obsolete or deprecated so it should keep failing until I get all of the new functions and whatever else gtk updated in the code before it works again.

keefaz 03-09-2018 03:01 PM

If there is a linking error again, add -lX11 after ' pkg-config --cflags --libs gtk+-2.0 ' at gcc command line
I wrongly suggested the opposite in previous post

BW-userx 03-09-2018 03:11 PM

Quote:

Originally Posted by keefaz (Post 5829151)
If there is a linking error again, add -lX11 after ' pkg-config --cflags --libs gtk+-2.0 ' at gcc command line
I wrongly suggested the opposite in previous post

figured it out, thanks again.
Code:

DEFINE = -D__CONFPATH='"$(CONFIGPATH)"' -D__CONFFILE='"$(CONFIGFILE)"'
LDLIBS += -lX11

#LIBCONFIG = `gtk-config  --cflags --libs`
LIBCONFIG = `pkg-config --cflags --libs gtk+-2.0`


$(BIN) : $(SRC)
        gcc $(CFLAGS) $(DEFINE) $(LDLIBS) $(LIBCONFIG) -o $(BIN) $(SRC)

gets
Code:

userx@slackwhere101:~/Documents/minicontrol
$ make
gcc -g -Wall -D__CONFPATH='"/usr/local/share/minicontrol"' -D__CONFFILE='"minicontrol.cf"' -lX11 `pkg-config --cflags --libs gtk+-2.0` -o minicontrol minicontrol.c
minicontrol.c: In function 'parse_from_config':
minicontrol.c:280:9: warning: variable 'c' set but not used [-Wunused-but-set-variable]
    int c;

equals a good build. Just need to update the code to get rid of the funny results I'm now getting when executing it.


All times are GMT -5. The time now is 05:23 PM.