本文整理汇总了C++中I_函数的典型用法代码示例。如果您正苦于以下问题:C++ I_函数的具体用法?C++ I_怎么用?C++ I_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了I_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exo_tree_view_button_release_event
static gboolean
exo_tree_view_button_release_event (GtkWidget *widget,
GdkEventButton *event)
{
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
GtkTreePath *path;
ExoTreeView *tree_view = EXO_TREE_VIEW (widget);
/* verify that the release event is for the internal tree view window */
if (G_LIKELY (event->window == gtk_tree_view_get_bin_window (GTK_TREE_VIEW (tree_view))))
{
/* check if we're in single-click mode and the button-release-event should emit a "row-activate" */
if (G_UNLIKELY (tree_view->priv->single_click && tree_view->priv->button_release_activates))
{
/* reset the "release-activates" flag */
tree_view->priv->button_release_activates = FALSE;
/* determine the path to the row that should be activated */
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), event->x, event->y, &path, &column, NULL, NULL))
{
/* emit row-activated for the determined row */
if( ! tree_view->priv->activable_column || tree_view->priv->activable_column == column )
gtk_tree_view_row_activated (GTK_TREE_VIEW (tree_view), path, column);
/* cleanup */
gtk_tree_path_free (path);
}
}
else if ((event->state & gtk_accelerator_get_default_mod_mask ()) == 0 && !tree_view->priv->button_release_unblocks_dnd)
{
/* determine the path on which the button was released and select only this row, this way
* the user is still able to alter the selection easily if all rows are selected.
*/
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), event->x, event->y, &path, &column, NULL, NULL))
{
/* check if the path is selected */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
if (gtk_tree_selection_path_is_selected (selection, path))
{
/* unselect all rows */
gtk_tree_selection_unselect_all (selection);
/* select the row and place the cursor on it */
gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, column, FALSE);
}
/* cleanup */
gtk_tree_path_free (path);
}
}
}
/* check if we need to re-enable drag and drop */
if (G_LIKELY (tree_view->priv->button_release_unblocks_dnd))
{
gpointer drag_data = g_object_get_data (G_OBJECT (tree_view), I_("gtk-site-data"));
if (G_LIKELY (drag_data != NULL))
{
g_signal_handlers_unblock_matched (G_OBJECT (tree_view),
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL,
drag_data);
}
tree_view->priv->button_release_unblocks_dnd = FALSE;
}
/* check if we need to re-enable rubberbanding */
if (G_UNLIKELY (tree_view->priv->button_release_enables_rubber_banding))
{
gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (tree_view), TRUE);
tree_view->priv->button_release_enables_rubber_banding = FALSE;
}
/* call the parent's button release handler */
return (*GTK_WIDGET_CLASS (exo_tree_view_parent_class)->button_release_event) (widget, event);
}
示例2: qemu_irq_raise
{
/*
* The Tx interrupt is always requested if the number of data in the
* transmit FIFO is smaller than the trigger level.
*/
if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
uint32_t count = (s->reg[I_(UFSTAT)] & UFSTAT_Tx_FIFO_COUNT) >>
UFSTAT_Tx_FIFO_COUNT_SHIFT;
if (count <= exynos4210_uart_Tx_FIFO_trigger_level(s)) {
s->reg[I_(UINTSP)] |= UINTSP_TXD;
}
}
s->reg[I_(UINTP)] = s->reg[I_(UINTSP)] & ~s->reg[I_(UINTM)];
if (s->reg[I_(UINTP)]) {
qemu_irq_raise(s->irq);
#if DEBUG_IRQ
fprintf(stderr, "UART%d: IRQ has been raised: %08x\n",
s->channel, s->reg[I_(UINTP)]);
#endif
} else {
qemu_irq_lower(s->irq);
}
}
static void exynos4210_uart_update_parameters(Exynos4210UartState *s)
示例3: G_DEFINE_TYPE
static guint tree_selection_signals [LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GtkTreeSelection, gtk_tree_selection, G_TYPE_OBJECT)
static void
gtk_tree_selection_class_init (GtkTreeSelectionClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass*) class;
object_class->finalize = gtk_tree_selection_finalize;
class->changed = NULL;
tree_selection_signals[CHANGED] =
g_signal_new (I_("changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkTreeSelectionClass, changed),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
gtk_tree_selection_init (GtkTreeSelection *selection)
{
selection->type = GTK_SELECTION_SINGLE;
}
static void
示例4: gtk_tool_item_class_init
static void
gtk_tool_item_class_init (GtkToolItemClass *klass)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GObjectClass *)klass;
widget_class = (GtkWidgetClass *)klass;
object_class->set_property = gtk_tool_item_set_property;
object_class->get_property = gtk_tool_item_get_property;
object_class->finalize = gtk_tool_item_finalize;
object_class->dispose = gtk_tool_item_dispose;
object_class->notify = gtk_tool_item_property_notify;
widget_class->realize = gtk_tool_item_realize;
widget_class->unrealize = gtk_tool_item_unrealize;
widget_class->map = gtk_tool_item_map;
widget_class->unmap = gtk_tool_item_unmap;
widget_class->size_request = gtk_tool_item_size_request;
widget_class->size_allocate = gtk_tool_item_size_allocate;
widget_class->parent_set = gtk_tool_item_parent_set;
klass->create_menu_proxy = _gtk_tool_item_create_menu_proxy;
klass->set_tooltip = gtk_tool_item_real_set_tooltip;
g_object_class_install_property (object_class,
PROP_VISIBLE_HORIZONTAL,
g_param_spec_boolean ("visible-horizontal",
P_("Visible when horizontal"),
P_("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."),
TRUE,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_VISIBLE_VERTICAL,
g_param_spec_boolean ("visible-vertical",
P_("Visible when vertical"),
P_("Whether the toolbar item is visible when the toolbar is in a vertical orientation."),
TRUE,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_IS_IMPORTANT,
g_param_spec_boolean ("is-important",
P_("Is important"),
P_("Whether the toolbar item is considered important. When TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
FALSE,
GTK_PARAM_READWRITE));
g_object_class_override_property (object_class, PROP_ACTIVATABLE_RELATED_ACTION, "related-action");
g_object_class_override_property (object_class, PROP_ACTIVATABLE_USE_ACTION_APPEARANCE, "use-action-appearance");
/**
* GtkToolItem::create-menu-proxy:
* @tool_item: the object the signal was emitted on
*
* This signal is emitted when the toolbar needs information from @tool_item
* about whether the item should appear in the toolbar overflow menu. In
* response the tool item should either
* <itemizedlist>
* <listitem>call gtk_tool_item_set_proxy_menu_item() with a %NULL
* pointer and return %TRUE to indicate that the item should not appear
* in the overflow menu
* </listitem>
* <listitem> call gtk_tool_item_set_proxy_menu_item() with a new menu
* item and return %TRUE, or
* </listitem>
* <listitem> return %FALSE to indicate that the signal was not
* handled by the item. This means that
* the item will not appear in the overflow menu unless a later handler
* installs a menu item.
* </listitem>
* </itemizedlist>
*
* The toolbar may cache the result of this signal. When the tool item changes
* how it will respond to this signal it must call gtk_tool_item_rebuild_menu()
* to invalidate the cache and ensure that the toolbar rebuilds its overflow
* menu.
*
* Return value: %TRUE if the signal was handled, %FALSE if not
**/
toolitem_signals[CREATE_MENU_PROXY] =
g_signal_new (I_("create-menu-proxy"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkToolItemClass, create_menu_proxy),
_gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
/**
* GtkToolItem::toolbar-reconfigured:
* @tool_item: the object the signal was emitted on
*
* This signal is emitted when some property of the toolbar that the
* item is a child of changes. For custom subclasses of #GtkToolItem,
* the default handler of this signal use the functions
* <itemizedlist>
* <listitem>gtk_tool_shell_get_orientation()</listitem>
* <listitem>gtk_tool_shell_get_style()</listitem>
//.........这里部分代码省略.........
示例5: g_tls_connection_class_init
//.........这里部分代码省略.........
G_PARAM_STATIC_STRINGS));
/**
* GTlsConnection:peer-certificate:
*
* The connection's peer's certificate, after the TLS handshake has
* completed and the certificate has been accepted. Note in
* particular that this is not yet set during the emission of
* #GTlsConnection::accept-certificate.
*
* (You can watch for a #GObject::notify signal on this property to
* detect when a handshake has occurred.)
*
* Since: 2.28
*/
g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE,
g_param_spec_object ("peer-certificate",
P_("Peer Certificate"),
P_("The connection's peer's certificate"),
G_TYPE_TLS_CERTIFICATE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* GTlsConnection:peer-certificate-errors:
*
* The errors noticed-and-ignored while verifying
* #GTlsConnection:peer-certificate. Normally this should be 0, but
* it may not be if #GTlsClientConnection:validation-flags is not
* %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
* #GTlsConnection::accept-certificate overrode the default
* behavior.
*
* Since: 2.28
*/
g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE_ERRORS,
g_param_spec_flags ("peer-certificate-errors",
P_("Peer Certificate Errors"),
P_("Errors found with the peer's certificate"),
G_TYPE_TLS_CERTIFICATE_FLAGS,
0,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* GTlsConnection::accept-certificate:
* @conn: a #GTlsConnection
* @peer_cert: the peer's #GTlsCertificate
* @errors: the problems with @peer_cert.
*
* Emitted during the TLS handshake after the peer certificate has
* been received. You can examine @peer_cert's certification path by
* calling g_tls_certificate_get_issuer() on it.
*
* For a client-side connection, @peer_cert is the server's
* certificate, and the signal will only be emitted if the
* certificate was not acceptable according to @conn's
* #GTlsClientConnection:validation_flags. If you would like the
* certificate to be accepted despite @errors, return %TRUE from the
* signal handler. Otherwise, if no handler accepts the certificate,
* the handshake will fail with %G_TLS_ERROR_BAD_CERTIFICATE.
*
* For a server-side connection, @peer_cert is the certificate
* presented by the client, if this was requested via the server's
* #GTlsServerConnection:authentication_mode. On the server side,
* the signal is always emitted when the client presents a
* certificate, and the certificate will only be accepted if a
* handler returns %TRUE.
*
* Note that if this signal is emitted as part of asynchronous I/O
* in the main thread, then you should not attempt to interact with
* the user before returning from the signal handler. If you want to
* let the user decide whether or not to accept the certificate, you
* would have to return %FALSE from the signal handler on the first
* attempt, and then after the connection attempt returns a
* %G_TLS_ERROR_HANDSHAKE, you can interact with the user, and if
* the user decides to accept the certificate, remember that fact,
* create a new connection, and return %TRUE from the signal handler
* the next time.
*
* If you are doing I/O in another thread, you do not
* need to worry about this, and can simply block in the signal
* handler until the UI thread returns an answer.
*
* Return value: %TRUE to accept @peer_cert (which will also
* immediately end the signal emission). %FALSE to allow the signal
* emission to continue, which will cause the handshake to fail if
* no one else overrides it.
*
* Since: 2.28
*/
signals[ACCEPT_CERTIFICATE] =
g_signal_new (I_("accept-certificate"),
G_TYPE_TLS_CONNECTION,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GTlsConnectionClass, accept_certificate),
g_signal_accumulator_true_handled, NULL,
NULL,
G_TYPE_BOOLEAN, 2,
G_TYPE_TLS_CERTIFICATE,
G_TYPE_TLS_CERTIFICATE_FLAGS);
}
示例6: g_mount_operation_class_init
static void
g_mount_operation_class_init (GMountOperationClass *klass)
{
GObjectClass *object_class;
g_type_class_add_private (klass, sizeof (GMountOperationPrivate));
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = g_mount_operation_finalize;
object_class->get_property = g_mount_operation_get_property;
object_class->set_property = g_mount_operation_set_property;
klass->ask_password = ask_password;
klass->ask_question = ask_question;
klass->show_processes = show_processes;
klass->show_unmount_progress = show_unmount_progress;
/**
* GMountOperation::ask-password:
* @op: a #GMountOperation requesting a password.
* @message: string containing a message to display to the user.
* @default_user: string containing the default user name.
* @default_domain: string containing the default domain.
* @flags: a set of #GAskPasswordFlags.
*
* Emitted when a mount operation asks the user for a password.
*
* If the message contains a line break, the first line should be
* presented as a heading. For example, it may be used as the
* primary text in a #GtkMessageDialog.
*/
signals[ASK_PASSWORD] =
g_signal_new (I_("ask-password"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, ask_password),
NULL, NULL,
NULL,
G_TYPE_NONE, 4,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ASK_PASSWORD_FLAGS);
/**
* GMountOperation::ask-question:
* @op: a #GMountOperation asking a question.
* @message: string containing a message to display to the user.
* @choices: an array of strings for each possible choice.
*
* Emitted when asking the user a question and gives a list of
* choices for the user to choose from.
*
* If the message contains a line break, the first line should be
* presented as a heading. For example, it may be used as the
* primary text in a #GtkMessageDialog.
*/
signals[ASK_QUESTION] =
g_signal_new (I_("ask-question"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, ask_question),
NULL, NULL,
NULL,
G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRV);
/**
* GMountOperation::reply:
* @op: a #GMountOperation.
* @result: a #GMountOperationResult indicating how the request was handled
*
* Emitted when the user has replied to the mount operation.
*/
signals[REPLY] =
g_signal_new (I_("reply"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, reply),
NULL, NULL,
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1,
G_TYPE_MOUNT_OPERATION_RESULT);
/**
* GMountOperation::aborted:
*
* Emitted by the backend when e.g. a device becomes unavailable
* while a mount operation is in progress.
*
* Implementations of GMountOperation should handle this signal
* by dismissing open password dialogs.
*
* Since: 2.20
*/
signals[ABORTED] =
g_signal_new (I_("aborted"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, aborted),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
//.........这里部分代码省略.........
示例7: wcf_handle_file_snapshot_delete
static int
wcf_handle_file_snapshot_delete(void)
{
tstring *msg = NULL;
uint32 code = 0;
int err = 0;
tstring *file_snapshot_path = NULL;
const tstring *file = NULL;
bn_binding_array *bindings = NULL;
tstring *dump_path = NULL, *dump_name = NULL, *dump_dir = NULL;
tbool simple = false, archived = false;
err = web_get_request_param_str(g_web_data, "f_file", ps_post_data,
&file);
bail_error_null(err, file);
/*
* First make sure the filename doesn't do anything crazy like
* trying to reference another directory.
*/
err = lf_path_component_is_simple(ts_str(file), &simple);
bail_error(err);
/* XXX/EMT: would be better to return friendly error page */
bail_require_msg(simple, I_("Filename \"%s\" required for download "
"was invalid"), ts_str(file));
/* Now generate the absolute file path */
err = lf_path_from_dir_file(snapshot_download_prefix, ts_str(file),
&file_snapshot_path);
err = web_get_msg_result(g_web_data, &code, NULL);
bail_error(err);
if (code) {
goto bail;
}
if (file_snapshot_path) {
err = lf_path_last(ts_str(file_snapshot_path), &dump_name);
bail_error_null(err, dump_name);
err = lf_path_parent(ts_str(file_snapshot_path), &dump_dir);
bail_error(err);
lc_log_basic(LOG_NOTICE, _("Deleting snapshot File:%s\n"), ts_str(dump_name));
err = mdc_send_action_with_bindings_str_va
(web_mcc, NULL, NULL, "/file/delete", 2, "local_dir", bt_string, ts_str(dump_dir),
"local_filename", bt_string, ts_str(dump_name));
if (err ) {
err = ts_new_sprintf(&msg, _("Could not delete snapshot %s" ),
ts_str(dump_name));
code = 1;
bail_error(err);
}
}
err = web_set_msg_result(g_web_data, code, msg);
bail_error(err);
bail:
bn_binding_array_free(&bindings);
ts_free(&dump_path);
ts_free(&dump_name);
ts_free(&dump_dir);
ts_free(&msg);
if (err) {
return(war_error);
} else {
return(war_ok);
}
}
示例8: g_signal_new
class->group_changed = NULL;
/**
* GtkRadioButton::group-changed:
* @style: the object which received the signal
*
* Emitted when the group of radio buttons that a radio button belongs
* to changes. This is emitted when a radio button switches from
* being alone to being part of a group of 2 or more buttons, or
* vice-versa, and when a button is moved from one group of 2 or
* more buttons to a different one, but not when the composition
* of the group that a button belongs to changes.
*
* Since: 2.4
*/
group_changed_signal = g_signal_new (I_("group-changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
gtk_radio_button_init (GtkRadioButton *radio_button)
{
gtk_widget_set_has_window (GTK_WIDGET (radio_button), FALSE);
gtk_widget_set_receives_default (GTK_WIDGET (radio_button), FALSE);
GTK_TOGGLE_BUTTON (radio_button)->active = TRUE;
示例9: wlog_get_publishlog_lines
static int
wlog_get_publishlog_lines(Tcl_Interp *interpreter, int fd,
uint32 start, uint32 end, Tcl_Obj **ret_list)
{
Tcl_Obj *list = NULL;
Tcl_Obj *line_obj = NULL;
tstring *line_buf = NULL;
char buf[wlog_log_buf_size];
uint32 cur_line = 0;
uint32 seg_start = 0;
uint32 i = 0;
int count = 0;
int err = 0;
char *cp;
bail_null(ret_list);
list = Tcl_NewListObj(0, NULL);
bail_null(list);
do {
if (cur_line + 1 >= end) {
break;
}
errno = 0;
count = read(fd, buf, wlog_log_buf_size);
if (count == -1 && errno == EINTR) {
continue;
}
bail_require_errno(count >= 0, I_("Reading log file '%s'"),
file_publishlog_path);
while (( cp = memchr(buf, '\0' , count )) != NULL )
*cp = ' ';
while (( cp = memchr(buf, '<' , count )) != NULL )
*cp = '[';
while (( cp = memchr(buf, '>' , count )) != NULL )
*cp = ']';
/* look for a newline inside the buffer */
seg_start = 0;
for (i = 0; i < (uint32)count; ++i) {
if (buf[i] == '\n') {
if (cur_line + 1 >= start && cur_line + 1 < end) {
if (!line_buf) {
err = ts_new(&line_buf);
bail_error(err);
}
err = ts_append_str_frag(line_buf, buf, seg_start,
i - seg_start);
bail_error(err);
line_obj = Tcl_NewStringObj(ts_str(line_buf),
ts_length(line_buf));
bail_null(line_obj);
err = Tcl_ListObjAppendElement(interpreter, list,
line_obj);
bail_require(err == TCL_OK);
err = 0;
ts_free(&line_buf);
}
seg_start = i + 1;
++cur_line;
}
}
if (seg_start < (uint32)count) {
if (cur_line + 1 >= start && cur_line + 1 < end) {
if (!line_buf) {
err = ts_new(&line_buf);
bail_error(err);
}
err = ts_append_str_frag(line_buf, buf, seg_start,
(uint32)count - seg_start);
bail_error(err);
}
}
} while (count > 0);
*ret_list = list;
list = NULL;
bail:
if (list) {
Tcl_DecrRefCount(list);
}
ts_free(&line_buf);
return(err);
}
示例10: clutter_text_buffer_class_init
static void
clutter_text_buffer_class_init (ClutterTextBufferClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = clutter_text_buffer_finalize;
gobject_class->set_property = clutter_text_buffer_set_property;
gobject_class->get_property = clutter_text_buffer_get_property;
klass->get_text = clutter_text_buffer_normal_get_text;
klass->get_length = clutter_text_buffer_normal_get_length;
klass->insert_text = clutter_text_buffer_normal_insert_text;
klass->delete_text = clutter_text_buffer_normal_delete_text;
klass->inserted_text = clutter_text_buffer_real_inserted_text;
klass->deleted_text = clutter_text_buffer_real_deleted_text;
g_type_class_add_private (gobject_class, sizeof (ClutterTextBufferPrivate));
/**
* ClutterTextBuffer:text:
*
* The contents of the buffer.
*
*
*/
obj_props[PROP_TEXT] =
g_param_spec_string ("text",
P_("Text"),
P_("The contents of the buffer"),
"",
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* ClutterTextBuffer:length:
*
* The length (in characters) of the text in buffer.
*
*
*/
obj_props[PROP_LENGTH] =
g_param_spec_uint ("length",
P_("Text length"),
P_("Length of the text currently in the buffer"),
0, CLUTTER_TEXT_BUFFER_MAX_SIZE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* ClutterTextBuffer:max-length:
*
* The maximum length (in characters) of the text in the buffer.
*
*
*/
obj_props[PROP_MAX_LENGTH] =
g_param_spec_int ("max-length",
P_("Maximum length"),
P_("Maximum number of characters for this entry. Zero if no maximum"),
0, CLUTTER_TEXT_BUFFER_MAX_SIZE, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
/**
* ClutterTextBuffer::inserted-text:
* @buffer: a #ClutterTextBuffer
* @position: the position the text was inserted at.
* @chars: The text that was inserted.
* @n_chars: The number of characters that were inserted.
*
* This signal is emitted after text is inserted into the buffer.
*
*
*/
signals[INSERTED_TEXT] =
g_signal_new (I_("inserted-text"),
CLUTTER_TYPE_TEXT_BUFFER,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterTextBufferClass, inserted_text),
NULL, NULL,
_clutter_marshal_VOID__UINT_STRING_UINT,
G_TYPE_NONE, 3,
G_TYPE_UINT,
G_TYPE_STRING,
G_TYPE_UINT);
/**
* ClutterTextBuffer::deleted-text:
* @buffer: a #ClutterTextBuffer
* @position: the position the text was deleted at.
* @n_chars: The number of characters that were deleted.
*
* This signal is emitted after text is deleted from the buffer.
*
*
*/
signals[DELETED_TEXT] =
g_signal_new (I_("deleted-text"),
CLUTTER_TYPE_TEXT_BUFFER,
G_SIGNAL_RUN_FIRST,
//.........这里部分代码省略.........
示例11: gtk_gesture_multi_press_class_init
static void
gtk_gesture_multi_press_class_init (GtkGestureMultiPressClass *klass)
{
GtkEventControllerClass *controller_class = GTK_EVENT_CONTROLLER_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkGestureClass *gesture_class = GTK_GESTURE_CLASS (klass);
object_class->finalize = gtk_gesture_multi_press_finalize;
gesture_class->check = gtk_gesture_multi_press_check;
gesture_class->begin = gtk_gesture_multi_press_begin;
gesture_class->update = gtk_gesture_multi_press_update;
gesture_class->end = gtk_gesture_multi_press_end;
gesture_class->cancel = gtk_gesture_multi_press_cancel;
controller_class->reset = gtk_gesture_multi_press_reset;
/**
* GtkGestureMultiPress::pressed:
* @gesture: the object which received the signal
* @n_press: how many touch/button presses happened with this one
* @x: The X coordinate, in widget allocation coordinates
* @y: The Y coordinate, in widget allocation coordinates
*
* This signal is emitted whenever a button or touch press happens.
*
* Since: 3.14
*/
signals[PRESSED] =
g_signal_new (I_("pressed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkGestureMultiPressClass, pressed),
NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_INT,
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
/**
* GtkGestureMultiPress::released:
* @gesture: the object which received the signal
* @n_press: number of press that is paired with this release
* @x: The X coordinate, in widget allocation coordinates
* @y: The Y coordinate, in widget allocation coordinates
*
* This signal is emitted when a button or touch is released. @n_press
* will report the number of press that is paired to this event, note
* that #GtkGestureMultiPress::stopped may have been emitted between the
* press and its release, @n_press will only start over at the next press.
*
* Since: 3.14
*/
signals[RELEASED] =
g_signal_new (I_("released"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkGestureMultiPressClass, released),
NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_INT,
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
/**
* GtkGestureMultiPress::stopped:
* @gesture: the object which received the signal
*
* This signal is emitted whenever any time/distance threshold has
* been exceeded.
*
* Since: 3.14
*/
signals[STOPPED] =
g_signal_new (I_("stopped"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkGestureMultiPressClass, stopped),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
示例12: gtk_tool_button_class_init
//.........这里部分代码省略.........
* - underscores are removed from the label text before
* the label is shown on the toolbutton unless the
* underscore is followed by another underscore
*
* - an underscore indicates that the next character when
* used in the overflow menu should be used as a
* mnemonic.
*
* In short: use_underline = TRUE means that the label text has
* the form "_Open" and the toolbar should take appropriate
* action.
*/
g_object_class_install_property (object_class,
PROP_LABEL,
g_param_spec_string ("label",
P_("Label"),
P_("Text to show in the item."),
NULL,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_USE_UNDERLINE,
g_param_spec_boolean ("use-underline",
P_("Use underline"),
P_("If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu"),
FALSE,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_LABEL_WIDGET,
g_param_spec_object ("label-widget",
P_("Label widget"),
P_("Widget to use as the item label"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_STOCK_ID,
g_param_spec_string ("stock-id",
P_("Stock Id"),
P_("The stock icon displayed on the item"),
NULL,
GTK_PARAM_READWRITE));
/**
* GtkToolButton:icon-name:
*
* The name of the themed icon displayed on the item.
* This property only has an effect if not overridden by "label",
* "icon_widget" or "stock_id" properties.
*
* Since: 2.8
*/
g_object_class_install_property (object_class,
PROP_ICON_NAME,
g_param_spec_string ("icon-name",
P_("Icon name"),
P_("The name of the themed icon displayed on the item"),
NULL,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_ICON_WIDGET,
g_param_spec_object ("icon-widget",
P_("Icon widget"),
P_("Icon widget to display in the item"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE));
/**
* GtkButton:icon-spacing:
*
* Spacing in pixels between the icon and label.
*
* Since: 2.10
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("icon-spacing",
P_("Icon spacing"),
P_("Spacing in pixels between the icon and label"),
0,
G_MAXINT,
3,
GTK_PARAM_READWRITE));
/**
* GtkToolButton::clicked:
* @toolbutton: the object that emitted the signal
*
* This signal is emitted when the tool button is clicked with the mouse
* or activated with the keyboard.
**/
toolbutton_signals[CLICKED] =
g_signal_new (I_("clicked"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkToolButtonClass, clicked),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_type_class_add_private (object_class, sizeof (GtkToolButtonPrivate));
}
示例13: clutter_path_constraint_class_init
static void
clutter_path_constraint_class_init (ClutterPathConstraintClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
/**
* ClutterPathConstraint:path:
*
* The #ClutterPath used to constrain the position of an actor.
*
*
*/
path_properties[PROP_PATH] =
g_param_spec_object ("path",
P_("Path"),
P_("The path used to constrain an actor"),
CLUTTER_TYPE_PATH,
CLUTTER_PARAM_READWRITE);
/**
* ClutterPathConstraint:offset:
*
* The offset along the #ClutterPathConstraint:path, between -1.0 and 2.0.
*
*
*/
path_properties[PROP_OFFSET] =
g_param_spec_float ("offset",
P_("Offset"),
P_("The offset along the path, between -1.0 and 2.0"),
-1.0, 2.0,
0.0,
CLUTTER_PARAM_READWRITE);
gobject_class->set_property = clutter_path_constraint_set_property;
gobject_class->get_property = clutter_path_constraint_get_property;
gobject_class->dispose = clutter_path_constraint_dispose;
g_object_class_install_properties (gobject_class,
LAST_PROPERTY,
path_properties);
meta_class->set_actor = clutter_path_constraint_set_actor;
constraint_class->update_allocation = clutter_path_constraint_update_allocation;
/**
* ClutterPathConstraint::node-reached:
* @constraint: the #ClutterPathConstraint that emitted the signal
* @actor: the #ClutterActor using the @constraint
* @index: the index of the node that has been reached
*
* The ::node-reached signal is emitted each time a
* #ClutterPathConstraint:offset value results in the actor
* passing a #ClutterPathNode
*
*
*/
path_signals[NODE_REACHED] =
g_signal_new (I_("node-reached"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
_clutter_marshal_VOID__OBJECT_UINT,
G_TYPE_NONE, 2,
CLUTTER_TYPE_ACTOR,
G_TYPE_UINT);
}
示例14: _terminal_profile_clone
TerminalProfile *
_terminal_profile_clone (TerminalProfile *base_profile,
const char *visible_name)
{
TerminalApp *app = terminal_app_get ();
GObject *base_object = G_OBJECT (base_profile);
TerminalProfilePrivate *new_priv;
char profile_name[32];
GParameter *params;
GParamSpec **pspecs;
guint n_pspecs, i, n_params, profile_num;
TerminalProfile *new_profile;
g_object_ref (base_profile);
profile_num = 0;
do
{
g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
}
while (terminal_app_get_profile_by_name (app, profile_name) != NULL);
/* Now we have an unused profile name */
pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile)), &n_pspecs);
params = g_newa (GParameter, n_pspecs);
n_params = 0;
for (i = 0; i < n_pspecs; ++i)
{
GParamSpec *pspec = pspecs[i];
GValue *value;
if (pspec->owner_type != TERMINAL_TYPE_PROFILE ||
(pspec->flags & G_PARAM_WRITABLE) == 0)
continue;
params[n_params].name = pspec->name;
value = ¶ms[n_params].value;
G_VALUE_TYPE (value) = 0;
g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (pspec->name == I_(TERMINAL_PROFILE_NAME))
g_value_set_static_string (value, profile_name);
else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME))
g_value_set_static_string (value, visible_name);
else
g_object_get_property (base_object, pspec->name, value);
++n_params;
}
new_profile = g_object_newv (TERMINAL_TYPE_PROFILE, n_params, params);
g_object_unref (base_profile);
for (i = 0; i < n_params; ++i)
g_value_unset (¶ms[i].value);
/* Flush the new profile to GSettings */
new_priv = new_profile->priv;
g_slist_free (new_priv->dirty_pspecs);
new_priv->dirty_pspecs = NULL;
if (new_priv->save_idle_id != 0)
{
g_source_remove (new_priv->save_idle_id);
new_priv->save_idle_id = 0;
}
for (i = 0; i < n_pspecs; ++i)
{
GParamSpec *pspec = pspecs[i];
if (pspec->owner_type != TERMINAL_TYPE_PROFILE ||
(pspec->flags & G_PARAM_WRITABLE) == 0)
continue;
new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
}
g_free (pspecs);
terminal_profile_save (new_profile);
return new_profile;
}
示例15: P_
P_("Draw Indicator"),
P_("If the indicator part of the button is displayed"),
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
props[PROP_INCONSISTENT] =
g_param_spec_boolean ("inconsistent",
P_("Inconsistent"),
P_("If the check button is in an “in between” state"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_CHECK_BOX);
gtk_widget_class_set_css_name (widget_class, I_("checkbutton"));
}
static void
draw_indicator_changed (GtkCheckButton *check_button)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
GtkCssNode *widget_node;
widget_node = gtk_widget_get_css_node (GTK_WIDGET (check_button));
if (priv->draw_indicator)
{
priv->indicator_widget = gtk_icon_new ("check");
gtk_widget_set_halign (priv->indicator_widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (priv->indicator_widget, GTK_ALIGN_CENTER);