static GHashTable * gum_sanity_checker_count_leaks_by_type_name (GumSanityChecker * self, GList * instances) { GHashTable * count_by_type; const GumInstanceVTable * vtable; GList * cur; count_by_type = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); vtable = gum_instance_tracker_get_current_vtable (self->priv->instance_tracker); for (cur = instances; cur != NULL; cur = cur->next) { const gchar * type_name; guint count; type_name = vtable->type_id_to_name (G_TYPE_FROM_INSTANCE (cur->data)); count = GPOINTER_TO_UINT (g_hash_table_lookup (count_by_type, type_name)); count++; g_hash_table_insert (count_by_type, (gpointer) type_name, GUINT_TO_POINTER (count)); } return count_by_type; }
/** * shell_dir_info_equal: * @dirinfo1: the first #ShellDirInfo. * @dirinfo2: the second #ShellDirInfo. * * Checks if two #ShellDirInfo<!-- -->s are equal. * * Returns: %TRUE if @dirinfo1 is equal to @dirinfo2. %FALSE otherwise. **/ gboolean shell_dir_info_equal (ShellDirInfo *dirinfo1, ShellDirInfo *dirinfo2) { ShellDirInfoIface *iface; g_return_val_if_fail (SHELL_IS_DIR_INFO (dirinfo1), FALSE); g_return_val_if_fail (SHELL_IS_DIR_INFO (dirinfo2), FALSE); if (G_TYPE_FROM_INSTANCE (dirinfo1) != G_TYPE_FROM_INSTANCE (dirinfo2)) return FALSE; iface = SHELL_DIR_INFO_GET_IFACE (dirinfo1); return (* iface->equal) (dirinfo1, dirinfo2); }
/* Converts items from one image to another */ static void file_open_convert_items (GimpImage *dest_image, const gchar *basename, GList *items) { GList *list; for (list = items; list; list = g_list_next (list)) { GimpItem *src = list->data; GimpItem *item; item = gimp_item_convert (src, dest_image, G_TYPE_FROM_INSTANCE (src)); if (g_list_length (items) == 1) { gimp_object_set_name (GIMP_OBJECT (item), basename); } else { gimp_object_set_name (GIMP_OBJECT (item), gimp_object_get_name (src)); } list->data = item; } }
#line 341 "DictionaryEntry.c" } } void system_collections_value_take_dictionary_entry (GValue* value, gpointer v_object) { SystemCollectionsDictionaryEntry* old; #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_COLLECTIONS_TYPE_DICTIONARY_ENTRY)); #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" old = value->data[0].v_pointer; #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" if (v_object) { #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SYSTEM_COLLECTIONS_TYPE_DICTIONARY_ENTRY)); #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" value->data[0].v_pointer = v_object; #line 360 "DictionaryEntry.c" } else { #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" value->data[0].v_pointer = NULL; #line 364 "DictionaryEntry.c" } #line 24 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/DictionaryEntry.vala" if (old) {
static void import_dialog_drop_callback (GtkWidget *widget, gint x, gint y, GimpViewable *viewable, gpointer data) { ImportDialog *dialog = data; gimp_context_set_by_type (dialog->context, G_TYPE_FROM_INSTANCE (viewable), GIMP_OBJECT (viewable)); if (GIMP_IS_GRADIENT (viewable) && dialog->import_type != GRADIENT_IMPORT) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->gradient_radio), TRUE); } else if (GIMP_IS_IMAGE (viewable) && dialog->import_type != IMAGE_IMPORT) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->image_radio), TRUE); } }
static void on_listbox_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, PrivateListBoxData* data) { GtkListBoxRow* row = gtk_list_box_get_row_at_index(data->widget, gtk_tree_path_get_indices(path)[0]); if(row) { GtkWidget* content = gtk_bin_get_child(GTK_BIN(row)); for(GSList* item = data->model_bindings; item != NULL; item = item->next) { const ModelPropertyBinding* bind = item->data; GValue value = G_VALUE_INIT; gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, bind->column, &value); if(bind->widget) { GObject* child = gtk_widget_get_template_child(content, G_TYPE_FROM_INSTANCE(content), bind->widget); if(child) g_object_set_property(child, bind->prop, &value); } else g_object_set_property(G_OBJECT(content), bind->prop, &value); g_value_unset(&value); } } }
static void _property_change_handler (AtkObject *obj, AtkPropertyValues *values) { G_CONST_RETURN gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (obj)); G_CONST_RETURN gchar *name = atk_object_get_name (obj); g_print ("_property_change_handler: Accessible Type: %s\n", type_name ? type_name : "NULL"); g_print ("_property_change_handler: Accessible name: %s\n", name ? name : "NULL"); g_print ("_property_change_handler: PropertyName: %s\n", values->property_name ? values->property_name: "NULL"); if (strcmp (values->property_name, "accessible-value") == 0) { GValue *value, val; int position; value = &val; memset (value, 0, sizeof (GValue)); atk_value_get_current_value (ATK_VALUE (obj), value); g_return_if_fail (G_VALUE_HOLDS_INT (value)); position = g_value_get_int (value); g_print ("Position is %d previous position was %d\n", position, last_position); last_position = position; atk_value_get_minimum_value (ATK_VALUE (obj), value); g_return_if_fail (G_VALUE_HOLDS_INT (value)); position = g_value_get_int (value); g_print ("Minimum Value is %d\n", position); atk_value_get_maximum_value (ATK_VALUE (obj), value); g_return_if_fail (G_VALUE_HOLDS_INT (value)); position = g_value_get_int (value); g_print ("Maximum Value is %d\n", position); } }
/** * polkit_backend_session_monitor_get_session_for_subject: * @monitor: A #PolkitBackendSessionMonitor. * @subject: A #PolkitSubject. * @error: Return location for error. * * Gets the session corresponding to @subject or %NULL if no session exists. * * Returns: %NULL if @error is set otherwise a #PolkitUnixSession that should be freed with g_object_unref(). */ PolkitSubject * polkit_backend_session_monitor_get_session_for_subject (PolkitBackendSessionMonitor *monitor, PolkitSubject *subject, GError **error) { PolkitUnixProcess *tmp_process = NULL; PolkitUnixProcess *process = NULL; PolkitSubject *session = NULL; char *session_id = NULL; pid_t pid; #if HAVE_SD_UID_GET_DISPLAY uid_t uid; #endif if (POLKIT_IS_UNIX_PROCESS (subject)) process = POLKIT_UNIX_PROCESS (subject); /* We already have a process */ else if (POLKIT_IS_SYSTEM_BUS_NAME (subject)) { /* Convert bus name to process */ tmp_process = (PolkitUnixProcess*)polkit_system_bus_name_get_process_sync (POLKIT_SYSTEM_BUS_NAME (subject), NULL, error); if (!tmp_process) goto out; process = tmp_process; } else { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_NOT_SUPPORTED, "Cannot get session for subject of type %s", g_type_name (G_TYPE_FROM_INSTANCE (subject))); } /* Now do process -> pid -> same session */ g_assert (process != NULL); pid = polkit_unix_process_get_pid (process); if (sd_pid_get_session (pid, &session_id) >= 0) { session = polkit_unix_session_new (session_id); goto out; } #if HAVE_SD_UID_GET_DISPLAY /* Now do process -> uid -> graphical session (systemd version 213)*/ if (sd_pid_get_owner_uid (pid, &uid) < 0) goto out; if (sd_uid_get_display (uid, &session_id) >= 0) { session = polkit_unix_session_new (session_id); goto out; } #endif out: free (session_id); if (tmp_process) g_object_unref (tmp_process); return session; }
static void _do_test(AtkObject *obj) { const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); AtkStateSet *state_set = atk_object_ref_state_set(obj); g_assert_cmpstr(type_name, ==, "EailLabel"); /** * AtkText tests */ g_assert(ATK_IS_TEXT(obj)); g_assert(atk_state_set_contains_state(state_set, ATK_STATE_MULTI_LINE)); g_object_unref(state_set); /* atk_text_get_text */ gchar *text = atk_text_get_text(ATK_TEXT(obj), 6, 11); g_assert_cmpstr(text, ==, "ipsum"); g_free(text); /* atk_text_get_character_at_offset */ g_assert(atk_text_get_character_at_offset(ATK_TEXT(obj), 12) == 'd'); /* atk_text_get_character_count */ g_assert(atk_text_get_character_count(ATK_TEXT(obj)) == 440); }
static void edited_callback (GtkCellRendererText *renderer, const gchar *path_string, const gchar *new_text, GtkTreeView *tree_view) { GtkTreeModel *model = NULL; GtkTreeModelSort *sort_model = NULL; GtkTreePath *path; GtkTreeIter iter; guint value = atoi (new_text); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); model = gtk_tree_view_get_model (tree_view); if (GTK_IS_TREE_MODEL_SORT (model)) { sort_model = GTK_TREE_MODEL_SORT (model); model = gtk_tree_model_sort_get_model (sort_model); } if (model == NULL) return; if (sort_model) { g_warning ("FIXME implement conversion from TreeModelSort iter to child model iter"); return; } path = gtk_tree_path_new_from_string (path_string); if (!gtk_tree_model_get_iter (model, &iter, path)) { g_warning ("%s: bad path?", G_STRLOC); return; } gtk_tree_path_free (path); if (GTK_IS_LIST_STORE (model)) { gtk_list_store_set (GTK_LIST_STORE (model), &iter, 4, value, -1); } else if (GTK_IS_TREE_STORE (model)) { gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 4, value, -1); } else g_warning ("don't know how to actually toggle value for model type %s", g_type_name (G_TYPE_FROM_INSTANCE (model))); }
GtkWidget * gimp_view_new_full (GimpContext *context, GimpViewable *viewable, gint width, gint height, gint border_width, gboolean is_popup, gboolean clickable, gboolean show_popup) { GtkWidget *view; g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL); view = gimp_view_new_full_by_types (context, GIMP_TYPE_VIEW, G_TYPE_FROM_INSTANCE (viewable), width, height, border_width, is_popup, clickable, show_popup); if (view) gimp_view_set_viewable (GIMP_VIEW (view), viewable); gimp_view_renderer_remove_idle (GIMP_VIEW (view)->renderer); return view; }
void gom_resource_build_save_cmd (GomResource *resource, GomAdapter *adapter) { GomCommandBuilder *builder; gboolean has_pkey, is_insert; GSList *types = NULL; GSList *iter; GType resource_type; GList *cmds = NULL; resource_type = G_TYPE_FROM_INSTANCE(resource); g_assert(g_type_is_a(resource_type, GOM_TYPE_RESOURCE)); builder = g_object_new(GOM_TYPE_COMMAND_BUILDER, "adapter", adapter, NULL); has_pkey = has_primary_key(resource); if (has_pkey) { /* Could be an insert for a non-automatic primary key, * or an update */ is_insert = !resource->priv->is_from_table; } else { is_insert = TRUE; } g_object_set_data (G_OBJECT (resource), "is-insert", GINT_TO_POINTER (is_insert)); do { types = g_slist_prepend(types, GINT_TO_POINTER(resource_type)); } while ((resource_type = g_type_parent(resource_type)) != GOM_TYPE_RESOURCE); for (iter = types; iter; iter = iter->next) { GomCommand *command; resource_type = GPOINTER_TO_INT(iter->data); g_object_set(builder, "resource-type", resource_type, NULL); if (is_insert) { command = gom_command_builder_build_insert(builder, resource); } else { command = gom_command_builder_build_update(builder, resource); } if (is_insert && gom_resource_has_dynamic_pkey(resource_type)) is_insert = FALSE; cmds = g_list_prepend (cmds, command); } cmds = g_list_reverse (cmds); g_object_set_data_full (G_OBJECT(resource), "save-commands", cmds, free_save_cmds); g_slist_free(types); g_object_unref (builder); }
static gboolean gom_resource_do_delete (GomResource *resource, GomAdapter *adapter, GError **error) { GomCommandBuilder *builder; GType resource_type; g_return_val_if_fail(GOM_IS_RESOURCE(resource), FALSE); g_return_val_if_fail(GOM_IS_ADAPTER(adapter), FALSE); resource_type = G_TYPE_FROM_INSTANCE(resource); builder = g_object_new(GOM_TYPE_COMMAND_BUILDER, "adapter", adapter, NULL); do { GomResourceClass *klass; GParamSpec *pspec; GomCommand *command; GomFilter *filter; GArray *values; GValue value = { 0 }; gchar *sql; klass = g_type_class_peek(resource_type); g_assert(GOM_IS_RESOURCE_CLASS(klass)); pspec = g_object_class_find_property(G_OBJECT_CLASS(klass), klass->primary_key); g_assert(pspec); g_value_init(&value, pspec->value_type); g_object_get_property(G_OBJECT(resource), klass->primary_key, &value); sql = g_strdup_printf("'%s'.'%s' = ?", klass->table, klass->primary_key); values = g_array_sized_new(FALSE, FALSE, sizeof(GValue), 1); g_array_append_val(values, value); filter = gom_filter_new_sql(sql, values); g_free(sql); memset(&value, 0, sizeof value); g_array_unref(values); g_object_set(builder, "filter", filter, "resource-type", resource_type, NULL); g_object_unref(filter); command = gom_command_builder_build_delete(builder); if (!gom_command_execute(command, NULL, error)) { g_object_unref(command); g_object_unref(builder); return FALSE; } g_object_unref(command); } while ((resource_type = g_type_parent(resource_type)) != GOM_TYPE_RESOURCE); g_object_unref(builder); return TRUE; }
static void ppg_instrument_set_session (PpgInstrument *instrument, PpgSession *session) { PpgInstrumentClass *klass; PpgInstrumentPrivate *priv; GError *error = NULL; g_return_if_fail(PPG_IS_INSTRUMENT(instrument)); g_return_if_fail(PPG_IS_SESSION(session)); priv = instrument->priv; klass = PPG_INSTRUMENT_GET_CLASS(instrument); priv->session = session; g_object_add_weak_pointer(G_OBJECT(priv->session), (gpointer *)&priv->session); if (klass->load) { if (!klass->load(instrument, session, &error)) { priv->failed = TRUE; g_critical("Failed to load instrument %s: %s", g_type_name(G_TYPE_FROM_INSTANCE(instrument)), error->message); /* * XXX: Should we store the error? */ g_error_free(error); return; } } }
/** * fo_object_sprintf: * @object: The #FoObject object. * * Calls sprintf method of class of @object, if @object is an * #FoObject or descendant type of #FoObject. * * Return value: Result of sprintf method of class of @object. **/ gchar* fo_object_sprintf (gpointer object) { if (object == NULL) { return g_strdup ("(null)"); } else if (!G_IS_OBJECT (object)) { return g_strdup_printf ("Not a GObject: %p", object); } else if (!FO_IS_OBJECT (object)) { return g_strdup_printf ("GObject but not an FoObject:: %s (%p : %d%s)", g_type_name (G_TYPE_FROM_INSTANCE (object)), object, ((GObject *) object)->ref_count, g_object_is_floating (object) ? " (floating)" : ""); } else { return FO_OBJECT_GET_CLASS (object)->print_sprintf (object); } }
/** * fo_property_space_start_minimum_validate: * @datatype: #FoDatatype to be validated against allowed datatypes and * values for current property. * @context: #FoContext object from which to possibly inherit values. * @error: Information about any error that has occurred. * * Validates @datatype against allowed values. Returns @datatype, a * replacement datatype value, or NULL if validation failed. * * Return value: Valid datatype value or NULL. **/ FoDatatype* fo_property_space_start_minimum_validate (FoDatatype *datatype, FoContext *context, GError **error) { g_return_val_if_fail (datatype != NULL, NULL); g_return_val_if_fail (FO_IS_DATATYPE (datatype), NULL); g_return_val_if_fail (context != NULL, NULL); g_return_val_if_fail (FO_IS_CONTEXT (context), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); if (FO_IS_LENGTH (datatype)) { return datatype; } else { gchar *datatype_sprintf = fo_object_sprintf (datatype); g_set_error (error, FO_FO_ERROR, FO_FO_ERROR_DATATYPE, _(fo_fo_error_messages[FO_FO_ERROR_DATATYPE]), class_name, datatype_sprintf, g_type_name (G_TYPE_FROM_INSTANCE (datatype))); g_object_unref (datatype); g_free (datatype_sprintf); return NULL; } }
/** * _sprintf_default: * @object: The #FoObject object. * * Default sprintf method. * * Return value: Text warning that @object does not have a 'sprintf' function. **/ static gchar* _sprintf_default (FoObject *object) { return g_strdup_printf ("%s has no 'sprintf' function.", g_type_name (G_TYPE_FROM_INSTANCE (object))); }
static void gimp_draw_tool_draw (GimpDrawTool *draw_tool) { if (draw_tool->display && draw_tool->paused_count == 0 && ! draw_tool->draw_timeout) { gimp_draw_tool_undraw (draw_tool); GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool); if (draw_tool->group_stack) { g_warning ("%s: draw_tool->group_stack not empty after calling " "GimpDrawTool::draw() of %s", G_STRFUNC, g_type_name (G_TYPE_FROM_INSTANCE (draw_tool))); while (draw_tool->group_stack) gimp_draw_tool_pop_group (draw_tool); } if (draw_tool->item) { GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display); gimp_display_shell_add_item (shell, draw_tool->item); } } }
static void clutter_behaviour_alpha_notify_unimplemented (ClutterBehaviour *behaviour, gdouble alpha_value) { g_warning ("ClutterBehaviourClass::alpha_notify not implemented for '%s'", g_type_name (G_TYPE_FROM_INSTANCE (behaviour))); }
static void show_device_type_specific_info (NMDevice * device) { g_return_if_fail (NM_IS_DEVICE (device)); if (NM_IS_DEVICE_ETHERNET (device)) { show_ethernet_specific_info (device); } else if (NM_IS_DEVICE_WIFI (device)) { show_wifi_specific_info (device); } else if (NM_IS_DEVICE_BT (device)) { show_bt_specific_info (device); } else if (NM_IS_GSM_DEVICE (device)) { show_gsm_specific_info (device); } else if (NM_IS_CDMA_DEVICE (device)) { show_cdma_specific_info (device); } else { g_printerr ("Unsupported device type: %s\n", g_type_name (G_TYPE_FROM_INSTANCE (device))); } }
static void each_cinfo(gpointer instance, ClassInfoCallbackFunc func, gpointer user_data) { const GType gtype = G_TYPE_FROM_INSTANCE(instance); GType* interfaces; guint n_interfaces = 0; interfaces = g_type_interfaces(gtype, &n_interfaces); { guint i; for (i = 0; i < n_interfaces; i++) { const RGObjClassInfo *info; info = GTYPE2CINFO_NO_CREATE(interfaces[i]); if (info) func(instance, info, user_data); } } g_free(interfaces); { GType type; for (type = gtype; type != G_TYPE_INVALID; type = g_type_parent(type)) { const RGObjClassInfo *info; info = GTYPE2CINFO_NO_CREATE(type); if (info) func(instance, info, user_data); } } }
/** * g_app_info_equal: * @appinfo1: the first #GAppInfo. * @appinfo2: the second #GAppInfo. * * Checks if two #GAppInfos are equal. * * Returns: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise. **/ gboolean g_app_info_equal (GAppInfo *appinfo1, GAppInfo *appinfo2) { GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo1), FALSE); g_return_val_if_fail (G_IS_APP_INFO (appinfo2), FALSE); if (G_TYPE_FROM_INSTANCE (appinfo1) != G_TYPE_FROM_INSTANCE (appinfo2)) return FALSE; iface = G_APP_INFO_GET_IFACE (appinfo1); return (* iface->equal) (appinfo1, appinfo2); }
/* * preset_get_paths: * @preset: a #GObject that implements #GstPreset * @preset_user_path: location for path or %NULL * @preset_system_path: location for path or %NULL * * Fetch the preset_path for user local and system wide settings. Don't free * after use. * * Returns: %FALSE if no paths could be found. */ static gboolean preset_get_paths (GstPreset * preset, const gchar ** preset_user_path, const gchar ** preset_system_path) { GType type = G_TYPE_FROM_INSTANCE (preset); gchar *preset_path; const gchar *element_name; /* we use the element name when we must contruct the paths */ element_name = G_OBJECT_TYPE_NAME (preset); GST_INFO_OBJECT (preset, "element_name: '%s'", element_name); if (preset_user_path) { /* preset user path requested, see if we have it cached in the qdata */ if (!(preset_path = g_type_get_qdata (type, preset_user_path_quark))) { gchar *preset_dir; /* user presets go in '$HOME/.gstreamer-0.10/presets/GstSimSyn.prs' */ preset_dir = g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR, "presets", NULL); GST_INFO_OBJECT (preset, "user_preset_dir: '%s'", preset_dir); preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs", preset_dir, element_name); GST_INFO_OBJECT (preset, "user_preset_path: '%s'", preset_path); /* create dirs */ g_mkdir_with_parents (preset_dir, 0755); g_free (preset_dir); /* cache the preset path to the type */ g_type_set_qdata (type, preset_user_path_quark, preset_path); } *preset_user_path = preset_path; } if (preset_system_path) { /* preset system path requested, see if we have it cached in the qdata */ if (!(preset_path = g_type_get_qdata (type, preset_system_path_quark))) { gchar *preset_dir; /* system presets in '$GST_DATADIR/gstreamer-0.10/presets/GstAudioPanorama.prs' */ preset_dir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR, "presets", NULL); GST_INFO_OBJECT (preset, "system_preset_dir: '%s'", preset_dir); preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs", preset_dir, element_name); GST_INFO_OBJECT (preset, "system_preset_path: '%s'", preset_path); /* create dirs */ g_mkdir_with_parents (preset_dir, 0755); g_free (preset_dir); /* cache the preset path to the type */ g_type_set_qdata (type, preset_system_path_quark, preset_path); } *preset_system_path = preset_path; } return TRUE; }
static void _do_test(AtkObject *obj) { const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); const char *name = atk_object_get_name(ATK_OBJECT(obj)); const char *type_name_child; AtkStateSet *state_set; AtkObject *xobj; _printf("type_name: %s\n", type_name ? type_name : "NULL"); g_assert(name); _printf("name: %s\n", name); g_assert_cmpstr(type_name, ==, "EailCheck"); g_assert(ATK_IS_OBJECT(obj)); g_assert(ATK_IS_ACTION(obj)); g_assert(ATK_IS_TEXT(obj)); state_set = atk_object_ref_state_set(obj); if (!strcmp(name, CHECK_TEXT1)) { _printf("check test: %s\n", CHECK_TEXT1); g_assert(atk_state_set_contains_state(state_set, ATK_STATE_CHECKED)); // test children g_assert(0 == atk_object_get_n_accessible_children(obj)); } else if (!strcmp(name, CHECK_TEXT2)) { _printf("check test: %s\n", CHECK_TEXT2); g_assert(!atk_state_set_contains_state(state_set, ATK_STATE_CHECKED)); // test children g_assert(1 == atk_object_get_n_accessible_children(obj)); xobj = atk_object_ref_accessible_child(obj, 0); g_assert(NULL != xobj); type_name_child = g_type_name(G_TYPE_FROM_INSTANCE(xobj)); _printf("type_name_child: %s\n", type_name_child); g_assert_cmpstr(type_name_child, ==, "EailIcon"); }
static gboolean needs_viewport (GtkWidget *widget) { guint id; id = g_signal_lookup ("set-scroll-adjustments", G_TYPE_FROM_INSTANCE (widget)); return id == 0; }
static gboolean check_video_profile (GstDiscovererInfo *info, GstEncodingProfile *profile) { GList *i, *stream_list; gboolean found_video = FALSE, found_audio = FALSE;; stream_list = gst_discoverer_info_get_stream_list (info); /* Check video and audio restrictions */ for (i = stream_list; i && !(found_video && found_audio); i = i->next) { GstDiscovererStreamInfo *stream; GType stream_type; GstCaps *caps = NULL; stream = GST_DISCOVERER_STREAM_INFO(i->data); stream_type = G_TYPE_FROM_INSTANCE (stream); if (!found_video && stream_type == GST_TYPE_DISCOVERER_VIDEO_INFO) { caps = caps_from_video_stream_info (stream); if (match_profile (profile, caps, GST_TYPE_ENCODING_VIDEO_PROFILE)) found_video = TRUE; else gupnp_dlna_debug (" Video did not match"); } else if (!found_audio && stream_type == GST_TYPE_DISCOVERER_AUDIO_INFO) { caps = caps_from_audio_stream_info (stream); if (match_profile (profile, caps, GST_TYPE_ENCODING_AUDIO_PROFILE)) found_audio = TRUE; else gupnp_dlna_debug (" Audio did not match"); } if (caps) gst_caps_unref (caps); } gst_discoverer_stream_info_list_free (stream_list); if (!found_video || !found_audio) return FALSE; /* Check container restrictions */ if (!check_container (info, profile)) { gupnp_dlna_debug (" Container did not match"); return FALSE; } return TRUE; }
USER_OBJECT_ toRPointerWithFinalizer(gconstpointer val, const gchar *typeName, RPointerFinalizer finalizer) { USER_OBJECT_ ans; USER_OBJECT_ r_finalizer = NULL_USER_OBJECT; USER_OBJECT_ klass = NULL, rgtk_class; int i = 0; GType type = 0; if(!val) return(NULL_USER_OBJECT); if (finalizer) { PROTECT(r_finalizer = R_MakeExternalPtr(finalizer, NULL_USER_OBJECT, NULL_USER_OBJECT)); } PROTECT(ans = R_MakeExternalPtr((gpointer)val, r_finalizer, NULL_USER_OBJECT)); if (finalizer) { R_RegisterCFinalizer(ans, RGtk_finalizer); } if (typeName) type = g_type_from_name(typeName); if(type) { if (G_TYPE_IS_INSTANTIATABLE(type) || G_TYPE_IS_INTERFACE(type)) type = G_TYPE_FROM_INSTANCE(val); if (G_TYPE_IS_DERIVED(type)) { setAttrib(ans, install("interfaces"), R_internal_getInterfaces(type)); PROTECT(klass = R_internal_getGTypeAncestors(type)); } } if (!klass && typeName) { PROTECT(klass = asRString(typeName)); } if (klass) { /* so much trouble just to add "RGtkObject" onto the end */ PROTECT(rgtk_class = NEW_CHARACTER(GET_LENGTH(klass)+1)); for (i = 0; i < GET_LENGTH(klass); i++) SET_STRING_ELT(rgtk_class, i, STRING_ELT(klass, i)); } else { PROTECT(rgtk_class = NEW_CHARACTER(1)); } SET_STRING_ELT(rgtk_class, i, COPY_TO_USER_STRING("RGtkObject")); SET_CLASS(ans, rgtk_class); if (g_type_is_a(type, S_TYPE_G_OBJECT)) { USER_OBJECT_ public_sym = install(".public"); setAttrib(ans, public_sym, findVar(public_sym, S_GOBJECT_GET_ENV(val))); } if (klass) UNPROTECT(1); if (finalizer) UNPROTECT(1); UNPROTECT(2); return(ans); }
static gchar* _sprintf (FoObject *object) { g_return_val_if_fail (object != NULL, NULL); g_return_val_if_fail (FO_IS_SEQUENCED_PAGE_SEQUENCE_WALKER (object), NULL); return (g_strdup_printf("%s", g_type_name (G_TYPE_FROM_INSTANCE (object)))); }
/** * autoar_common_g_signal_emit: * @instance: the instance the signal is being emitted on. * @in_thread: %TRUE if you are not call this function inside the main thread. * @signal_id: the signal id * @detail: the detail * @...: parameters to be passed to the signal. * * This is a wrapper for g_signal_emit(). If @in_thread is %FALSE, this * function is the same as g_signal_emit(). If @in_thread is %TRUE, the * signal will be emitted from the main thread. This function will send * the signal emission job via g_main_context_invoke(), but it does not * wait for the signal emission job to be completed. Hence, the signal * may emitted after autoar_common_g_signal_emit() is returned. **/ G_GNUC_INTERNAL void autoar_common_g_signal_emit (gpointer instance, gboolean in_thread, guint signal_id, GQuark detail, ...) { va_list ap; va_start (ap, detail); if (in_thread) { int i; gchar *error; GSignalQuery query; AutoarCommonSignalData *data; error = NULL; data = g_new0 (AutoarCommonSignalData, 1); data->signal_id = signal_id; data->detail = detail; data->used_values = 1; g_value_init (data->instance_and_params, G_TYPE_FROM_INSTANCE (instance)); g_value_set_instance (data->instance_and_params, instance); g_signal_query (signal_id, &query); if (query.signal_id == 0) { autoar_common_signal_data_free (data); va_end (ap); return; } for (i = 0; i < query.n_params; i++) { G_VALUE_COLLECT_INIT (data->instance_and_params + i + 1, query.param_types[i], ap, 0, &error); if (error != NULL) break; data->used_values++; } if (error == NULL) { g_main_context_invoke (NULL, autoar_common_g_signal_emit_main_context, data); } else { autoar_common_signal_data_free (data); g_debug ("G_VALUE_COLLECT_INIT: Error: %s", error); g_free (error); va_end (ap); return; } } else { g_signal_emit_valist (instance, signal_id, detail, ap); } va_end (ap); }
static void gimp_display_shell_drop_drawable (GtkWidget *widget, gint x, gint y, GimpViewable *viewable, gpointer data) { GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data); GimpImage *image = gimp_display_get_image (shell->display); GType new_type; GimpItem *new_item; GIMP_LOG (DND, NULL); if (shell->display->gimp->busy) return; if (! image) { image = gimp_image_new_from_drawable (shell->display->gimp, GIMP_DRAWABLE (viewable)); gimp_create_display (shell->display->gimp, image, GIMP_UNIT_PIXEL, 1.0, G_OBJECT (gtk_widget_get_screen (widget)), gimp_widget_get_monitor (widget)); g_object_unref (image); return; } if (GIMP_IS_LAYER (viewable)) new_type = G_TYPE_FROM_INSTANCE (viewable); else new_type = GIMP_TYPE_LAYER; new_item = gimp_item_convert (GIMP_ITEM (viewable), image, new_type); if (new_item) { GimpLayer *new_layer = GIMP_LAYER (new_item); gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE, _("Drop New Layer")); gimp_display_shell_dnd_position_item (shell, image, new_item); gimp_item_set_visible (new_item, TRUE, FALSE); gimp_item_set_linked (new_item, FALSE, FALSE); gimp_image_add_layer (image, new_layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE); gimp_image_undo_group_end (image); gimp_display_shell_dnd_flush (shell, image); } }