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; }
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); }
/** * 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); }
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))); } }
/* 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); } }
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); }
/** * 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; }
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; }
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; }
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); }
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; }
/** * 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); }
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; }
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)); }
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; }
void tp_properties_mixin_init (GObject *obj, glong offset) { TpPropertiesMixinClass *mixin_cls; TpPropertiesMixin *mixin; TpPropertiesContext *ctx; g_assert (G_IS_OBJECT (obj)); g_assert (TP_IS_SVC_PROPERTIES_INTERFACE (obj)); g_type_set_qdata (G_OBJECT_TYPE (obj), TP_PROPERTIES_MIXIN_OFFSET_QUARK, GINT_TO_POINTER (offset)); mixin = TP_PROPERTIES_MIXIN (obj); mixin_cls = TP_PROPERTIES_MIXIN_CLASS (G_OBJECT_GET_CLASS (obj)); mixin->properties = g_new0 (TpProperty, mixin_cls->num_props); mixin->priv = g_slice_new0 (TpPropertiesMixinPrivate); mixin->priv->object = obj; ctx = &mixin->priv->context; ctx->mixin_cls = mixin_cls; ctx->mixin = mixin; ctx->values = g_new0 (GValue *, mixin_cls->num_props); }
/** * gst_is_vulkan_memory: * @mem:a #GstMemory * * Returns: whether the memory at @mem is a #GstVulkanMemory */ gboolean gst_is_vulkan_memory (GstMemory * mem) { return mem != NULL && mem->allocator != NULL && g_type_is_a (G_OBJECT_TYPE (mem->allocator), GST_TYPE_VULKAN_MEMORY_ALLOCATOR); }
void tidy_stylable_notify (TidyStylable *stylable, const gchar *property_name) { GParamSpec *pspec; g_return_if_fail (TIDY_IS_STYLABLE (stylable)); g_return_if_fail (property_name != NULL); g_object_ref (stylable); pspec = g_param_spec_pool_lookup (style_property_spec_pool, property_name, G_OBJECT_TYPE (stylable), TRUE); if (!pspec) g_warning ("%s: object class `%s' has no style property named `%s'", G_STRFUNC, G_OBJECT_TYPE_NAME (stylable), property_name); else { GObjectNotifyQueue *nqueue; nqueue = g_object_notify_queue_freeze (G_OBJECT (stylable), &property_notify_context); g_object_notify_queue_add (G_OBJECT (stylable), nqueue, pspec); g_object_notify_queue_thaw (G_OBJECT (stylable), nqueue); } g_object_unref (stylable); }
/** * fs_session_new_stream: * @session: a #FsSession * @participant: #FsParticipant of a participant for the new stream * @direction: #FsStreamDirection describing the direction of the new stream that will * be created for this participant * @transmitter: Name of the type of transmitter to use for this session * @stream_transmitter_n_parameters: Number of parametrs passed to the stream * transmitter * @stream_transmitter_parameters: an array of n_parameters #GParameter struct * that will be passed * to the newly-create #FsStreamTransmitter * @error: location of a #GError, or %NULL if no error occured * * This function creates a stream for the given participant into the active session. * * Returns: the new #FsStream that has been created. User must unref the * #FsStream when the stream is ended. If an error occured, returns NULL. */ FsStream * fs_session_new_stream (FsSession *session, FsParticipant *participant, FsStreamDirection direction, const gchar *transmitter, guint stream_transmitter_n_parameters, GParameter *stream_transmitter_parameters, GError **error) { FsSessionClass *klass = FS_SESSION_GET_CLASS (session); FsStream *new_stream = NULL; g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (session), FS_TYPE_SESSION), NULL); if (klass->new_stream) { new_stream = klass->new_stream (session, participant, direction, transmitter, stream_transmitter_n_parameters, stream_transmitter_parameters, error); if (!new_stream) return NULL; /* Let's catch all stream errors and forward them */ g_signal_connect (new_stream, "error", G_CALLBACK (fs_session_error_forward), session); } else { g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED, "new_stream not defined for %s", G_OBJECT_TYPE_NAME (session)); } return new_stream; }
/** * gst_is_gl_base_buffer: * @mem:a #GstMemory * * Returns: whether the memory at @mem is a #GstGLBaseBuffer */ gboolean gst_is_gl_base_buffer (GstMemory * mem) { return mem != NULL && mem->allocator != NULL && g_type_is_a (G_OBJECT_TYPE (mem->allocator), GST_TYPE_GL_BASE_BUFFER_ALLOCATOR); }
static JSValueRef seed_gobject_signal_emit (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { JSValueRef ret; GValue *params; GValue ret_value = { 0 }; GSignalQuery query; signal_privates *privates; guint i, signal_id; privates = JSObjectGetPrivate (thisObject); signal_id = g_signal_lookup (privates->signal_name, G_OBJECT_TYPE (privates->object)); g_signal_query (signal_id, &query); if (argumentCount != query.n_params) { seed_make_exception (ctx, exception, "ArgumentError", "Signal: %s for type %s expected %u " "arguments, got %zd", query.signal_name, g_type_name (query.itype), query.n_params, argumentCount); return JSValueMakeNull (ctx); } params = g_new0 (GValue, argumentCount + 1); g_value_init (¶ms[0], G_TYPE_OBJECT); g_value_set_object (¶ms[0], privates->object); for (i = 0; i < argumentCount; i++) seed_value_to_gvalue (ctx, arguments[i], query.param_types[i], ¶ms[i + 1], exception); if (query.return_type != G_TYPE_NONE) g_value_init (&ret_value, query.return_type); g_signal_emitv (params, signal_id, 0, &ret_value); for (i = 0; i < argumentCount; i++) g_value_unset (¶ms[i]); g_free (params); ret = seed_value_from_gvalue (ctx, &ret_value, exception); if (query.return_type != G_TYPE_NONE) g_value_unset (&ret_value); return ret; }
static void paste_object (GnmPasteTarget const *pt, SheetObject const *src, int left, int top) { SheetObject *dst; SheetObjectAnchor tmp; tmp = *sheet_object_get_anchor (src); if (G_OBJECT_TYPE (src) == CELL_COMMENT_TYPE) { if ((pt->paste_flags & PASTE_COMMENTS) && (pt->paste_flags & PASTE_IGNORE_COMMENTS_AT_ORIGIN && tmp.cell_bound.start.col == 0 && tmp.cell_bound.start.row == 0)) return; } else if (!(pt->paste_flags & PASTE_OBJECTS)) return; if (NULL == (dst = sheet_object_dup (src))) return; if (pt->paste_flags & PASTE_TRANSPOSE) { GnmCellPos origin; origin.col = 0; origin.row = 0; range_transpose (&tmp.cell_bound, pt->sheet, &origin); } range_translate (&tmp.cell_bound, pt->sheet, left, top); sheet_object_set_anchor (dst, &tmp); sheet_object_set_sheet (dst, pt->sheet); g_object_unref (dst); }
/*<private> * _clutter_actor_set_default_paint_volume: * @self: a #ClutterActor * @check_gtype: if not %G_TYPE_INVALID, match the type of @self against * this type * @volume: the #ClutterPaintVolume to set * * Sets the default paint volume for @self. * * This function should be called by #ClutterActor sub-classes that follow * the default assumption that their paint volume is defined by their * allocation. * * If @check_gtype is not %G_TYPE_INVALID, this function will check the * type of @self and only compute the paint volume if the type matches; * this can be used to avoid computing the paint volume for sub-classes * of an actor class * * Return value: %TRUE if the paint volume was set, and %FALSE otherwise */ gboolean _clutter_actor_set_default_paint_volume (ClutterActor *self, GType check_gtype, ClutterPaintVolume *volume) { ClutterGeometry geometry = { 0, }; if (check_gtype != G_TYPE_INVALID) { if (G_OBJECT_TYPE (self) != check_gtype) return FALSE; } /* calling clutter_actor_get_allocation_* can potentially be very * expensive, as it can result in a synchronous full stage relayout * and redraw */ if (!clutter_actor_has_allocation (self)) return FALSE; clutter_actor_get_allocation_geometry (self, &geometry); clutter_paint_volume_set_width (volume, geometry.width); clutter_paint_volume_set_height (volume, geometry.height); return TRUE; }
/** * gdict_context_match_word: * @context: a #GdictContext * @database: a database name to search into, or %NULL for the * default database * @strategy: a strategy name to use for matching, or %NULL for * the default strategy * @word: the word to match * @error: return location for a #GError, or %NULL * * Query @context for a list of word matching @word inside @database, * using @strategy as a matching strategy. Each time a matching word * is found, the "match-found" signal is fired. * * Return value: %TRUE if the query was successfully started. * * Since: 1.0 */ gboolean gdict_context_match_word (GdictContext *context, const gchar *database, const gchar *strategy, const gchar *word, GError **error) { g_return_val_if_fail (GDICT_IS_CONTEXT (context), FALSE); g_return_val_if_fail (word != NULL, FALSE); if (!GDICT_CONTEXT_GET_IFACE (context)->match_word) { g_warning ("Object `%s' does not implement the match_word " "virtual function.", g_type_name (G_OBJECT_TYPE (context))); return FALSE; } return GDICT_CONTEXT_GET_IFACE (context)->match_word (context, database, strategy, word, error); }
/** * egg_state_machine_connect_object: (skip) * @self: A #EggStateMachine. * @state: The state the signal connection should exist within * @source: the source object to connect to * @detailed_signal: The detailed signal of @source to connect. * @callback: (scope notified) (closure user_data): The callback to execute upon signal emission. * @user_data: The user data for @callback. * @flags: signal connection flags. * * Connects to the @detailed_signal of @source only when the current * state of the state machine is @state. */ void egg_state_machine_connect_object (EggStateMachine *self, const gchar *state, gpointer source, const gchar *detailed_signal, GCallback callback, gpointer user_data, GConnectFlags flags) { EggState *state_obj; EggSignalGroup *signals; g_return_if_fail (EGG_IS_STATE_MACHINE (self)); g_return_if_fail (state != NULL); g_return_if_fail (G_IS_OBJECT (source)); g_return_if_fail (detailed_signal != NULL); g_return_if_fail (callback != NULL); state_obj = egg_state_machine_get_state_obj (self, state); if (!(signals = g_hash_table_lookup (state_obj->signals, source))) { signals = egg_signal_group_new (G_OBJECT_TYPE (source)); g_hash_table_insert (state_obj->signals, source, signals); g_object_weak_ref (source, egg_state_machine__signal_source_weak_notify, self); } egg_signal_group_connect_object (signals, detailed_signal, callback, user_data, flags); }
/* Find view by type */ XfdashboardView* xfdashboard_viewpad_find_view_by_type(XfdashboardViewpad *self, GType inType) { ClutterActorIter iter; ClutterActor *child; XfdashboardView *view; g_return_val_if_fail(XFDASHBOARD_IS_VIEWPAD(self), NULL); view=NULL; /* Iterate through children and create list of views */ clutter_actor_iter_init(&iter, CLUTTER_ACTOR(self)); while(!view && clutter_actor_iter_next(&iter, &child)) { /* Check if child is a view and of type looking for */ if(XFDASHBOARD_IS_VIEW(child)==TRUE && G_OBJECT_TYPE(child)==inType) { view=XFDASHBOARD_VIEW(child); } } /* Return view found which may be NULL if no view of requested type was found */ return(view); }
static void gtk_recent_action_unselect_all (GtkRecentChooser *chooser) { g_warning ("This function is not implemented for " "widgets of class '%s'", g_type_name (G_OBJECT_TYPE (chooser))); }
/*<private> * _clutter_actor_set_default_paint_volume: * @self: a #ClutterActor * @check_gtype: if not %G_TYPE_INVALID, match the type of @self against * this type * @volume: the #ClutterPaintVolume to set * * Sets the default paint volume for @self. * * This function should be called by #ClutterActor sub-classes that follow * the default assumption that their paint volume is defined by their * allocation. * * If @check_gtype is not %G_TYPE_INVALID, this function will check the * type of @self and only compute the paint volume if the type matches; * this can be used to avoid computing the paint volume for sub-classes * of an actor class * * Return value: %TRUE if the paint volume was set, and %FALSE otherwise */ gboolean _clutter_actor_set_default_paint_volume (ClutterActor *self, GType check_gtype, ClutterPaintVolume *volume) { ClutterActorBox box; if (check_gtype != G_TYPE_INVALID) { if (G_OBJECT_TYPE (self) != check_gtype) return FALSE; } /* calling clutter_actor_get_allocation_* can potentially be very * expensive, as it can result in a synchronous full stage relayout * and redraw */ if (!clutter_actor_has_allocation (self)) return FALSE; clutter_actor_get_allocation_box (self, &box); /* we only set the width and height, as the paint volume is defined * to be relative to the actor's modelview, which means that the * allocation's origin has already been applied */ clutter_paint_volume_set_width (volume, box.x2 - box.x1); clutter_paint_volume_set_height (volume, box.y2 - box.y1); return TRUE; }
static void extensible_load_extension (GType extension_type, EExtensible *extensible) { EExtensionClass *extension_class; GType extensible_type; GPtrArray *extensions; EExtension *extension; extensible_type = G_OBJECT_TYPE (extensible); extension_class = g_type_class_ref (extension_type); /* Only load extensions that extend the given extensible object. */ if (!g_type_is_a (extensible_type, extension_class->extensible_type)) goto exit; extension = g_object_new ( extension_type, "extensible", extensible, NULL); extensions = extensible_get_extensions (extensible); g_ptr_array_add (extensions, extension); exit: g_type_class_unref (extension_class); }
static gboolean ToolsCoreRegisterSignal(ToolsAppCtx *ctx, ToolsAppProvider *prov, ToolsPluginData *plugin, gpointer reg) { gboolean valid; guint sigId; GQuark sigDetail; ToolsPluginSignalCb *sig = reg; valid = g_signal_parse_name(sig->signame, G_OBJECT_TYPE(ctx->serviceObj), &sigId, &sigDetail, FALSE); if (valid) { g_signal_connect(ctx->serviceObj, sig->signame, sig->callback, sig->clientData); return TRUE; } g_debug("Plugin '%s' unable to connect to signal '%s'.\n", plugin->name, sig->signame); return FALSE; }