How can I make the menubar work with the New button. Solved
Posted: Sat 10 Nov 2012, 21:40
Hello Everyone,
I have done an editor for Manna, but I have no glue on how to make a new note/file with the New button in the file menubar. Not sure if I need another widget or not.
Any help would be great thanks.
code
I have done an editor for Manna, but I have no glue on how to make a new note/file with the New button in the file menubar. Not sure if I need another widget or not.
Any help would be great thanks.
code
#!/bin/bash
GTKDIALOG=gtkdialog
WORKDIR="/usr/local/Manna"
NOTES_DIR="$WORKDIR/notestxt"
#define special Sans-12 font for Reader
CURRFONTNAME=`cat $HOME/.gtkrc-2.0 | grep font_name | cut -d "=" -f2 | cut -d " " -f2 | sed 's/\"//g'` ##define current user-font
if [ "`cat $HOME/.gtkrc-2.0 | grep font_name | grep Sans`" != "" ] && [ "$CURRFONTNAME" != "Sans" ]; then
FONT_NAME="$CURRFONTNAME"
else
FONT_NAME=""
fi
if [ -f "/usr/local/Manna/xresourcesmarker" ]; then #Iguleder derivatives
echo "Xft.dpi: 78" > $HOME/.Xresources
FONT_SIZE="12"
else
FONT_SIZE="16"
fi
echo "style \"specialsize\"
{
font_name=\"$FONT_NAME Sans $FONT_SIZE\"
}
widget \"*\" style \"specialsize\"
class \"*\" style \"specialsize\"" > "$WORKDIR/gtkrc_size"
export GTK2_RC_FILES="$WORKDIR/gtkrc_size:${HOME}/.gtkrc-2.0"
export TMPDIR=/tmp/notes
mkdir -p "$TMPDIR"
echo "$TMPDIR"/notes
export MAIN_DIALOG='
<window title="Notes" icon-name="Com">
<frame>
<vbox spacing="0">
<menubar>
<menu use-underline="true">
<menuitem stock-id="gtk-new">
<action>new:file</action>
</menuitem>
<menuitem stock-id="gtk-save">
<action>Save:EDITOR</action>
<action>Save:Saving</action>
<action>refresh:EDITOR</action>
</menuitem>
<menuitem stock-id="gtk-refresh">
<action>refresh:EDITOR</action>
</menuitem>
<menuitem stock-id="gtk-quit">
<action>exit:Quit</action>
</menuitem>
<label>"_File"</label>
</menu>
<menu label="_Edit" use-underline="true">
<menuitem stock-id="gtk-file" label="Send to Abiword">
<action>abiword '"$TMPDIR"'/notes &</action>
</menuitem>
</menu>
</menubar>
</vbox>
<hbox>
<vbox width-request="140">
<table>
<label>Notes</label>
<variable>ITEM</variable>
<input>'"$WORKDIR/gtkrc_size:${HOME}/.gtkrc-2.0"'</input>
<input>ls '"$NOTES_DIR"'</input>
<action>ln -sf "/usr/local/Manna/notestxt/$ITEM" '"$TMPDIR"'/notes</action>
<action>refresh:EDITOR</action>
</table>
</vbox>
<edit editable="true" accepts-tab="true" indent="" justification="0" left-margin="12" right-margin="15" wrap-mode="1">
<variable>EDITOR</variable>
<height>450</height>
<width>500</width>
<input file>'"$TMPDIR"'/notes</input>
<output file>'"$TMPDIR"'/notes</output>
</edit>
</hbox>
</frame>
</window>
'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --center --program=MAIN_DIALOG ;;
esac