C Language - Icon for right-click menu in C?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

C Language - Icon for right-click menu in C?

#1 Post by RSH »

Hi.

I want to have an icon for a menu entry.

Code: Select all

   menuitem = gtk_menu_item_new_with_label("LazY FReD Free Repository Downloader");
   g_signal_connect(menuitem, "activate", (GCallback) view_popup_menu_run_lazy_fred, status_icon);
   gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
Full Code here

What do i have to change, to have an icon in a menu entry?

Thanks

RSH
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#2 Post by 01micko »

This example should do what you want.
Puppy Linux Blog - contact me for access

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#3 Post by RSH »

01micko wrote:This example should do what you want.
Thanks. Got it working. :D

Image

Is there any documentation for C language and especially the gcc syntax available?
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#4 Post by technosaurus »

I used a more unix-ian philosophy for sit. I figured we could use gtkdialog (or Bacon, tk, xdialog, yad, getgui, xmessage, 9menu, pygtk,...) for the left and right click menus. Since the tray icon updates itself whenever the icon file changes, a gtkdialog program only needs to update the icon (with freedom to do whatever else). The only catch is it is useful for the dialog tool to have a "near mouse" option (most do). It _should_ greatly simplify the necessary logic for building any quick and dirty tray app (its basically gtrayicon on steroids, except public domain / any OSI licensed)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#5 Post by RSH »

@technosaurus
What do you mean? Your program sit?

Meanwhile i've made some work on this.

Created a Taskbar Menu containing default applications with default icons as menu entries like i've added to the wbar

Image

This menu shows up if left-clicked on the tray icon. If i do right-click on the tray icon, it shows up the openbox menu, which is started through a little script. The script itself calls xdotool using "key ctrl+alt+w" as parameter.

Code: Select all

#!/bin/sh
sleep .15
/usr/bin/xdotool key ctrl+alt+w &
exit 0
This has been set earlier in /root/.config/openbox/rc.xml to be able to run the openbox menu from keyboard.

Code: Select all

    <keybind key="C-A-w">
      <action name="ShowMenu">
        <menu>root-menu</menu>
      </action>
    </keybind>
That's pretty cool! 8)

Compiled C Code binary runs a bash script that runs a binary that executes a keyboard shortcut defined in an .xml file!

It's quite familiar to playing in a band - but: me one is playing all instruments! :lol: :D 8)
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#6 Post by technosaurus »

Seaside posted a link to it in your other tray app thread (I thought this was the same thread when I poste), but here is the link
http://murga-linux.com/puppy/viewtopic.php?t=76431
I'd say the only thing it may be missing at this point is to check args and image file existences (right now it expects that to already be done externally)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply