示例#1
0
/**
 * g_paste_applet_footer_new:
 * @client: a #GPasteClient instance
 * @app: (nullable): the #GApplication to quit
 *
 * Create a new instance of #GPasteAppletFooter
 *
 * Returns: a newly allocated #GPasteAppletFooter
 *          free it with g_object_unref
 */
G_PASTE_VISIBLE GPasteAppletFooter *
g_paste_applet_footer_new (GPasteClient *client,
                           GApplication *app)
{
    g_return_val_if_fail (G_PASTE_IS_CLIENT (client), NULL);
    g_return_val_if_fail ((!app || G_IS_APPLICATION (app)), NULL);

    GPasteAppletFooter *self = g_object_new (G_PASTE_TYPE_APPLET_FOOTER, NULL);
    GPasteAppletFooterPrivate *priv = g_paste_applet_footer_get_instance_private (self);

    priv->empty = g_paste_applet_empty_new (client);
    priv->about = g_paste_applet_about_new (client);
    if (app)
        priv->quit = g_paste_applet_quit_new (app);

    return self;
}
示例#2
0
/**
 * g_paste_ui_header_new:
 * @topwin: the main #GtkWindow
 * @client: a #GPasteClient instance
 *
 * Create a new instance of #GPasteUiHeader
 *
 * Returns: a newly allocated #GPasteUiHeader
 *          free it with g_object_unref
 */
G_PASTE_VISIBLE GtkWidget *
g_paste_ui_header_new (GtkWindow    *topwin,
                       GPasteClient *client)
{
    g_return_val_if_fail (GTK_IS_WINDOW (topwin), NULL);
    g_return_val_if_fail (G_PASTE_IS_CLIENT (client), NULL);

    GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_UI_HEADER, NULL);
    GtkHeaderBar *bar = GTK_HEADER_BAR (self);

    gtk_header_bar_pack_start (bar, g_paste_ui_switch_new (topwin, client));

    gtk_header_bar_pack_end (bar, g_paste_ui_about_new (gtk_window_get_application (topwin)));
    gtk_header_bar_pack_end (bar, g_paste_ui_empty_new (topwin, client));

    return self;
}