GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 24, 2014 8:02 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: mkBIB
PostPosted: Thu Oct 18, 2012 1:11 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
Dear friends,
with HUGE help from this forum, I have managed to complete my first project. It is accepted in CTAN today.
http://mirror.ctan.org/biblio/bibtex/utils/mkbib.zip
I will be very happy if you kindly have a look and find time to comment on this.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Thu Oct 18, 2012 8:11 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
BTW, I have tried to run valgrind to check memory lick, but can't manage its output. some outlook on this regard will also be very helpful.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Mon Oct 22, 2012 11:09 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
I like it; especially the neat google scholar search integration. There is also a lot of potential for expansion of it (e.g. some form of database management of downloaded articles). I'll have to try it out more to see how it fits with the kind of articles I reference to see if I have any specific issues.

The main issue I see is not with your code, but with your packaging. When you run make install, it only moves the binary into the filesystem hierarchy and not the icon (thus g_object_unref(pixbuf) in help.c creates a critical error due to pixbuf being empty).
As a minor note in your help dialog, after pressing "Next" a number of times, the help menu ends with "Apply".

You can do a lot more with the autotools than just build a GTK application. With a little extra work you can add in gnome-doc-utils to provide the manual based on a file in docbook format; provide internationalisation support with gettext; and have better integration with the gnome desktop using a mkbib.desktop file. I have two sample apps in my repositories https://github.com/pchilds/Harmonic and https://github.com/pchilds/IS_TIB. The files therein may help guide you in this. Let me know how you go; I can easily put together a .deb package for you with the auto-tools scripts cleaned up a bit.

Regarding valgrind. GTK really isn't set up to do memory checks very well. You might find the information at https://live.gnome.org/Valgrind of use for suppressing false errors, but you will still likely get a vast mass of useless information to sift through.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Mon Oct 22, 2012 1:53 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
Paul,
Quote:
I like it; especially the neat google scholar search integration. There is also a lot of potential for expansion of it (e.g. some form of database management of downloaded articles). I'll have to try it out more to see how it fits with the kind of articles I reference to see if I have any specific issues.

thanks for your time and encouraging words.

Quote:
The main issue I see is not with your code, but with your packaging. When you run make install, it only moves the binary into the filesystem hierarchy and not the icon (thus g_object_unref(pixbuf) in help.c creates a critical error due to pixbuf being empty).

Yes, this issue is there, as I posted in a thread http://www.gtkforums.com/viewtopic.php?f=3&t=178110 and failed to manage yet.
Quote:
As a minor note in your help dialog, after pressing "Next" a number of times, the help menu ends with "Apply".

Thanks for pointing that out. Have corrected that.

Quote:
You can do a lot more with the autotools than just build a GTK application. With a little extra work you can add in gnome-doc-utils to provide the manual based on a file in docbook format; provide internationalisation support with gettext; and have better integration with the gnome desktop using a mkbib.desktop file. I have two sample apps in my repositories https://github.com/pchilds/Harmonic and https://github.com/pchilds/IS_TIB. The files therein may help guide you in this. Let me know how you go; I can easily put together a .deb package for you with the auto-tools scripts cleaned up a bit.

I tried to compile your code, but that needs gtkplot-2.0, which is not there in fedora(I will search for the exact name in fedora), but looking at your source code I got very essential idea of writing application.desktop file. I will include this as soon as possible.

Thank you very much for such encouraging and detailed review.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Tue Oct 23, 2012 12:16 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Ok got a fix for it.
Here is the makefile.am:
Code:
pixmapdir=$(datadir)/images
pixmap_DATA = images/icon.svg images/icon.png images/mkb0.png images/mkb1.png images/mkb2.png images/mkb3.png images/mkbib.png
AM_CFLAGS = @GTK_CFLAGS@ @LIBSOUP_CFLAGS@
AM_CPPFLAGS= -DPIXMAP=\"$(datadir)/images\"
bin_PROGRAMS = mkbib
mkbib_SOURCES = src/assist.c  src/caution.c src/search.c \
      src/help.c  src/mkbib.c  src/update_file.c \
      src/biblst src/main.h src/view.c src/file_util.c
mkbib_LDADD = @GTK_LIBS@ @LIBSOUP_LIBS@
EXTRA_DIST=Docs $(pixmap_DATA)
CLEANFILES = *~

