static gboolean history_filter_entry_timeout_cb (gpointer data) { HistoryDialog *dialog = data; HistoryDialogPrivate *p = dialog->priv; p->filter_entry_timeout = 0; START_PROFILER ("Clear liststore"); history_dialog_clear_view (dialog); STOP_PROFILER ("Clear liststore"); START_PROFILER ("Setting filter"); history_dialog_setup_filter (dialog); STOP_PROFILER ("Setting filter"); START_PROFILER ("Filling view"); history_dialog_fill_view (dialog); STOP_PROFILER ("Filling view"); return FALSE; }
static gboolean ephy_spinner_load_images (EphySpinner *spinner) { EphySpinnerDetails *details = spinner->details; if (details->need_load) { START_PROFILER ("ephy_spinner_load_images") details->images = ephy_spinner_cache_get_images (details->cache, gtk_widget_get_screen (GTK_WIDGET (spinner)), details->size); STOP_PROFILER ("ephy_spinner_load_images") details->current_image = 0; /* 'rest' icon */ details->need_load = FALSE; } return details->images != NULL; }
static void update_encoding_menu_cb (GtkAction *dummy, GaleonEncodingMenu *menu) { GaleonEncodingMenuPrivate *p = menu->priv; GaleonEmbed *embed; GtkAction *action; GaleonEncodingPageInfo *page_info; const GaleonEncodingInfo *info; char name[128]; const char *encoding; GList *recent = NULL, *related = NULL, *l; /* get most recently used encodings */ recent = galeon_encodings_get_recent (p->encodings); embed = galeon_window_get_active_embed (p->window); page_info = galeon_embed_get_encoding_info (embed); if (page_info == NULL) { build_menu (menu, NULL, NULL); return; } LOG ("encoding information enc='%s', forced=%s", page_info->encoding, (page_info->forced ? "Yes" : "No") ); START_PROFILER ("Building encoding menu"); encoding = page_info->encoding; info = galeon_encodings_get_encoding (p->encodings, encoding); g_return_if_fail (info != NULL); /* set the encodings group's active member */ g_snprintf (name, sizeof (name), "Encoding%s", encoding); action = gtk_action_group_get_action (p->action_group, name); if (action == NULL) { action = add_action (info, menu); } /* FIXME: block the "activate" signal on the actions instead; needs to * wait until g_signal_handlers_block_matched supports blocking * by signal id alone. */ menu->priv->update_tag = TRUE; /* set the encodings group's active member */ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); /* check if encoding was overridden */ action = gtk_action_group_get_action (p->action_group, "ViewEncodingAutomatic"); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !page_info->forced); g_object_set (G_OBJECT (action), "sensitive", page_info->forced, NULL); /* get encodings related to the current encoding */ related = galeon_encodings_get_encodings (p->encodings, info->group); related = g_list_sort (related, (GCompareFunc) compare_encodings); menu->priv->update_tag = FALSE; /* add the current encoding to the list of things to display */ if (g_list_find (related, info) == NULL) { related = g_list_prepend (related, (GaleonEncodingInfo*)info); } /* make sure related and recent are disjoint so we don't display twice */ for (l = related; l != NULL; l = l->next) { recent = g_list_remove (recent, l->data); } recent = g_list_sort (recent, (GCompareFunc) compare_encodings); build_menu (menu, recent, related); STOP_PROFILER ("Building encoding menu"); /* cleanup */ g_list_free (related); g_list_free (recent); galeon_encoding_page_info_free (page_info); }
static gboolean load_iso_entries (int iso, GFunc read_entry_func, gpointer user_data) { xmlTextReaderPtr reader; ParserState state = STATE_START; xmlChar iso_entries[32], iso_entry[32]; char *filename; int ret = -1; LOG ("Loading ISO-%d codes", iso); START_PROFILER ("Loading ISO codes"); filename = g_strdup_printf (ISO_CODES_PREFIX "/share/xml/iso-codes/iso_%d.xml", iso); reader = xmlNewTextReaderFilename (filename); if (reader == NULL) goto out; xmlStrPrintf (iso_entries, sizeof (iso_entries), (const xmlChar*)"iso_%d_entries", iso); xmlStrPrintf (iso_entry, sizeof (iso_entry), (const xmlChar*)"iso_%d_entry", iso); ret = xmlTextReaderRead (reader); while (ret == 1) { const xmlChar *tag; xmlReaderTypes type; tag = xmlTextReaderConstName (reader); type = xmlTextReaderNodeType (reader); if (state == STATE_ENTRIES && type == XML_READER_TYPE_ELEMENT && xmlStrEqual (tag, iso_entry)) { read_entry_func (reader, user_data); } else if (state == STATE_START && type == XML_READER_TYPE_ELEMENT && xmlStrEqual (tag, iso_entries)) { state = STATE_ENTRIES; } else if (state == STATE_ENTRIES && type == XML_READER_TYPE_END_ELEMENT && xmlStrEqual (tag, iso_entries)) { state = STATE_STOP; } else if (type == XML_READER_TYPE_SIGNIFICANT_WHITESPACE || type == XML_READER_TYPE_WHITESPACE || type == XML_READER_TYPE_TEXT || type == XML_READER_TYPE_COMMENT) { /* eat it */ } else { /* ignore it */ } ret = xmlTextReaderRead (reader); } xmlFreeTextReader (reader); out: if (ret < 0 || state != STATE_STOP) { /* This is not critical, we will fallback to our own code */ LOG ("Failed to load ISO-%d codes from %s!\n", iso, filename); g_free (filename); return FALSE; } g_free (filename); STOP_PROFILER ("Loading ISO codes"); return TRUE; }