/* called when a uri is renamed in a store */ static void mail_vfolder_rename_folder (CamelStore *store, const gchar *old_folder_name, const gchar *new_folder_name) { ERuleContext *rule_context; EFilterRule *rule; const gchar *source; CamelVeeFolder *vf; CamelSession *session; gint changed = 0; gchar *old_uri; gchar *new_uri; d(printf("vfolder rename uri: %s to %s\n", cfrom, cto)); if (context == NULL) return; if (folder_is_spethal (store, old_folder_name)) return; if (folder_is_spethal (store, new_folder_name)) return; g_return_if_fail (mail_in_main_thread ()); session = camel_service_get_session (CAMEL_SERVICE (store)); old_uri = e_mail_folder_uri_build (store, old_folder_name); new_uri = e_mail_folder_uri_build (store, new_folder_name); G_LOCK (vfolder); rule_context = E_RULE_CONTEXT (context); /* see if any rules directly reference this removed uri */ rule = NULL; while ((rule = e_rule_context_next_rule (rule_context, rule, NULL))) { EMVFolderRule *vf_rule = EM_VFOLDER_RULE (rule); source = NULL; while ((source = em_vfolder_rule_next_source (vf_rule, source))) { /* Remove all sources that match, ignore changed events though * because the adduri call above does the work async */ if (e_mail_folder_uri_equal (session, old_uri, source)) { vf = g_hash_table_lookup (vfolder_hash, rule->name); if (!vf) { g_warning ("vf is NULL for %s\n", rule->name); continue; } g_signal_handlers_disconnect_matched ( rule, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, rule_changed, vf); em_vfolder_rule_remove_source (vf_rule, source); em_vfolder_rule_add_source (vf_rule, new_uri); g_signal_connect ( vf_rule, "changed", G_CALLBACK (rule_changed), vf); changed++; source = NULL; } } } G_UNLOCK (vfolder); if (changed) { const gchar *config_dir; gchar *user; d(printf("Vfolders updated from renamed folder\n")); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); e_rule_context_save ((ERuleContext *) context, user); g_free (user); } g_free (old_uri); g_free (new_uri); }
void soy_textures_bumpmap_set (soytexturesBumpmap* self, gint index, GObject* value) { soyatomsVector* vector = NULL; GObject* _tmp0_; GObject* _tmp1_; soyatomsVector* _tmp2_; soyatomsVector* _tmp3_; gfloat _tmp4_; gfloat _tmp5_; soyatomsVector* _tmp11_; gfloat _tmp12_; gfloat _tmp13_; soyatomsVector* _tmp19_; gfloat _tmp20_; gfloat _tmp21_; GeeHashMap* _tmp27_; gint _tmp28_; gboolean _tmp29_ = FALSE; GeeHashMap* _tmp37_; gint _tmp38_; soyatomsVector* _tmp39_; soyatomsVector* _tmp40_; soyatomsVector* _tmp41_; guchar* _tmp42_; gint _tmp43_; soyatomsVector* _tmp44_; gfloat _tmp45_; gfloat _tmp46_; guchar _tmp47_; guchar* _tmp48_; gint _tmp49_; soyatomsVector* _tmp50_; gfloat _tmp51_; gfloat _tmp52_; guchar _tmp53_; guchar* _tmp54_; gint _tmp55_; soyatomsVector* _tmp56_; gfloat _tmp57_; gfloat _tmp58_; guchar _tmp59_; g_return_if_fail (self != NULL); g_return_if_fail (value != NULL); _tmp0_ = value; if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, SOY_ATOMS_TYPE_VECTOR)) { _g_object_unref0 (vector); return; } _tmp1_ = value; _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SOY_ATOMS_TYPE_VECTOR, soyatomsVector)); _g_object_unref0 (vector); vector = _tmp2_; _tmp3_ = vector; _tmp4_ = soy_atoms_vector_get_x (_tmp3_); _tmp5_ = _tmp4_; if (_tmp5_ > 1.0f) { soyatomsVector* _tmp6_; _tmp6_ = vector; soy_atoms_vector_set_x (_tmp6_, 1.0f); } else { soyatomsVector* _tmp7_; gfloat _tmp8_; gfloat _tmp9_; _tmp7_ = vector; _tmp8_ = soy_atoms_vector_get_x (_tmp7_); _tmp9_ = _tmp8_; if (_tmp9_ < (-1.0f)) { soyatomsVector* _tmp10_; _tmp10_ = vector; soy_atoms_vector_set_x (_tmp10_, -1.0f); } } _tmp11_ = vector; _tmp12_ = soy_atoms_vector_get_y (_tmp11_); _tmp13_ = _tmp12_; if (_tmp13_ > 1.0f) { soyatomsVector* _tmp14_; _tmp14_ = vector; soy_atoms_vector_set_y (_tmp14_, 1.0f); } else { soyatomsVector* _tmp15_; gfloat _tmp16_; gfloat _tmp17_; _tmp15_ = vector; _tmp16_ = soy_atoms_vector_get_y (_tmp15_); _tmp17_ = _tmp16_; if (_tmp17_ < (-1.0f)) { soyatomsVector* _tmp18_; _tmp18_ = vector; soy_atoms_vector_set_y (_tmp18_, -1.0f); } } _tmp19_ = vector; _tmp20_ = soy_atoms_vector_get_z (_tmp19_); _tmp21_ = _tmp20_; if (_tmp21_ > 1.0f) { soyatomsVector* _tmp22_; _tmp22_ = vector; soy_atoms_vector_set_z (_tmp22_, 1.0f); } else { soyatomsVector* _tmp23_; gfloat _tmp24_; gfloat _tmp25_; _tmp23_ = vector; _tmp24_ = soy_atoms_vector_get_z (_tmp23_); _tmp25_ = _tmp24_; if (_tmp25_ < (-1.0f)) { soyatomsVector* _tmp26_; _tmp26_ = vector; soy_atoms_vector_set_z (_tmp26_, -1.0f); } } _tmp27_ = self->priv->_texel_objs; _tmp28_ = index; _tmp29_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp27_, (gpointer) ((gintptr) _tmp28_)); if (_tmp29_) { GeeHashMap* _tmp30_; gint _tmp31_; gpointer _tmp32_ = NULL; soyatomsVector* _tmp33_; soyatomsVector* old; soyatomsVector* _tmp34_; guint _tmp35_ = 0U; soyatomsVector* _tmp36_; _tmp30_ = self->priv->_texel_objs; _tmp31_ = index; _tmp32_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp30_, (gpointer) ((gintptr) _tmp31_)); _tmp33_ = _g_object_ref0 ((soyatomsVector*) _tmp32_); old = _tmp33_; _tmp34_ = old; g_signal_parse_name ("on-set", SOY_ATOMS_TYPE_VECTOR, &_tmp35_, NULL, FALSE); g_signal_handlers_disconnect_matched (_tmp34_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp35_, 0, NULL, (GCallback) __soy_textures_bumpmap_texel_set_soy_atoms_vector_on_set, self); _tmp36_ = old; g_object_weak_unref ((GObject*) _tmp36_, __soy_textures_bumpmap_texel_weak_gweak_notify, self); _g_object_unref0 (old); } _tmp37_ = self->priv->_texel_objs; _tmp38_ = index; _tmp39_ = vector; gee_abstract_map_set ((GeeAbstractMap*) _tmp37_, (gpointer) ((gintptr) _tmp38_), _tmp39_); _tmp40_ = vector; g_signal_connect_object (_tmp40_, "on-set", (GCallback) __soy_textures_bumpmap_texel_set_soy_atoms_vector_on_set, self, 0); _tmp41_ = vector; g_object_weak_ref ((GObject*) _tmp41_, __soy_textures_bumpmap_texel_weak_gweak_notify, self); _tmp42_ = ((soytexturesTexture*) self)->texels; _tmp43_ = index; _tmp44_ = vector; _tmp45_ = soy_atoms_vector_get_x (_tmp44_); _tmp46_ = _tmp45_; _tmp42_[_tmp43_ * 3] = (guchar) ((gchar) (_tmp46_ * 128.0f)); _tmp47_ = _tmp42_[_tmp43_ * 3]; _tmp48_ = ((soytexturesTexture*) self)->texels; _tmp49_ = index; _tmp50_ = vector; _tmp51_ = soy_atoms_vector_get_y (_tmp50_); _tmp52_ = _tmp51_; _tmp48_[(_tmp49_ * 3) + 1] = (guchar) ((gchar) (_tmp52_ * 128.0f)); _tmp53_ = _tmp48_[(_tmp49_ * 3) + 1]; _tmp54_ = ((soytexturesTexture*) self)->texels; _tmp55_ = index; _tmp56_ = vector; _tmp57_ = soy_atoms_vector_get_z (_tmp56_); _tmp58_ = _tmp57_; _tmp54_[(_tmp55_ * 3) + 2] = (guchar) ((gchar) (_tmp58_ * 128.0f)); _tmp59_ = _tmp54_[(_tmp55_ * 3) + 2]; g_mutex_lock (&self->priv->_mutex); ((soytexturesTexture*) self)->updated = TRUE; g_mutex_unlock (&self->priv->_mutex); _g_object_unref0 (vector); }
/** * mail_vfolder_delete_folder: * @backend: an #EMailBackend * @store: a #CamelStore * @folder_name: a folder name * * Looks through all vfolder rules to see if @folder_name is listed as a * source for any vfolder rules. If the folder is found in the source for * any rule, it is removed and the user is alerted to the fact that the * vfolder rules have been updated. The new vfolder rules are written * to disk. * * XXX: It doesn't appear that the changes to the vfolder rules are sent * down to the camel level, however. So the actual vfolders will not change * behavior until evolution is restarted (?) * * NOTE: This function must be called from the main thread. */ static void mail_vfolder_delete_folder (EMailBackend *backend, CamelStore *store, const gchar *folder_name) { ERuleContext *rule_context; EFilterRule *rule; EMailSession *session; const gchar *source; CamelVeeFolder *vf; GString *changed; GQueue *queue; guint changed_count; gchar *uri; GList *link; g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (folder_name != NULL); if (folder_is_spethal (store, folder_name)) return; d(printf ("Deleting uri to check: %s\n", uri)); g_return_if_fail (mail_in_main_thread ()); session = e_mail_backend_get_session (backend); uri = e_mail_folder_uri_build (store, folder_name); changed_count = 0; changed = g_string_new (""); G_LOCK (vfolder); if (context == NULL) goto done; rule_context = E_RULE_CONTEXT (context); /* see if any rules directly reference this removed uri */ rule = NULL; while ((rule = e_rule_context_next_rule (rule_context, rule, NULL))) { EMVFolderRule *vf_rule = EM_VFOLDER_RULE (rule); if (!rule->name) continue; source = NULL; while ((source = em_vfolder_rule_next_source (vf_rule, source))) { /* Remove all sources that match, ignore changed events though * because the adduri call above does the work async */ if (e_mail_folder_uri_equal (CAMEL_SESSION (session), uri, source)) { vf = g_hash_table_lookup ( vfolder_hash, rule->name); if (!vf) { g_warning ("vf is NULL for %s\n", rule->name); continue; } g_signal_handlers_disconnect_matched ( rule, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, rule_changed, vf); em_vfolder_rule_remove_source (vf_rule, source); g_signal_connect ( rule, "changed", G_CALLBACK (rule_changed), vf); if (changed_count == 0) { g_string_append (changed, rule->name); } else { if (changed_count == 1) { g_string_prepend (changed, " "); g_string_append (changed, "\n"); } g_string_append_printf ( changed, " %s\n", rule->name); } changed_count++; source = NULL; } } } done: queue = &source_folders_remote; link = mv_find_folder (queue, session, uri); if (link != NULL) { g_free (link->data); g_queue_delete_link (queue, link); } queue = &source_folders_local; link = mv_find_folder (queue, session, uri); if (link != NULL) { g_free (link->data); g_queue_delete_link (queue, link); } G_UNLOCK (vfolder); if (changed_count > 0) { const gchar *config_dir; gchar *user, *info; info = g_strdup_printf (ngettext ( /* Translators: The first %s is name of the affected * search folder(s), the second %s is the URI of the * removed folder. For more than one search folder is * each of them on a separate line, with four spaces * in front of its name, without quotes. */ "The Search Folder \"%s\" has been modified to " "account for the deleted folder\n\"%s\".", "The following Search Folders\n%s have been modified " "to account for the deleted folder\n\"%s\".", changed_count), changed->str, uri); e_mail_backend_submit_alert ( backend, "mail:vfolder-updated", info, NULL); g_free (info); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); e_rule_context_save ((ERuleContext *) context, user); g_free (user); } g_string_free (changed, TRUE); g_free (uri); }
static bool startHttp(ResourceHandle* handle) { ASSERT(handle); SoupSession* session = handle->defaultSession(); ensureSessionIsInitialized(session); ResourceHandleInternal* d = handle->getInternal(); ResourceRequest request(handle->firstRequest()); KURL url(request.url()); url.removeFragmentIdentifier(); request.setURL(url); d->m_msg = request.toSoupMessage(); if (!d->m_msg) return false; if (!handle->shouldContentSniff()) soup_message_disable_feature(d->m_msg, SOUP_TYPE_CONTENT_SNIFFER); g_signal_connect(d->m_msg, "restarted", G_CALLBACK(restartedCallback), handle); g_signal_connect(d->m_msg, "got-headers", G_CALLBACK(gotHeadersCallback), handle); g_signal_connect(d->m_msg, "content-sniffed", G_CALLBACK(contentSniffedCallback), handle); g_signal_connect(d->m_msg, "got-chunk", G_CALLBACK(gotChunkCallback), handle); #ifdef HAVE_LIBSOUP_2_29_90 String firstPartyString = request.firstPartyForCookies().string(); if (!firstPartyString.isEmpty()) { GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data())); soup_message_set_first_party(d->m_msg, firstParty.get()); } #endif g_object_set_data(G_OBJECT(d->m_msg), "resourceHandle", reinterpret_cast<void*>(handle)); FormData* httpBody = d->m_firstRequest.httpBody(); if (httpBody && !httpBody->isEmpty()) { size_t numElements = httpBody->elements().size(); // handle the most common case (i.e. no file upload) if (numElements < 2) { Vector<char> body; httpBody->flatten(body); soup_message_set_request(d->m_msg, d->m_firstRequest.httpContentType().utf8().data(), SOUP_MEMORY_COPY, body.data(), body.size()); } else { /* * we have more than one element to upload, and some may * be (big) files, which we will want to mmap instead of * copying into memory; TODO: support upload of non-local * (think sftp://) files by using GIO? */ soup_message_body_set_accumulate(d->m_msg->request_body, FALSE); for (size_t i = 0; i < numElements; i++) { const FormDataElement& element = httpBody->elements()[i]; if (element.m_type == FormDataElement::data) soup_message_body_append(d->m_msg->request_body, SOUP_MEMORY_TEMPORARY, element.m_data.data(), element.m_data.size()); else { /* * mapping for uploaded files code inspired by technique used in * libsoup's simple-httpd test */ GError* error = 0; CString fileName = fileSystemRepresentation(element.m_filename); GMappedFile* fileMapping = g_mapped_file_new(fileName.data(), false, &error); if (error) { g_error_free(error); g_signal_handlers_disconnect_matched(d->m_msg, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, handle); g_object_unref(d->m_msg); d->m_msg = 0; return false; } SoupBuffer* soupBuffer = soup_buffer_new_with_owner(g_mapped_file_get_contents(fileMapping), g_mapped_file_get_length(fileMapping), fileMapping, #if GLIB_CHECK_VERSION(2, 21, 3) reinterpret_cast<GDestroyNotify>(g_mapped_file_unref)); #else reinterpret_cast<GDestroyNotify>(g_mapped_file_free)); #endif soup_message_body_append_buffer(d->m_msg->request_body, soupBuffer); soup_buffer_free(soupBuffer); } } } }
~ContextMenuTest() { g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); }
~BackForwardListTest() { g_signal_handlers_disconnect_matched(m_list, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); }
virtual void resourceFinished(WebKitWebResource* resource) { g_signal_handlers_disconnect_matched(resource, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); if (++m_resourcesLoaded == m_resourcesToLoad) g_main_loop_quit(m_mainLoop); }
static void thunar_folder_finished (ThunarVfsJob *job, ThunarFolder *folder) { ThunarFile *file; GList *files; GList *lp; _thunar_return_if_fail (THUNAR_IS_FOLDER (folder)); _thunar_return_if_fail (THUNAR_VFS_IS_JOB (job)); _thunar_return_if_fail (THUNAR_IS_FILE (folder->corresponding_file)); _thunar_return_if_fail (folder->handle == NULL); _thunar_return_if_fail (folder->job == job); /* check if we need to merge new files with existing files */ if (G_UNLIKELY (folder->files != NULL)) { /* determine all added files (files on new_files, but not on files) */ for (files = NULL, lp = folder->new_files; lp != NULL; lp = lp->next) if (g_list_find (folder->files, lp->data) == NULL) { /* put the file on the added list */ files = g_list_prepend (files, lp->data); /* add to the internal files list */ folder->files = g_list_prepend (folder->files, lp->data); g_object_ref (G_OBJECT (lp->data)); } /* check if any files were added */ if (G_UNLIKELY (files != NULL)) { /* emit a "files-added" signal for the added files */ g_signal_emit (G_OBJECT (folder), folder_signals[FILES_ADDED], 0, files); /* release the added files list */ g_list_free (files); } /* determine all removed files (files on files, but not on new_files) */ for (files = NULL, lp = folder->files; lp != NULL; ) { /* determine the file */ file = THUNAR_FILE (lp->data); /* determine the next list item */ lp = lp->next; /* check if the file is not on new_files */ if (g_list_find (folder->new_files, file) == NULL) { /* put the file on the removed list (owns the reference now) */ files = g_list_prepend (files, file); /* remove from the internal files list */ folder->files = g_list_remove (folder->files, file); } } /* check if any files were removed */ if (G_UNLIKELY (files != NULL)) { /* emit a "files-removed" signal for the removed files */ g_signal_emit (G_OBJECT (folder), folder_signals[FILES_REMOVED], 0, files); /* release the removed files list */ thunar_file_list_free (files); } /* drop the temporary new_files list */ thunar_file_list_free (folder->new_files); folder->new_files = NULL; } else { /* just use the new files for the files list */ folder->files = folder->new_files; folder->new_files = NULL; /* emit a "files-added" signal for the new files */ g_signal_emit (G_OBJECT (folder), folder_signals[FILES_ADDED], 0, folder->files); } /* we did it, the folder is loaded */ g_signal_handlers_disconnect_matched (folder->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder); g_object_unref (G_OBJECT (folder->job)); folder->job = NULL; /* add us to the file alteration monitor */ folder->handle = thunar_vfs_monitor_add_directory (folder->monitor, thunar_file_get_path (folder->corresponding_file), thunar_folder_monitor, folder); /* tell the consumers that we have loaded the directory */ g_object_notify (G_OBJECT (folder), "loading"); }