本文整理汇总了C++中G_OBJECT_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_OBJECT_TYPE函数的具体用法?C++ G_OBJECT_TYPE怎么用?C++ G_OBJECT_TYPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_OBJECT_TYPE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ges_project_try_updating_id
gchar *
ges_project_try_updating_id (GESProject * project, GESAsset * asset,
GError * error)
{
gchar *new_id = NULL;
g_return_val_if_fail (GES_IS_PROJECT (project), NULL);
g_return_val_if_fail (GES_IS_ASSET (asset), NULL);
g_return_val_if_fail (error, NULL);
GST_DEBUG_OBJECT (project, "Try to proxy %s", ges_asset_get_id (asset));
if (ges_asset_request_id_update (asset, &new_id, error) == FALSE) {
GST_DEBUG_OBJECT (project, "Type: %s can not be proxied for id: %s",
g_type_name (G_OBJECT_TYPE (asset)), ges_asset_get_id (asset));
return NULL;
}
if (new_id == NULL)
g_signal_emit (project, _signals[MISSING_URI_SIGNAL], 0, error, asset,
&new_id);
if (new_id) {
if (!ges_asset_set_proxy (asset, new_id)) {
g_free (new_id);
new_id = NULL;
}
}
g_hash_table_remove (project->priv->loading_assets, ges_asset_get_id (asset));
return new_id;
}
示例2: notify
static void
notify (GObject *object, GParamSpec *pspec)
{
PropertiesChangedInfo *info;
GValue *value;
/* Ignore properties that shouldn't be exported */
if (pspec->flags & NM_PROPERTY_PARAM_NO_EXPORT)
return;
info = (PropertiesChangedInfo *) g_object_get_data (object, NM_DBUS_PROPERTY_CHANGED);
if (!info) {
info = properties_changed_info_new ();
g_object_set_data_full (object, NM_DBUS_PROPERTY_CHANGED, info, properties_changed_info_destroy);
info->signal_id = g_signal_lookup ("properties-changed", G_OBJECT_TYPE (object));
g_assert (info->signal_id);
}
value = g_slice_new0 (GValue);
g_value_init (value, pspec->value_type);
g_object_get_property (object, pspec->name, value);
g_hash_table_insert (info->hash, uscore_to_wincaps (pspec->name), value);
if (!info->idle_id)
info->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, properties_changed, object, idle_id_reset);
}
示例3: e_extensible_list_extensions
/**
* e_extensible_list_extensions:
* @extensible: an #EExtensible
* @extension_type: the type of extensions to list
*
* Returns a list of #EExtension objects bound to @extensible whose
* types are ancestors of @extension_type. For a complete list of
* extension objects bound to @extensible, pass %E_TYPE_EXTENSION.
*
* The list itself should be freed with g_list_free(). The extension
* objects are owned by @extensible and should not be unreferenced.
*
* Returns: a list of extension objects derived from @extension_type
*
* Since: 3.4
**/
GList *
e_extensible_list_extensions (EExtensible *extensible,
GType extension_type)
{
GPtrArray *extensions;
GList *list = NULL;
guint ii;
g_return_val_if_fail (E_IS_EXTENSIBLE (extensible), NULL);
g_return_val_if_fail (IS_AN_EXTENSION_TYPE (extension_type), NULL);
e_extensible_load_extensions (extensible);
extensions = extensible_get_extensions (extensible);
g_return_val_if_fail (extensions != NULL, NULL);
for (ii = 0; ii < extensions->len; ii++) {
GObject *object;
object = g_ptr_array_index (extensions, ii);
if (g_type_is_a (G_OBJECT_TYPE (object), extension_type))
list = g_list_prepend (list, object);
}
return g_list_reverse (list);
}
示例4: st_scroll_view_add
static void
st_scroll_view_add (ClutterContainer *container,
ClutterActor *actor)
{
StScrollView *self = ST_SCROLL_VIEW (container);
StScrollViewPrivate *priv = self->priv;
if (ST_IS_SCROLLABLE (actor))
{
priv->child = actor;
/* chain up to StBin::add() */
st_scroll_view_parent_iface->add (container, actor);
st_scrollable_set_adjustments (ST_SCROLLABLE (actor),
priv->hadjustment, priv->vadjustment);
}
else
{
g_warning ("Attempting to add an actor of type %s to "
"a StScrollView, but the actor does "
"not implement StScrollable.",
g_type_name (G_OBJECT_TYPE (actor)));
}
}
示例5: gtk_dialog_add_action_widget
/* Outputs source to add a child widget to a hbuttonbox. We need to check if
the hbuttonbox is a GtkDialog action area, and if it is we use the special
gtk_dialog_add_action_widget() function to add it. */
void
gb_hbutton_box_write_add_child_source (GtkWidget * parent,
const gchar *parent_name,
GtkWidget *child,
GbWidgetWriteSourceData * data)
{
if (gb_hbutton_box_is_dialog_action_area (parent)
&& G_OBJECT_TYPE (child) == GTK_TYPE_BUTTON)
{
gint response_id;
char *response_name, *dialog_name;
response_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (child), GladeDialogResponseIDKey));
response_name = gb_dialog_response_id_to_string (response_id);
dialog_name = (char*) gtk_widget_get_name (parent->parent->parent);
dialog_name = source_create_valid_identifier (dialog_name);
source_add (data,
" gtk_dialog_add_action_widget (GTK_DIALOG (%s), %s, %s);\n",
dialog_name, data->wname, response_name);
g_free (dialog_name);
}
else
{
/* Use the standard gtk_container_add(). */
source_add (data, " gtk_container_add (GTK_CONTAINER (%s), %s);\n",
parent_name, data->wname);
}
}
示例6: gb_slider_add_child
static void
gb_slider_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *type)
{
GbSliderPosition position = GB_SLIDER_NONE;
g_assert (GTK_IS_BUILDABLE (buildable));
g_assert (GTK_IS_BUILDER (builder));
g_assert (G_IS_OBJECT (child));
if (!GTK_IS_WIDGET (child))
{
g_warning ("Child \"%s\" must be of type GtkWidget.",
g_type_name (G_OBJECT_TYPE (child)));
return;
}
if (ide_str_equal0 (type, "bottom"))
position = GB_SLIDER_BOTTOM;
else if (ide_str_equal0 (type, "top"))
position = GB_SLIDER_TOP;
else if (ide_str_equal0 (type, "left"))
position = GB_SLIDER_LEFT;
else if (ide_str_equal0 (type, "right"))
position = GB_SLIDER_RIGHT;
gtk_container_add_with_properties (GTK_CONTAINER (buildable), GTK_WIDGET (child),
"position", position,
NULL);
}
示例7: gfbgraph_connectable_default_parse_connected_data
/**
* gfbgraph_connectable_default_parse_connected_data:
* @self: a #GFBGraphConnectable.
* @payload: a const #gchar with the response string from the Facebook Graph API.
* @error: (allow-none): a #GError or %NULL.
*
* In most cases, #GFBGraphConnectable implementers can use this function in order to parse
* the response when a gfbgraph_node_get_connection_nodes() is executed and the
* gfbgraph_connectable_parse_connected_data() was called.
*
* Normally, Facebook Graph API returns the connections in the same way, using JSON objects,
* with a root object called "data".
*
* Returns: (element-type GFBGraphNode) (transfer full): a newly-allocated #GList of #GFBGraphNode with the same #GType as @self.
**/
GList*
gfbgraph_connectable_default_parse_connected_data (GFBGraphConnectable *self, const gchar *payload, GError **error)
{
GList *nodes_list = NULL;
JsonParser *jparser;
GType node_type;
node_type = G_OBJECT_TYPE (self);
jparser = json_parser_new ();
if (json_parser_load_from_data (jparser, payload, -1, error)) {
JsonNode *root_jnode;
JsonObject *main_jobject;
JsonArray *nodes_jarray;
int i = 0;
root_jnode = json_parser_get_root (jparser);
main_jobject = json_node_get_object (root_jnode);
nodes_jarray = json_object_get_array_member (main_jobject, "data");
for (i = 0; i < json_array_get_length (nodes_jarray); i++) {
JsonNode *jnode;
GFBGraphNode *node;
jnode = json_array_get_element (nodes_jarray, i);
node = GFBGRAPH_NODE (json_gobject_deserialize (node_type, jnode));
nodes_list = g_list_append (nodes_list, node);
}
}
g_clear_object (&jparser);
return nodes_list;
}
示例8: ATTR_PRINTF_FORMAT
ATTR_PRINTF_FORMAT (2,3) gchar *
_lp_event_to_string (lp_Event *event, const gchar *fmt, ...)
{
va_list args;
gchar *suffix = NULL;
gchar *str;
gint n;
va_start (args, fmt);
n = g_vasprintf (&suffix, fmt, args);
g_assert_nonnull (suffix);
g_assert (n >= 0);
va_end (args);
str = g_strdup_printf ("\
%s at %p\n\
source: %s at %p\n\
mask: 0x%x\n\
%s\
", G_OBJECT_TYPE_NAME (event),
G_TYPE_CHECK_INSTANCE_CAST (event,
G_OBJECT_TYPE (event),
gpointer),
LP_IS_SCENE (event->priv->source) ? "lp_Scene"
: LP_IS_MEDIA (event->priv->source) ? "lp_Media"
: "unknown",
event->priv->source,
(guint) event->priv->mask,
suffix);
g_assert_nonnull (str);
g_free (suffix);
return str;
}
示例9: get_ancestors
static gboolean
get_ancestors (GtkWidget *widget,
GType widget_type,
GtkWidget **ancestor,
GtkWidget **below)
{
GtkWidget *a, *b;
a = NULL;
b = widget;
while (b != NULL)
{
a = gtk_widget_get_parent (b);
if (!a)
return FALSE;
if (g_type_is_a (G_OBJECT_TYPE (a), widget_type))
break;
b = a;
}
*below = b;
*ancestor = a;
return TRUE;
}
示例10: netstatus_connect_signal_while_alive
void
netstatus_connect_signal_while_alive (gpointer object,
const char *detailed_signal,
GCallback func,
gpointer func_data,
gpointer alive_object)
{
GClosure *closure;
GType type;
guint signal_id = 0;
GQuark detail = 0;
type = G_OBJECT_TYPE (object);
if (!g_signal_parse_name (detailed_signal, type, &signal_id, &detail, FALSE))
{
g_warning (G_STRLOC ": unable to parse signal \"%s\" for type \"%s\"",
detailed_signal, g_type_name (type));
return;
}
closure = g_cclosure_new (func, func_data, NULL);
g_object_watch_closure (G_OBJECT (alive_object), closure);
g_signal_connect_closure_by_id (object, signal_id, detail, closure, FALSE);
}
示例11: _bus_stop_stream_cb
static gboolean
_bus_stop_stream_cb (GstBus *bus, GstMessage *message, gpointer user_data)
{
FsStreamTransmitter *st = user_data;
GstState oldstate, newstate, pending;
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_STATE_CHANGED ||
G_OBJECT_TYPE (GST_MESSAGE_SRC (message)) != GST_TYPE_PIPELINE)
return bus_error_callback (bus, message, user_data);
gst_message_parse_state_changed (message, &oldstate, &newstate, &pending);
if (newstate != GST_STATE_PLAYING)
return TRUE;
if (pending != GST_STATE_VOID_PENDING)
ts_fail ("New state playing, but pending is %d", pending);
GST_DEBUG ("Stopping stream transmitter");
fs_stream_transmitter_stop (st);
g_object_unref (st);
GST_DEBUG ("Stopped stream transmitter");
g_atomic_int_set(&running, FALSE);
g_main_loop_quit (loop);
return TRUE;
}
示例12: gst_is_gl_memory_pbo
/**
* gst_is_gl_memory_pbo:
* @mem:a #GstMemory
*
* Returns: whether the memory at @mem is a #GstGLMemoryPBO
*
* Since: 1.8
*/
gboolean
gst_is_gl_memory_pbo (GstMemory * mem)
{
return mem != NULL && mem->allocator != NULL
&& g_type_is_a (G_OBJECT_TYPE (mem->allocator),
GST_TYPE_GL_MEMORY_PBO_ALLOCATOR);
}
示例13: gtk_tool_button_create_menu_proxy
static gboolean
gtk_tool_button_create_menu_proxy (GtkToolItem *item)
{
GtkToolButton *button = GTK_TOOL_BUTTON (item);
GtkWidget *menu_item;
GtkWidget *menu_image = NULL;
GtkStockItem stock_item;
gboolean use_mnemonic = TRUE;
const char *label;
if (_gtk_tool_item_create_menu_proxy (item))
return TRUE;
if (GTK_IS_LABEL (button->priv->label_widget))
{
label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->priv->label_widget));
}
else if (button->priv->label_text)
{
label = button->priv->label_text;
use_mnemonic = button->priv->use_underline;
}
else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item))
{
label = stock_item.label;
}
else
{
label = "";
}
if (use_mnemonic)
menu_item = gtk_image_menu_item_new_with_mnemonic (label);
else
menu_item = gtk_image_menu_item_new_with_label (label);
if (GTK_IS_IMAGE (button->priv->icon_widget))
{
menu_image = clone_image_menu_size (GTK_IMAGE (button->priv->icon_widget),
gtk_widget_get_settings (GTK_WIDGET (button)));
}
else if (button->priv->stock_id)
{
menu_image = gtk_image_new_from_stock (button->priv->stock_id, GTK_ICON_SIZE_MENU);
}
if (menu_image)
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), menu_image);
g_signal_connect_closure_by_id (menu_item,
g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
g_cclosure_new_object_swap (G_CALLBACK (gtk_button_clicked),
G_OBJECT (GTK_TOOL_BUTTON (button)->priv->button)),
FALSE);
gtk_tool_item_set_proxy_menu_item (GTK_TOOL_ITEM (button), MENU_ID, menu_item);
return TRUE;
}
示例14: mcd_dbus_get_interfaces
void
mcd_dbus_get_interfaces (TpSvcDBusProperties *self, const gchar *name,
GValue *value)
{
McdInterfaceData *iface_data, *id;
GPtrArray *a_ifaces;
GType type;
DEBUG ("called");
a_ifaces = g_ptr_array_new ();
for (type = G_OBJECT_TYPE (self); type != 0; type = g_type_parent (type))
{
iface_data = g_type_get_qdata (type, MCD_INTERFACES_QUARK);
if (!iface_data) continue;
for (id = iface_data; id->get_type; id++)
{
if (id->optional &&
!mcd_dbus_is_active_optional_interface (self,
id->get_type ()))
{
DEBUG ("skipping inactive optional iface %s", id->interface);
continue;
}
g_ptr_array_add (a_ifaces, g_strdup (id->interface));
}
}
g_ptr_array_add (a_ifaces, NULL);
g_value_init (value, G_TYPE_STRV);
g_value_take_boxed (value, g_ptr_array_free (a_ifaces, FALSE));
}
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-mission-control,代码行数:35,代码来源:mcd-dbusprop.c
示例15: rg_m_get_style_by_paths
static VALUE
rg_m_get_style_by_paths(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
VALUE settings, widget_path, class_path, klass;
GtkStyle* style;
GType gtype;
const gchar* name;
rb_scan_args(argc, argv, "13", &settings, &widget_path, &class_path, &klass);
style = gtk_rc_get_style_by_paths(GTK_SETTINGS(RVAL2GOBJ(settings)),
NIL_P(widget_path) ? NULL : RVAL2CSTR(widget_path),
NIL_P(class_path) ? NULL : RVAL2CSTR(class_path),
NIL_P(klass) ? G_TYPE_NONE : CLASS2GTYPE(klass));
if (style){
gtype = G_OBJECT_TYPE(style);
name = G_OBJECT_TYPE_NAME(style);
if (! rb_const_defined_at(mGtk, rb_intern(name))){
G_DEF_CLASS(gtype, (gchar*)name, mGtk);
}
return GOBJ2RVAL(style);
}
return Qnil;
}