C++ (Cpp) _ Examples

C++ (Cpp) _ - 30 examples found. These are the top rated real world C++ (Cpp) examples of _ extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
/* Print an option OPT nicely into a STRING allocated in POOL.
 * If OPT has a single-character short form, then print OPT->name (if not
 * NULL) as an alias, else print LONG_ALIAS (if not NULL) as an alias.
 * If DOC is set, include the generic documentation string of OPT,
 * localized to the current locale if a translation is available.
 */
static void
format_option(const char **string,
              const apr_getopt_option_t *opt,
              const char *long_alias,
              svn_boolean_t doc,
              apr_pool_t *pool)
{
    char *opts;

    if (opt == NULL)
    {
        *string = "?";
        return;
    }

    /* We have a valid option which may or may not have a "short
       name" (a single-character alias for the long option). */
    if (opt->optch <= 255)
        opts = apr_psprintf(pool, "-%c [--%s]", opt->optch, opt->name);
    else if (long_alias)
        opts = apr_psprintf(pool, "--%s [--%s]", opt->name, long_alias);
    else
        opts = apr_psprintf(pool, "--%s", opt->name);

    if (opt->has_arg)
        opts = apr_pstrcat(pool, opts, _(" ARG"), (char *)NULL);

    if (doc)
        opts = apr_psprintf(pool, "%-24s : %s", opts, _(opt->description));

    *string = opts;
}
static void
brasero_medium_selection_update_no_disc_entry (BraseroMediumSelection *self,
        GtkTreeModel *model,
        GtkTreeIter *iter)
{
    BraseroMediumMonitor *monitor;
    GIcon *icon;

    monitor = brasero_medium_monitor_get_default ();
    if (brasero_medium_monitor_is_probing (monitor)) {
        icon = g_themed_icon_new_with_default_fallbacks ("image-loading");
        gtk_list_store_set (GTK_LIST_STORE (model), iter,
                            NAME_COL, _("Searching for available discs"),
                            ICON_COL, icon,
                            VISIBLE_TEXT_COL, TRUE,
                            VISIBLE_PROGRESS_COL, FALSE,
                            -1);
    }
    else {
        icon = g_themed_icon_new_with_default_fallbacks ("drive-optical");
        gtk_list_store_set (GTK_LIST_STORE (model), iter,
                            NAME_COL, _("No disc available"),
                            ICON_COL, icon,
                            VISIBLE_TEXT_COL, TRUE,
                            VISIBLE_PROGRESS_COL, FALSE,
                            -1);
    }

    g_object_unref (icon);
    g_object_unref (monitor);

    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self), iter);
    brasero_medium_selection_set_current_medium (self, iter);
}
Example #3
0
static gboolean
unmount_notify_timer_cb (gpointer user_data)
{
    UnmountNotifyData *data = user_data;
    gchar *message, *name;

    data->unmount_timer_id = 0;

    if (data->unmount_fired)
        goto out;

    /* TODO: it would be nice to include and update the time left and
     * bytes left fields.
     */
    data->unmount_fired = TRUE;

    name = unmount_notify_get_name (data);
    if (data->generic_text)
        message = g_strdup_printf (_("Unmounting %s\nPlease wait"), name);
    else
        message = g_strdup_printf (_("Writing data to %s\nDon't unplug until finished"), name);

    g_signal_emit_by_name (data->op, "show-unmount-progress",
                           message, -1, -1);
    g_free (message);
    g_free (name);

out:
    return FALSE;
}
Example #4
0
static int swap_rewrite_signature(const char *devname, unsigned int pagesize)
{
    int fd, rc = -1;

    fd = open(devname, O_WRONLY);
    if (fd == -1) {
        warn(_("%s: open failed"), devname);
        return -1;
    }

    if (lseek(fd, pagesize - SWAP_SIGNATURE_SZ, SEEK_SET) < 0) {
        warn(_("%s: lseek failed"), devname);
        goto err;
    }

    if (write(fd, (void *) SWAP_SIGNATURE,
              SWAP_SIGNATURE_SZ) != SWAP_SIGNATURE_SZ) {
        warn(_("%s: write signature failed"), devname);
        goto err;
    }

    rc  = 0;
err:
    close(fd);
    return rc;
}
Example #5
0
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
    fputs(USAGE_HEADER, out);

    fprintf(out, _(" %s [options] [<spec>]\n"), program_invocation_short_name);

    fputs(USAGE_OPTIONS, out);
    fputs(_(" -a, --all              enable all swaps from /etc/fstab\n"
            " -d, --discard          discard freed pages before they are reused\n"
            " -e, --ifexists         silently skip devices that do not exis\n"
            " -f, --fixpgsz          reinitialize the swap space if necessary\n"
            " -p, --priority <prio>  specify the priority of the swap device\n"
            " -s, --summary          display summary about used swap devices and exit\n"
            " -v, --verbose          verbose mode\n"), out);

    fputs(USAGE_SEPARATOR, out);
    fputs(USAGE_HELP, out);
    fputs(USAGE_VERSION, out);

    fputs(_("\nThe <spec> parameter:\n" \
            " -L <label>             synonym for LABEL=<label>\n"
            " -U <uuid>              synonym for UUID=<uuid>\n"
            " LABEL=<label>          specifies device by swap area label\n"
            " UUID=<uuid>            specifies device by swap area UUID\n"
            " PARTLABEL=<label>      specifies device by partition label\n"
            " PARTUUID=<uuid>        specifies device by partition UUID\n"
            " <device>               name of device to be used\n"
            " <file>                 name of file to be used\n"), out);

    fprintf(out, USAGE_MAN_TAIL("swapon(8)"));
    exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
Example #6
0
gboolean
gdip_save_pixbuf (GdkPixbuf *pixbuf,
                  const WCHAR *format,
                  const EncoderParameters *encoder_params,
                  GdkPixbufSaveFunc save_func,
                  gpointer user_data,
                  GError **error)
{
    GpBitmap *image;
    CLSID clsid;
    gboolean success;

    if (!GetEncoderClsid (format, &clsid)) {
        g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Unsupported image format for GDI+"));
        return FALSE;
    }

    image = gdip_pixbuf_to_bitmap (pixbuf);

    if (image == NULL) {
        g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Couldn't save"));
        return FALSE;
    }

    success = gdip_save_bitmap_to_callback (image, &clsid, encoder_params, save_func, user_data, error);

    GdipDisposeImage ((GpImage *)image);

    return success;
}