Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 29 Jul 2014, 04:41
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog1-1.3
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 14 [207 Posts]   Goto page: 1, 2, 3, ..., 12, 13, 14 Next
Author Message
goingnuts

Joined: 07 Dec 2008
Posts: 779

PostPosted: Fri 03 Feb 2012, 00:55    Post subject:  GtkDialog1-1.3
Subject description: Was: Backport gtkdialog 0.59.8 to use gtk1/gtk2: gtkdialog1-1.0
 

New release, GtkDialog1-1.3, ready.

amigo has done a great job sanitizing the package and he has also been kind to host the current and the previous sources:
Download here

Although originally ment as a backport it has turned out to be slightly more than that - so thread-title changed.

A lot of enhancements made - for full description read the ChangeLog included in the source.

Last edited by goingnuts on Sun 07 Jul 2013, 05:15; edited 25 times in total
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4280

PostPosted: Fri 03 Feb 2012, 01:52    Post subject:  

I went through and did a diff -urp on all of the src directories from each tarball to its predecessor ... from 0.7.20 you can pick up at
http://code.google.com/p/gtkdialog/source/list

Edit someone downloaded the patch history before I could add the 59.0 through 59.8 patches (I mistakenly thought 58 and 59 were parallel releases ... stable/unstabe because I misread some dates)

btw the included changelog is not in order

to fix pixmap path in stringman.c
Code:
   if (access(filename, R_OK) == 0)
      return filename;

-   snprintf(tmp, 127, "/usr/share/icons/Bluecurve/16x16/stock/%s",
+   snprintf(tmp, 127, "/usr/share/pixmaps/%s",
         filename);
   tmp[127] = '\0';
   if (access(tmp, R_OK) == 0)
      return strdup(tmp);


for the majority of the warnings for undefined reference to ...
the header files could all be included in gtkdialog.h (the way gtk.h does - it will make things easier in the long run) ... also this:
#ifndef HEADERFILENAME_H
#define HEADERFILENAME_H
<rest of header>
#endif

I think a lot of the unused variables are from gtk2-ectomy ... just needs a few things commented out

There were a couple of wrong number of parameters - probably from things being added/removed in gtk2 which will likely just involve removing the extra parameter or adding a NULL value per these:
http://www.gtk.org/tutorial1.2/
http://developer.gnome.org/gtk-tutorial/2.22/
gtkff.gz
Description  this is a work in progress - ffmpeg frontend
still isn't quite working though
gz

 Download 
Filename  gtkff.gz 
Filesize  3.64 KB 
Downloaded  489 Time(s) 
gtkdialoghist.tar.gz
Description 
gz

 Download 
Filename  gtkdialoghist.tar.gz 
Filesize  265.28 KB 
Downloaded  510 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 779

PostPosted: Sat 04 Feb 2012, 06:16    Post subject:  

I haven't solved the "Gdk-WARNING **: Creating pixmap from xpm with NULL window and colormap" issue - really annoying!

But additional pacth to the "fix pixmap path in stringman.c":

in automation.c:
Code:

-#define GTK_STOCK_CANCEL "/usr/share/pixmaps/gtk-cancel.xpm"    
-#define GTK_STOCK_HELP   "/usr/share/pixmaps/gtk-help.xpm"
-#define GTK_STOCK_NO     "/usr/share/pixmaps/gtk-no.xpm"
-#define GTK_STOCK_OK     "/usr/share/pixmaps/gtk-ok.xpm"
-#define GTK_STOCK_YES    "/usr/share/pixmaps/gtk-yes.xpm"
+#define GTK_STOCK_CANCEL "gtk-cancel.xpm"    
+#define GTK_STOCK_HELP   "gtk-help.xpm"
+#define GTK_STOCK_NO     "gtk-no.xpm"
+#define GTK_STOCK_OK     "gtk-ok.xpm"
+#define GTK_STOCK_YES    "gtk-yes.xpm" 

-box1 = xpm_label_box(Widget, GTK_STOCK_OK, "OK");
+box1 = xpm_label_box(Widget, find_pixmap(GTK_STOCK_OK), "OK");

-box1 = xpm_label_box(Widget, GTK_STOCK_CANCEL, "Cancel");
+box1 = xpm_label_box(Widget, find_pixmap(GTK_STOCK_CANCEL), "Cancel");

-box1 = xpm_label_box(Widget, GTK_STOCK_HELP, "Help");
+box1 = xpm_label_box(Widget, find_pixmap(GTK_STOCK_HELP), "Help");

-box1 = xpm_label_box(Widget, GTK_STOCK_YES, "Yes");
+box1 = xpm_label_box(Widget, find_pixmap(GTK_STOCK_YES), "Yes");

-box1 = xpm_label_box(Widget, GTK_STOCK_NO, "No");
+box1 = xpm_label_box(Widget, find_pixmap(GTK_STOCK_NO), "No");


And patch to make edit widget work - in widgets.c:
IN fill_edit_by_file:
Code:

+#ifdef USE_GTK2   
     GtkTextBuffer *buffer;
+#endif

+#ifdef USE_GTK2   
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
     gtk_text_buffer_set_text(buffer, filebuffer, st.st_size);
+#else
+     gtk_text_insert( GTK_TEXT(widget), NULL, NULL, NULL, filebuffer, st.st_size );
+#endif

IN save_edit_to_file:
Code:

+#ifdef USE_GTK2   
     GtkTextBuffer *buffer;
     GtkTextIter start, end;
+#endif

+#ifdef USE_GTK2   
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
     gtk_text_buffer_get_start_iter(buffer, &start);
     gtk_text_buffer_get_end_iter(buffer, &end);
     text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+#else
+     text=gtk_editable_get_chars( GTK_EDITABLE(widget), 0, -1 );   
+#endif

So now the basis for a small editor works:
Code:
#! /bin/sh
export MAIN_DIALOG='
 <vbox>
  <frame Edit>
    <edit>
      <input file>gtk_edit</input>
      <output file>new-file</output>
      <variable>EDIT</variable>
      <width>350</width><height>150</height>
    </edit>
    <hbox>
      <button>
        <label>Save as "new-file"</label>
        <action>Save:EDIT</action>
      </button>
    </hbox>
  </frame>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
 </vbox>
'
./gtkdlg1 --program MAIN_DIALOG


How to handle those updates? Maybe leave the original starting code as is and then when enough patches done submit a new version and keep the starting point "forever" present?
Edit: Added GTK_TEXT and GTK_EDITABLE before widget in above.

Also following patch in widget.c remove 1 warning:
IN fill_label_by_file:
Code:

-gtk_label_set_text(widget, filebuffer);
+gtk_label_set_text(GTK_LABEL(label), filebuffer);

In make file "-lgdk_pixbuf -ljpeg -ltiff " can be removed - not needed...
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2224

PostPosted: Sat 04 Feb 2012, 10:56    Post subject:  

Oh, I love it! -err, I think I do anyway. Itries to do this myself some years ago -actually from the old 'gins' program, but could never get it working enough to run...
I say i think I like it because actually I hate XML -both as a reader and a writer. Still, this excellent news for me- Count on me grabbing everything you do right for gtk1!

Edit: As a historical note, before there was the gtkdialg you already know, there was a gtkdialog for gtk1, which was a replacement for xmessage. It's actually rather attractive. You can still get it at that place ith all the gk1 stuff which has disappeared from everywhere else LOL:
http://distro.ibiblio.org/amigolinux/download/DeskTop/MsgDialog/gtkdialog-1.04/
Nice looking buttons.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2224

PostPosted: Sat 04 Feb 2012, 11:11    Post subject:  

I hope you guys can keep the changes generally applicable... actually it would be great if your work gets up-streamed since thunor is a buddy around here...
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4280

PostPosted: Sat 04 Feb 2012, 11:42    Post subject:  

The pixmap warning and possible solution was referenced here:
http://mail.gnome.org/archives/gtk-list/1999-August/msg00270.html
for the pixmap path glade 0.6.x uses support.c for a lot of the pixmap handling - seems pretty robust.

@amigo, I attempted to do it with gtkdialog-0.7.20 a while back myself - got it to compile, but it would load and immediately exit (now I realize it was probably just a pixmap) - I am not missing libxml either (too bad rox needs it too), but I speculate that is how the var="value" tags were added and wonder if we could do it another way (using jwm's code maybe) or somehow instead use regular tags. The obvious example is <wtitle> in this version compared to <window title="" ...> I doubt Thunor will want much to do with our patches (at least for a while), it will be enough for us to just try to catch up to his work (though I may try to make a locate replacement shell script that he could use)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2224

PostPosted: Sat 04 Feb 2012, 11:54    Post subject:  

The number of changes so far is pretty small actually and probably manageable eventually upstream, I would think. I had to maually edit the Mkefile of course to get it to compile, but it is running at least. Could I hope that you would try to use gtk1 gdk-pixbuf loaders instead of relying on hard-coded xpm's? You know you're gonna want this thing to look as good as possible too eventually.

The thing I hate about XMl is that all the tags look alike. Unless it is prettily-formatted it just looks like gibberish.

I maintain the aine chatbot which uses a tag syntax which is pretty easy to use and read -easier than the AIML it was adapted from. Perhaps you'd want to look at that? I've made a couple of small changes to the syntax myself since I took it over. The last maintainer put a lot of work into building a tight parser in C. Still, as it is, libxml2 is gonna be there if you have rox anyway -and who would do without that?
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 779

PostPosted: Sat 04 Feb 2012, 12:11    Post subject:  

technosaurus: Thanks! The point to glade did the trick!
So in automation.c do
Code:

-pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask,
-                                      &style->bg[GTK_STATE_NORMAL],
-                                       xpm_filename);
+colormap = gtk_widget_get_colormap (parent);
+pixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, +&mask, NULL, xpm_filename);
+ g_free (xpm_filename);