The first two lines basically handle the installation of the images to a sensible place on the filesystem. This can then be passed on to the c files using AM_CPPFLAGS -D which defines a PIXMAP macro to pass to your c files during compilation. This can then be used in your code as e.g.:
Code:
gchar* str;
...
str=g_strdup_printf("%s/mkb0.png", PIXMAP);
GtkWidget *ast1im=gtk_image_new_from_file(str);
g_free(str);

If there's windows issues with the /'s being that way around, I think there's portable ways of dealing with it.

You will still likely want to brush it up a bit more (e.g. gnome-doc-utils etc.). I'm trying to put together an auto-tools tutorial that may be useful.
By the way gtkplot is my post (just previous to yours) on this showcase forum. It's also found in my github repositories.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Tue Oct 23, 2012 1:54 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
Wow, it worked like a charm. A autotool tutorial is definitely useful.
Just find out a more about gnome-doc-utils. I will write it down soon.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Tue Oct 23, 2012 8:48 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
Paul,
I tried to create gnome-doc-utils.
Code:
help
|-- C
|   `-- mkbib.xml
|-- es
|   |-- es.mo
|   |-- es.po
|   `-- mkbib.xml
|-- Makefile
|-- Makefile.am
|-- Makefile.in
|-- mkbib-manual.omf.in
|-- sr
|   |-- mkbib.xml
|   |-- sr.mo
|   `-- sr.po
`-- uk
    |-- mkbib.xml
    |-- uk.mo
    `-- uk.po

4 directories, 14 files


with the C/mkbib.xml a copy of your Harmonic project xml.
Firstly, automake gives a lot of warning regarding gnome-doc-utils.make (which is in topdir)
Code:
$ ll gnome-doc-utils.make
lrwxrwxrwx. 1 rudra rudra 47 Oct 23 21:11 gnome-doc-utils.make -> /usr/share/gnome-doc-utils/gnome-doc-utils.make

Code:
$ automake
gnome-doc-utils.make:74: if $(DOC_H_FILE: non-POSIX variable name
gnome-doc-utils.make:74: (probably a GNU make extension)
help/Makefile.am:1:   `gnome-doc-utils.make' included from here

and secondly,
the generated xml file, say, help/uk/mkbib.xml, when opened via firefox, says,
Quote:
This XML file does not appear to have any style information associated with it. The document tree is shown below.


I have made the installation with prefix=/opt/mkbib ...not in its usual location.
Can you make a guess where I went wrong or if this is normal behaviour?


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Tue Oct 23, 2012 10:01 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
The firefox error is quite normal. There is no xsl stylesheet defined; rather gnome help interprets it automatically through docbook and its own inbuilt styling.
By the look of your languages, I'm guessing that your following the instructions on http://developer.gnome.org/gnome-doc-make/unstable/migrating.html.en, which pretty much tells you exactly what to do. From a look of some related bugs, I'm guessing that you need to regenerate gnome-doc-utils.make for your system. Do this with:
Code:
rm gnome-doc-utils.make
gnome-doc-prepare --force


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Tue Oct 23, 2012 10:22 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
in my system? you mean I should delete /usr/share/gnome-doc-utils/gnome-doc-utis.make?


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Tue Oct 23, 2012 10:38 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
Oh! thats fine. yelp is doing that.
but gnome-doc-prepare needs a bit more work from me i guess.
Thanks for showing.


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Wed Oct 24, 2012 4:56 am 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
Paul,
I need your help once again.
I have created the docbook. But there also, I need to put the path of the image file.
Code:
<inlinemediaobject>
      <imageobject>
   <imagedata fileref="/home/rudra/MKBIB/images/mkbib.png"/>
      </imageobject>
    </inlinemediaobject>


How I can get rid of this via make file(I have seperate Makefile.am for help) The working copy of the Makefile and help/C/mkbib.xml is posted. Kindly advice.
Code:
include $(top_srcdir)/gnome-doc-utils.make
dist-hook: doc-dist-hook

DOC_MODULE = mkbib
DOC_ENTITIES =
DOC_INCLUDES =
DOC_LINGUAS = uk bn it
DISTCLEANFILES = \
   Makefile.in

Code:
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY appname "mkBIB">
<!ENTITY app "<application>mkBiB</application>">
<!ENTITY appversion "1.1">
<!ENTITY manrevision "1.1">
<!ENTITY date "October 2012">
]>
<article id="index" lang="en">
  <articleinfo>
    <title>&appname; Manual</title>
    <abstract role="description">
      <para>&app; is a program for for creating bibtex file.</para>
    </abstract>
    <copyright>
      <year>2012</year>
      <holder>Rudra Banerjee</holder>
    </copyright>
    <author role="maintainer">
      <firstname>Rudra</firstname>
      <surname>Banerjee</surname>
      <affiliation>
   <orgname></orgname>
        <address>
          <email>bnrj.rudra@yahoo.com</email>
        </address>
      </affiliation>
    </author>
    <revhistory>
      <revision>
        <revnumber>&appname; Manual &manrevision;</revnumber>
        <date>23-10-2012</date>
      </revision>
    </revhistory>
    <releaseinfo>
      Version &manrevision; documenting &appname; version &appversion;.
    </releaseinfo>

    <legalnotice>
      <title>Copyright</title>
      <para>Copyright (C)  2012  Rudra Banerjee.</para>
      <para>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".</para>
  </legalnotice>
  </articleinfo>
  <sect1 id="introduction"><title>Introduction</title>
    <inlinemediaobject>
      <imageobject>
   <imagedata fileref="/home/rudra/MKBIB/images/mkbib.png"/>
      </imageobject>
    </inlinemediaobject>
    <para> &app; is a utility to generate bibtex file.</para>
    <!--<para>For updates please visit <ulink type="http" url="https://github.com/pchilds/Harmonic">Harmonic's repository</ulink></para>-->
  </sect1>
  <sect1 id="features"><title>Features</title>
      <itemizedlist type='ordered'>
   <listitem id-text='1' id='uid1' label='(1)'><p noindent='true'>Gives user a simple gui to generate bibtex file.</p>
     </listitem>
     <listitem id-text='2' id='uid2' label='(2)'><p noindent='true'>Enable user to search google scholar from the same interface(Search in google scholar webpage, not withstanding there terms of usage,in my knowledge).</p>
       </listitem>
       <listitem id-text='3' id='uid3' label='(3)'><p noindent='true'>Creates bibliography section in tex format.</p>
         <warning><title>Warning</title>
      All 361 bibliographystyle packages, that are distributed with texlive-2012, are included to make the creation easy. Use with caution.
         </warning>
     </listitem>
   </itemizedlist>
      </sect1>
      <sect1 id="requirements"><title>Requirements</title>
   <itemizedlist type='ordered'>
     <listitem id-text='1' id='uid1' label='(1)'><p noindent='true'>GTK+-3</p>
     </listitem>
     <listitem id-text='2' id='uid2' label='(2)'><p noindent='true'>libsoup</p>
       </listitem>
       <listitem id-text='3' id='uid3' label='(3)'><p noindent='true'>gnome-doc-utils</p>
     </listitem>
   </itemizedlist>
      </sect1>
      <sect1 id="usage"><title>Usage</title>
   <sect2 id="new"><title>Create New Enter</title>
     <para>User can either edit a New file, or edit an old file to enter new bibtex entry. Process is straight forward:
       Choose a file → Enter bibtex specification → Create! If no file choosen, file will append Untitled.bib in current working directory.</para>
   </sect2>
   <sect2 id="web"><title>Search Google Scholar</title>
     <para>You can also search google scholar from the same interface. Enter Author, Title and year(optional) and enter google search scholar button.</para>
     <tip><title>Tip</title>
       <itemizedlist type='ordered'>
     <listitem id-text='1' id='uid1' label='(1)'><p noindent='true'>Use Title box as keyword, and Author as author(s) name. Year is optional. </p>
     </listitem>
     <listitem id-text='2' id='uid2' label='(2)'><p noindent='true'>You can do  better by turning bibtex link in google scholar setting "on"</p>
       </listitem>
   </itemizedlist>

     </tip>
   </sect2>
   <sect2 id="tex"><title>Create tex file</title>
     <para>Once a bibtex file is created, user can choose to create a tex file using it. If user chooses any
       entry from the drop-down box,say A at the right, a texfile named A.tex, using “nocite” will be created.</para>

   </sect2>
      </sect1>
</article>


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Wed Oct 24, 2012 8:53 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
You would put images you use for documentation in the help folder and then place them in the DOC_FIGURES line of help/Makefile.am.
For an example see the source code for zenity http://git.gnome.org/browse/zenity/tree/help?id=ZENITY_3_2_0


Top
 Profile  
 
 Post subject: Re: mkBIB
PostPosted: Wed Feb 13, 2013 8:18 pm 
Offline
GTK+ Guru

Joined: Sun Jul 08, 2012 3:14 pm
Posts: 107
Location: Coventry, UK
An updated version in posted at http://download-mirror.savannah.gnu.org/releases/mkbib/

I will be grateful if people review this project and send comments on it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group