• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PWARN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PWARN函数的典型用法代码示例。如果您正苦于以下问题:C++ PWARN函数的具体用法?C++ PWARN怎么用?C++ PWARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PWARN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: qof_book_get_default_gains_policy

/** Returns pointer to default gain/loss policy for book, if one exists in the
  * KVP, or NULL; does not validate contents nor determine if there is a valid
  * book-currency, both of which are required, for the 'book-currency'
  * currency accounting method to apply. Use instead
  * 'gnc_book_get_default_gains_policy' which does these validations. */
const gchar *
qof_book_get_default_gains_policy (QofBook *book)
{
    KvpFrame *kvp;
    KvpValue *value;

    if (!book)
    {
        PWARN ("No book!!!");
        return NULL;
    }

    /* Get the KVP from the current book */
    kvp = qof_instance_get_slots (QOF_INSTANCE (book));

    if (!kvp)
    {
        PWARN ("Book has no KVP_Frame");
        return NULL;
    }

    /* See if there is a default gain/loss policy */
    value = kvp->get_slot({KVP_OPTION_PATH, OPTION_SECTION_ACCOUNTS,
                           OPTION_NAME_DEFAULT_GAINS_POLICY});
    if (!value)
    /* No default gain/loss policy, therefore not valid book-currency
       accounting method */
        return nullptr;

    return g_strdup(value->get<const char*>());
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:36,代码来源:qofbook.cpp


示例2: xaccScrubMergeSubSplits

gboolean
xaccScrubMergeSubSplits (Split *split, gboolean strict)
{
    gboolean rc = FALSE;
    Transaction *txn;
    SplitList *node;
    GNCLot *lot;

    if (strict && (FALSE == is_subsplit (split))) return FALSE;

    txn = split->parent;

    // Don't mess with splits from an invoice transaction
    // Those are the responsibility of the business code
    if (gncInvoiceGetInvoiceFromTxn (txn)) return FALSE;

    lot = xaccSplitGetLot (split);

    ENTER ("(Lot=%s)", gnc_lot_get_title(lot));
restart:
    for (node = txn->splits; node; node = node->next)
    {
        Split *s = node->data;
        if (xaccSplitGetLot (s) != lot) continue;
        if (s == split) continue;
        if (qof_instance_get_destroying(s)) continue;

        // Don't mess with splits from an invoice transaction
        // Those are the responsibility of the business code
        if (gncInvoiceGetInvoiceFromTxn (s->parent)) return FALSE;

        if (strict)
        {
            /* OK, this split is in the same lot (and thus same account)
             * as the indicated split.  Make sure it is really a subsplit
             * of the split we started with.  It's possible to have two
             * splits in the same lot and transaction that are not subsplits
             * of each other, the test-period test suite does this, for
             * example.  Only worry about adjacent sub-splits.  By
             * repeatedly merging adjacent subsplits, we'll get the non-
             * adjacent ones too. */
            if (!xaccSplitIsPeerSplit (split, s))
                continue;
        }

        merge_splits (split, s);
        rc = TRUE;
        goto restart;
    }
    if (rc && gnc_numeric_zero_p (split->amount))
    {
        time64 pdate = xaccTransGetDate (txn);
        gchar *pdatestr = gnc_ctime (&pdate);
        PWARN ("Result of merge has zero amt!");
        PWARN ("Transaction details - posted date %s - description %s", pdatestr, xaccTransGetDescription(txn));
        g_free (pdatestr);
    }
    LEAVE (" splits merged=%d", rc);
    return rc;
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:60,代码来源:Scrub2.c


示例3: gncTaxTableEntryEqual

gboolean gncTaxTableEntryEqual(const GncTaxTableEntry *a, const GncTaxTableEntry *b)
{
    if (a == NULL && b == NULL) return TRUE;
    if (a == NULL || b == NULL) return FALSE;

    if (!xaccAccountEqual(a->account, b->account, TRUE))
    {
        PWARN("accounts differ");
        return FALSE;
    }

    if (a->type != b->type)
    {
        PWARN("types differ");
        return FALSE;
    }

    if (!gnc_numeric_equal(a->amount, b->amount))
    {
        PWARN("amounts differ");
        return FALSE;
    }

    return TRUE;
}
开发者ID:mlq,项目名称:gnucash,代码行数:25,代码来源:gncTaxTable.c


示例4: gnc_timespec_to_iso8601_buff

char *
gnc_timespec_to_iso8601_buff (Timespec ts, char * buff)
{
    constexpr size_t max_iso_date_length = 32;
    const char* format = "%Y-%m-%d %H:%M:%s %q";

    if (! buff) return NULL;
    try
    {
        GncDateTime gncdt(ts.tv_sec);
        auto sstr = gncdt.format(format);

        memset(buff, 0, sstr.length() + 1);
        strncpy(buff, sstr.c_str(), sstr.length());
        return buff + sstr.length();
    }
    catch(std::logic_error& err)
    {
        PWARN("Error processing time64 %" PRId64 ": %s", ts.tv_sec, err.what());
        return buff;
    }
    catch(std::runtime_error& err)
    {
        PWARN("Error processing time64 %" PRId64 ": %s", ts.tv_sec, err.what());
        return buff;
    }
}
开发者ID:jralls,项目名称:gnucash,代码行数:27,代码来源:gnc-date.cpp


示例5: qof_book_get_counter

gint64
qof_book_get_counter (QofBook *book, const char *counter_name)
{
    QofBackend *be;
    KvpFrame *kvp;
    KvpValue *value;
    gint64 counter;

    if (!book)
    {
        PWARN ("No book!!!");
        return -1;
    }

    if (!counter_name || *counter_name == '\0')
    {
        PWARN ("Invalid counter name.");
        return -1;
    }

    /* If we've got a backend with a counter method, call it */
    be = book->backend;
    if (be && be->counter)
        return ((be->counter)(be, counter_name));

    /* If not, then use the KVP in the book */
    kvp = qof_book_get_slots (book);

    if (!kvp)
    {
        PWARN ("Book has no KVP_Frame");
        return -1;
    }

    value = kvp_frame_get_slot_path (kvp, "counters", counter_name, NULL);
    if (value)
    {
        /* found it */
        counter = kvp_value_get_gint64 (value);
    }
    else
    {
        /* New counter */
        counter = 0;
    }

    /* Counter is now valid; increment it */
    counter++;

    /* Save off the new counter */
    qof_book_begin_edit(book);
    value = kvp_value_new_gint64 (counter);
    kvp_frame_set_slot_path (kvp, value, "counters", counter_name, NULL);
    kvp_value_delete (value);
    qof_book_mark_dirty(book);
    qof_book_commit_edit(book);

    /* and return the value */
    return counter;
}
开发者ID:nizarklai,项目名称:gnucash-1,代码行数:60,代码来源:qofbook.c


示例6: qof_book_get_book_currency

/** Returns pointer to book-currency name for book, if one exists in the
  * KVP, or NULL; does not validate contents nor determine if there is a valid
  * default gain/loss policy, both of which are required, for the
  * 'book-currency' currency accounting method to apply. Use instead
  * 'gnc_book_get_book_currency' which does these validations. */
const gchar *
qof_book_get_book_currency (QofBook *book)
{
    KvpFrame *kvp;
    KvpValue *value;

    if (!book)
    {
        PWARN ("No book!!!");
        return NULL;
    }

    /* Get the KVP from the current book */
    kvp = qof_instance_get_slots (QOF_INSTANCE (book));

    if (!kvp)
    {
        PWARN ("Book has no KVP_Frame");
        return NULL;
    }

    /* See if there is a book currency. */
    value = kvp->get_slot({KVP_OPTION_PATH, OPTION_SECTION_ACCOUNTS,
                           OPTION_NAME_BOOK_CURRENCY});
    if (!value) /* No book-currency */
        return nullptr;

    return value->get<const char*>();
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:34,代码来源:qofbook.cpp


示例7: xaccQueryAddAccountMatch

void
xaccQueryAddAccountMatch(QofQuery *q, AccountList *acct_list,
                         QofGuidMatch how, QofQueryOp op)
{
    GList *list = NULL;

    if (!q) return;
    for (; acct_list; acct_list = acct_list->next)
    {
        Account *acc = acct_list->data;
        const GncGUID *guid;

        if (!acc)
        {
            PWARN ("acct_list has NULL account");
            continue;
        }

        guid = qof_entity_get_guid (QOF_INSTANCE(acc));
        if (!guid)
        {
            PWARN ("acct returns NULL GncGUID");
            continue;
        }

        list = g_list_prepend (list, (gpointer)guid);
    }
    xaccQueryAddAccountGUIDMatch (q, list, how, op);
    g_list_free (list);
}
开发者ID:fraga,项目名称:gnucash,代码行数:30,代码来源:Query.c


示例8: tea5764_i2c_probe

/* I2C probe: check if the device exists and register with v4l if it is */
static int __devinit tea5764_i2c_probe(struct i2c_client *client,
					const struct i2c_device_id *id)
{
	struct tea5764_device *radio;
	struct tea5764_regs *r;
	int ret;

	PDEBUG("probe");
	radio = kmalloc(sizeof(struct tea5764_device), GFP_KERNEL);
	if (!radio)
		return -ENOMEM;

	mutex_init(&radio->mutex);
	radio->i2c_client = client;
	ret = tea5764_i2c_read(radio);
	if (ret)
		goto errfr;
	r = &radio->regs;
	PDEBUG("chipid = %04X, manid = %04X", r->chipid, r->manid);
	if (r->chipid != TEA5764_CHIPID ||
		(r->manid & 0x0fff) != TEA5764_MANID) {
		PWARN("This chip is not a TEA5764!");
		ret = -EINVAL;
		goto errfr;
	}

	radio->videodev = video_device_alloc();
	if (!(radio->videodev)) {
		ret = -ENOMEM;
		goto errfr;
	}
	memcpy(radio->videodev, &tea5764_radio_template,
		sizeof(tea5764_radio_template));

	i2c_set_clientdata(client, radio);
	video_set_drvdata(radio->videodev, radio);

	ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr);
	if (ret < 0) {
		PWARN("Could not register video device!");
		goto errrel;
	}

	/* initialize and power off the chip */
	tea5764_i2c_read(radio);
	tea5764_set_audout_mode(radio, V4L2_TUNER_MODE_STEREO);
	tea5764_mute(radio, 1);
	tea5764_power_down(radio);

	PINFO("registered.");
	return 0;
errrel:
	video_device_release(radio->videodev);
errfr:
	kfree(radio);
	return ret;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:58,代码来源:radio-tea5764.c


示例9: gnc_keyring_set_password

void gnc_keyring_set_password (const gchar *access_method,
                               const gchar *server,
                               guint32 port,
                               const gchar *service,
                               const gchar *user,
                               const gchar* password)
{

#ifdef HAVE_GNOME_KEYRING
    GnomeKeyringResult  gkr_result;
    guint32 item_id = 0;

    gkr_result = gnome_keyring_set_network_password_sync
                 (NULL, user, NULL, server, service,
                  access_method, NULL, port, password, &item_id);

    if (gkr_result != GNOME_KEYRING_RESULT_OK)
    {
        PWARN ("Gnome-keyring error: %s",
               gnome_keyring_result_to_message(gkr_result));
        PWARN ("The user will be prompted for a password again next time.");
    }
#endif /* HAVE_GNOME_KEYRING */
#ifdef HAVE_OSX_KEYCHAIN
    OSStatus status;
    SecKeychainItemRef *itemRef = NULL;

    /* mysql and postgres aren't valid protocols on Mac OS X.
     * So we use the security domain parameter to allow us to
     * distinguish between these two.
     */
    // FIXME I'm not sure this works if a password was already in the keychain
    //       I may have to do a lookup first and if it exists, run some update
    //       update function instead
    status = SecKeychainAddInternetPassword ( NULL, /* keychain */
             strlen(server), server,                /* servername */
             strlen(access_method), access_method,  /* securitydomain */
             strlen(user), user,                    /* acountname */
             strlen(service), service,              /* path */
             port,                                  /* port */
             kSecProtocolTypeAny,                   /* protocol */
             kSecAuthenticationTypeDefault,         /* auth type */
             strlen(password), password,            /* passworddata */
             itemRef );

    if ( status != noErr )
    {
        CFStringRef osx_resultstring = SecCopyErrorMessageString( status, NULL );
        const gchar *resultstring = CFStringGetCStringPtr(osx_resultstring,
                                    GetApplicationTextEncoding());
        PWARN ( "OS X keychain error: %s", resultstring );
        PWARN ( "The user will be prompted for a password again next time." );
        CFRelease ( osx_resultstring );
    }
#endif /* HAVE_OSX_KEYCHAIN */
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:56,代码来源:gnc-keyring.c


示例10: qof_book_get_counter_format

const gchar *
qof_book_get_counter_format(const QofBook *book, const char *counter_name)
{
    KvpFrame *kvp;
    const char *format;
    KvpValue *value;
    gchar *error;

    if (!book)
    {
        PWARN ("No book!!!");
        return NULL;
    }

    if (!counter_name || *counter_name == '\0')
    {
        PWARN ("Invalid counter name.");
        return NULL;
    }

    /* Get the KVP from the current book */
    kvp = qof_instance_get_slots (QOF_INSTANCE (book));

    if (!kvp)
    {
        PWARN ("Book has no KVP_Frame");
        return NULL;
    }

    format = NULL;

    /* Get the format string */
    value = kvp->get_slot({"counter_formats", counter_name});
    if (value)
    {
        format = value->get<const char*>();
        error = qof_book_validate_counter_format(format);
        if (error != NULL)
        {
            PWARN("Invalid counter format string. Format string: '%s' Counter: '%s' Error: '%s')", format, counter_name, error);
            /* Invalid format string */
            format = NULL;
            g_free(error);
        }
    }

    /* If no (valid) format string was found, use the default format
     * string */
    if (!format)
    {
        /* Use the default format */
        format = "%.6" G_GINT64_FORMAT;
    }
    return format;
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:55,代码来源:qofbook.cpp


示例11: proc_handle_softreboot

ssize_t proc_handle_softreboot(struct file *file, const char __user *buffer,
    unsigned long count, void *data)
{
    int len = count, i, start, k, cdev;
    u16 devs[4] = { 0 };
    char buf[OMAP3_MAX_SEQ];

    if (len > OMAP3_MAX_SEQ-1)
    {
        PWARN("Too long OMAP boot sequence\n");
        return -EFAULT;
    }
    if (copy_from_user(buf, buffer, len))
        return -EFAULT;

    buf[len++] = 0;
    for (i = 0, start = 0, cdev = 0; i < len; i++)
    {
        if (buf[i] == ',' || !buf[i] || buf[i] == '\n')
        {
            for (k = 0; k < OMAP3_DEV_COUNT; k++)
            {
                if (omap3_dev_names[k] &&
                    !strncmp(buf+start, omap3_dev_names[k], i-start))
                {
                    if (cdev >= 4)
                    {
                        PWARN("You can specify only up to 4 OMAP boot devices\n");
                        return -EFAULT;
                    }
                    devs[cdev++] = k;
                    break;
                }
            }
            if (k >= OMAP3_DEV_COUNT)
            {
                buf[i] = 0;
                PWARN("Incorrect OMAP boot device name \"%s\"\n", buf+start);
                return -EFAULT;
            }
            start = i+1;
            if (!buf[i] || buf[i] == '\n')
                break;
        }
    }

    // Reboot device with new configuration
    PWARN("New config: %x %x %x %x\n", devs[0], devs[1], devs[2], devs[3]);
    omap_reset_to(devs);

    return count;
}
开发者ID:alephzain,项目名称:archos-gpl-gen8-kernel,代码行数:52,代码来源:omap-softreboot.c


示例12: gncOwnerOffsetLots

static void gncOwnerOffsetLots (GNCLot *from_lot, GNCLot *to_lot, const GncOwner *owner)
{
    gnc_numeric target_offset;
    Split *split;

    /* from lot should not be a document lot because we're removing a split from there ! */
    if (gncInvoiceGetInvoiceFromLot (from_lot))
    {
        PWARN ("from_lot %p is a document lot. That is not allowed in gncOwnerOffsetLots", from_lot);
        return;
    }

    /* Get best matching split from from_lot to offset to_lot */
    target_offset = gnc_lot_get_balance (to_lot);
    if (gnc_numeric_zero_p (target_offset))
        return; // to_lot is already balanced, nothing more to do

    split = gncOwnerFindOffsettingSplit (from_lot, target_offset);
    if (!split)
        return; // No suitable offsetting split found, nothing more to do

    /* If the offsetting split is bigger than the amount needed to balance
     * to_lot, reduce the split so its reduced value closes to_lot exactly.
     * Note the negation in the reduction function. The split must be of
     * opposite sign of to_lot's balance in order to be able to close it.
     */
    if (gnc_numeric_compare (gnc_numeric_abs (xaccSplitGetValue (split)),
                             gnc_numeric_abs (target_offset)) > 0)
        gncOwnerReduceSplitTo (split, gnc_numeric_neg (target_offset));

    /* Move the reduced split from from_lot to to_lot */
    gnc_lot_add_split (to_lot, split);

}
开发者ID:ShawnMcGough,项目名称:gnucash,代码行数:34,代码来源:gncOwner.c


示例13: gncScrubLotIsSingleLotLinkSplit

static gboolean
gncScrubLotIsSingleLotLinkSplit (GNCLot *lot)
{
    Split *split = NULL;
    Transaction *trans = NULL;

    // Lots with a single split which is also a lot link transaction split
    // may be sign of a dangling payment. Let's try to fix that

    // Only works for single split lots...
    if (1 != gnc_lot_count_splits (lot))
        return FALSE;

    split = gnc_lot_get_earliest_split (lot);
    trans = xaccSplitGetParent (split);

    if (!trans)
    {
        // Ooops - the split doesn't belong to any transaction !
        // This is not expected so issue a warning and continue with next split
        PWARN("Encountered a split in a business lot that's not part of any transaction. "
              "This is unexpected! Skipping split %p.", split);
        return FALSE;
    }

    // Only works if single split belongs to a lot link transaction...
    if (xaccTransGetTxnType (trans) != TXN_TYPE_LINK)
        return FALSE;

    return TRUE;
}
开发者ID:hawk-lord,项目名称:gnucash,代码行数:31,代码来源:ScrubBusiness.c


示例14: verify_essentials

Transaction* GncPreTrans::create_trans (QofBook* book, gnc_commodity* currency)
{
    if (created)
        return nullptr;

    /* Gently refuse to create the transaction if the basics are not set correctly
     * This should have been tested before calling this function though!
     */
    auto check = verify_essentials();
    if (!check.empty())
    {
        PWARN ("Refusing to create transaction because essentials not set properly: %s", check.c_str());
        return nullptr;
    }

    auto trans = xaccMallocTransaction (book);
    xaccTransBeginEdit (trans);
    xaccTransSetCurrency (trans, m_commodity ? *m_commodity : currency);
    xaccTransSetDatePostedSecsNormalized (trans,
                        static_cast<time64>(GncDateTime(*m_date, DayPart::neutral)));

    if (m_num)
        xaccTransSetNum (trans, m_num->c_str());

    if (m_desc)
        xaccTransSetDescription (trans, m_desc->c_str());

    if (m_notes)
        xaccTransSetNotes (trans, m_notes->c_str());


    created = true;
    return trans;
}
开发者ID:carrot-garden,项目名称:money_gnucash,代码行数:34,代码来源:gnc-trans-props.cpp


示例15: load_slot

static void
load_slot( slot_info_t *pInfo, GncSqlRow* row )
{
    slot_info_t *slot_info;

    g_return_if_fail( pInfo != NULL );
    g_return_if_fail( pInfo->be != NULL );
    g_return_if_fail( row != NULL );
    g_return_if_fail( pInfo->pKvpFrame != NULL );

    slot_info = slot_info_copy( pInfo, NULL );
    g_string_free( slot_info->path, TRUE );
    slot_info->path = NULL;

    gnc_sql_load_object( pInfo->be, row, TABLE_NAME, slot_info, col_table );

    if ( slot_info->path != NULL )
    {
        (void)g_string_free( slot_info->path, TRUE );
    }
    if ( slot_info->pList != pInfo->pList )
    {
        if (pInfo->pList != NULL)
        {
            PWARN("Load slot returned a different list than the original");
        }
        else
        {
            pInfo->pList = slot_info->pList;
        }
    }
    g_slice_free( slot_info_t, slot_info );
}
开发者ID:nishmu,项目名称:gnucash,代码行数:33,代码来源:gnc-slots-sql.c


示例16: calloc

/**
 *
 * @param sensor_id
 * @return
 */
int BstSensor::send_flush_event(int32_t sensor_id)
{
    sensors_meta_data_event_t *p_event;
    int32_t ret;

    p_event = (sensors_meta_data_event_t *) calloc(1, sizeof(sensors_meta_data_event_t));
    if (NULL == p_event)
    {
        PWARN("calloc fail");
        return -1;
    }

    p_event->version = META_DATA_VERSION;
    p_event->type = SENSOR_TYPE_META_DATA;
    p_event->meta_data.what = META_DATA_FLUSH_COMPLETE;
    p_event->meta_data.sensor = sensor_id;

    ret = write(HALpipe_fd[1], p_event, sizeof(sensors_meta_data_event_t));
    if(ret < 0){
        PERR("send flush echo fail, errno = %d(%s)", errno, strerror(errno));
    }

    free(p_event);

    return 0;
}
开发者ID:BoschSensortec,项目名称:BSX4-HAL-4.1NoFusion,代码行数:31,代码来源:sensord.cpp


示例17: owner_type_handler

static gboolean
owner_type_handler (xmlNodePtr node, gpointer owner_pdata)
{
    struct owner_pdata* pdata = static_cast<decltype (pdata)> (owner_pdata);
    char* txt = dom_tree_to_text (node);
    g_return_val_if_fail (txt, FALSE);

    if (!g_strcmp0 (txt, GNC_ID_CUSTOMER))
        gncOwnerInitCustomer (pdata->owner, NULL);
    else if (!g_strcmp0 (txt, GNC_ID_JOB))
        gncOwnerInitJob (pdata->owner, NULL);
    else if (!g_strcmp0 (txt, GNC_ID_VENDOR))
        gncOwnerInitVendor (pdata->owner, NULL);
    else if (!g_strcmp0 (txt, GNC_ID_EMPLOYEE))
        gncOwnerInitEmployee (pdata->owner, NULL);
    else
    {
        PWARN ("Unknown owner type: %s", txt);
        g_free (txt);
        return FALSE;
    }

    g_free (txt);
    return TRUE;
}
开发者ID:TumbleweedPretzel,项目名称:gnucash,代码行数:25,代码来源:gnc-owner-xml-v2.cpp


示例18: qof_gobject_double_getter

static double
qof_gobject_double_getter (gpointer data, QofParam *getter)
{
    GObject *gob = data;
    double fval;

    GParamSpec *gps = getter->param_userdata;

    /* Note that the return type must actually be of type
     * getter->param_type but we just follow the hard-coded
     * mapping below ... */
    if (G_IS_PARAM_SPEC_FLOAT(gps))
    {
        GValue gval = {G_TYPE_INVALID};
        g_value_init (&gval, G_TYPE_FLOAT);
        g_object_get_property (gob, getter->param_name, &gval);

        fval = g_value_get_float (&gval);
        return fval;
    }
    else if (G_IS_PARAM_SPEC_DOUBLE(gps))
    {
        GValue gval = {G_TYPE_INVALID};
        g_value_init (&gval, G_TYPE_DOUBLE);
        g_object_get_property (gob, getter->param_name, &gval);

        fval = g_value_get_double (&gval);
        return fval;
    }

    PWARN ("unhandled parameter type %s for paramter %s",
           G_PARAM_SPEC_TYPE_NAME(gps), getter->param_name);
    return 0.0;
}
开发者ID:nizarklai,项目名称:gnucash-1,代码行数:34,代码来源:qofgobj.c


示例19: gnc_builder_add_from_file

/* gnc_builder_add_from_file:
 *
 *   a convenience wrapper for gtk_builder_add_objects_from_file.
 *   It takes care of finding the directory for glade files and prints a
 *   warning message in case of an error.
 */
gboolean
gnc_builder_add_from_file (GtkBuilder *builder, const char *filename, const char *root)
{
    GError* error = NULL;
    char *fname;
    gchar *gnc_builder_dir;
    gboolean result;

    g_return_val_if_fail (builder != NULL, FALSE);
    g_return_val_if_fail (filename != NULL, FALSE);
    g_return_val_if_fail (root != NULL, FALSE);

    gnc_builder_dir = gnc_path_get_gtkbuilderdir ();
    fname = g_build_filename(gnc_builder_dir, filename, (char *)NULL);
    g_free (gnc_builder_dir);

    {
        gchar *localroot = g_strdup(root);
        gchar *objects[] = { localroot, NULL };
        result = gtk_builder_add_objects_from_file (builder, fname, objects, &error);
        if (!result)
        {
            PWARN ("Couldn't load builder file: %s", error->message);
            g_error_free (error);
        }
        g_free (localroot);
    }

    g_free (fname);

    return result;
}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:38,代码来源:dialog-utils.c


示例20: gnc_state_save

void gnc_state_save (const QofSession *session)
{
    GError *error = NULL;

    if (!qof_session_get_url(session))
    {
        DEBUG("No file associated with session - skip state saving");
        return;
    }

    gnc_state_set_base (session);

    /* Write it all out to disk */
    if (state_file_name)
        gnc_key_file_save_to_file(state_file_name, state_file, &error);
    else
        PWARN ("No state file name set, can't save state");

    if (error)
    {
        PERR ("Error: Failure saving state file.\n  %s",
              error->message);
        g_error_free (error);
    }
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:25,代码来源:gnc-state.c



注:本文中的PWARN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PWMOutputState函数代码示例发布时间:2022-05-30
下一篇:
C++ PVR_UNREFERENCED_PARAMETER函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap