static gboolean
_button_clicked_event (CairoMainIcon *icon, GdkEventButton *event, gpointer null)
{
  g_return_val_if_fail (AWN_IS_CAIRO_MAIN_ICON(icon), FALSE);
  CairoMainIconPrivate * priv = GET_PRIVATE (icon);

  if (event->button == 1)
  {
    awn_icon_popup_gtk_menu (AWN_ICON (icon), priv->menu, event->button, event->time);

    if (!priv->autohide_cookie)
    {
      priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(priv->applet),"CairoMenu" );
    }
    g_object_set(awn_overlayable_get_effects (AWN_OVERLAYABLE(icon)), "depressed", FALSE,NULL);
  }
  else if (event->button == 3)
  {
    GtkWidget * item;

    if (!priv->context_menu)
    {
      priv->context_menu = awn_applet_create_default_menu (AWN_APPLET(priv->applet));
      gtk_menu_set_screen(GTK_MENU(priv->context_menu), NULL);
      item = awn_themed_icon_create_remove_custom_icon_item (AWN_THEMED_ICON(icon),NULL);
      gtk_menu_shell_append (GTK_MENU_SHELL(priv->context_menu), item);
/*      item = gtk_image_menu_item_new_with_label("Applet Preferences");
      gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(item),
                                     gtk_image_new_from_stock (GTK_STOCK_PREFERENCES,GTK_ICON_SIZE_MENU));
      gtk_widget_show(item);
      gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);
       */
//      g_signal_connect(G_OBJECT(item), "button-press-event", G_CALLBACK(_show_prefs), NULL);
      item=awn_applet_create_about_item_simple(AWN_APPLET(priv->applet),
                                               "Copyright 2007,2008, 2009 Rodney Cryderman <*****@*****.**>",
                                               AWN_APPLET_LICENSE_GPLV2,
                                               VERSION);
      gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);
      g_signal_connect(G_OBJECT(priv->context_menu), "deactivate", G_CALLBACK(_deactivate_event), icon);
    }
    if (!priv->autohide_cookie)
    {
      priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(priv->applet),"CairoMenu" );
    }
    awn_icon_popup_gtk_menu (AWN_ICON (icon), priv->context_menu, event->button, event->time);
    g_object_set(awn_overlayable_get_effects (AWN_OVERLAYABLE(icon)), "depressed", FALSE,NULL);
    awn_utils_show_menu_images (GTK_MENU (priv->context_menu));
  }
  else
  {
    return TRUE;
  }

  awn_icon_set_is_active (AWN_ICON(icon), TRUE);
  return TRUE;
}
AwnApplet*
awn_applet_factory_initp ( gchar* uid, gint orient, gint height )
{
  AwnApplet *applet = awn_applet_new( uid, orient, height );
  GtkWidget     *trash;
  GtkWidget     *menu;
  GtkWidget     *item;
  
  gnome_vfs_init ();
  
  /* trash */
  trash = trash_applet_new (applet);

  /* menu */
  menu = awn_applet_create_default_menu (applet);

  item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
  g_signal_connect (G_OBJECT (item), "activate", 
                    G_CALLBACK (show_about), trash);


  item = gtk_image_menu_item_new_from_stock (GTK_STOCK_HELP, NULL);
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
  g_signal_connect (G_OBJECT (item), "activate", 
                    G_CALLBACK (show_help), trash);


  item = gtk_separator_menu_item_new ();
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);

  item = gtk_menu_item_new_with_mnemonic ("_Empty the Wastebasket");
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
  g_signal_connect (G_OBJECT (item), "activate", 
                    G_CALLBACK (empty_trash), trash);
  
  item = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, NULL);
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
  g_signal_connect (G_OBJECT (item), "activate", 
                    G_CALLBACK (open_trash), trash);

  g_signal_connect (G_OBJECT (applet), "button-release-event", 
                    G_CALLBACK (applet_button_release), menu);
                         
  
  gtk_widget_set_size_request (GTK_WIDGET (applet),
                               awn_applet_get_height (applet), 
                               awn_applet_get_height (applet) * 2);
  
  gtk_container_add (GTK_CONTAINER (applet), trash);
  
  gtk_widget_show_all (GTK_WIDGET (menu));

  return applet;
}
Beispiel #3
0
static gboolean
_button_clicked_event (GtkWidget      *widget,
                       GdkEventButton *event,
                       WebApplet      *webapplet)
{
  static GtkWidget *menu=NULL;

  if (event->button == 1)
  {
    if (GTK_WIDGET_VISIBLE (webapplet->mainwindow))
    {
      gtk_widget_hide (webapplet->mainwindow);
    }
    else
    {
      gtk_widget_show_all (webapplet->mainwindow);
    }
  }
  else if (event->button == 3)
  {
    if (!menu)
    {
      GtkWidget *item;
      menu = awn_applet_create_default_menu (webapplet->applet);
      gtk_menu_set_screen (GTK_MENU (menu), NULL);
      if (config_get_enable_location_dialog(webapplet))
      {
        item = gtk_image_menu_item_new_with_label (_("Open Location"));
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
                                       gtk_image_new_from_stock (GTK_STOCK_OPEN,
                                                          GTK_ICON_SIZE_MENU));
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show_all (item);
        g_signal_connect (G_OBJECT (item), "activate",
                          G_CALLBACK (_show_location_dialog), webapplet);
      }           
      item = awn_applet_create_about_item_simple(webapplet->applet,
                                                 "2008 Rodney Cryderman <*****@*****.**>\n"
                                                 "2008 Mark Lee <*****@*****.**>\n",
                                                 AWN_APPLET_LICENSE_GPLV2,
                                                 NULL);
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
    }
    awn_applet_popup_gtk_menu (webapplet->applet, menu, event->button, event->time);
  }
  return TRUE;
}
Beispiel #4
0
static gboolean
_button_clicked_event (GtkWidget      *widget,
                       GdkEventButton *event,
                       AwnApplet *applet)
{
  static GtkWidget *menu=NULL;
  if (event->button == 3)
  {
    if (!menu)
    {
      menu = awn_applet_create_default_menu (applet);
    }
    gtk_menu_set_screen (GTK_MENU (menu), NULL);
    awn_applet_popup_gtk_menu (applet, menu, event->button, event->time);
  }
  return TRUE;
}
Beispiel #5
0
static void 
awn_CPUicon_show_context_menu(AwnCPUicon *self)
{
  AwnCPUiconPrivate *priv;
  AwnApplet         *applet;
  GtkWidget         *item;
  GtkWidget         *submenu;
  gboolean          render_bg;

  g_object_get (self,
                "render-bg", &render_bg,
                NULL);
  
  priv = AWN_CPUICON_GET_PRIVATE (self);
  if (priv->context_menu)
  {
    gtk_widget_destroy (priv->context_menu);
  }
  g_object_get (self,
                "applet",&applet,
                NULL);
  
  priv->context_menu = awn_applet_create_default_menu(applet);
  item = gtk_menu_item_new_with_label (_("Graph Type"));
  gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);
  
  submenu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM(item),submenu);
  
  /* Translators: refers to a graph type */
  item = gtk_menu_item_new_with_label (_("Area"));
  gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
  g_signal_connect_swapped (item, "activate", G_CALLBACK(change_to_area), self);
  item = gtk_menu_item_new_with_label (_("Circle"));
  gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
  g_signal_connect_swapped (item, "activate", G_CALLBACK(change_to_circle), self);  
  item = gtk_menu_item_new_with_label (_("Bars"));
  gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
  g_signal_connect_swapped (item, "activate", G_CALLBACK(change_to_bars), self);  
  item = gtk_menu_item_new_with_label (_("Default"));
  gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
  g_signal_connect_swapped (item, "activate", G_CALLBACK(change_to_default), self);  

/*  item = gtk_menu_item_new_with_label ("Add Icon");
  gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);
  submenu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM(item),submenu);
  item = gtk_menu_item_new_with_label ("CPU");
  gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
*/
/*  item = gtk_menu_item_new_with_label ("Remove Icon");
  gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);  
*/
  item = gtk_check_menu_item_new_with_label (_("Render Background"));
  gtk_check_menu_item_set_active ( GTK_CHECK_MENU_ITEM (item),render_bg);  
  gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);
  g_signal_connect_swapped (item, "activate", G_CALLBACK(change_render_bg), self);  

  item = awn_applet_create_about_item_simple (applet,
                                              "Copyright 2009 Rodney Cryderman <*****@*****.**>\n",
                                              AWN_APPLET_LICENSE_GPLV2,
                                              VERSION);
  gtk_menu_shell_append(GTK_MENU_SHELL(priv->context_menu), item);
  
  gtk_widget_show_all (priv->context_menu);
  awn_utils_show_menu_images (GTK_MENU(priv->context_menu));
  awn_applet_popup_gtk_menu (applet, priv->context_menu, 0, gtk_get_current_event_time());
}