LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-30-2009, 06:22 AM   #1
librano
Member
 
Registered: Jul 2004
Location: Here, there and everywhere.
Distribution: Arch+KDE, Linux Mint Fluxbox CE
Posts: 163

Rep: Reputation: 31
Question gtkdialog + glade + bash/dash/sh


Hi all!

I am trying to build some simple applications in Linux. I am not a seasoned coder. I have some experience in bash scripting and very minimal knowledge of python. This is why I decided on using gtkdialog with an interface built using Glade and the code written in bash.

Let me mention that I am using Linux Mint Felicia which is based on Ubuntu Intrepid.

However, I am facing some problems with running gtkdialog. I keep getting this error:

Code:
sh: source: not found
sh: login_server: not found
It even appears when I use the example scripts that are provided in the gtkdialog docs. The GUI is displayed but any action that is initiated (clicking a button) gives this error in the terminal.

From my searches, I think the problem lies with the function scripts which contain bashisms... but I am not sure.

Here are the example files I am running.

glade-01.00-entries_functions.sh
Code:
#! /bin/bash 

gtkdialog --glade-xml=glade-01.00-entries_functions.glade \
          --include=glade-01.00-entries_functions.functions \
          --program=login_window
glade-01.00-entries_functions.glade
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!-- Generated with glade3
	Version: 3.0.1
	Date: Thu Oct 26 22:04:10 2006
	User: pipas
	Host: desktop.otthon
-->
<glade-interface>
  <widget class="GtkWindow" id="login_window">
    <property name="border_width">5</property>
    <property name="title">GtkDialog Example</property>
    <child>
      <widget class="GtkVBox" id="vbox1">
        <property name="visible">True</property>
        <child>
          <widget class="GtkFrame" id="frame1">
            <property name="visible">True</property>
            <property name="label_xalign">0,000000</property>
            <child>
              <widget class="GtkAlignment" id="alignment1">
                <property name="visible">True</property>
                <property name="border_width">5</property>
                <property name="left_padding">12</property>
                <child>
                  <widget class="GtkTable" id="table1">
                    <property name="visible">True</property>
                    <property name="n_rows">3</property>
                    <property name="n_columns">2</property>
                    <property name="column_spacing">5</property>
                    <property name="row_spacing">5</property>
                    <child>
                      <widget class="GtkEntry" id="database_entry">
                        <property name="visible">True</property>
                        <property name="activates_default">True</property>
                      </widget>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">2</property>
                        <property name="bottom_attach">3</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkEntry" id="name_entry">
                        <property name="visible">True</property>
                        <property name="activates_default">True</property>
                        <signal name="realize" handler="whoami"/>
                      </widget>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">1</property>
                        <property name="bottom_attach">2</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkEntry" id="server_entry">
                        <property name="visible">True</property>
                        <property name="activates_default">True</property>
                        <property name="text">localhost</property>
                      </widget>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkLabel" id="label4">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Database:</property>
                      </widget>
                      <packing>
                        <property name="top_attach">2</property>
                        <property name="bottom_attach">3</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkLabel" id="label3">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Name:</property>
                      </widget>
                      <packing>
                        <property name="top_attach">1</property>
                        <property name="bottom_attach">2</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkLabel" id="label2">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Server:</property>
                      </widget>
                    </child>
                  </widget>
                </child>
              </widget>
            </child>
            <child>
              <widget class="GtkLabel" id="label1">
                <property name="visible">True</property>
                <property name="label" translatable="yes">&lt;b&gt;PostgreSQL Login&lt;/b&gt;</property>
                <property name="use_markup">True</property>
              </widget>
              <packing>
                <property name="type">label_item</property>
              </packing>
            </child>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
          </packing>
        </child>
        <child>
          <widget class="GtkHButtonBox" id="hbuttonbox1">
            <property name="visible">True</property>
            <property name="border_width">5</property>
            <property name="spacing">5</property>
            <property name="layout_style">GTK_BUTTONBOX_END</property>
            <child>
              <widget class="GtkButton" id="cancel_button">
                <property name="visible">True</property>
                <property name="label">gtk-cancel</property>
                <property name="use_stock">True</property>
                <signal name="clicked" handler="echo &quot;hello&quot;" object="objektum neve"/>
                <signal name="clicked" handler="exit:Cancel"/>
              </widget>
            </child>
            <child>
              <widget class="GtkButton" id="ok_button">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="can_default">True</property>
                <property name="has_default">True</property>
                <property name="label">gtk-ok</property>
                <property name="use_stock">True</property>
                <signal name="clicked" handler="login_server &quot;$server_entry&quot; &quot;$name_entry&quot; &quot;$database_entry&quot;"/>
              </widget>
              <packing>
                <property name="position">1</property>
              </packing>
            </child>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">1</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
glade-01.00-entries_functions.functions
Code:
#! /bin/bash
# 
# We don't really need this first line but my text editor recognizes it and i
# like the syntax highlight.
#
function login_server() 
{
	xterm -hold -e "psql -h $1 -U $2 -d $3" &
}
What is wrong here? I am totally stumped...
 
Old 06-28-2009, 08:22 PM   #2
travisn000
LQ Newbie
 
Registered: May 2009
Posts: 4

Rep: Reputation: 0
I know its been awhile, but I saw the answer to this while looking for other related gtkdialog info..

..apparently Ubuntu uses dash instead of bash; the post I saw indicates that it will work normally if you change to a true bash shell. (I think the post was on this forum, but I cannot find it)
 
Old 11-24-2009, 12:02 AM   #3
disciplepup
Member
 
Registered: Jun 2007
Location: Auckland, NZ
Distribution: Puppy & Grafpup
Posts: 54

Rep: Reputation: 17
It's been even longer now
How far did you get with this, and did you find any good examples? I'd quite like to find some gtkdialog/glade examples...

Also, if you didn't want to use glade you should check out the gtkdialog/bash programs used in Puppy Linux, some of which are very complex (a lot are found here - N.B. a .pet file is just a .tar.gz with a checksum), and the gtkdialog tips thread
 
Old 11-24-2009, 11:34 PM   #4
travisn000
LQ Newbie
 
Registered: May 2009
Posts: 4

Rep: Reputation: 0
I put together a few basic examples awhile back, and also links to my resources:

http://www.pclinuxos.com/forum/index...c,59050.0.html



Hopefully you will find them helpful!
 
Old 11-26-2009, 02:46 AM   #5
disciplepup
Member
 
Registered: Jun 2007
Location: Auckland, NZ
Distribution: Puppy & Grafpup
Posts: 54

Rep: Reputation: 17
thanks
 
  


Reply

Tags
bash, gtkdialog, scripting


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with BASH and DASH cosmicbrat Linux - Software 1 03-12-2009 08:39 PM
gtkdialog window size restriction kkpal Programming 1 11-10-2007 05:46 PM
gtkdialog treestore loading PatrickNew Linux - Software 0 09-09-2007 10:14 PM
Changing the gtkdialog title with bash jimmy512 Programming 2 09-07-2007 11:00 AM
exec bash scripts from Glade/GTK? HELP! cho Programming 1 07-04-2005 08:01 AM


All times are GMT -5. The time now is 10:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration