static void exitbutton_construct(XfcePanelPlugin *plugin)
{
  ExitbuttonPlugin *exitbutton;

  /* setup translation domain */
  xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

  /* create the plugin */
  exitbutton = exitbutton_new(plugin);

  /* add the button to the panel */
  gtk_container_add(GTK_CONTAINER (plugin), exitbutton->button);

  /* show the panel's right-click menu on this bitton */
  xfce_panel_plugin_add_action_widget(plugin, exitbutton->button);

  /* connect plugin signals */
  g_signal_connect(G_OBJECT(plugin), "free-data", G_CALLBACK(exitbutton_free), exitbutton);

  g_signal_connect(G_OBJECT(plugin), "save", G_CALLBACK(exitbutton_save), exitbutton);

  g_signal_connect(G_OBJECT(plugin), "size-changed", G_CALLBACK(exitbutton_size_changed), exitbutton);

  g_signal_connect(G_OBJECT(plugin), "orientation-changed", G_CALLBACK(exitbutton_orientation_changed), exitbutton);

  /* show the configure menu item and connect signal */
  xfce_panel_plugin_menu_show_configure (plugin);
  g_signal_connect (G_OBJECT(plugin), "configure-plugin", G_CALLBACK(exitbutton_configure), exitbutton);

  /* show the about menu item and connect signal */
  xfce_panel_plugin_menu_show_about (plugin);
  g_signal_connect (G_OBJECT(plugin), "about", G_CALLBACK(exitbutton_about), NULL);
}
static void
xfapplet_setup_empty (XfAppletPlugin *xap)
{
	GtkWidget *img, *eb, *child = NULL;
	GdkPixbuf *pixbuf;
	gint	   size;
	
	size = xfce_panel_plugin_get_size (xap->plugin);
	pixbuf = gdk_pixbuf_new_from_file_at_size (DATADIR "/pixmaps/xfapplet1.svg", size, size, NULL);
	img = gtk_image_new_from_pixbuf (pixbuf);
	g_object_unref (pixbuf);
	gtk_widget_show (img);

	eb = gtk_event_box_new ();
	gtk_container_add (GTK_CONTAINER (eb), img);
	gtk_widget_show (eb);

	child = xfapplet_get_plugin_child (xap->plugin);
	if (child)
		gtk_widget_destroy (child);
	
	gtk_container_add (GTK_CONTAINER(xap->plugin), eb);
	xfce_panel_plugin_add_action_widget (xap->plugin, eb);
	xfce_panel_plugin_menu_show_configure (xap->plugin);
	xfce_panel_plugin_menu_show_about (xap->plugin);

	xap->configured = FALSE;
}
/**
 * construct:
 * @plugin: the xfce plugin
 *
 * Constructs the xfce plugin.
 */
static void
construct(XfcePanelPlugin *plugin)
{
    i3WorkspacesPlugin *i3_workspaces = construct_workspaces(plugin);

    /* add the ebox to the panel */
    gtk_container_add (GTK_CONTAINER(plugin), i3_workspaces->ebox);

    /* show the panel's right-click menu on this ebox */
    xfce_panel_plugin_add_action_widget(plugin, i3_workspaces->ebox);

    /* connect plugin signals */
    g_signal_connect(G_OBJECT(plugin), "free-data",
            G_CALLBACK(destruct), i3_workspaces);

    g_signal_connect(G_OBJECT(plugin), "size-changed",
            G_CALLBACK(size_changed), i3_workspaces);

    g_signal_connect(G_OBJECT(plugin), "orientation-changed",
            G_CALLBACK (orientation_changed), i3_workspaces);

    g_signal_connect(G_OBJECT(plugin), "configure-plugin",
            G_CALLBACK (configure_plugin), i3_workspaces);

    /* show the configure menu item */
    xfce_panel_plugin_menu_show_configure(plugin);
}
示例#4
0
static void
eyes_construct (XfcePanelPlugin *plugin)
{
    t_eyes *eyes = g_new0 (t_eyes, 1);

    g_signal_connect (plugin, "orientation-changed",
                      G_CALLBACK (eyes_orientation_changed), eyes);

    g_signal_connect (plugin, "size-changed",
                      G_CALLBACK (eyes_set_size), NULL);

    g_signal_connect (plugin, "free-data",
                      G_CALLBACK (eyes_free_data), eyes);

    g_signal_connect (plugin, "save",
                      G_CALLBACK (eyes_write_rc_file), eyes);

    xfce_panel_plugin_menu_show_configure (plugin);
    g_signal_connect (plugin, "configure-plugin",
                      G_CALLBACK (eyes_properties_dialog), eyes);

    eyes->plugin = plugin;

    eyes_read_rc_file (plugin, eyes);

    gtk_container_add (GTK_CONTAINER (plugin), eyes->eyes);

    xfce_panel_plugin_add_action_widget (plugin, eyes->eyes);
}
示例#5
0
/* create widgets and connect to signals */
static void
quicklauncher_construct (XfcePanelPlugin *plugin)
{
    t_quicklauncher *quicklauncher = quicklauncher_new(plugin);
    xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

    g_signal_connect (plugin, "orientation-changed",
                      G_CALLBACK (quicklauncher_orientation_changed), quicklauncher);

    g_signal_connect (plugin, "size-changed",
                      G_CALLBACK (quicklauncher_set_size), quicklauncher);

    g_signal_connect (plugin, "free-data",
                      G_CALLBACK (quicklauncher_free_data), quicklauncher);

    g_signal_connect (plugin, "save",
                      G_CALLBACK (quicklauncher_save), quicklauncher);

    xfce_panel_plugin_menu_show_configure (plugin);
    g_signal_connect (plugin, "configure-plugin",
                      G_CALLBACK (quicklauncher_configure), quicklauncher);

   xfce_panel_plugin_menu_show_about(plugin);
   g_signal_connect (plugin, "about",
                      G_CALLBACK (quicklauncher_about), quicklauncher);

}
static void 
clipman_construct (XfcePanelPlugin *plugin)
{
    ClipmanPlugin *clipman;

    xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
    
    clipman = clipman_new (plugin);
    
    gtk_container_add (GTK_CONTAINER (plugin), clipman->button);
    
    xfce_panel_plugin_add_action_widget (plugin, clipman->button);
    
    g_signal_connect (plugin, "free-data", 
        G_CALLBACK (clipman_free), clipman);
    
    g_signal_connect (plugin, "save", 
        G_CALLBACK (clipman_save), clipman);
    
    g_signal_connect (plugin, "size-changed",
        G_CALLBACK (clipman_set_size), clipman);
    
    xfce_panel_plugin_menu_show_configure (plugin);
    g_signal_connect (plugin, "configure-plugin", 
        G_CALLBACK (clipman_configure), clipman);
}
static fortune_fish_plugin *fortune_fish_plugin_new(XfcePanelPlugin *plugin) {
    fortune_fish_plugin *fish_plugin;

    /* Allocate memory for the plugin structure. */
    fish_plugin = (fortune_fish_plugin *)g_new0(fortune_fish_plugin, 1);

    /* Create new fish structure and initialize the panel animation. */
    fish_plugin->plugin = plugin;
    fish_plugin->fish = fortune_fish_new();
    fortune_fish_animation_init(fish_plugin->fish);

    /* Show settings in plugin menu. */
    xfce_panel_plugin_menu_show_configure(fish_plugin->plugin);
    g_signal_connect_swapped(fish_plugin->plugin, "configure-plugin",
            G_CALLBACK(fortune_fish_plugin_settings), fish_plugin);

    /* Connect notifications of orientation and size changes from the
     * XFCE panel. Needed for proper rendering of the animation image. */
    g_signal_connect_swapped(fish_plugin->plugin, "size-changed",
            G_CALLBACK(fortune_fish_plugin_adjust), fish_plugin);
    g_signal_connect_swapped(fish_plugin->plugin, "orientation-changed",
            G_CALLBACK(fortune_fish_plugin_adjust), fish_plugin);

    /* Free all plugin resources. */
    g_signal_connect_swapped(fish_plugin->plugin, "free-data",
            G_CALLBACK(fortune_fish_plugin_destroy), fish_plugin);

    return fish_plugin;
}
static void
screenshot_construct (XfcePanelPlugin * plugin)
{
    ScreenshotData *sd = g_new0 (ScreenshotData, 1);
   
    sd->plugin = plugin;

    screenshot_read_rc_file (plugin, sd);
    
    sd->button = xfce_create_panel_button ();
    
    sd->counter = 0;
    
    sd->tooltips = gtk_tooltips_new ();
    gtk_tooltips_set_tip (sd->tooltips, sd->button, _("Take screenshot"), NULL);
            
    sd->image = gtk_image_new ();
    gtk_container_add (GTK_CONTAINER (sd->button), GTK_WIDGET (sd->image));

    gtk_widget_show_all (sd->button);

    sd->chooser = gtk_file_chooser_dialog_new ( _("Save screenshot as ..."),
                                                NULL, 
                                                GTK_FILE_CHOOSER_ACTION_SAVE,
                                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                                GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
                                                NULL);

#if GTK_CHECK_VERSION(2,8,0)
    gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (sd->chooser), TRUE);
#endif
    gtk_dialog_set_default_response (GTK_DIALOG (sd->chooser), GTK_RESPONSE_ACCEPT);
    
    sd->preview = gtk_image_new ();
    gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (sd->chooser), sd->preview);
    
    gtk_container_add (GTK_CONTAINER (plugin), sd->button);
    xfce_panel_plugin_add_action_widget (plugin, sd->button);
    
    g_signal_connect (sd->button, "clicked", 
                      G_CALLBACK (button_clicked), sd);

    g_signal_connect (plugin, "free-data",
                      G_CALLBACK (screenshot_free_data), sd);

    g_signal_connect (plugin, "size-changed",
                      G_CALLBACK (screenshot_set_size), sd);

    sd->style_id = 
        g_signal_connect (plugin, "style-set",
                          G_CALLBACK (screenshot_style_set), sd);
    
    xfce_panel_plugin_menu_show_configure (plugin);
    g_signal_connect (plugin, "configure-plugin", 
                      G_CALLBACK (screenshot_properties_dialog), sd);
}
示例#9
0
static void windowck_construct(XfcePanelPlugin *plugin)
{
    WindowckPlugin *wckp;
    GtkWidget *refresh;

    /* setup transation domain */
    xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

    /* create the plugin */
    wckp = windowck_new(plugin);

    /* add the ebox to the panel */
    gtk_container_add(GTK_CONTAINER (plugin), wckp->ebox);

    /* show the panel's right-click menu on this ebox */
    xfce_panel_plugin_add_action_widget(plugin, wckp->ebox);

    // Set event handling (icon & title clicks)
    g_signal_connect(G_OBJECT (wckp->ebox), "button-press-event", G_CALLBACK (on_title_pressed), wckp);

    g_signal_connect(G_OBJECT (wckp->ebox), "button-release-event", G_CALLBACK (on_title_released), wckp);

    g_signal_connect(G_OBJECT (wckp->icon->eventbox), "button-release-event", G_CALLBACK (on_icon_released), wckp);

    /* connect plugin signals */

    g_signal_connect(G_OBJECT (plugin), "free-data", G_CALLBACK (windowck_free), wckp);

    g_signal_connect(G_OBJECT (plugin), "save", G_CALLBACK (windowck_save), wckp);

    g_signal_connect(G_OBJECT (plugin), "size-changed", G_CALLBACK (windowck_size_changed), wckp);

    g_signal_connect(G_OBJECT (plugin), "screen-position-changed", G_CALLBACK (windowck_screen_position_changed), wckp);

    g_signal_connect(G_OBJECT (plugin), "orientation-changed", G_CALLBACK (windowck_orientation_changed), wckp);

    /* show the configure menu item and connect signal */
    xfce_panel_plugin_menu_show_configure(plugin);
    g_signal_connect(G_OBJECT (plugin), "configure-plugin", G_CALLBACK (windowck_configure), wckp);

    /* show the about menu item and connect signal */
    xfce_panel_plugin_menu_show_about(plugin);
    g_signal_connect (G_OBJECT (plugin), "about",
                    G_CALLBACK (wck_about), "windowck-plugin");

    /* add custom menu items */
    refresh = show_refresh_item (plugin);
    g_signal_connect (G_OBJECT (refresh), "activate", G_CALLBACK (on_refresh_item_activated), wckp);

    /* start tracking title size */
    init_title(wckp);

    /* start tracking title text */
    wckp->win = g_slice_new0 (WckUtils);
    init_wnck(wckp->win, wckp->prefs->only_maximized, wckp);
}
示例#10
0
static void
xfce_xkb_construct (XfcePanelPlugin *plugin)
{
    GtkWidget *configure_layouts;
    GtkIconTheme *theme;
    GtkWidget *image;
    GdkPixbuf *pixbuf;

    t_xkb *xkb = xkb_new (plugin);

    xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

    xfce_panel_plugin_set_small (plugin, TRUE);

    g_signal_connect (plugin, "orientation-changed",
            G_CALLBACK (xfce_xkb_orientation_changed), xkb);

    g_signal_connect (plugin, "size-changed",
            G_CALLBACK (xfce_xkb_set_size), xkb);

    g_signal_connect (plugin, "free-data",
            G_CALLBACK (xfce_xkb_free_data), xkb);

    g_signal_connect (plugin, "save",
            G_CALLBACK (xfce_xkb_save_config), xkb);

    xfce_panel_plugin_menu_show_configure (plugin);
    g_signal_connect (plugin, "configure-plugin",
            G_CALLBACK (xfce_xkb_configure), xkb);

    xfce_panel_plugin_menu_show_about (plugin);
    g_signal_connect (plugin, "about",
            G_CALLBACK (xfce_xkb_about), xkb);

    configure_layouts =
        gtk_menu_item_new_with_label (_("Keyboard settings"));

    theme = gtk_icon_theme_get_for_screen (gdk_screen_get_default());
    pixbuf = gtk_icon_theme_load_icon (theme, "preferences-desktop-keyboard",
                                       GTK_ICON_SIZE_MENU, 0, NULL);
    if (pixbuf != NULL)
    {
        image = gtk_image_new ();
        gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (configure_layouts),
                                       image);
        g_object_unref (pixbuf);
    }

    gtk_widget_show (configure_layouts);
    xfce_panel_plugin_menu_insert_item (plugin,
                                        GTK_MENU_ITEM (configure_layouts));

    g_signal_connect (G_OBJECT (configure_layouts), "activate",
                      G_CALLBACK (xfce_xkb_configure_layout), NULL);
}
示例#11
0
文件: ui.c 项目: hdfssk/bubblemon
static void
bubblemon_construct (XfcePanelPlugin *plugin)
{
  Bubblemon *base;

  xfce_textdomain( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

  base = create_gui(plugin);
  xfce_panel_plugin_menu_show_configure(plugin);

  g_signal_connect(plugin, "free-data", G_CALLBACK(plugin_destroy), base);
  g_signal_connect(plugin, "configure-plugin", G_CALLBACK(display_about_dialog), base);
  g_signal_connect(plugin, "size-changed", G_CALLBACK(plugin_reconfigure), base);
  g_signal_connect(plugin, "orientation-changed", G_CALLBACK(update_orientation), base);
}
static void
power_manager_plugin_construct (XfcePanelPlugin *plugin)
{
    PowerManagerPlugin *power_manager_plugin;

    xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

    /* create the plugin */
    power_manager_plugin = power_manager_plugin_new (plugin);

    /* show the configure menu item and connect signal */
    xfce_panel_plugin_menu_show_configure (plugin);
    g_signal_connect (G_OBJECT (plugin), "configure-plugin",
                      G_CALLBACK (power_manager_plugin_configure), power_manager_plugin);

    /* add the ebox to the panel */
    gtk_container_add (GTK_CONTAINER (plugin), power_manager_plugin->ebox);
}
示例#13
0
static void
lightdash_construct (XfcePanelPlugin *plugin)
{
    LightdashPlugin *lightdash;

    xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

    lightdash = lightdash_new (plugin);



    /* set translation domain */
// xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");


    /* create initial window */
    lightdash->lightdash_window = lightdash_window_new (NULL, !opt_collapsed, lightdash);

    xfce_panel_plugin_add_action_widget (plugin, lightdash->button);

    xfce_panel_plugin_menu_show_configure (plugin);

    g_signal_connect (G_OBJECT (plugin), "free-data",
                      G_CALLBACK (lightdash_free), lightdash);

    g_signal_connect (G_OBJECT (plugin), "save",
                      G_CALLBACK (lightdash_save), lightdash);

    g_signal_connect (G_OBJECT (lightdash->button), "toggled",
                      G_CALLBACK (lightdash_button_clicked), lightdash);

    g_signal_connect (G_OBJECT (plugin), "size-changed",
                      G_CALLBACK (lightdash_size_changed), lightdash);

    g_signal_connect (G_OBJECT (lightdash->lightdash_window), "unmap",
                      G_CALLBACK (lightdash_window_unmap), lightdash);

    g_signal_connect (G_OBJECT (plugin), "configure-plugin",
                      G_CALLBACK (lightdash_configure), lightdash);

    g_signal_connect (G_OBJECT (plugin), "remote-event",
                      G_CALLBACK (lightdash_remote_event), lightdash);

}
示例#14
0
static void
sample_construct (XfcePanelPlugin *plugin)
{
  SamplePlugin *sample;

  /* setup transation domain */
  xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

  /* create the plugin */
  sample = sample_new (plugin);

  /* add the ebox to the panel */
  gtk_container_add (GTK_CONTAINER (plugin), sample->ebox);

  /* show the panel's right-click menu on this ebox */
  xfce_panel_plugin_add_action_widget (plugin, sample->ebox);

  /* connect plugin signals */
  g_signal_connect (G_OBJECT (plugin), "free-data",
                    G_CALLBACK (sample_free), sample);

  g_signal_connect (G_OBJECT (plugin), "save",
                    G_CALLBACK (sample_save), sample);

  g_signal_connect (G_OBJECT (plugin), "size-changed",
                    G_CALLBACK (sample_size_changed), sample);

  g_signal_connect (G_OBJECT (plugin), "orientation-changed",
                    G_CALLBACK (sample_orientation_changed), sample);

  /* show the configure menu item and connect signal */
  xfce_panel_plugin_menu_show_configure (plugin);
  g_signal_connect (G_OBJECT (plugin), "configure-plugin",
                    G_CALLBACK (sample_configure), sample);

  /* show the about menu item and connect signal */
  xfce_panel_plugin_menu_show_about (plugin);
  g_signal_connect (G_OBJECT (plugin), "about",
                    G_CALLBACK (sample_about), NULL);
}
示例#15
0
static void
xfce_constructor (XfcePanelPlugin *plugin)
{
	MultiloadPlugin *multiload = multiload_new();

	multiload->panel_data = plugin;
	multiload->panel_orientation = xfce_panel_plugin_get_orientation (plugin);
	gtk_container_add (GTK_CONTAINER (plugin), GTK_WIDGET(multiload->container));

	multiload_ui_read (multiload);
	multiload_start(multiload);


	/* show the panel's right-click menu on this ebox */
	xfce_panel_plugin_add_action_widget (plugin, GTK_WIDGET(multiload->container));


	/* plugin signals */
	g_signal_connect(G_OBJECT(plugin), "free-data",           G_CALLBACK (xfce_free_cb),                multiload);
	g_signal_connect(G_OBJECT(plugin), "save",                G_CALLBACK (xfce_save_cb),                multiload);
	g_signal_connect(G_OBJECT(plugin), "size-changed",        G_CALLBACK (xfce_size_changed_cb),        multiload);
	g_signal_connect(G_OBJECT(plugin), "orientation-changed", G_CALLBACK (xfce_orientation_changed_cb), multiload);

	/* menu items */
	GtkMenuItem *mi_separator = GTK_MENU_ITEM(gtk_separator_menu_item_new ());
	GtkMenuItem *mi_help = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic (_("_Help")));
	GtkMenuItem *mi_sysmon = GTK_MENU_ITEM(gtk_menu_item_new_with_label(_("Start task manager")));
	xfce_panel_plugin_menu_show_configure (plugin);
	xfce_panel_plugin_menu_show_about (plugin);
	xfce_panel_plugin_menu_insert_item (plugin, mi_separator);
	xfce_panel_plugin_menu_insert_item (plugin, mi_help);
	xfce_panel_plugin_menu_insert_item (plugin, mi_sysmon);
	g_signal_connect (G_OBJECT (plugin), "configure-plugin",	G_CALLBACK (xfce_configure_cb), multiload);
	g_signal_connect (G_OBJECT (plugin), "about",				G_CALLBACK (xfce_about_cb), NULL);
	g_signal_connect (G_OBJECT (mi_help), "activate",			G_CALLBACK (xfce_help_cb), NULL);
	g_signal_connect (G_OBJECT (mi_sysmon), "activate",			G_CALLBACK (xfce_sysmon_cb), multiload);
	gtk_widget_show(GTK_WIDGET(mi_separator));
	gtk_widget_show(GTK_WIDGET(mi_help));
	gtk_widget_show(GTK_WIDGET(mi_sysmon));
}
示例#16
0
PlacesCfg*
places_cfg_new(XfcePanelPlugin *plugin)
{
    PlacesCfg     *cfg;
    XfconfChannel *channel;
    gchar         *property;

    cfg             = g_object_new (XFCE_TYPE_PLACES_CFG, NULL);
    cfg->plugin     = plugin;

    xfconf_init(NULL);
    channel = xfconf_channel_get ("xfce4-panel");

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-button-type", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_INT, cfg, "show-button-type");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/button-label", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "button-label");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-icons", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-icons");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-volumes", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-volumes");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/mount-open-volumes", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "mount-open-volumes");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-bookmarks", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-bookmarks");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/server-connect-cmd", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "server-connect-cmd");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/network-cmd", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "network-cmd");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-recent", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-recent");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-recent-clear", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-recent-clear");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-recent-number", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_INT, cfg, "show-recent-number");
    g_free (property);

    property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/search-cmd", NULL);
    xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "search-cmd");
    g_free (property);

    g_signal_connect_swapped(G_OBJECT(plugin), "configure-plugin",
                             G_CALLBACK(places_cfg_open_dialog), cfg);

    xfce_panel_plugin_menu_show_configure(plugin);

    return cfg;
}
static void
time_out_construct (XfcePanelPlugin *plugin)
{
  TimeOutPlugin *time_out;
  GtkWidget     *menu_item;

  /* Setup translation domain */
  xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");

  /* Create the plugin */
  time_out = time_out_new (plugin);

  /* Load the settings */
  time_out_load_settings (time_out);

  /* Hide the time label if settings says so */
  if (!time_out->display_time)
    gtk_widget_hide (time_out->time_label);

  /* Add the event box to the panel */
  gtk_container_add (GTK_CONTAINER (plugin), time_out->ebox);

  /* Create menu item for taking an instant break */
  menu_item = gtk_menu_item_new_with_label (_("Take a break"));
  xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (menu_item));
  gtk_widget_show (GTK_WIDGET (menu_item));

  /* Connect to the menu item to react on break requests */
  g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (time_out_take_break), time_out);

  /* Create menu item for resetting the timer */
  menu_item = gtk_menu_item_new_with_label (_("Reset timer"));
  xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (menu_item));
  gtk_widget_show (GTK_WIDGET (menu_item));

  /* Connect to the menu item to react on reset requests */
  g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (time_out_reset_timer), time_out);

  /* Create menu item for enabling/disabling the countdown */
  menu_item = gtk_check_menu_item_new_with_label (_("Enabled"));
  xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (menu_item));
  gtk_widget_show (GTK_WIDGET (menu_item));

  /* Connect to the check menu item to react on toggle events */
  g_signal_connect (G_OBJECT (menu_item), "toggled", G_CALLBACK (time_out_enabled_toggled), time_out);

  /* Set enabled state according to the settings */
  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), time_out->enabled);

  /* Connect plugin signals */
  g_signal_connect (G_OBJECT (plugin), "free-data", G_CALLBACK (time_out_free), time_out);
  g_signal_connect (G_OBJECT (plugin), "size-changed", G_CALLBACK (time_out_size_changed), time_out);
  g_signal_connect (G_OBJECT (plugin), "configure-plugin", G_CALLBACK (time_out_configure), time_out);
  g_signal_connect (G_OBJECT (plugin), "orientation-changed", G_CALLBACK (time_out_orientation_changed), time_out);
  g_signal_connect (G_OBJECT (plugin), "about", G_CALLBACK (time_out_about), NULL);

  /* Display the configure menu item */
  xfce_panel_plugin_menu_show_configure (plugin);

  /* Display the about menu item */
  xfce_panel_plugin_menu_show_about (plugin);

  /* Start break countdown if the plugin is active */
  if (G_LIKELY (time_out->enabled)) 
    time_out_start_break_countdown (time_out, time_out->break_countdown_seconds);
}
static void planetload_applet_start(XfcePanelPlugin *plugin)
{
    struct app_t *app;
    GtkWidget *vbox;
    
    xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, NULL);
    
    app = g_new(struct app_t, 1);
    memset(app, 0, sizeof *app);
    
    app->use_planet = TRUE;
    
    app->applet = plugin;
    
    g_signal_connect(plugin, "free-data", G_CALLBACK(destroy_cb), app);
    g_signal_connect(plugin, "save", G_CALLBACK(save_config_cb), app);
    g_signal_connect(plugin, "size-changed", G_CALLBACK(change_size_cb), app);
    g_signal_connect(plugin, "orientation-changed", G_CALLBACK(change_orient_cb), app);
    g_signal_connect(plugin, "configure-plugin", G_CALLBACK(preferences), app);
    g_signal_connect(plugin, "about", G_CALLBACK(about), app);
    
    app->is_vert = get_applet_vert(plugin);
    
    app->tooltips = gtk_tooltips_new();
    
    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(plugin), vbox);
    xfce_panel_plugin_add_action_widget(plugin, vbox);
    
    if (!app->is_vert)
	app->pack = gtk_hbox_new(FALSE, 0);
    else
	app->pack = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), app->pack, TRUE, TRUE, 0);
    
    if (!appconf_load(app)) {
	appconf_init(app);
	appconf_save(app);
    }
    
    xfce_panel_plugin_menu_show_configure(plugin);
    xfce_panel_plugin_menu_show_about(plugin);
    setup_schemes_menu(app);
    
    app->scheme_label_bar = gtk_event_box_new();
    gtk_box_pack_end(GTK_BOX(vbox), app->scheme_label_bar, FALSE, FALSE, 0);
    g_signal_connect(G_OBJECT(app->scheme_label_bar), "button-press-event",
	    G_CALLBACK(lmenu_popup), app);
    
    {
	gchar buf[128];
	app->scheme_label_text = gtk_label_new(scheme_get_current(app, buf));
	gtk_container_add(GTK_CONTAINER(app->scheme_label_bar), app->scheme_label_text);
    }
    
    {
	PangoFontDescription *pfd;
	pfd = pango_font_description_from_string(app->fontname);
	gtk_widget_modify_font(app->scheme_label_text, pfd);
	pango_font_description_free(pfd);
    }
    
    gtk_widget_show_all(GTK_WIDGET(vbox));
    
    disp_scheme_onoff(app);
    
    timer_set(app);
}
Plugin::Plugin(XfcePanelPlugin *xfce_plugin_)
  : xfce_plugin(xfce_plugin_),

  // Setting defaults
  icon_path("/usr/share/pixmaps/xfce4-hardware-monitor-plugin.png"),
  viewer_type("curve"),
  viewer_font(""),
  viewer_size(96),  // Arbitrary default, see later in this function for notes
  background_color(0x000000FF),  // Black as the night - note that the
                                 // transparency bits need to be set to max to
                                 // ensure the colour is visible
  use_background_color(false),
  next_color(0),
  viewer_text_overlay_enabled(false),
  viewer_text_overlay_format_string("%a %m"),
  viewer_text_overlay_separator(" "),
  viewer_text_overlay_font(""),
  viewer_text_overlay_use_font(false),
  viewer_text_overlay_color(0x000000FF),
  viewer_text_overlay_position(CanvasView::top_left),
  viewer_monitor_type_sync_enabled(true)
{
  // Search for settings file
  XfceRc* settings_ro = NULL;
  gchar* file = xfce_panel_plugin_lookup_rc_file(xfce_plugin);
  
  if (file)
  {
    // One exists - loading settings
    settings_ro = xfce_rc_simple_open(file, true);
    g_free(file);

    // Ensuring default group is in focus
    xfce_rc_set_group(settings_ro, NULL);

    icon_path = xfce_rc_read_entry(settings_ro, "icon-path", icon_path.c_str());
    viewer_type = xfce_rc_read_entry(settings_ro, "viewer_type",
      viewer_type.c_str());
    viewer_size = xfce_rc_read_int_entry(settings_ro, "viewer_size",
      viewer_size);
    viewer_font = xfce_rc_read_entry(settings_ro, "viewer_font",
      viewer_font.c_str());
    background_color = xfce_rc_read_int_entry(settings_ro, "background_color",
      background_color);
    use_background_color = xfce_rc_read_bool_entry(settings_ro,
      "use_background_color", use_background_color);
    next_color = xfce_rc_read_int_entry(settings_ro, "next_color",
      next_color);
    viewer_text_overlay_enabled = xfce_rc_read_bool_entry(settings_ro,
      "viewer_text_overlay_enabled", viewer_text_overlay_enabled);
    viewer_text_overlay_format_string = xfce_rc_read_entry(settings_ro,
      "viewer_text_overlay_format_string",
      viewer_text_overlay_format_string.c_str());
    viewer_text_overlay_separator = xfce_rc_read_entry(settings_ro,
      "viewer_text_overlay_separator", viewer_text_overlay_separator.c_str());
    viewer_text_overlay_font = xfce_rc_read_entry(settings_ro,
      "viewer_text_overlay_font", viewer_text_overlay_font.c_str());
    viewer_text_overlay_color = xfce_rc_read_int_entry(settings_ro,
      "viewer_text_overlay_color", viewer_text_overlay_color);
    viewer_monitor_type_sync_enabled = xfce_rc_read_bool_entry(settings_ro,
      "viewer_monitor_type_sync_enabled", viewer_monitor_type_sync_enabled);

    // Enum is validated in set_viewer_text_overlay_position
    CanvasView::TextOverlayPosition text_overlay_position =
        static_cast<CanvasView::TextOverlayPosition>(
          xfce_rc_read_int_entry(settings_ro, "viewer_text_overlay_position",
                                 CanvasView::top_left));
    set_viewer_text_overlay_position(text_overlay_position);
  }
  
  // Loading icon
  try
  {
    icon = Gdk::Pixbuf::create_from_file(icon_path);
  }
  catch (...)
  {
    std::cerr <<
      String::ucompose(_("Hardware Monitor: cannot load the icon '%1'.\n"),
          icon_path);

    // It's a minor problem if we can't find the icon
    icon = Glib::RefPtr<Gdk::Pixbuf>();
  }

  // Configuring viewer type
  viewer_type_listener(viewer_type);

  /* Actually setting the viewer size has no effect in this function -
   * seems that it needs to be done in or after the mainloop kicks off */

  // Loading up monitors
  /* Plugin& is initialised from non-transient address of this ('this' itself
   * is an rvalue so not allowed for a reference) */
  monitor_seq mon = load_monitors(settings_ro, *this);
  for (monitor_iter i = mon.begin(), end = mon.end(); i != end; ++i)
    add_monitor(*i);

  // All settings loaded
  if (settings_ro)
    xfce_rc_close(settings_ro);

  /* Connect plugin signals to functions - since I'm not really interested
   * in the plugin but the plugin pointer, swapped results in the signal
   * handler getting the plugin reference first - the plugin pointer is
   * passed next, but since the handler only takes one parameter this is
   * discarded
   * Providing About option */
  g_signal_connect_swapped(xfce_plugin, "about", G_CALLBACK(display_about),
    this);

  // Hooking into Properties option
  g_signal_connect_swapped(xfce_plugin, "configure-plugin",
    G_CALLBACK(display_preferences), this);

  // Hooking into plugin destruction signal
  g_signal_connect_swapped(xfce_plugin, "free-data", G_CALLBACK(plugin_free),
    this);

  // Hooking into save signal
  g_signal_connect_swapped(xfce_plugin, "save", G_CALLBACK(save_monitors),
    this);

  /* Not needed as the canvas resizes on the fly
  // Hooking into size changed signal
  g_signal_connect(xfce_plugin, "size-changed", G_CALLBACK(size_changed),
    this);
  */

  // Adding configure and about to the plugin's right-click menu
  xfce_panel_plugin_menu_show_configure(xfce_plugin);
  xfce_panel_plugin_menu_show_about(xfce_plugin);

  /* Add plugin to panel - I need to turn the Plugin (which inherits from
   * Gtk::EventBox) into a GtkWidget* - to do this I get at the GObject
   * pointer underneath the gtkmm layer */
  gtk_container_add(GTK_CONTAINER(xfce_plugin), GTK_WIDGET(this->gobj()));

  // Initialising timer to run every second (by default) to trigger main_loop
  timer =
    Glib::signal_timeout().connect(sigc::mem_fun(*this, &Plugin::main_loop),
      update_interval);

  // Initial main_loop run
  main_loop();
}