and warnings gone!

To make the "Closewindow" action work do this in automation.c
Code:

-if (strncasecmp(str, "Closewindow:", 12) == 0) {
-      action_closewindow(button, &((char *) str)[12]);
-      return;
-   }

+if( strncasecmp(str, "Closewindow:", 11)==0 ){
+gdk_window_destroy( gtk_widget_get_parent_window(button) );
+return;
+}

which also seems to make function "action_closewindow" in actions.c unused and removable.

amigo: I do not hope this messing with gtk1 and the old gtkdialog source is "stepping on someones toes"? Should I ask someone for permission to do this or anything else to avoid violation of someone rights?
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4280

PostPosted: Sat 04 Feb 2012, 12:26    Post subject:  

goingnuts wrote:
I do not hope this messing with gtk1 and the old gtkdialog source is "stepping on someones toes"? Should I ask someone for permission to do this or anything else to avoid violation of someone rights?

It's GPL2, so aside from omitting COPYING from your tarball, you are good

before you remove the close window chunks, there are a couple of examples that open child windows (see original 0.58.11 sources gtk_launch)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 779

PostPosted: Sat 04 Feb 2012, 12:48    Post subject:  

Quote:
It's GPL2, so aside from omitting COPYING from your tarball, you are good

OK thanks - I will include that.
Quote:

before you remove the close window chunks, there are a couple of examples that open child windows (see original 0.58.11 sources gtk_launch)

The patch was to make that example work - took the code-bit for "Closewindow" from 0.56 but haven't tried to remove the function from action.c yet - it just looks as nobody else is using it...

The idea of using parser method from jwm or other sources sounds good. Might remove need for the parser/lexer "black-box-stuff". I will try to catch up with all the patches until now, create a config.h for the DEFINES and try to create a single headerfile as you suggested - and submit a new source-tar.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4280

PostPosted: Sat 04 Feb 2012, 13:18    Post subject:  

a good way (not perfect) to test if something is being used:
CFLAGS="-ffunction-sections -fdata-sections ..."
LDFLAGS="-Wl,--gc-sections,--print-gc-sections ..."

print-gc-sections will tell you which functions/data get garbage collected

Then again you _can_ just remove stuff to see what (if anything) breaks ... That's what I did with planner and gconf.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 779

PostPosted: Sat 04 Feb 2012, 16:09    Post subject:  

Did not went well with the single header file - think the parser messed up. Also found that your gtkff failed if the "g_free (xpm_filename); " is in the GtkWidget *xpm_label_box function -as the only one of the scripts -so remove that from the function.
Would like to test the action append but cant find any examples on the format - anyone has an example of this?
We might have to make a more general test script to verify things are working as intended...
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4280

PostPosted: Sat 04 Feb 2012, 21:58    Post subject:  

I only posted gtkff because I had to head out for the weekend and wanted to have an extra example (I was backporting my Woo-ff stuff)

for testing I wonder if having an action:close ?syntax? at the end of a script with only 1 widget (or widget group) per script and testing for the return value would be workable?

Then have a single script with all of the widgets so that you can bypass running the test suite if it opens/closes properly. (btw I did get most of the 0.58.11 examples to run before I left, and it looked as if a lot of the gtkdialog2 apps may work with minimal modification, but I didn't have time to track them down)

the only other mods I made were to add various templates for implicit definition stuff to appropriate headers
the only ones I recall
added yy* stuff to parser.h and added parser.h to those *.c files that gcc complained about
basically a lot of:
grep <missing_template> *.c
then copy the:
<some_type> some_function(various args);
to the .h file of the same name as that .c file

I was just dumping it at the bottom so they may not make for good patches, because I couldn't readily determine the organizational structure of the code. I think I got it down to maybe 5 or so warnings.

Edit: so here is my todo list of apps in no particular order
backport some low hanging fruit (p-apps ... suggestions?)
union/aufs/symlink frontend for {s,2,3,4}fs.../iso/partitions/directories/...pretty much anything you can mount
archive utility (guitar and friends need to much tweaking)
simple mp3 player using minimp3 and signals

btw I am going to rewrite/rename bashbox from scratch for this and plan to incorporate CLI functionality where possible as well as optional text to speech (I'd like to have some kind of voice recognition too, so I'll probably stub that out)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 779

PostPosted: Tue 07 Feb 2012, 15:10    Post subject:  

Updated source and shipped a static build version. Included examples from different versions - not all working or revised to work.
Now menu-widget is working including more than 1 command-action. Append works (syntax: <action>append:FROM,TOO</action>).
Tree is not working - tempted to just remove it.
Would like to implement alignment of text (its always centered in text-widget), user setting of button-size and have the edit-widget working as an small editor (file open/save and append works) but cant use "fileselection" to parse and open a file inside the edit-widget.
Still a "lot" of compiler warnings to fix...
snap0001.png
 Description   The menu, entry and edit-widget in action
 Filesize   15.74 KB
 Viewed   1481 Time(s)

snap0001.png

Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2224

PostPosted: Tue 07 Feb 2012, 15:33    Post subject:  

Keep up the good work. At some point I might work on patching the full sources so that config-time option for gtk1 can be used.

Text and tree code is the hardest to convert. For tips and example code, look at older source which allowed using either gtk1 or gtk1. rox-1.2.2 is one example. I'll have to dig to make more suggestions. even if you never get every possible widget working, having a few of the basics working will be great in order to use the same scripts with either toolkit.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 14 [207 Posts]   Goto page: 1, 2, 3, ..., 12, 13, 14 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1123s ][ Queries: 13 (0.0073s) ][ GZIP on ]