Ximba Radio: Developing a GTK+/Glade GUI to XM Satellite Radio
Listing 4. This function changes the state icon to the connected state using what GTK+ calls the Apply icon.
code: gtk_image_set_from_stock(GTK_IMAGE(XR_Status_Image), GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
The use of global variables is not the only issue experienced developers might take with my methodology. Another is my choice of using a deprecated GTK+ widget: the CList, also known as the columned list widget. Deprecated implies that the widget, while still part of the current distribution, is no longer being developed actively and may be removed from the GTK+ distribution in the future.
The current replacement for the CList widget is the Tree and List widget. Ximba Radio requires list entries to be added and removed dynamically on a frequent basis. Neither the CList nor the Tree and List widget were helpful with this requirement. However, because the CList was designed specifically for handling lists and not expandable trees, I found it the less complex of the two choices. By definition, prototypes require getting an application up and running quickly with a standard or typical interface. CList support in Glade makes this possible without having to learn the complexities of the Tree and List widget. The trade-off will come later when I have to deal with the eventual disposition of the CList.
Ximba Radio makes heavy use of lists. All channel, category and favorites information is kept in columned lists. While the complete channel listings and the favorites are static lists that never go completely away, the category lists are dynamic. Users can enable or disable them from the display, making it easier to find stations based on their own preferences. To manage the dynamic nature of the category lists, I made use of GLib's doubly linked list, the GList. Few applications of any complexity can avoid the use of linked lists, and GLists are extremely easy to use. A one-way link list option exists, the GSList, but it costs little to have the two-way links in a GList, and reserving the option to travel in both directions in a list is worth any extra weight a GList might add.
Listing 5. These two functions write preference data to a file, traversing a GList to get category information.
code:
void
XRUSavePrefs()
{
...
/* Write the preferences to it. */
fprintf(fd, "hostname:%s\n", prefs.hostname);
if ( prefs.daemondir )
fprintf(fd, "daemondir:%s\n",prefs.daemondir);
else
fprintf(fd, "daemondir:\n");
fprintf(fd, "favorites:%d\n",
(int)prefs.enable_favorites);
fprintf(fd, "channels:%d\n",
(int)prefs.channel_windows);
fprintf(fd, "performance:%d\n",
prefs.performance);
/* Run the list of categories and save them
* and their states
*/
g_list_foreach(prefs.categories,
SavePrefsCategory, fd);
...
}
static void
SavePrefsCategory(
CatEntryT *catentry,
FILE *fd
)
{
fprintf(fd, "category:%s:%d\n", catentry->name,
catentry->state);
}
One other pitfall to avoid comes with testing your application if you use pixmaps. Ximba Radio uses a logo pixmap in several places. The pixmap is not found if you run the application from the default src directory unless you first do a complete build:
./configure --prefix=<install directory> make make install
This process copies over pixmaps to a pixmap directory under the install directory prefix. For example, if <install directory> is set to /usr/local/ximbaradio, the pixmaps are installed in /usr/local/ximbaradio/share/ximbaradio/pixmaps. Once installed, the compiled program finds the pixmaps correctly. If the pixmaps are updated, the make install step needs to be rerun. Switching to compiled logos—that is, making them part of the binary so relocation issues are not relevant—is possible with modifications to the support.c file. I've done this for previous applications, but the technique is beyond the scope of this article.
I managed to get the complete application written in approximately 30 hours of total work. Most of that was spent on core code. UI code was completed in perhaps ten hours of total work. The application matches the Windows UI in all major features and the Preferences are easy to manage. The UI code is independent of the core code, although some dependency on the callbacks.c file still is present.
Development of Ximba Radio continues. Plans include adding audio control options and a GStreamer-based reflector. The reflector, Ximba Radio and OpenXM will combine to allow remote access to PC-based XM Radio satellite service.
Glade 3 is under development, and it's expected that the code generation feature will be removed. Because this upcoming release has been long in development and its release does not appear to be close to the horizon, working with generated code remains a viable option for Glade-built prototypes for the near future. That said, prototype development does remain fast and painless with GTK+ and Glade.
Michael J. Hammel is a software engineer and author living in Houston, Texas, with his wife, Brinda, and daughter, Ryann. An avid runner and tennis player, who loves his dogs Reba and Bailey as much as he loves his computer, Michael spends his spare time nursing aging knees, cleaning up torn sofa cushions and asking himself why he doesn't have any spare time. His Web site is graphics-muse.com, and he can be reached at mjhammel@graphics-muse.org.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Developer Poll
- Dart: a New Web Programming Experience
- What's the tweeting protocol?
- New Products
- Thanks for taking the time to
49 sec ago - Linux is good
1 hour 58 min ago - Reply to comment | Linux Journal
2 hours 15 min ago - Web Hosting IQ
2 hours 45 min ago - Web Hosting IQ
2 hours 46 min ago - Web Hosting IQ
2 hours 47 min ago - Reply to comment | Linux Journal
5 hours 47 min ago - play with linux? i think you mean work-around linux
14 hours 13 min ago - Where is Epistle?
14 hours 19 min ago - You forgot OwnCloud
14 hours 49 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




Comments
XM Satellite Radio
In a little under four years, his show went from 47 stations to more than 200 (it's now at 350) and XM satellite radio. In 2006, when he began a TV gig on ...
Re: Ximba Radio: Developing a GTK+/Glade GUI to XM Satellite Rad
Is it possible to download the sourcecode for Ximba? I'm a current subscriber to XM Radio for my car and would like to have this for my PC in the future. Thanks!!
Re: Ximba Radio: Developing a GTK+/Glade GUI to XM Satellite Rad
Try going to the Authors website
http://graphics-muse.com/
Usability and design of Gnome Applications
some suggestions on how to make your application fit in better with other Gnome applications.
a menubar with only two top level menus is a waste of prime real estate
if at all possible add in some more menus like perhaps
an edit menu with undo, redo, cut, copy, paste, select all, preferences
a view menu, with ...
a Radio menu with ...
a row of buttons! you really should use a real toolbar.
not only will it look better but it will allow users to choose to have text labels or not
the Ximba Radio graphic is nice but wouldn't it be better to save it for the About Dialog rather (with useful version and author information) than having such loud branding?
good luck
- Alan