<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><updated>2011-08-10T15:27:49-05:00</updated><title type="text">Feed for edmann.com</title><link href="http://www.edmann.com/Open-Source/feed/atom.xml" rel="self"/><author><name>edmann.com</name><email>support@arctechnologies.net</email><uri>http://edmann.com</uri></author><id>urn:uuid:61a0877b-9f9a-311b-a922-99fb9d4529c7</id><category term="Open-Source"/><subtitle type="text"></subtitle><entry><title>Freedos book usb stick</title><link href="/Open-Source/2011/08/10/Freedos-book-usb-stick"/><id>urn:uuid:6a07202a-bf9b-31ec-a2fe-21ef7c25beb3</id><updated>2011-08-10T15:26:29-05:00</updated><summary type="html"><![CDATA[<p>
	I am copying this verbatim from <a href="http://muzso.hu/2010/03/29/how-to-put-dos-on-an-usb-drive-using-linux">muzso.hu</a> website. I am posting it here because one it&#39;s easier for me to find in the future, second things seem to go away on the web. And who said it was forever. :-)</p>
<p>
	<span style="font-style:italic">Prerequisites:</span></p>
<ul class="bb-list" style="list-style-type:circle;">
	<li>
		dd</li>
	<li>
		qemu</li>
	<li>
		a DOS floppy image, e.g. <a class="bb-url" href="http://www.finnix.org/files/balder10.img">balder10.img</a></li>
</ul>
<p>
	<br />
	Procedure (assumptions for this description: balder10.img is in CWD, stick appears as /dev/sdc):</p>
<ul class="bb-list" style="list-style-type:circle;">
	<li>
		Insert memory stick (Caution: all data on this stick will be destroyed)</li>
	<li>
		Find out device name (e.g. /dev/sdc)</li>
	<li>
		Make sure it&#39;s not mounted (check with <code>mount</code> command)</li>
	<li>
		Clear the MBR:<br />
		<div class="codefilter-code">
			<code>dd if=/dev/zero of=/dev/sdc bs=1012 count=2</code></div>
	</li>
	<li>
		Boot qemu:<br />
		<div class="codefilter-code">
			<code>qemu -curses -boot a -fda ./balder10.img -hda /dev/sdc</code></div>
		The <code>-curses</code> option will make it run in text mode.<br />
		(This way you can run qemu easily eg. over an ssh connection.)</li>
	<li>
		Answer all questions with their default values</li>
	<li>
		At the <code>A:\&gt;</code> prompt:<br />
		<div class="codefilter-code">
			<code>fdisk</code></div>
		(create a bootable, primary DOS partition)</li>
	<li>
		Stop qemu</li>
	<li>
		Remove memory stick and re-insert it.</li>
	<li>
		Make sure it&#39;s still /dev/sdc, otherwise use new name in the next steps.</li>
	<li>
		Make sure again that it is not mounted.</li>
	<li>
		Boot qemu:<br />
		<div class="codefilter-code">
			<code>qemu -curses -boot a -fda ./balder10.img -hda /dev/sdc</code></div>
	</li>
	<li>
		At the <code>A:\&gt;</code> prompt:<br />
		<div class="codefilter-code">
			<code>format c: /s</code></div>
	</li>
	<li>
		At the <code>A:\&gt;</code> prompt:<br />
		<div class="codefilter-code">
			<code>xcopy a: c: /n /e</code></div>
	</li>
	<li>
		Stop qemu</li>
</ul>
<p>
	Done! Now you can mount the stick again and copy any required utilities on it ...</p>
<p>
	&nbsp;</p>]]></summary><category term="Open Source"/><published>2011-08-10T15:27:49-05:00</published><content type="html"><![CDATA[<p>
	I am copying this verbatim from <a href="http://muzso.hu/2010/03/29/how-to-put-dos-on-an-usb-drive-using-linux">muzso.hu</a> website. I am posting it here because one it&#39;s easier for me to find in the future, second things seem to go away on the web. And who said it was forever. :-)</p>
<p>
	<span style="font-style:italic">Prerequisites:</span></p>
<ul class="bb-list" style="list-style-type:circle;">
	<li>
		dd</li>
	<li>
		qemu</li>
	<li>
		a DOS floppy image, e.g. <a class="bb-url" href="http://www.finnix.org/files/balder10.img">balder10.img</a></li>
</ul>
<p>
	<br />
	Procedure (assumptions for this description: balder10.img is in CWD, stick appears as /dev/sdc):</p>
<ul class="bb-list" style="list-style-type:circle;">
	<li>
		Insert memory stick (Caution: all data on this stick will be destroyed)</li>
	<li>
		Find out device name (e.g. /dev/sdc)</li>
	<li>
		Make sure it&#39;s not mounted (check with <code>mount</code> command)</li>
	<li>
		Clear the MBR:<br />
		<div class="codefilter-code">
			<code>dd if=/dev/zero of=/dev/sdc bs=1012 count=2</code></div>
	</li>
	<li>
		Boot qemu:<br />
		<div class="codefilter-code">
			<code>qemu -curses -boot a -fda ./balder10.img -hda /dev/sdc</code></div>
		The <code>-curses</code> option will make it run in text mode.<br />
		(This way you can run qemu easily eg. over an ssh connection.)</li>
	<li>
		Answer all questions with their default values</li>
	<li>
		At the <code>A:\&gt;</code> prompt:<br />
		<div class="codefilter-code">
			<code>fdisk</code></div>
		(create a bootable, primary DOS partition)</li>
	<li>
		Stop qemu</li>
	<li>
		Remove memory stick and re-insert it.</li>
	<li>
		Make sure it&#39;s still /dev/sdc, otherwise use new name in the next steps.</li>
	<li>
		Make sure again that it is not mounted.</li>
	<li>
		Boot qemu:<br />
		<div class="codefilter-code">
			<code>qemu -curses -boot a -fda ./balder10.img -hda /dev/sdc</code></div>
	</li>
	<li>
		At the <code>A:\&gt;</code> prompt:<br />
		<div class="codefilter-code">
			<code>format c: /s</code></div>
	</li>
	<li>
		At the <code>A:\&gt;</code> prompt:<br />
		<div class="codefilter-code">
			<code>xcopy a: c: /n /e</code></div>
	</li>
	<li>
		Stop qemu</li>
</ul>
<p>
	Done! Now you can mount the stick again and copy any required utilities on it ...</p>
<p>
	&nbsp;</p>]]></content></entry><entry><title>Recording audio from command line</title><link href="/Open-Source/2011/08/09/Recording-audio-from-command-line"/><id>urn:uuid:6c926340-9a96-377d-b1d6-11c5930d17bb</id><updated>2011-08-09T19:57:43-05:00</updated><summary type="html"><![CDATA[<p>So i want to record the audio from my pc, this is the internal audio, not from an external source. So i found <a href="http://jordilin.wordpress.com/2006/07/28/howto-recording-audio-from-the-command-line/">Jordi Carrillo</a>'s site that had the commands that i can use in Fedora Linux. I am posting the commands that i would user here so i can find them easier next time.</p>
<p>&nbsp;</p>
<p><strong>alsamixer</strong></p>
<p>Once there, select the capture view by typing the tab key. You&rsquo;ll get the next screen:</p>
<p><a href="http://jordilin.files.wordpress.com/2006/07/alsamixer.png" title="alsamixer.png" class="imagelink"><img alt="alsamixer.png" src="http://jordilin.files.wordpress.com/2006/07/alsamixer.thumbnail.png?w=640" /></a></p>
<p>With the arrow keys select the column Capture and set it to the  CAPTUR mode with the space key as in the screenshot. Adjust the  recording volume with the arrow keys. You can also set it up with the  gnome volume control panel going to the capture tab.</p>
<p><strong>Recording sound to an mp3 file</strong></p>
<p>You&rsquo;ll need the lame mp3 encoder. Install it by doing</p>
<p><strong>Recording sound to an ogg file</strong></p>
<p>You&rsquo;ll need the oggenc (the ogg encoder). Install it by doing</p>
<p><strong>sudo yum install vorbis-tools</strong></p>
<p>Type the following command</p>
<p><strong>arecord -f cd -t raw | oggenc &ndash; -r -o out.ogg</strong></p>
<p>And you&rsquo;ll get your sound recorded to an ogg file. Take into account  that we record directly to a compressed file, so there&rsquo;s nothing in  between, so you can record for hours saving an incredible amount of hard  disk space.</p>]]></summary><category term="Open Source"/><published>2011-08-09T20:00:54-05:00</published><content type="html"><![CDATA[<p>So i want to record the audio from my pc, this is the internal audio, not from an external source. So i found <a href="http://jordilin.wordpress.com/2006/07/28/howto-recording-audio-from-the-command-line/">Jordi Carrillo</a>'s site that had the commands that i can use in Fedora Linux. I am posting the commands that i would user here so i can find them easier next time.</p>
<p>&nbsp;</p>
<p><strong>alsamixer</strong></p>
<p>Once there, select the capture view by typing the tab key. You&rsquo;ll get the next screen:</p>
<p><a href="http://jordilin.files.wordpress.com/2006/07/alsamixer.png" title="alsamixer.png" class="imagelink"><img alt="alsamixer.png" src="http://jordilin.files.wordpress.com/2006/07/alsamixer.thumbnail.png?w=640" /></a></p>
<p>With the arrow keys select the column Capture and set it to the  CAPTUR mode with the space key as in the screenshot. Adjust the  recording volume with the arrow keys. You can also set it up with the  gnome volume control panel going to the capture tab.</p>
<p><strong>Recording sound to an mp3 file</strong></p>
<p>You&rsquo;ll need the lame mp3 encoder. Install it by doing</p>
<p><strong>Recording sound to an ogg file</strong></p>
<p>You&rsquo;ll need the oggenc (the ogg encoder). Install it by doing</p>
<p><strong>sudo yum install vorbis-tools</strong></p>
<p>Type the following command</p>
<p><strong>arecord -f cd -t raw | oggenc &ndash; -r -o out.ogg</strong></p>
<p>And you&rsquo;ll get your sound recorded to an ogg file. Take into account  that we record directly to a compressed file, so there&rsquo;s nothing in  between, so you can record for hours saving an incredible amount of hard  disk space.</p>]]></content></entry><entry><title>Installing Enlightenment on Fedora YUM Repo</title><link href="/Open-Source/2010/04/02/Installing-Enlightenment-on-Fedora-YUM-Repo"/><id>urn:uuid:70657b1e-ea40-3ad3-865a-42a85d087a96</id><updated>2010-04-02T12:11:58-05:00</updated><summary type="html"><![CDATA[<p>For those who don't know E17 is in fedora, but it's not a very current release. So i found a repo that has some more up-to-date files. It's easy to install just follow the directions on the site. I will add more notes later, because i just wanted to capture the link.</p>
<p><a href="http://optics.csufresno.edu/~kriehn/fedora/fedora_files/f12/howto/e17-installation.html">http://optics.csufresno.edu/~kriehn/fedora/fedora_files/f12/howto/e17-installation.html</a></p>
<p>Install Enlightenment and have fun.</p>]]></summary><category term="Open Source"/><published>2010-04-02T12:13:26-05:00</published><content type="html"><![CDATA[<p>For those who don't know E17 is in fedora, but it's not a very current release. So i found a repo that has some more up-to-date files. It's easy to install just follow the directions on the site. I will add more notes later, because i just wanted to capture the link.</p>
<p><a href="http://optics.csufresno.edu/~kriehn/fedora/fedora_files/f12/howto/e17-installation.html">http://optics.csufresno.edu/~kriehn/fedora/fedora_files/f12/howto/e17-installation.html</a></p>
<p>Install Enlightenment and have fun.</p>]]></content></entry><entry><title>First Enlightenment App</title><link href="/Open-Source/2010/04/01/First-Enlightenment-App"/><id>urn:uuid:e6e8b15e-bc4c-34c8-ae9e-4a5d56a60a7c</id><updated>2010-04-01T11:39:40-05:00</updated><summary type="html"><![CDATA[<span id="synopsis">&#13;
<p>Well<a href="http://enlightenment.org/"> Enlightenment</a> has come a long ways. I remember getting e16 over 10 years ago and i thought it was awesome back then. It has only gotten better. I have been following the progress over the years and have tried e17 several times. Well now it looks like e17 is getting stable and a new stable release will be out. Now it may be another year i don't know, but things are looking very good.</p>&#13;
<p>I have two apps that i want to do the first is a gui front-end for <a href="http://notmuchmail.org/">notmuchmail</a>. And the other is just a personal project to see if something is very feasible. I will give more input once i have it in a viewable state, right now it would be labelled as vaporware.</p>&#13;
</span>]]></summary><category term="Open Source"/><published>2010-04-01T11:48:51-05:00</published><content type="html"><![CDATA[<p><span id="synopsis">
<p>Well<a href="http://enlightenment.org/"> Enlightenment</a> has come a long ways. I&nbsp;remember getting e16 over 10 years ago and i thought it was awesome back then. It has only gotten better. I&nbsp;have been following the progress over the years and have tried e17 several times. Well now it looks like e17 is getting stable and a new stable release will be out. Now it may be another year i don't know, but things are looking very good.</p>
<p>I&nbsp;have two apps that i want to do the first is a gui front-end for <a href="http://notmuchmail.org/">notmuchmail</a>. And the other is just a personal project to see if something is very feasible. I will give more input once i have it in a viewable state, right now it would be labelled as vaporware.</p>
</span></p>
<p>Well first things first i need to learn E, and so i started with the <a href="http://docs.enlightenment.org/books/cookbook/eflcookbook.html">EFL cookbook</a> on the enlightenment website. Well it must be out of date because i had to fix some things to get the code to compile. Here is the code that i am currently using.</p>
<p><code>#include &lt;errno.h&gt;<br />
#include &lt;string.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;unistd.h&gt;<br />
#include &lt;sys/stat.h&gt;<br />
#include &lt;sys/types.h&gt;<br />
#include &lt;Ewl.h&gt;<br />
<br />
#define PROG&nbsp;&nbsp;&nbsp; &quot;EWL Text Viewer&quot;<br />
<br />
/* globals */<br />
static Ewl_Widget *main_win = NULL;<br />
static Ewl_Widget *fd_win = NULL;<br />
<br />
/* pre-declarations */<br />
static void destroy_cb(Ewl_Widget *, void *, void *);<br />
static void destroy_filedialog_cb(Ewl_Widget *, void *, void *);<br />
static void open_file_cb(Ewl_Widget *, void *, void *);<br />
static void home_cb(Ewl_Widget *win, void *ev, void *data);<br />
static void file_menu_open_cb(Ewl_Widget *, void *, void *);<br />
static void key_up_cb(Ewl_Widget *, void *, void *);<br />
<br />
static char *read_file(char *);<br />
static void mk_gui(void);<br />
<br />
<br />
/* lets go */<br />
int main(int argc, char ** argv) {<br />
&nbsp;&nbsp;&nbsp; ewl_init(&amp;argc, argv);<br />
&nbsp;&nbsp;&nbsp; mk_gui();<br />
&nbsp;&nbsp;&nbsp; ewl_main();<br />
&nbsp;&nbsp;&nbsp; return 0;<br />
}<br />
<br />
/* build the main gui */<br />
static void mk_gui(void) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ewl_Widget *box = NULL, *menu_bar = NULL;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ewl_Widget *text_area = NULL, *scroll = NULL;<br />
<br />
&nbsp;&nbsp;&nbsp; /* create the main window */<br />
&nbsp;&nbsp;&nbsp; main_win = ewl_window_new();<br />
&nbsp;&nbsp;&nbsp; ewl_window_title_set(EWL_WINDOW(main_win), PROG);<br />
&nbsp;&nbsp;&nbsp; ewl_window_name_set(EWL_WINDOW(main_win), PROG);<br />
&nbsp;&nbsp;&nbsp; ewl_window_class_set(EWL_WINDOW(main_win), PROG);<br />
<br />
&nbsp;&nbsp;&nbsp; ewl_object_size_request(EWL_OBJECT(main_win), 200, 300);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(main_win), EWL_FLAG_FILL_FILL);<br />
<br />
&nbsp;&nbsp; // ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(main_win);<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; /* create the main container */<br />
&nbsp;&nbsp;&nbsp; box = ewl_vbox_new();<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(main_win), box);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_FILL);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(box);<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; /* create the menu bar */<br />
&nbsp;&nbsp;&nbsp; menu_bar = ewl_hbox_new();<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(box), menu_bar);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(menu_bar), EWL_FLAG_FILL_HSHRINK);<br />
&nbsp;&nbsp;&nbsp; ewl_object_alignment_set(EWL_OBJECT(menu_bar), EWL_FLAG_ALIGN_LEFT);<br />
&nbsp;&nbsp;&nbsp; ewl_box_spacing_set(EWL_BOX(menu_bar), 4);<br />
&nbsp;&nbsp;&nbsp; ewl_object_padding_set(EWL_OBJECT(menu_bar), 5, 5, 5, 5);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(menu_bar);<br />
&nbsp; <br />
&nbsp;&nbsp;&nbsp; /* create the scrollpane */<br />
&nbsp;&nbsp;&nbsp; scroll = ewl_scrollpane_new();<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(box), scroll);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(scroll), EWL_FLAG_FILL_FILL);<br />
&nbsp;&nbsp;&nbsp; /*ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(scroll), <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EWL_SCROLLPANE_FLAG_AUTO_VISIBLE);<br />
&nbsp;&nbsp;&nbsp; ewl_scrollpane_vscrollbar_flag_set(EWL_SCROLLPANE(scroll), <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EWL_SCROLLPANE_FLAG_AUTO_VISIBLE);<br />
*/<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(scroll);<br />
<br />
&nbsp;&nbsp;&nbsp; /* create the text area */<br />
&nbsp;&nbsp;&nbsp; char *content = &quot;This is some content&quot;;<br />
&nbsp;&nbsp;&nbsp; text_area = ewl_text_new();<br />
&nbsp;&nbsp;&nbsp; ewl_text_text_set(EWL_TEXT(text_area), content);<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(scroll), text_area);<br />
&nbsp;&nbsp;&nbsp; ewl_object_padding_set(EWL_OBJECT(text_area), 1, 1, 1, 1);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(text_area);<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; /* create the menu */<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ewl_Widget *file_menu = NULL, *item = NULL;<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* create the file menu */ <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file_menu = ewl_menu_new();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_button_label_set(EWL_BUTTON(file_menu), &quot;File&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(menu_bar), file_menu);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_widget_show(file_menu);<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* add the open entry to the file menu */ <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; item = ewl_menu_item_new();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_button_label_set(EWL_BUTTON(item), &quot;Open&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(file_menu), item);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_callback_append(item, EWL_CALLBACK_CLICKED, file_menu_open_cb, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text_area);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_widget_show(item);<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* add the quit entry to the file menu */ <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; item = ewl_menu_item_new();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_button_label_set(EWL_BUTTON(item), &quot;Quit&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(file_menu), item);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_callback_append(item, EWL_CALLBACK_CLICKED, destroy_cb, NULL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_widget_show(item); <br />
&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp; }<br />
<br />
/* destroy the app */<br />
static void destroy_cb(Ewl_Widget *win, void *ev, void *data) {<br />
&nbsp;&nbsp;&nbsp; ewl_widget_destroy(win);<br />
&nbsp;&nbsp;&nbsp; ewl_main_quit();<br />
}<br />
<br />
/* the file menu open button callback */<br />
static void file_menu_open_cb(Ewl_Widget *win, void *ev, void *data) {<br />
&nbsp;&nbsp;&nbsp; Ewl_Widget *fd = NULL;<br />
&nbsp;&nbsp;&nbsp; Ewl_Widget *box = NULL;<br />
&nbsp;&nbsp;&nbsp; Ewl_Widget *home = NULL;<br />
<br />
&nbsp;&nbsp;&nbsp; /* create the file dialog window */<br />
&nbsp;&nbsp;&nbsp; fd_win = ewl_window_new();<br />
&nbsp;&nbsp;&nbsp; ewl_window_title_set(EWL_WINDOW(fd_win), PROG &quot; -- file dialog&quot;);<br />
&nbsp;&nbsp;&nbsp; ewl_window_name_set(EWL_WINDOW(fd_win), PROG &quot; -- file dialog&quot;);<br />
&nbsp;&nbsp;&nbsp; ewl_window_class_set(EWL_WINDOW(fd_win), PROG &quot; -- file dialog&quot;);<br />
&nbsp;&nbsp;&nbsp; ewl_object_size_request(EWL_OBJECT(fd_win), 500, 400);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(fd_win),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EWL_FLAG_FILL_FILL | EWL_FLAG_FILL_SHRINK);<br />
&nbsp;&nbsp;&nbsp; ewl_callback_append(fd_win, EWL_CALLBACK_DELETE_WINDOW, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destroy_filedialog_cb, NULL);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(fd_win);<br />
<br />
&nbsp;&nbsp;&nbsp; /* fd win container */<br />
&nbsp;&nbsp;&nbsp; box = ewl_vbox_new();<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(fd_win), box);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(box),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EWL_FLAG_FILL_FILL | EWL_FLAG_FILL_SHRINK);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(box);<br />
<br />
&nbsp;&nbsp;&nbsp; /* the file dialog */<br />
&nbsp;&nbsp;&nbsp; fd = ewl_filedialog_new();<br />
&nbsp;&nbsp;&nbsp; ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, open_file_cb, data);<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(box), fd);<br />
<br />
&nbsp;&nbsp;&nbsp; /* add a home button */<br />
&nbsp;&nbsp;&nbsp; home = ewl_button_new();<br />
&nbsp;&nbsp;&nbsp; ewl_button_label_set(EWL_BUTTON(home), &quot;Home&quot;);<br />
&nbsp;&nbsp;&nbsp; ewl_callback_append(home, EWL_CALLBACK_CLICKED, home_cb, fd);<br />
&nbsp;&nbsp;&nbsp; ewl_object_fill_policy_set(EWL_OBJECT(home), EWL_FLAG_FILL_HFILL);<br />
&nbsp;&nbsp;&nbsp; ewl_container_child_append(EWL_CONTAINER(fd), home);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(home);<br />
<br />
&nbsp;&nbsp;&nbsp; ewl_widget_show(fd);<br />
}<br />
<br />
/* close the file dialog */<br />
static void destroy_filedialog_cb(Ewl_Widget *win, void *ev, void *data) {<br />
&nbsp;&nbsp;&nbsp; ewl_widget_hide(win);<br />
&nbsp;&nbsp;&nbsp; ewl_widget_destroy(win);<br />
}<br />
<br />
/* the file dialog open button callback */<br />
static void open_file_cb(Ewl_Widget *w, void *ev, void *data) {<br />
&nbsp;&nbsp;&nbsp; char *text = NULL;<br />
&nbsp;&nbsp;&nbsp; char *filename;<br />
&nbsp;&nbsp;&nbsp; int *response = (int *)ev;<br />
<br />
&nbsp;&nbsp;&nbsp; switch (*response) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case EWL_STOCK_OPEN:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filename = ewl_filedialog_selected_file_get(EWL_FILEDIALOG(w));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text = read_file(filename);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case EWL_STOCK_CANCEL:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br />
&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp; if (text) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_text_text_set(EWL_TEXT(data), text);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; free(text);<br />
&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; text = NULL;<br />
<br />
&nbsp;&nbsp;&nbsp; ewl_widget_hide(fd_win);<br />
}<br />
<br />
<br />
/* the fd home button is clicked */<br />
static void home_cb(Ewl_Widget *win, void *ev, void *data) {<br />
&nbsp;&nbsp;&nbsp; char *home = NULL;<br />
&nbsp;&nbsp;&nbsp; Ewl_Filedialog *fd = data;<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; home = getenv(&quot;HOME&quot;);<br />
&nbsp;&nbsp;&nbsp; if (home)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ewl_filedialog_directory_set(fd, home);<br />
}&nbsp;&nbsp; <br />
<br />
/* read a file */<br />
static char *read_file(char *file) {<br />
&nbsp;&nbsp;&nbsp; char *text = NULL;<br />
&nbsp;&nbsp;&nbsp; FILE *f = NULL;<br />
&nbsp;&nbsp;&nbsp; int read = 0, st_ret = 0;<br />
&nbsp;&nbsp;&nbsp; struct stat s;<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; f = fopen(file, &quot;r&quot;);<br />
&nbsp;&nbsp;&nbsp; st_ret = stat(file, &amp;s);<br />
<br />
&nbsp;&nbsp;&nbsp; if (st_ret != 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (errno == ENOENT)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;not a file %s\n&quot;, file); <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return NULL;<br />
&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp; text = (char *)malloc(s.st_size * sizeof(char));<br />
&nbsp;&nbsp;&nbsp; read = fread(text, sizeof(char), s.st_size, f); <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; fclose(f);<br />
&nbsp;&nbsp;&nbsp; return text;<br />
}<br />
<br />
<br />
/* a key was pressed */<br />
static void key_up_cb(Ewl_Widget *win, void *ev, void *data) {<br />
&nbsp;&nbsp;&nbsp; Ewl_Event_Key_Down *e = (Ewl_Event_Key_Down *)ev;<br />
&nbsp;&nbsp;&nbsp; //Ewl_Scrollpane *scroll = (Ewl_Scrollpane *)data;<br />
&nbsp;&nbsp; double val = 0;<br />
&nbsp;&nbsp;&nbsp; if (!strcmp(e-&gt;base.keyname, &quot;q&quot;)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destroy_cb(win, ev, data);<br />
<br />
&nbsp;&nbsp;&nbsp; } else if (!strcmp(e-&gt;base.keyname, &quot;Left&quot;)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double val = ewl_scrollpane_hscrollbar_value_get(EWL_SCROLLPANE(scroll));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double step = ewl_scrollpane_hscrollbar_step_get(EWL_SCROLLPANE(scroll));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (val != 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(scroll), <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val - step);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;here&quot;);<br />
&nbsp;&nbsp;&nbsp; } else if (!strcmp(e-&gt;base.keyname, &quot;Right&quot;)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double val = ewl_scrollpane_hscrollbar_value_get(EWL_SCROLLPANE(scroll));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double step = ewl_scrollpane_hscrollbar_step_get(EWL_SCROLLPANE(scroll));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (val != 1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ewl_scrollpane_vscrollbar_value_set(EWL_SCROLLPANE(scroll), <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val + step);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;here&quot;);<br />
&nbsp;&nbsp;&nbsp; } else if (!strcmp(e-&gt;base.keyname, &quot;Up&quot;)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double val = ewl_scrollpane_vscrollbar_value_get(EWL_SCROLLPANE(scroll));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // double step = ewl_scrollpane_vscrollbar_step_get(EWL_SCROLLPANE(scroll));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (val != 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp; ewl_scrollpane_vscrollbar_value_set(EWL_SCROLLPANE(scroll), <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val - step);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;here&quot;); <br />
&nbsp;&nbsp;&nbsp; } else if (!strcmp(e-&gt;base.keyname, &quot;Down&quot;)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double val = ewl_scrollpane_vscrollbar_value_get(EWL_SCROLLPANE(scroll));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //double step = ewl_scrollpane_vscrollbar_step_get(EWL_SCROLLPANE(scroll));<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (val != 1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; ewl_scrollpane_vscrollbar_value_set(EWL_SCROLLPANE(scroll), <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val + step);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;here&quot;);<br />
&nbsp;&nbsp;&nbsp; } <br />
}</code></p>
<p>You can compile the application with the following:</p>
<p><code>gcc -Wall -o ewl_text main.c `pkg-config --cflags --libs ewl`</code></p>
<p>The problem i am having is with the ewl_scrollpane_vscrollbar_* functions. They are throwing errors when i try to use them.</p>
<p><code>implicit declaration of function &lsquo;ewl_scrollpane_hscrollbar_flag_set&rsquo;</code></p>
<p>So i posted my question out on the forum, and i hope to get some help on fixing it.&nbsp;The app does not have scroll bars, and if you load a good size document it looses it's menus from time to time. Not the best, but it's my first shot at this.</p>
<p>If you have any advice let me know.</p>
<h2>Update 4/02/2010</h2>
<p>I found this other getting <a href="http://docs.enlightenment.org/api/ewl/html/getting_started.html">started page</a>. Thought i would share it as well. A few things are wrong in it. On line 114 or around that you need to find ecore_list_goto_first(files); and replace it with ecore_list_first_goto(files); Even after that i could not get files = ecore_file_ls(dir); to work. So i commented out the section. The main goal of this was to figure out why when i closed my app i would get a segfault. Well it seems that it's a problem with the version of enlightenment i am using.</p>
<p>&nbsp;</p>]]></content></entry><entry><title>gnome gtk system-tray in C</title><link href="/Open-Source/2010/02/16/gnome-gtk-system-tray-in-C"/><id>urn:uuid:4ab919a7-35db-3f0b-82e7-0275108e0640</id><updated>2010-02-16T08:18:32-06:00</updated><summary type="html"><![CDATA[<p>I was looking for a simple tutorial on how to make system tray icon in C. Well i found this <a href="http://blog.sacaluta.com/2007/08/gtk-system-tray-icon-example.html">page</a> and tried the example. Just needed to add &lt;gtk/gtk.h&gt; to the include and it compiled and worked just fine. I&nbsp;am adding it here so </p>
<ol>
    <li>&nbsp;it's easier for me to find when i actually need it again, </li>
    <li>sites tend to disappear on the net, so this is my backup copy.</li>
</ol>
<p><code>#include &lt;gtk/gtk.h&gt;<br />
<br />
void tray_icon_on_click(GtkStatusIcon *status_icon,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpointer user_data)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Clicked on tray icon\n&quot;);<br />
}<br />
<br />
void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; guint activate_time, gpointer user_data)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Popup menu\n&quot;);<br />
}<br />
<br />
static GtkStatusIcon *create_tray_icon() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GtkStatusIcon *tray_icon;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tray_icon = gtk_status_icon_new();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_signal_connect(G_OBJECT(tray_icon), &quot;activate&quot;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_CALLBACK(tray_icon_on_click), NULL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_signal_connect(G_OBJECT(tray_icon),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;popup-menu&quot;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_CALLBACK(tray_icon_on_menu), NULL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_status_icon_set_from_icon_name(tray_icon,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GTK_STOCK_MEDIA_STOP);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_status_icon_set_tooltip(tray_icon,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Example Tray Icon&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_status_icon_set_visible(tray_icon, TRUE);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return tray_icon;<br />
}<br />
<br />
int main(int argc, char **argv) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GtkStatusIcon *tray_icon;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_init(&amp;argc, &amp;argv);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tray_icon = create_tray_icon();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_main();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br />
}<br />
</code></p>]]></summary><category term="Open Source"/><published>2010-02-16T08:21:51-06:00</published><content type="html"><![CDATA[<p>I was looking for a simple tutorial on how to make system tray icon in C. Well i found this <a href="http://blog.sacaluta.com/2007/08/gtk-system-tray-icon-example.html">page</a> and tried the example. Just needed to add &lt;gtk/gtk.h&gt; to the include and it compiled and worked just fine. I&nbsp;am adding it here so</p>
<ol>
    <li>&nbsp;it's easier for me to find when i actually need it again,</li>
    <li>sites tend to disappear on the net, so this is my backup copy.</li>
</ol>
<p>Save the following code into main.c file.</p>
<p><code>#include &lt;gtk/gtk.h&gt;<br />
<br />
void tray_icon_on_click(GtkStatusIcon *status_icon,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpointer user_data)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Clicked on tray icon\n&quot;);<br />
}<br />
<br />
void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; guint activate_time, gpointer user_data)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Popup menu\n&quot;);<br />
}<br />
<br />
static GtkStatusIcon *create_tray_icon() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GtkStatusIcon *tray_icon;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tray_icon = gtk_status_icon_new();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_signal_connect(G_OBJECT(tray_icon), &quot;activate&quot;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_CALLBACK(tray_icon_on_click), NULL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_signal_connect(G_OBJECT(tray_icon),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;popup-menu&quot;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_CALLBACK(tray_icon_on_menu), NULL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_status_icon_set_from_icon_name(tray_icon,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GTK_STOCK_MEDIA_STOP);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_status_icon_set_tooltip(tray_icon,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Example Tray Icon&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_status_icon_set_visible(tray_icon, TRUE);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return tray_icon;<br />
}<br />
<br />
int main(int argc, char **argv) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GtkStatusIcon *tray_icon;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_init(&amp;argc, &amp;argv);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tray_icon = create_tray_icon();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_main();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br />
}<br />
</code></p>
<p>You compile the app with the following</p>
<p><code>gcc main.c -o tray-icon `pkg-config --cflags --libs gtk+-2.0`</code></p>
<p>Then launch it ./tray-icon</p>
<p>You should see a gray &quot;stop&quot; box appear in the tray. Easy as that.</p>]]></content></entry></feed>

