PHP
  Home arrow PHP arrow Page 6 - Building Your Own System Tray Application Using PHP-GTK
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Building Your Own System Tray Application Using PHP-GTK
By: K.K.Sou
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 6
    2008-09-30


    Table of Contents:
  • Building Your Own System Tray Application Using PHP-GTK
  • Set up the main application
  • Second example of GtkStatusIcon
  • Display a popup menu
  • Popup menu on right mouse click
  • A note about subclassing a widget

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building Your Own System Tray Application Using PHP-GTK - A note about subclassing a widget
    ( Page 6 of 6 )

    One of the biggest advantages of subclassing a widget, as you can see from this example, is that you can neatly encapsulate all the signal handlers and related methods into a class.

    As you start to build bigger and more complex PHP-GTK2 applications, you will find that the number of signal handlers corresponding to each widget become more and more difficult to manage and maintain.

    The ability to encapsulate signal handlers and methods that are used only by the widget itself makes it particularly attractive for debugging and maintaining codes.

    However, there are always two sides to a coin. The main “disadvantage” of subclassing a widget is that you are not able to use these subclassed widgets in Glade. Glade only recognizes standard GTK widgets. So all the widgets you use in Glade have to be the standard GTK widgets.

    Of course, you can intermix both in your application. In this example, I used Glade in the main application, but used the subclass approach when setting up the system tray icon.

    The complete sample code and glade file

    Click on the following links to download the complete sample code and the corresponding glade file.

     

    -DOWNLOAD SOURCE-

    Final Words

    We’ve come to the end of this article. In this tutorial, you saw how you can easily convert any standard PHP-GTK2 application into a system tray application.

    You first set up the main application as per your original desktop application. Then you add a system tray icon with the help of the widget GtkStatusIcon.

    The system tray icon behaves like a button, responding to both left and right mouse clicks. For a left mouse click, we usually hide or reveal the main application. For a right mouse click, we usually pop up a menu listing some commonly-used functions.

    Now that you know how to create system tray applications, I hope you will have lots of fun in the next couple of days converting some of your existing PHP-GTK applications into system tray applications!



     
     
    >>> More PHP Articles          >>> More By K.K.Sou
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT