static void
cc_sharing_panel_constructed (GObject *object)
{
  CcSharingPanelPrivate *priv = CC_SHARING_PANEL (object)->priv;

  G_OBJECT_CLASS (cc_sharing_panel_parent_class)->constructed (object);

  /* add the master switch */
  cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
                                   gtk_widget_get_parent (priv->master_switch));
}
static void
cc_bluetooth_panel_constructed (GObject *object)
{
	CcBluetoothPanel *self = CC_BLUETOOTH_PANEL (object);

	G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->constructed (object);

	/* add kill switch widgets  */
	self->priv->kill_switch_header = g_object_ref (WID ("box_power"));
	cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (self)),
					 self->priv->kill_switch_header);
	gtk_widget_show_all (self->priv->kill_switch_header);
}
static void
cc_mouse_panel_constructed (GObject *object)
{
  CcMousePanel *self = CC_MOUSE_PANEL (object);
  CcMousePanelPrivate *priv = self->priv;
  GtkWidget *button, *container, *toplevel, *label;
  CcShell *shell;

  G_OBJECT_CLASS (cc_mouse_panel_parent_class)->constructed (object);

  /* Add test area button to shell header. */
  shell = cc_panel_get_shell (CC_PANEL (self));

  label = gtk_label_new_with_mnemonic (_("Test Your _Settings"));
  gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
  gtk_widget_show (label);

  button = gtk_button_new ();
  gtk_container_add (GTK_CONTAINER (button), label);
  gtk_style_context_add_class (gtk_widget_get_style_context (button),
                               "text-button");
  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
  gtk_widget_set_visible (button, TRUE);

  cc_shell_embed_widget_in_header (shell, button);

  g_signal_connect (GTK_BUTTON (button), "clicked",
                    G_CALLBACK (shell_test_button_clicked),
                    self);

  toplevel = cc_shell_get_toplevel (shell);
  priv->test_dialog = g_object_new (GTK_TYPE_DIALOG, "title", _("Test Your Settings"),
                                                     "transient-for", GTK_WINDOW (toplevel),
                                                     "modal", TRUE,
                                                     "use_header-bar", TRUE,
                                                     "resizable", FALSE,
                                                     NULL);

  container = gtk_dialog_get_content_area (GTK_DIALOG (priv->test_dialog));
  gtk_container_add (GTK_CONTAINER (container), priv->test_widget);
}
/* Add test area toggle to shell header. */
static gboolean
add_shell_test_button_cb (gpointer user_data)
{
    CcMousePanel *panel = CC_MOUSE_PANEL (user_data);
    GtkWidget *box, *button;

    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);

    button = gtk_toggle_button_new_with_mnemonic (_("_Test Your Settings"));
    gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
    gtk_widget_set_visible (button, TRUE);

    cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (panel)), box);
    gtk_widget_set_visible (box, TRUE);

    panel->priv->shell_header = g_object_ref (box);

    g_signal_connect (GTK_BUTTON (button), "toggled",
                      G_CALLBACK (shell_test_button_toggle_event),
                      panel);

    return FALSE;
}