How to modify showing desktop with Pager Applet



Dear all,
      i wanna modify the "showing desktop" applet with the button_press_event (GDK_2BUTTON_PRESS), instead of a toggled button. in details, add the function for showing desktop into the pager applet, and have defined the callback function for button_press_event, but i could not modify the "button_toggled_callback" function well. after making install my code, when double clicked the pager, the panel will disappear, but all applications still being there. as i know, it must be something wrong in this line, "if (pager->wnck_screen != NULL) wnck_screen_button_press_event_showing_desktop (pager->wnck_screen, gtk_pager_get_active (GTK_PAGER (pager)));".
      would you help me?

SHen, Meng

following is the additional part of my source of pager.c:

......
#include <libwnck/screen.h>
......

typedef struct {
 ...... 
 WnckScreen *wnck_screen;

 guint showing_desktop : 1;
} PagerData;

......
static void show_desktop_changed_callback (WnckScreen      *screen,
                                           PagerData *pager);

static gboolean double_press_callback (GtkWidget      *widget,
                         GdkEventButton *event, PagerData *pager);

......

static gboolean
double_press_callback (GtkWidget      *widget,
                         GdkEventButton *event, PagerData *pager)
{
        if ((event->button == 1)&&(event->type == GDK_2BUTTON_PRESS)) 
   {
                    if (pager->wnck_screen != NULL)
                wnck_screen_button_press_event_showing_desktop (pager->wnck_screen
                                         ,gtk_pager_get_active (GTK_PAGER (pager)));
            
   }

        return FALSE;
}


gboolean
fill_pager_applet(PanelApplet *applet)
{
 ...... 

 g_signal_connect (G_OBJECT (pager->pager), "button_press_event",
     G_CALLBACK (double_press_callback),
     pager);
 
 pager_update (pager);
 
 gtk_widget_show (pager->pager);
 gtk_container_add (GTK_CONTAINER (pager->frame), pager->pager);

 gtk_widget_show (pager->frame);
 
 gtk_container_add (GTK_CONTAINER (pager->applet), pager->frame);

 pager->wnck_screen =
                wnck_screen_get (gdk_screen_get_number (gtk_widget_get_screen (pager->applet)));

        if (pager->wnck_screen != NULL)
                g_signal_connect (G_OBJECT (pager->wnck_screen),
                                  "showing_desktop_changed",
                                  G_CALLBACK (show_desktop_changed_callback),
                                  pager);
        else
                g_warning ("Could not get WnckScreen!");
  
 ......
}

......

static void
show_desktop_changed_callback (WnckScreen      *screen,
                               PagerData *pager)
{
        if (pager->wnck_screen != NULL)
                pager->showing_desktop =
                        wnck_screen_get_showing_desktop (pager->wnck_screen);
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]